Mercurial > p > roundup > code
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 2480:6e4c9680e0c1 | 2482:a15f91a10e45 |
|---|---|
| 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.46.2.2 2004-05-12 22:31:37 richard Exp $ | 20 $Id: roundup_server.py,v 1.46.2.3 2004-06-21 04:34:58 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 |
| 475 if e[0] == errno.EADDRINUSE: | 475 if e[0] == errno.EADDRINUSE: |
| 476 raise socket.error, \ | 476 raise socket.error, \ |
| 477 _("Unable to bind to port %s, port already in use." % port) | 477 _("Unable to bind to port %s, port already in use." % port) |
| 478 raise | 478 raise |
| 479 | 479 |
| 480 if group is not None and hasattr(os, 'getgid'): | 480 if group is not None and hasattr(os, 'getuid'): |
| 481 # if root, setgid to the running user | 481 # if root, setgid to the running user |
| 482 if not os.getgid() and user is not None: | 482 if not os.getuid(): |
| 483 try: | 483 try: |
| 484 import pwd | 484 import grp |
| 485 except ImportError: | 485 except ImportError: |
| 486 raise ValueError, _("Can't change groups - no pwd module") | 486 raise ValueError, _("Can't change groups - no grp module") |
| 487 try: | 487 try: |
| 488 gid = pwd.getpwnam(user)[3] | 488 gid = grp.getgrnam(group)[2] |
| 489 except KeyError: | 489 except KeyError: |
| 490 raise ValueError,_("Group %(group)s doesn't exist")%locals() | 490 raise ValueError,_("Group %(group)s doesn't exist")%locals() |
| 491 os.setgid(gid) | 491 os.setgid(gid) |
| 492 elif os.getgid() and user is not None: | 492 elif os.getuid(): |
| 493 print _('WARNING: ignoring "-g" argument, not root') | 493 print _('WARNING: ignoring "-g" argument, not root') |
| 494 | 494 |
| 495 if hasattr(os, 'getuid'): | 495 if hasattr(os, 'getuid'): |
| 496 # if root, setuid to the running user | 496 # if root, setuid to the running user |
| 497 if not os.getuid() and user is not None: | 497 if not os.getuid() and user is not None: |
