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;
28 int send_auth(int conn, char *host_name)
31 int code, auth_version = 2;
34 code = get_mr_update_ticket(host_name, &ticket_st);
37 code = send_string(conn, "AUTH_002", 9);
40 code = recv_int(conn, &response);
45 code = send_string(conn, "AUTH_001", 9);
48 code = recv_int(conn, &response);
55 code = send_string(conn, (char *)ticket_st.dat, ticket_st.length);
58 code = recv_int(conn, &response);
64 if (auth_version == 2)
66 des_key_schedule sched;
71 code = recv_string(conn, &data, &size);
74 des_key_sched(session, sched);
75 des_ecb_encrypt(data, enonce, sched, 1);
77 code = send_string(conn, (char *)enonce, sizeof(enonce));
80 code = recv_int(conn, &response);
90 int execute(int conn, char *path)
96 data = malloc(10 + strlen(path));
99 sprintf(data, "EXEC_002 %s", path);
100 code = send_string(conn, data, strlen(data) + 1);
104 code = recv_int(conn, &response);
113 void send_quit(int conn)
115 send_string(conn, "quit", 5);
118 void fail(int conn, int err, char *msg)
120 com_err(whoami, err, msg);