]> Zhao Yanbai Git Server - minix.git/commitdiff
Don't panic on a misconfigured machine
authorThomas Veerman <thomas@minix3.org>
Mon, 30 Jan 2012 15:12:12 +0000 (15:12 +0000)
committerThomas Veerman <thomas@minix3.org>
Mon, 30 Jan 2012 15:16:20 +0000 (15:16 +0000)
servers/apfs/main.c
servers/inet/inet.c

index cbba28287cef621a8332a4637412a1c0a059d3b4..8669c7f79d6cca2dfadafecd53c3d64bfcde8e38 100644 (file)
@@ -137,10 +137,15 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
   uds_init();
   buf_pool();
 
-  if ((pw = getpwnam(SERVICE_LOGIN)) == NULL)
-       panic("unable to retrieve uid of SERVICE_LOGIN");
-  if (setuid(pw->pw_uid) != 0)
+
+  /* Drop root privileges */
+  if ((pw = getpwnam(SERVICE_LOGIN)) == NULL) {
+       printf("PFS: unable to retrieve uid of SERVICE_LOGIN, "
+               "still running as root");
+  } else if (setuid(pw->pw_uid) != 0) {
        panic("unable to drop privileges");
+  }
+
   SELF_E = getprocnr();
 
   return(OK);
index 3e3ce0db3b8c3a9dd232a31a9dfe94470bfa74ad..d4e974637e66ac2847912568616c904b326b1fe8 100644 (file)
@@ -286,10 +286,12 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
        }
 
        /* Drop root privileges */
-       if ((pw = getpwnam(SERVICE_LOGIN)) == NULL)
-               ip_panic(("inet: unable to retrieve uid of SERVICE_LOGIN"));
-       if (setuid(pw->pw_uid) != 0)
+       if ((pw = getpwnam(SERVICE_LOGIN)) == NULL) {
+               printf("inet: unable to retrieve uid of SERVICE_LOGIN, "
+                       "still running as root");
+       } else if (setuid(pw->pw_uid) != 0) {
                ip_panic(("inet: unable to drop privileges"));
+       }
 
        /* Announce we are up. INET announces its presence to VFS just like
         * any other character driver.