summaryrefslogtreecommitdiffstats
path: root/wallace/__init__.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-29 10:47:39 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-29 10:47:39 +0200
commite2b0cacccc6aed5fbd8864fc694f437130899327 (patch)
tree3661a09925904420ceeda874a62a50f549d24eda /wallace/__init__.py
parent70851f82d1d67336cde884569d37bc484361e53f (diff)
downloadpykolab-e2b0cacccc6aed5fbd8864fc694f437130899327.tar.gz
Make sure we use no functions that have been introduced in Python > 2.6 (#803)
Diffstat (limited to 'wallace/__init__.py')
-rw-r--r--wallace/__init__.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/wallace/__init__.py b/wallace/__init__.py
index 0d04c5b..45ad211 100644
--- a/wallace/__init__.py
+++ b/wallace/__init__.py
@@ -254,12 +254,16 @@ class WallaceDaemon(object):
exitcode = 0
try:
- (ruid, euid, suid) = os.getresuid()
- (rgid, egid, sgid) = os.getresgid()
+ try:
+ (ruid, euid, suid) = os.getresuid()
+ (rgid, egid, sgid) = os.getresgid()
+ except AttributeError, errmsg:
+ ruid = os.getuid()
+ rgid = os.getgid()
if ruid == 0:
# Means we can setreuid() / setregid() / setgroups()
- if egid == 0:
+ if rgid == 0:
# Get group entry details
try:
(
@@ -277,7 +281,7 @@ class WallaceDaemon(object):
sys.exit(1)
# Set real and effective group if not the same as current.
- if not group_gid == egid:
+ if not group_gid == rgid:
log.debug(
_("Switching real and effective group id to %d") % (
group_gid
@@ -287,7 +291,7 @@ class WallaceDaemon(object):
os.setregid(group_gid, group_gid)
- if euid == 0:
+ if ruid == 0:
# Means we haven't switched yet.
try:
(
@@ -309,7 +313,7 @@ class WallaceDaemon(object):
# Set real and effective user if not the same as current.
- if not user_uid == euid:
+ if not user_uid == ruid:
log.debug(
_("Switching real and effective user id to %d") % (
user_uid