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>
29 extern des_cblock session;
32 extern krb5_context context;
34 int mr_send_krb5_auth(int conn, char *host_name)
40 memset(&auth, 0, sizeof(auth));
42 code = get_mr_krb5_update_ticket(host_name, &auth);
45 code = send_string(conn, "AUTH_003", 9);
48 code = recv_int(conn, &response);
53 /* Talking to a server that doesn't do AUTH_003 */
54 krb5_free_data_contents(context, &auth);
57 code = send_string(conn, (char *)auth.data, auth.length);
60 code = recv_int(conn, &response);
65 krb5_free_data_contents(context, &auth);
72 krb5_free_data_contents(context, &auth);
76 int mr_send_auth(int conn, char *host_name)
80 int code, auth_version = 2;
83 code = get_mr_update_ticket(host_name, &ticket_st);
86 code = send_string(conn, "AUTH_002", 9);
89 code = recv_int(conn, &response);
94 code = send_string(conn, "AUTH_001", 9);
97 code = recv_int(conn, &response);
104 code = send_string(conn, (char *)ticket_st.dat, ticket_st.length);
107 code = recv_int(conn, &response);
113 if (auth_version == 2)
115 des_key_schedule sched;
120 code = recv_string(conn, &data, &size);
123 des_key_sched(session, sched);
124 des_ecb_encrypt(data, enonce, sched, 1);
126 code = send_string(conn, (char *)enonce, sizeof(enonce));
129 code = recv_int(conn, &response);
142 int mr_execute(int conn, char *path)
148 data = malloc(10 + strlen(path));
151 sprintf(data, "EXEC_002 %s", path);
152 code = send_string(conn, data, strlen(data) + 1);
156 code = recv_int(conn, &response);
165 void mr_send_quit(int conn)
167 send_string(conn, "quit", 5);
170 void fail(int conn, int err, char *msg)
172 com_err(whoami, err, msg);