From e2b0cacccc6aed5fbd8864fc694f437130899327 Mon Sep 17 00:00:00 2001 From: "Jeroen van Meeuwen (Kolab Systems)" Date: Tue, 29 May 2012 10:47:39 +0200 Subject: Make sure we use no functions that have been introduced in Python > 2.6 (#803) --- kolabd/__init__.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'kolabd') diff --git a/kolabd/__init__.py b/kolabd/__init__.py index 6939326..bf4fc7b 100644 --- a/kolabd/__init__.py +++ b/kolabd/__init__.py @@ -92,12 +92,16 @@ class KolabDaemon(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: ( @@ -115,7 +119,7 @@ class KolabDaemon(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 @@ -125,7 +129,7 @@ class KolabDaemon(object): os.setregid(group_gid, group_gid) - if euid == 0: + if ruid == 0: # Means we haven't switched yet. try: ( @@ -147,7 +151,7 @@ class KolabDaemon(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 -- cgit v1.1