3 * This code handles the actual distribution of data files
4 * to servers in the Moira server-update program.
6 * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology.
7 * For copying and distribution information, please see the file
11 #include <mit-copyright.h>
26 extern des_cblock session;
28 extern krb5_context context;
30 int mr_send_krb5_auth(int conn, char *host_name)
36 memset(&auth, 0, sizeof(auth));
38 code = get_mr_krb5_update_ticket(host_name, &auth);
41 code = send_string(conn, "AUTH_003", 9);
44 code = recv_int(conn, &response);
49 /* Talking to a server that doesn't do AUTH_003 */
50 krb5_free_data_contents(context, &auth);
53 code = send_string(conn, (char *)auth.data, auth.length);
56 code = recv_int(conn, &response);
61 krb5_free_data_contents(context, &auth);
68 krb5_free_data_contents(context, &auth);
72 int mr_send_auth(int conn, char *host_name)
75 int code, auth_version = 2;
78 code = get_mr_update_ticket(host_name, &ticket_st);
81 code = send_string(conn, "AUTH_002", 9);
84 code = recv_int(conn, &response);
89 code = send_string(conn, "AUTH_001", 9);
92 code = recv_int(conn, &response);
99 code = send_string(conn, (char *)ticket_st.dat, ticket_st.length);
102 code = recv_int(conn, &response);
108 if (auth_version == 2)
110 des_key_schedule sched;
115 code = recv_string(conn, &data, &size);
118 des_key_sched(session, sched);
119 des_ecb_encrypt(data, enonce, sched, 1);
121 code = send_string(conn, (char *)enonce, sizeof(enonce));
124 code = recv_int(conn, &response);
134 int mr_execute(int conn, char *path)
140 data = malloc(10 + strlen(path));
143 sprintf(data, "EXEC_002 %s", path);
144 code = send_string(conn, data, strlen(data) + 1);
148 code = recv_int(conn, &response);
157 void mr_send_quit(int conn)
159 send_string(conn, "quit", 5);
162 void fail(int conn, int err, char *msg)
164 com_err(whoami, err, msg);