My favorites
▼
|
Sign in
pyicqt
ICQ transport for XMPP
Project Home
Downloads
Wiki
Issues
Source
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
186
attachment: main.py.patch
(2.1 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--- src/main.py 2009-08-26 18:49:20.000000000 +0200
+++ src/main.py 2009-08-26 18:49:35.000000000 +0200
@@ -1,7 +1,7 @@
# Copyright 2004-2006 Daniel Henninger <jadestorm@nc.rr.com>
# Licensed for distribution under the GPL version 2, check COPYING for details
-import os, os.path, time, sys, codecs, getopt, shutil
+import os, os.path, time, sys, codecs, getopt, shutil, pwd
reload(sys)
sys.setdefaultencoding("utf-8")
sys.stdout = codecs.lookup('utf-8')[-1](sys.stdout)
@@ -39,7 +39,9 @@
daemonizeme = False
debugLevel = 0
debugFile = ""
-opts, args = getopt.getopt(sys.argv[1:], "bc:o:dDgtl:p:h", ["background", "config=", "option=", "debug", "Debug", "garbage", "traceback", "log=", "profile=", "help"])
+user = ""
+group = ""
+opts, args = getopt.getopt(sys.argv[1:], "bc:o:dDgtl:p:u:k:h", ["background", "config=", "option=", "debug", "Debug", "garbage", "traceback", "log=", "profile=", "user=", "group=", "help"])
for o, v in opts:
if o in ("-c", "--config"):
conffile = v
@@ -61,6 +63,10 @@
elif o in ("-o", "--option"):
var, setting = v.split("=", 2)
options[var] = setting
+ elif o in ("-u", "--user"):
+ user = v
+ elif o in ("-k", "--group"):
+ group = v
elif o in ("-h", "--help"):
print "./PyICQt [options]"
print " -h print this help"
@@ -72,6 +78,8 @@
print " -t print debugging only on traceback"
print " -l <file> write debugging output to file"
print " -o <var>=<setting> set config var to setting"
+ print " -u <userid> change to userid after start-up"
+ print " -k <groupid> change to groupid after start-up"
sys.exit(0)
config.debugLevel = debugLevel
config.debugFile = debugFile
@@ -424,6 +432,18 @@
if config.pid:
self.writePID()
+ # change EUID/EGID _after_ PID was created
+ if group and os.name == "posix":
+ if group.isdigit():
+ os.setegid(int(group))
+ else:
+ os.setegid(pwd.getpwnam(group)[2])
+ if user and os.name == "posix":
+ if user.isdigit():
+ os.seteuid(int(user))
+ else:
+ os.seteuid(pwd.getpwnam(user)[2])
+
jid = config.jid
if config.useXCP and config.compjid: jid = config.compjid
Powered by
Google Project Hosting