diff roundup/scripts/roundup_server.py @ 2482:a15f91a10e45 maint-0.7

merge from HEAD
author Richard Jones <richard@users.sourceforge.net>
date Mon, 21 Jun 2004 04:34:58 +0000
parents 105a4079b98f
children 200eb6e20351
line wrap: on
line diff
--- a/roundup/scripts/roundup_server.py	Thu Jun 17 10:15:49 2004 +0000
+++ b/roundup/scripts/roundup_server.py	Mon Jun 21 04:34:58 2004 +0000
@@ -17,7 +17,7 @@
 
 """Command-line script that runs a server over roundup.cgi.client.
 
-$Id: roundup_server.py,v 1.46.2.2 2004-05-12 22:31:37 richard Exp $
+$Id: roundup_server.py,v 1.46.2.3 2004-06-21 04:34:58 richard Exp $
 """
 __docformat__ = 'restructuredtext'
 
@@ -477,19 +477,19 @@
                       _("Unable to bind to port %s, port already in use." % port)
             raise
 
-        if group is not None and hasattr(os, 'getgid'):
+        if group is not None and hasattr(os, 'getuid'):
             # if root, setgid to the running user
-            if not os.getgid() and user is not None:
+            if not os.getuid():
                 try:
-                    import pwd
+                    import grp
                 except ImportError:
-                    raise ValueError, _("Can't change groups - no pwd module")
+                    raise ValueError, _("Can't change groups - no grp module")
                 try:
-                    gid = pwd.getpwnam(user)[3]
+                    gid = grp.getgrnam(group)[2]
                 except KeyError:
                     raise ValueError,_("Group %(group)s doesn't exist")%locals()
                 os.setgid(gid)
-            elif os.getgid() and user is not None:
+            elif os.getuid():
                 print _('WARNING: ignoring "-g" argument, not root')
 
         if hasattr(os, 'getuid'):

Roundup Issue Tracker: http://roundup-tracker.org/