Mercurial > p > roundup > code
comparison roundup/scripts/roundup_server.py @ 2481:8f2d1aabd940
fixed -g arg to roundup-server [SF#973946]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 21 Jun 2004 04:33:52 +0000 |
| parents | b54ad9ed394a |
| children | 55b496fb7b5b |
comparison
equal
deleted
inserted
replaced
| 2479:7f9f1c66c1b6 | 2481:8f2d1aabd940 |
|---|---|
| 15 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 15 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 16 # | 16 # |
| 17 | 17 |
| 18 """Command-line script that runs a server over roundup.cgi.client. | 18 """Command-line script that runs a server over roundup.cgi.client. |
| 19 | 19 |
| 20 $Id: roundup_server.py,v 1.50 2004-05-18 19:25:24 a1s Exp $ | 20 $Id: roundup_server.py,v 1.51 2004-06-21 04:33:52 richard Exp $ |
| 21 """ | 21 """ |
| 22 __docformat__ = 'restructuredtext' | 22 __docformat__ = 'restructuredtext' |
| 23 | 23 |
| 24 # python version check | 24 # python version check |
| 25 from roundup import version_check | 25 from roundup import version_check |
| 476 if e[0] == errno.EADDRINUSE: | 476 if e[0] == errno.EADDRINUSE: |
| 477 raise socket.error, \ | 477 raise socket.error, \ |
| 478 _("Unable to bind to port %s, port already in use." % port) | 478 _("Unable to bind to port %s, port already in use." % port) |
| 479 raise | 479 raise |
| 480 | 480 |
| 481 if group is not None and hasattr(os, 'getgid'): | 481 if group is not None and hasattr(os, 'getuid'): |
| 482 # if root, setgid to the running user | 482 # if root, setgid to the running user |
| 483 if not os.getgid() and user is not None: | 483 if not os.getuid(): |
| 484 try: | 484 try: |
| 485 import pwd | 485 import grp |
| 486 except ImportError: | 486 except ImportError: |
| 487 raise ValueError, _("Can't change groups - no pwd module") | 487 raise ValueError, _("Can't change groups - no grp module") |
| 488 try: | 488 try: |
| 489 gid = pwd.getpwnam(user)[3] | 489 gid = grp.getgrnam(group)[2] |
| 490 except KeyError: | 490 except KeyError: |
| 491 raise ValueError,_("Group %(group)s doesn't exist")%locals() | 491 raise ValueError,_("Group %(group)s doesn't exist")%locals() |
| 492 os.setgid(gid) | 492 os.setgid(gid) |
| 493 elif os.getgid() and user is not None: | 493 elif os.getuid(): |
| 494 print _('WARNING: ignoring "-g" argument, not root') | 494 print _('WARNING: ignoring "-g" argument, not root') |
| 495 | 495 |
| 496 if hasattr(os, 'getuid'): | 496 if hasattr(os, 'getuid'): |
| 497 # if root, setuid to the running user | 497 # if root, setuid to the running user |
| 498 if not os.getuid() and user is not None: | 498 if not os.getuid() and user is not None: |
