/*
* 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.
* 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;
* RETURN VALUE:
* void
* SIDE EFFECTS:
- * Initializes GDB library and SMSU error table.
+ * Initializes GDB library.
* PROBLEMS:
*
*/
if (!initialized) {
gdb_init();
- init_smsU_err_tbl();
initialized++;
}
}
* 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:
(((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");
" 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");
" 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);
execute(path)
char *path;
{
- union wait response;
+ int response;
STRING data;
register int code;
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);
}