]> andersk Git - moira.git/blobdiff - update/client.c
punt UBIK version number checking; Write UBIK header when creating
[moira.git] / update / client.c
index 709d1f9de5091ba361c3f76eec82f998cd83a5c9..49544df3f06b10ff4f37f26700f0c511382deb39 100644 (file)
@@ -10,7 +10,9 @@ static char *rcsid_client2_c = "$Header$";
 /*
  * MODULE IDENTIFICATION:
  *     $Header$
- *     Copyright 1987 MIT Project Athena.
+ *     Copyright 1987, 1988 by the Massachusetts Institute of Technology.
+ *     For copying and distribution information, please see the file
+ *     <mit-copyright.h>.
  * DESCRIPTION:
  *     This code handles the actual distribution of data files
  *     to servers in the SMS server-update program.
@@ -22,19 +24,22 @@ static char *rcsid_client2_c = "$Header$";
  *     sms_update_server
  */
 
+#include <mit-copyright.h>
 #include <stdio.h>
 #include <strings.h>
 #include <gdb.h>
 #include <sys/param.h>
 #include <sys/wait.h>
+#include <sys/socket.h>
 #include <update.h>
 #include <errno.h>
 #include <dcm.h>
 #include <sms.h>
+#include <sms_app.h>
 #include <krb.h>
 
 extern char *malloc();
-extern int errno;
+extern int errno, dbg;
 
 static char buf[BUFSIZ];
 static int code;
@@ -53,7 +58,7 @@ CONNECTION conn;
  * RETURN VALUE:
  *     void
  * SIDE EFFECTS:
- *     Initializes GDB library and SMSU error table.
+ *     Initializes GDB library.
  * PROBLEMS:
  *
  */
@@ -64,7 +69,6 @@ initialize()
 
     if (!initialized) {
        gdb_init();
-       init_smsU_err_tbl();
        initialized++;
     }
 }
@@ -75,7 +79,7 @@ initialize()
  *     sms_update_server(service, machine, target_path)
  * DESCRIPTION:
  *     Attempts to perform an update to the named machine
- *     of the named service.  The file SMS_DIR/dcm/service.out
+ *     of the named service.  The file DCM_DIR/service.out
  *     will be sent, then the file SMS_DIR/bin/service.sh,
  *     the the shell script will be executed.
  * INPUT:
@@ -110,6 +114,7 @@ char *instructions;
     (((str) != (char *)NULL) && (strlen(str) != 0))
 
     char *service_address, *service_updated, *pathname;
+    int on;
     
     /* some sanity checking of arguments while we build data */
     ASSERT(NONNULL(machine), SMS_INTERNAL, " null host name");
@@ -129,7 +134,7 @@ char *instructions;
           " target pathname");
     ASSERT2(target_path[0] == '/', SMS_NOT_UNIQUE,
           " non-absolute pathname supplied \"%s\"", target_path);
-    sprintf(buf, "%s/dcm/%s.out", SMS_DIR, service);
+    sprintf(buf, "%s/%s.out", DCM_DIR, service);
     pathname = strsave(buf);
     ASSERT(NONNULL(pathname), SMS_NO_MEM, " for pathname");
     ASSERT(NONNULL(instructions), SMS_NO_MEM, " for instructions");
@@ -146,6 +151,8 @@ char *instructions;
                " can't connect to update %s", service_address);
        return(SMS_CANT_CONNECT);
     }
+    on = 1;
+    setsockopt(conn->in.fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
     
     /* send authenticators */
     code = send_auth(machine);
@@ -234,7 +241,7 @@ static
 execute(path)
     char *path;
 {
-    union wait response;
+    int response;
     STRING data;
     register int code;
     
@@ -246,15 +253,10 @@ execute(path)
     code = receive_object(conn, (char *)&response, INTEGER_T);
     if (code)
        return(connection_errno(conn));
-    if (response.w_retcode) {
-/****************************************************************
- * The following line is there because the current update servers
- * don't return the correct error code when an update fails.  Remove
- * this line when they are fixed.  -mar  7/26/88
- ****************************************************************/
-       return(SMS_INTERNAL);
-/*     return(response.w_retcode); */
-    }
+    if (dbg & DBG_TRACE)
+      com_err(whoami, response, "execute returned %d", response);
+    if (response)
+      return(response);
     return(SMS_SUCCESS);
 }
 
This page took 0.067472 seconds and 4 git commands to generate.