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"
22 void exec_002(int conn, char *str)
25 sigset_t mask, oldmask;
29 if (!have_authorization)
31 send_int(conn, MR_PERM);
34 if (config_lookup("noexec"))
36 send_int(conn, EPERM);
37 com_err(whoami, EPERM, "Not allowed to execute");
45 sigaddset(&mask, SIGCHLD);
46 sigprocmask(SIG_BLOCK, &mask, &oldmask);
52 sigprocmask(SIG_UNBLOCK, &oldmask, &mask);
53 com_err(whoami, n, ": can't fork to run install script");
54 code = send_int(conn, n);
62 com_err(whoami, errno, "Unable to setuid to %d\n", uid);
65 sigprocmask(SIG_UNBLOCK, &oldmask, &mask);
66 execlp(str, str, NULL);
68 sigprocmask(SIG_UNBLOCK, &oldmask, &mask);
69 com_err(whoami, n, ": %s", str);
76 while (n != -1 && n != pid);
78 sigprocmask(SIG_UNBLOCK, &oldmask, &mask);
79 if ((WIFEXITED(waitb) && (WEXITSTATUS(waitb) != 0)) ||
82 if (WIFSIGNALED(waitb))
85 com_err(whoami, n, " child exited on signal %d",
90 n = WEXITSTATUS(waitb) + ERROR_TABLE_BASE_sms;
91 com_err(whoami, n, " child exited with status %d",
94 code = send_int(conn, n);
100 code = send_ok(conn);