Don't panic on a misconfigured machine

This commit is contained in:
Thomas Veerman 2012-01-30 15:12:12 +00:00
parent 1fc399a5c1
commit 1ff24e3f2f
2 changed files with 13 additions and 6 deletions

View file

@ -137,10 +137,15 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
uds_init(); uds_init();
buf_pool(); buf_pool();
if ((pw = getpwnam(SERVICE_LOGIN)) == NULL)
panic("unable to retrieve uid of SERVICE_LOGIN"); /* Drop root privileges */
if (setuid(pw->pw_uid) != 0) 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"); panic("unable to drop privileges");
}
SELF_E = getprocnr(); SELF_E = getprocnr();
return(OK); return(OK);

View file

@ -286,10 +286,12 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
} }
/* Drop root privileges */ /* Drop root privileges */
if ((pw = getpwnam(SERVICE_LOGIN)) == NULL) if ((pw = getpwnam(SERVICE_LOGIN)) == NULL) {
ip_panic(("inet: unable to retrieve uid of SERVICE_LOGIN")); printf("inet: unable to retrieve uid of SERVICE_LOGIN, "
if (setuid(pw->pw_uid) != 0) "still running as root");
} else if (setuid(pw->pw_uid) != 0) {
ip_panic(("inet: unable to drop privileges")); ip_panic(("inet: unable to drop privileges"));
}
/* Announce we are up. INET announces its presence to VFS just like /* Announce we are up. INET announces its presence to VFS just like
* any other character driver. * any other character driver.