summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/mailmanctl11
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/mailmanctl b/bin/mailmanctl
index b4d404c17..a20144b79 100644
--- a/bin/mailmanctl
+++ b/bin/mailmanctl
@@ -95,6 +95,7 @@ import getopt
import signal
import errno
import pwd
+import grp
import socket
import paths
@@ -264,10 +265,12 @@ def check_privs():
# which Mailman was configured for, and refuse to run if we didn't coerce
# the uid/gid.
if os.getuid() == 0:
- os.setgid(mm_cfg.MAILMAN_GID)
- os.setuid(mm_cfg.MAILMAN_UID)
- if os.getuid() <> mm_cfg.MAILMAN_UID:
- name = pwd.getpwuid(mm_cfg.MAILMAN_UID)[0]
+ gid = grp.getgrnam(mm_cfg.MAILMAN_GROUP)[2]
+ uid = pwd.getpwnam(mm_cfg.MAILMAN_USER)[2]
+ os.setgid(gid)
+ os.setuid(uid)
+ if os.getuid() <> uid:
+ name = mm_cfg.MAILMAN_USER
usage(1, _(
'Run this program as root or as the %(name)s user, or use -u.'))