From: Thomas Veerman Date: Mon, 30 Jan 2012 15:12:12 +0000 (+0000) Subject: Don't panic on a misconfigured machine X-Git-Tag: v3.2.0~97 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/style.css?a=commitdiff_plain;h=1ff24e3f2f263e7eef4739a44e4a5160813714ea;p=minix.git Don't panic on a misconfigured machine --- diff --git a/servers/apfs/main.c b/servers/apfs/main.c index cbba28287..8669c7f79 100644 --- a/servers/apfs/main.c +++ b/servers/apfs/main.c @@ -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); diff --git a/servers/inet/inet.c b/servers/inet/inet.c index 3e3ce0db3..d4e974637 100644 --- a/servers/inet/inet.c +++ b/servers/inet/inet.c @@ -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.