]> andersk Git - moira.git/blobdiff - update/exec_002.c
make sure new usernames don't conflict with filesys aliases
[moira.git] / update / exec_002.c
index d492d92d1af6f7335eeff7b06406dd8de1425100..fcf0d96ff1437003f3b94aada4c684f686e65d80 100644 (file)
@@ -27,7 +27,7 @@ static char *rcsid_exec_002_c = "$Header$";
 #include "update.h"
 
 extern CONNECTION conn;
-extern int code, errno, uid, log_priority;
+extern int code, errno, uid, log_priority, have_authorization;
 extern char *whoami;
 
 #if defined(vax) || defined(ibm032)
@@ -48,9 +48,13 @@ exec_002(str)
 #endif
     int n, pid;
 
+    if (!have_authorization) {
+       reject_call(MR_PERM);
+       return(0);
+    }
     if (config_lookup("noexec")) {
        code = EPERM;
-       code = send_object(conn, (char *)&code, INTEGER_T);
+       send_object(conn, (char *)&code, INTEGER_T);
        com_err(whoami, code, "Not allowed to execute");
        return(0);
     }
@@ -111,16 +115,16 @@ exec_002(str)
 #endif
 #ifdef POSIX
        if ( (WIFEXITED(waitb) && (WEXITSTATUS(waitb)!=0)) || WIFSIGNALED(waitb)  ) {
-           /* This is not really correct.  It will cause teh moira server to
-              report a bogus error message if the script died on a signal.
-              However this is the same thing that occurs in the non-POSIX
-              case, and I don't know how to come up with a useful error based
-              on the signal recieved.
-           */
-           n = WEXITSTATUS(waitb) + ERROR_TABLE_BASE_sms;
            log_priority = log_ERROR;
-           com_err(whoami, n, " child exited with status %d",
-                   WEXITSTATUS(waitb));
+           if (WIFSIGNALED(waitb)) {
+               n = MR_COREDUMP;
+               com_err(whoami, n, " child exited on signal %d",
+                       WTERMSIG(waitb));
+           } else {
+               n = WEXITSTATUS(waitb) + ERROR_TABLE_BASE_sms;
+               com_err(whoami, n, " child exited with status %d",
+                       WEXITSTATUS(waitb));
+           }
 #else
        if (waitb.w_status) {
            n = waitb.w_retcode + ERROR_TABLE_BASE_sms;
This page took 0.058942 seconds and 4 git commands to generate.