#include <mit-copyright.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <gdb.h>
#include <sys/param.h>
#include <moira_site.h>
#include <krb.h>
-extern char *malloc();
extern int errno, dbg;
+extern C_Block session;
static char buf[BUFSIZ];
static int code;
goto update_failed;
}
- code = send_file(pathname, target_path, 0);
+ code = send_file(pathname, target_path, 1);
if (code)
goto update_failed;
#undef ASSERT
}
-
-static
send_auth(host_name)
char *host_name;
{
STRING data;
register int code;
int response;
+ int auth_version = 2;
code = get_mr_update_ticket(host_name, ticket);
if (code) {
return(code);
}
- STRING_DATA(data) = "AUTH_001";
+ STRING_DATA(data) = "AUTH_002";
MAX_STRING_SIZE(data) = 9;
code = send_object(conn, (char *)&data, STRING_T);
if (code) {
return(connection_errno(conn));
}
if (response) {
- return(response);
+ STRING_DATA(data) = "AUTH_001";
+ MAX_STRING_SIZE(data) = 9;
+ code = send_object(conn, (char *)&data, STRING_T);
+ if (code) {
+ return(connection_errno(conn));
+ }
+ code = receive_object(conn, (char *)&response, INTEGER_T);
+ if (code) {
+ return(connection_errno(conn));
+ }
+ if (response) {
+ return(response);
+ }
+ auth_version = 1;
}
STRING_DATA(data) = (char *)ticket->dat;
MAX_STRING_SIZE(data) = ticket->length;
if (response) {
return(response);
}
+
+ if (auth_version == 2) {
+ des_key_schedule sched;
+ C_Block enonce;
+
+ code = receive_object(conn, (char *)&data, STRING_T);
+ if (code) {
+ return(connection_errno(conn));
+ }
+ des_key_sched(&session, &sched);
+ des_ecb_encrypt(STRING_DATA(data), enonce, sched, 1);
+ STRING_DATA(data) = enonce;
+ code = send_object(conn, (char *)&data, STRING_T);
+ if (code) {
+ return(connection_errno(conn));
+ }
+ code = receive_object(conn, (char *)&response, INTEGER_T);
+ if (code) {
+ return(connection_errno(conn));
+ }
+ if (response) {
+ return(response);
+ }
+ }
+
return(MR_SUCCESS);
}
-static
execute(path)
char *path;
{
code = receive_object(conn, (char *)&response, INTEGER_T);
if (code)
return(connection_errno(conn));
- if (dbg & DBG_TRACE)
- com_err(whoami, response, "execute returned %d", response);
if (response)
return(response);
return(MR_SUCCESS);