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>
25 extern des_cblock session;
27 int send_auth(int conn, char *host_name)
30 int code, auth_version = 2;
33 code = get_mr_update_ticket(host_name, &ticket_st);
36 code = send_string(conn, "AUTH_002", 9);
39 code = recv_int(conn, &response);
44 code = send_string(conn, "AUTH_001", 9);
47 code = recv_int(conn, &response);
54 code = send_string(conn, (char *)ticket_st.dat, ticket_st.length);
57 code = recv_int(conn, &response);
63 if (auth_version == 2)
65 des_key_schedule sched;
70 code = recv_string(conn, &data, &size);
73 des_key_sched(session, sched);
74 des_ecb_encrypt(data, enonce, sched, 1);
76 code = send_string(conn, (char *)enonce, sizeof(enonce));
79 code = recv_int(conn, &response);
89 int execute(int conn, char *path)
95 data = malloc(10 + strlen(path));
98 sprintf(data, "EXEC_002 %s", path);
99 code = send_string(conn, data, strlen(data) + 1);
103 code = recv_int(conn, &response);
112 void send_quit(int conn)
114 send_string(conn, "quit", 5);
117 void fail(int conn, int err, char *msg)