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 */
49 krb5_free_data_contents(context, &auth);
52 code = send_string(conn, (char *)auth.data, auth.length);
55 code = recv_int(conn, &response);
61 krb5_free_data_contents(context, &auth);
69 krb5_free_data_contents(context, &auth);
73 int mr_send_auth(int conn, char *host_name)
76 int code, auth_version = 2;
79 code = get_mr_update_ticket(host_name, &ticket_st);
82 code = send_string(conn, "AUTH_002", 9);
85 code = recv_int(conn, &response);
90 code = send_string(conn, "AUTH_001", 9);
93 code = recv_int(conn, &response);
100 code = send_string(conn, (char *)ticket_st.dat, ticket_st.length);
103 code = recv_int(conn, &response);
109 if (auth_version == 2)
111 des_key_schedule sched;
116 code = recv_string(conn, &data, &size);
119 des_key_sched(session, sched);
120 des_ecb_encrypt(data, enonce, sched, 1);
122 code = send_string(conn, (char *)enonce, sizeof(enonce));
125 code = recv_int(conn, &response);
135 int mr_execute(int conn, char *path)
141 data = malloc(10 + strlen(path));
144 sprintf(data, "EXEC_002 %s", path);
145 code = send_string(conn, data, strlen(data) + 1);
149 code = recv_int(conn, &response);
158 void mr_send_quit(int conn)
160 send_string(conn, "quit", 5);
163 void fail(int conn, int err, char *msg)
165 com_err(whoami, err, msg);