Add a wrapper for setgroups() that trims off extra groups and retries

if setgroups() fails.  Also add some missing addrefs for PERM_USER
and PERM_FULL_USER.
This commit is contained in:
Todd C. Miller
2011-07-20 16:54:12 -04:00
parent b124635b04
commit 022591f4bf
8 changed files with 140 additions and 67 deletions

View File

@@ -928,7 +928,7 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
if (!ISSET(details->flags, CD_PRESERVE_GROUPS)) {
if (details->ngroups >= 0) {
if (setgroups(details->ngroups, details->groups) < 0) {
if (sudo_setgroups(details->ngroups, details->groups) < 0) {
warning(_("unable to set supplementary group IDs"));
goto done;
}