The call to setuid(2) subsequently causes setgroups(2) to fail. setgroups(2)

requires super-user access in order to complete successfully.
Move setgroups(2) to execute before setuid(2) so that it is successful.
This commit is contained in:
Christian S.J. Peron 2004-06-30 18:58:19 +00:00
parent f5298929e3
commit 0c90b4887e

View File

@ -286,9 +286,9 @@ main(int argc, char *argv[])
syslog(LOG_ERR, "chroot: %s: %m", chroot_dir);
exit(1);
}
chdir( "/" );
setuid(nobody->pw_uid);
chdir("/");
setgroups(1, &nobody->pw_gid);
setuid(nobody->pw_uid);
}
len = sizeof(me);