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 code = get_mr_krb5_update_ticket(host_name, &auth);
39 code = send_string(conn, "AUTH_003", 9);
42 code = recv_int(conn, &response);
47 /* Talking to a server that doesn't do AUTH_003 */
48 krb5_free_data_contents(context, &auth);
51 code = send_string(conn, (char *)auth.data, auth.length);
54 code = recv_int(conn, &response);
59 krb5_free_data_contents(context, &auth);
66 krb5_free_data_contents(context, &auth);
70 int mr_send_auth(int conn, char *host_name)
73 int code, auth_version = 2;
76 code = get_mr_update_ticket(host_name, &ticket_st);
79 code = send_string(conn, "AUTH_002", 9);
82 code = recv_int(conn, &response);
87 code = send_string(conn, "AUTH_001", 9);
90 code = recv_int(conn, &response);
97 code = send_string(conn, (char *)ticket_st.dat, ticket_st.length);
100 code = recv_int(conn, &response);
106 if (auth_version == 2)
108 des_key_schedule sched;
113 code = recv_string(conn, &data, &size);
116 des_key_sched(session, sched);
117 des_ecb_encrypt(data, enonce, sched, 1);
119 code = send_string(conn, (char *)enonce, sizeof(enonce));
122 code = recv_int(conn, &response);
132 int mr_execute(int conn, char *path)
138 data = malloc(10 + strlen(path));
141 sprintf(data, "EXEC_002 %s", path);
142 code = send_string(conn, data, strlen(data) + 1);
146 code = recv_int(conn, &response);
155 void mr_send_quit(int conn)
157 send_string(conn, "quit", 5);
160 void fail(int conn, int err, char *msg)
162 com_err(whoami, err, msg);