7 static char *rcsid_client2_c = "$Header$";
11 * MODULE IDENTIFICATION:
13 * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
14 * For copying and distribution information, please see the file
17 * This code handles the actual distribution of data files
18 * to servers in the Moira server-update program.
20 * Ken Raeburn (spook@athena.MIT.EDU),
21 * MIT Project Athena/MIT Information Systems.
27 #include <mit-copyright.h>
32 #include <sys/param.h>
34 #include <sys/socket.h>
38 #include <moira_site.h>
41 extern int errno, dbg;
42 extern C_Block session;
44 static char buf[BUFSIZ];
54 * Insures that various libraries have a chance to get
61 * Initializes GDB library.
65 static void initialize()
67 static int initialized = 0;
76 int send_auth(char *host_name)
79 KTEXT ticket = &ticket_st;
85 code = get_mr_update_ticket(host_name, ticket);
88 STRING_DATA(data) = "AUTH_002";
89 MAX_STRING_SIZE(data) = 9;
90 code = send_object(conn, (char *)&data, STRING_T);
92 return connection_errno(conn);
93 code = receive_object(conn, (char *)&response, INTEGER_T);
95 return connection_errno(conn);
98 STRING_DATA(data) = "AUTH_001";
99 MAX_STRING_SIZE(data) = 9;
100 code = send_object(conn, (char *)&data, STRING_T);
102 return connection_errno(conn);
103 code = receive_object(conn, (char *)&response, INTEGER_T);
105 return connection_errno(conn);
110 STRING_DATA(data) = (char *)ticket->dat;
111 MAX_STRING_SIZE(data) = ticket->length;
112 code = send_object(conn, (char *)&data, STRING_T);
114 return connection_errno(conn);
115 code = receive_object(conn, (char *)&response, INTEGER_T);
117 return connection_errno(conn);
121 if (auth_version == 2)
123 des_key_schedule sched;
126 code = receive_object(conn, (char *)&data, STRING_T);
128 return connection_errno(conn);
129 des_key_sched(session, sched);
130 des_ecb_encrypt(STRING_DATA(data), enonce, sched, 1);
131 STRING_DATA(data) = enonce;
132 code = send_object(conn, (char *)&data, STRING_T);
134 return connection_errno(conn);
135 code = receive_object(conn, (char *)&response, INTEGER_T);
137 return connection_errno(conn);
145 int execute(char *path)
151 string_alloc(&data, BUFSIZ);
152 sprintf(STRING_DATA(data), "EXEC_002 %s", path);
153 code = send_object(conn, (char *)&data, STRING_T);
155 return connection_errno(conn);
156 code = receive_object(conn, (char *)&response, INTEGER_T);
158 return connection_errno(conn);
169 string_alloc(&str, 5);
170 strcpy(STRING_DATA(str), "quit");
171 send_object(conn, (char *)&str, STRING_T);