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();
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);

View 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.