tools/regression/priv: Don't call setgroups() with the effective GID
The 'setgroups(0, NULL);' stance works the same on all versions of
FreeBSD, getting rid of all supplementary groups. The replaced code
would force the effective GID to also be a supplementary group.
Fixes: 9da2fe96ff ("kern: fix setgroups(2) and getgroups(2) to match other platforms")
MFC after: 5 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52289
This commit is contained in:
@@ -423,12 +423,10 @@ setup_file(const char *test, char *fpathp, uid_t uid, gid_t gid, mode_t mode)
|
||||
static void
|
||||
set_creds(const char *test, uid_t uid, gid_t gid)
|
||||
{
|
||||
gid_t gids[1] = { gid };
|
||||
|
||||
if (setgid(gid) < 0)
|
||||
err(-1, "test %s: setegid(%d)", test, gid);
|
||||
if (setgroups(sizeof(gids)/sizeof(gid_t), gids) < 0)
|
||||
err(-1, "test %s: setgroups(%d)", test, gid);
|
||||
if (setgroups(0, NULL) < 0)
|
||||
err(-1, "test %s: setgroups(NULL)", test);
|
||||
if (setuid(uid) < 0)
|
||||
err(-1, "test %s: seteuid(%d)", test, uid);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user