3 * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
4 * For copying and distribution information, please see the file
8 #include <mit-copyright.h>
10 #include "update_server.h"
24 extern CONNECTION conn;
25 extern int code, uid, log_priority, have_authorization;
28 int exec_002(char *str)
31 sigset_t mask, oldmask;
34 if (!have_authorization)
39 if (config_lookup("noexec"))
42 send_object(conn, (char *)&code, INTEGER_T);
43 com_err(whoami, code, "Not allowed to execute");
50 sigaddset(&mask, SIGCHLD);
51 sigprocmask(SIG_BLOCK, &mask, &oldmask);
57 sigprocmask(SIG_UNBLOCK, &oldmask, &mask);
58 log_priority = log_ERROR;
59 com_err(whoami, errno, ": can't fork to run install script");
60 code = send_object(conn, (char *)&n, INTEGER_T);
67 com_err(whoami, errno, "Unable to setuid to %d\n", uid);
70 sigprocmask(SIG_UNBLOCK, &oldmask, &mask);
71 execlp(str, str, NULL);
73 sigprocmask(SIG_UNBLOCK, &oldmask, &mask);
74 log_priority = log_ERROR;
75 com_err(whoami, n, ": %s", str);
76 send_object(conn, (char *)&n, INTEGER_T);
81 while (n != -1 && n != pid);
82 sigprocmask(SIG_UNBLOCK, &oldmask, &mask);
83 if ((WIFEXITED(waitb) && (WEXITSTATUS(waitb) != 0)) ||
86 log_priority = log_ERROR;
87 if (WIFSIGNALED(waitb))
90 com_err(whoami, n, " child exited on signal %d",
95 n = WEXITSTATUS(waitb) + ERROR_TABLE_BASE_sms;
96 com_err(whoami, n, " child exited with status %d",
99 code = send_object(conn, (char *)&n, INTEGER_T);