summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRezrov Frotz <rezrov.frotz@gmail.com>2014-07-18 12:23:40 -0400
committerJoel Rosdahl <joel@rosdahl.net>2014-07-31 15:37:27 +0200
commit9c14fbe90499b72202db944bc8c8a6f6a747f458 (patch)
tree498888e1e452de7b97a52916657e40d89edba1f5
parent31c0cf9a9fed97e14be80f2c7cae9a654e156549 (diff)
downloadminiircd-9c14fbe90499b72202db944bc8c8a6f6a747f458.tar.gz
miniircd-9c14fbe90499b72202db944bc8c8a6f6a747f458.zip
Use split to parse user/group ID
-rwxr-xr-xminiircd13
1 files changed, 5 insertions, 8 deletions
diff --git a/miniircd b/miniircd
index d8d0017..ac9357e 100755
--- a/miniircd
+++ b/miniircd
@@ -883,14 +883,11 @@ def main(argv):
from grp import getgrnam
if os.getuid() != 0:
op.error("Must be root to use --setuid")
- match = re.findall(r"([a-z_][a-z0-9_-]*\$?)", options.setuid,
- flags=re.IGNORECASE)
- if len(match) > 1:
- options.setuid = (int(getpwnam(match[0]).pw_uid),
- int(getgrnam(match[1]).gr_gid))
- elif len(match) == 1:
- options.setuid = (int(getpwnam(match[0]).pw_uid),
- int(getpwnam(match[0]).pw_gid))
+ matches = options.setuid.split(":")
+ if len(matches) > 1:
+ options.setuid = (int(getpwnam(matches[0]).pw_uid),int(getgrnam(matches[1]).gr_gid))
+ elif len(matches) == 1:
+ options.setuid = (int(getpwnam(matches[0]).pw_uid),int(getpwnam(matches[0]).pw_gid))
else:
op.error("Specify a user, or user and group separated by a colon,"
" e.g. --setuid daemon, --setuid nobody:nobody")