From 87bd68cb93a11cf332fc62074009e0ba2c4e9c9f Mon Sep 17 00:00:00 2001 From: bwarsaw <> Date: Sun, 14 Dec 2003 17:57:40 +0000 Subject: check_privs(): Set the process's supplemental groups to those of the setuid'd user, if os.setgroup() is available (it's not in Python 2.1). Close SF bug #777444 posted by Richard Barrett, identified and solved by Jonas Muerer. --- bin/mailmanctl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/mailmanctl b/bin/mailmanctl index 4ebeb836..d49309ea 100644 --- a/bin/mailmanctl +++ b/bin/mailmanctl @@ -288,6 +288,13 @@ def check_privs(): uid = pwd.getpwnam(mm_cfg.MAILMAN_USER)[2] myuid = os.getuid() if myuid == 0: + groups = [x[2] for x in grp.getgrall() if mm_cfg.MAILMAN_USER in x[3]] + groups.append(gid) + try: + os.setgroups(groups) + except AttributeError: + # Python 2.1 doesn't have setgroups + syslog('error', 'Warning: unable to setgroups(%s)' % groups) os.setgid(gid) os.setuid(uid) elif myuid <> uid: -- cgit v1.2.3