]> andersk Git - moira.git/commitdiff
handle "noexec" and "user" config options
authormar <mar>
Tue, 25 Aug 1992 14:43:12 +0000 (14:43 +0000)
committermar <mar>
Tue, 25 Aug 1992 14:43:12 +0000 (14:43 +0000)
update/exec_002.c

index f02f208176360a080e204c20e540d429a63076a5..887c4b1316a3d7014069ca0f271435c9a65ebd92 100644 (file)
@@ -12,6 +12,7 @@ static char *rcsid_exec_002_c = "$Header$";
 
 #include <mit-copyright.h>
 #include <stdio.h>
+#include <errno.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <signal.h>
@@ -20,7 +21,9 @@ static char *rcsid_exec_002_c = "$Header$";
 #include "update.h"
 
 extern CONNECTION conn;
-extern int code, errno;
+extern int code, errno, uid;
+extern char *whoami;
+
 
 int
 exec_002(str)
@@ -29,6 +32,12 @@ exec_002(str)
     union wait waitb;
     int n, pid, mask;
 
+    if (config_lookup("noexec")) {
+       code = EPERM;
+       code = send_object(conn, (char *)&code, INTEGER_T);
+       com_err(whoami, code, "Not allowed to execute");
+       return;
+    }
     str += 8;
     while (*str == ' ')
        str++;
@@ -45,6 +54,10 @@ exec_002(str)
            exit(1);
        return;
     case 0:
+       if (setuid(uid) < 0) {
+           com_err(whoami, errno, "Unable to setuid to %d\n", uid);
+           exit(1);
+       }
        sigsetmask(mask);
        execlp(str, str, (char *)NULL);
        n = errno;
This page took 0.052058 seconds and 5 git commands to generate.