]> andersk Git - moira.git/commitdiff
Remove code from update_test that was duplicated in client.c
authordanw <danw>
Thu, 3 Jul 1997 03:19:45 +0000 (03:19 +0000)
committerdanw <danw>
Thu, 3 Jul 1997 03:19:45 +0000 (03:19 +0000)
Send data files (but not instruction files) encrypted by default.
When authenticating, try the AUTH_002 protocol first, and fall back to
AUTH_001 if the server doesn't understand AUTH_002.

update/Imakefile
update/client.c
update/update_test.c

index d1127c0747ea0989044a48afe2c1faf4febeadee..514788e0e0ab70846baaf1333c850ee52ba734f2 100644 (file)
@@ -8,29 +8,28 @@
 # Imakefile for update.
 #
 
-SRCS=  auth_001.c checksum.c client.c exec_002.c get_file.c \
-       hostname.c inst_001.c log.c send_file.c ticket.c \
-       update_server.c xfer_002.c xfer_003.c config.c update_test.c
+SRCS=  auth_002.c checksum.c client.c config.c exec_002.c \
+       get_file.c hostname.c log.c send_file.c ticket.c \
+       update_server.c update_test.c xfer_002.c xfer_003.c
 SRCDIR=${SRCTOP}/update
 CODE=${SRCS} Imakefile
-SOBJS= update_server.o auth_001.o inst_001.o xfer_002.o exec_002.o \
-       xfer_003.o log.o get_file.o checksum.o config.o
-COBJS= ticket.o send_file.o checksum.o
+SOBJS = auth_002.o checksum.o config.o exec_002.o get_file.o \
+       log.o update_server.o xfer_002.o xfer_003.o
+COBJS= checksum.o client.o send_file.o ticket.o
 
 #ifdef HAS_VSPRINTF
 DEFINES= -DHAS_VSPRINTF
 #endif
 
-#ifdef SVRBUILD
-all::  update_server moira_update.o update_test
-#else
 all::  update_server update_test
+#ifdef SVRBUILD
+all::  moira_update.o
 #endif
 
 #ifdef SVRBUILD
-moira_update.o: ${COBJS} client.o
-       ${LD} -r -o moira_update.o ${COBJS} client.o
+moira_update.o: ${COBJS}
+       ${LD} -r -o moira_update.o ${COBJS}
 #endif
 
 program(update_server, ${SOBJS},${MR_LIBDEP} ${GDB_LIBDEP}, ${CLIBS},${ETCDIR})
-test_program(update_test, ${COBJS}, ${CLIBS})
+program(update_test, update_test.c ${COBJS}, ${MR_LIBDEP} ${GDB_LIBDEP}, ${CLIBS},${BINDIR})
index 1a0babaa7db1670ec7c3d0b316cecc47eaff9d3b..3033d265b404bf1d311788000470e3beb9ad8d2b 100644 (file)
@@ -40,6 +40,7 @@ static char *rcsid_client2_c = "$Header$";
 #include <krb.h>
 
 extern int errno, dbg;
+extern C_Block session;
 
 static char buf[BUFSIZ];
 static int code;
@@ -161,7 +162,7 @@ char *instructions;
        goto update_failed;
     }
     
-    code = send_file(pathname, target_path, 0);
+    code = send_file(pathname, target_path, 1);
     if (code)
       goto update_failed;
 
@@ -192,8 +193,6 @@ char *instructions;
 #undef ASSERT
 }
 
-
-static
 send_auth(host_name)
 char *host_name;
 {
@@ -202,12 +201,13 @@ 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) {
@@ -218,7 +218,20 @@ char *host_name;
        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;
@@ -233,10 +246,34 @@ char *host_name;
     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;
 {
@@ -252,8 +289,6 @@ execute(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);
index 3cbf1499f3437673342cd71c9a41f09e7f87afd0..ad99e73318ec4797f5d6fc390c01305c2003645d 100644 (file)
@@ -125,77 +125,3 @@ usage()
     fprintf(stderr, "\t-X file\t\texecutes file\n");
     exit(1);
 }
-
-send_auth(host_name)
-char *host_name;
-{
-    KTEXT_ST ticket_st;
-    KTEXT ticket = &ticket_st;
-    STRING data;
-    register int code;
-    int response;
-    
-    code = get_mr_update_ticket(host_name, ticket);
-    if (code) {
-       return(code);
-    }
-    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);
-    }
-    STRING_DATA(data) = (char *)ticket->dat;
-    MAX_STRING_SIZE(data) = ticket->length;
-    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) {
-       com_err(whoami, response, "Permission to connect denied");
-       return(response);
-    }
-    return(MR_SUCCESS);
-}
-
-execute(path)
-    char *path;
-{
-    int response;
-    STRING data;
-    register int code;
-    
-    string_alloc(&data, BUFSIZ);
-    sprintf(STRING_DATA(data), "EXEC_002 %s", path);
-    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);
-}
-
-send_quit()
-{
-    STRING str;
-    if (!conn)
-       return;
-    string_alloc(&str, 5);
-    (void) strcpy(STRING_DATA(str), "quit");
-    (void) send_object(conn, (char *)&str, STRING_T);
-    string_free(&str);
-}
This page took 0.093853 seconds and 5 git commands to generate.