Fix seteuid magic
authorDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Mon, 3 Dec 2007 07:58:44 +0000 (02:58 -0500)
committerDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Mon, 3 Dec 2007 07:58:44 +0000 (02:58 -0500)
bin/ceo
pylib/csc/apps/urwid/groups.py
pylib/csc/apps/urwid/main.py

diff --git a/bin/ceo b/bin/ceo
index e707277..9c87819 100755 (executable)
--- a/bin/ceo
+++ b/bin/ceo
@@ -18,8 +18,10 @@ for pathent in sys.path[:]:
     if not pathent.find('/usr') == 0 and not pathent.find('/var') == 0:
         sys.path.remove(pathent)
 
     if not pathent.find('/usr') == 0 and not pathent.find('/var') == 0:
         sys.path.remove(pathent)
 
-euid = os.getuid()
-egid = os.getgid()
+euid = os.geteuid()
+egid = os.getegid()
+uid = os.getuid()
+gid = os.getgid()
 try:
     os.setreuid(euid, euid)
     os.setregid(egid, egid)
 try:
     os.setreuid(euid, euid)
     os.setregid(egid, egid)
@@ -28,4 +30,4 @@ except OSError, e:
     sys.exit(1)
 
 import csc.apps.urwid.main
     sys.exit(1)
 
 import csc.apps.urwid.main
-csc.apps.urwid.main.start(euid, egid)
+csc.apps.urwid.main.start(uid, gid)
index e3f576a..94be769 100644 (file)
@@ -20,11 +20,11 @@ def list_group_members(data):
     search.member_list( mlist )
 
 def group_members(data):
     search.member_list( mlist )
 
 def group_members(data):
-    data, euid = data
+    data, uid = data
 
     # only syscom may modify non-club groups
     if data['group'] != 'office':
 
     # only syscom may modify non-club groups
     if data['group'] != 'office':
-        user = pwd.getpwuid(euid).pw_name
+        user = pwd.getpwuid(uid).pw_name
         users = grp.getgrnam('syscom').gr_mem
         if user not in users:
             member = members.get(data['group'])
         users = grp.getgrnam('syscom').gr_mem
         if user not in users:
             member = members.get(data['group'])
@@ -66,8 +66,8 @@ class IntroPage(WizardPanel):
         return False
 
 class InfoPage(WizardPanel):
         return False
 
 class InfoPage(WizardPanel):
-    def __init__(self, state, euid):
-        state['euid'] = euid
+    def __init__(self, state, uid):
+        state['uid'] = uid
         WizardPanel.__init__(self, state)
     def init_widgets(self):
         self.group = WordEdit("Club or Group: ")
         WizardPanel.__init__(self, state)
     def init_widgets(self):
         self.group = WordEdit("Club or Group: ")
@@ -85,7 +85,7 @@ class InfoPage(WizardPanel):
             "group" : group_name,
             "groups" : [group],
         }
             "group" : group_name,
             "groups" : [group],
         }
-        group_members((data, self.state['euid']))
+        group_members((data, self.state['uid']))
 
 class ChangeMember(WizardPanel):
     def __init__(self, state, data):
 
 class ChangeMember(WizardPanel):
     def __init__(self, state, data):
index 4e1749d..eda6695 100644 (file)
@@ -74,9 +74,9 @@ def main_menu():
         ("Manage Club or Group Members", manage_group, None),
         ("Manage Positions", manage_positions, None),
         ("Manage Office Staff", groups.group_members,
         ("Manage Club or Group Members", manage_group, None),
         ("Manage Positions", manage_positions, None),
         ("Manage Office Staff", groups.group_members,
-            (office_data, ui.euid)),
+            (office_data, ui.uid)),
         ("Manage Systems Committee", groups.group_members,
         ("Manage Systems Committee", groups.group_members,
-            (syscom_data, ui.euid)),
+            (syscom_data, ui.uid)),
         ("Exit", raise_abort, None),
     ]
 
         ("Exit", raise_abort, None),
     ]
 
@@ -102,7 +102,7 @@ def new_club(*args, **kwargs):
 def manage_group(*args, **kwargs):
     push_wizard("Manage Club or Group Members", [
         groups.IntroPage,
 def manage_group(*args, **kwargs):
     push_wizard("Manage Club or Group Members", [
         groups.IntroPage,
-        (groups.InfoPage, ui.euid),
+        (groups.InfoPage, ui.uid),
     ], (60, 15))
 
 def renew_member(*args, **kwargs):
     ], (60, 15))
 
 def renew_member(*args, **kwargs):
@@ -154,9 +154,9 @@ def run():
     push_window( main_menu(), program_name() )
     event_loop( ui )
 
     push_window( main_menu(), program_name() )
     event_loop( ui )
 
-def start(euid, egid):
-    ui.euid = euid
-    ui.egid = egid
+def start(uid, gid):
+    ui.uid = uid
+    ui.gid = gid
     ui.run_wrapper( run )
 
 if __name__ == '__main__':
     ui.run_wrapper( run )
 
 if __name__ == '__main__':