mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-17 15:27:36 +00:00
Initialize the group list so that any filter programs that are
run by lpd are not run with root's groups.
This commit is contained in:
parent
c3899f8d3c
commit
b406e662aa
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=10530
@ -1072,6 +1072,7 @@ dofork(action)
|
||||
int action;
|
||||
{
|
||||
register int i, pid;
|
||||
struct passwd *pwd;
|
||||
|
||||
for (i = 0; i < 20; i++) {
|
||||
if ((pid = fork()) < 0) {
|
||||
@ -1081,8 +1082,15 @@ dofork(action)
|
||||
/*
|
||||
* Child should run as daemon instead of root
|
||||
*/
|
||||
if (pid == 0)
|
||||
if (pid == 0) {
|
||||
if ((pwd = getpwuid(DU)) == NULL) {
|
||||
syslog(LOG_ERR, "Can't lookup default uid in password file");
|
||||
break;
|
||||
}
|
||||
initgroups(pwd->pw_name, pwd->pw_gid);
|
||||
setgid(pwd->pw_gid);
|
||||
setuid(DU);
|
||||
}
|
||||
return(pid);
|
||||
}
|
||||
syslog(LOG_ERR, "can't fork");
|
||||
|
@ -1072,6 +1072,7 @@ dofork(action)
|
||||
int action;
|
||||
{
|
||||
register int i, pid;
|
||||
struct passwd *pwd;
|
||||
|
||||
for (i = 0; i < 20; i++) {
|
||||
if ((pid = fork()) < 0) {
|
||||
@ -1081,8 +1082,15 @@ dofork(action)
|
||||
/*
|
||||
* Child should run as daemon instead of root
|
||||
*/
|
||||
if (pid == 0)
|
||||
if (pid == 0) {
|
||||
if ((pwd = getpwuid(DU)) == NULL) {
|
||||
syslog(LOG_ERR, "Can't lookup default uid in password file");
|
||||
break;
|
||||
}
|
||||
initgroups(pwd->pw_name, pwd->pw_gid);
|
||||
setgid(pwd->pw_gid);
|
||||
setuid(DU);
|
||||
}
|
||||
return(pid);
|
||||
}
|
||||
syslog(LOG_ERR, "can't fork");
|
||||
|
Loading…
Reference in New Issue
Block a user