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>
24 extern C_Block session;
28 int send_auth(char *host_name)
31 KTEXT ticket = &ticket_st;
37 code = get_mr_update_ticket(host_name, ticket);
40 STRING_DATA(data) = "AUTH_002";
41 MAX_STRING_SIZE(data) = 9;
42 code = send_object(conn, (char *)&data, STRING_T);
44 return connection_errno(conn);
45 code = receive_object(conn, (char *)&response, INTEGER_T);
47 return connection_errno(conn);
50 STRING_DATA(data) = "AUTH_001";
51 MAX_STRING_SIZE(data) = 9;
52 code = send_object(conn, (char *)&data, STRING_T);
54 return connection_errno(conn);
55 code = receive_object(conn, (char *)&response, INTEGER_T);
57 return connection_errno(conn);
62 STRING_DATA(data) = (char *)ticket->dat;
63 MAX_STRING_SIZE(data) = ticket->length;
64 code = send_object(conn, (char *)&data, STRING_T);
66 return connection_errno(conn);
67 code = receive_object(conn, (char *)&response, INTEGER_T);
69 return connection_errno(conn);
73 if (auth_version == 2)
75 des_key_schedule sched;
78 code = receive_object(conn, (char *)&data, STRING_T);
80 return connection_errno(conn);
81 des_key_sched(session, sched);
82 des_ecb_encrypt(STRING_DATA(data), enonce, sched, 1);
83 STRING_DATA(data) = enonce;
84 code = send_object(conn, (char *)&data, STRING_T);
86 return connection_errno(conn);
87 code = receive_object(conn, (char *)&response, INTEGER_T);
89 return connection_errno(conn);
97 int execute(char *path)
103 string_alloc(&data, BUFSIZ);
104 sprintf(STRING_DATA(data), "EXEC_002 %s", path);
105 code = send_object(conn, (char *)&data, STRING_T);
107 return connection_errno(conn);
108 code = receive_object(conn, (char *)&response, INTEGER_T);
110 return connection_errno(conn);
121 string_alloc(&str, 5);
122 strcpy(STRING_DATA(str), "quit");
123 send_object(conn, (char *)&str, STRING_T);