Procházet zdrojové kódy

Merge branch 'lukaszo/master'
_msg.

Conflicts:
celery/platforms.py

Ask Solem před 13 roky
rodič
revize
939695114f
1 změnil soubory, kde provedl 10 přidání a 1 odebrání
  1. 10 1
      celery/platforms.py

+ 10 - 1
celery/platforms.py

@@ -330,6 +330,14 @@ def parse_gid(gid):
         raise
 
 
+def setgroups(uid):
+    if grp and pwd:
+        user_name = pwd.getpwuid(uid)[0]
+        user_groups = [gr.gr_gid for gr in grp.getgrall()
+                                                if user_name in gr.gr_mem]
+        os.setgroups(user_groups)
+
+
 def setegid(gid):
     """Set effective group id."""
     gid = parse_gid(gid)
@@ -370,7 +378,8 @@ def set_effective_user(uid=None, gid=None):
         # If GID isn't defined, get the primary GID of the user.
         if not gid and pwd:
             gid = pwd.getpwuid(uid).pw_gid
-            setgid(gid)
+        setgid(gid)
+        setgroups(uid)
         setuid(uid)
     else:
         gid and setgid(gid)