For userpriv, call setgroups with all groups that the portage user belongs to (bug...
authorZac Medico <zmedico@gentoo.org>
Thu, 19 Oct 2006 23:04:26 +0000 (23:04 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 19 Oct 2006 23:04:26 +0000 (23:04 -0000)
svn path=/main/trunk/; revision=4760

pym/portage.py
pym/portage_data.py

index 4d6c86a040c959a5a94d2f78d509116d04ec4957..21867762563a411568683ec8a79bf6c3fc93e905 100644 (file)
@@ -73,7 +73,7 @@ try:
          INCREMENTALS, EAPI, MISC_SH_BINARY
 
        from portage_data import ostype, lchown, userland, secpass, uid, wheelgid, \
-                                portage_uid, portage_gid
+                                portage_uid, portage_gid, userpriv_groups
        from portage_manifest import Manifest
 
        import portage_util
@@ -1926,7 +1926,7 @@ def spawn(mystring,mysettings,debug=0,free=0,droppriv=0,sesandbox=0,fd_pipes=Non
                 ("userpriv" in string.split(mysettings["RESTRICT"]))))
 
        if droppriv and not uid and portage_gid and portage_uid:
-               keywords.update({"uid":portage_uid,"gid":portage_gid,"groups":[portage_gid],"umask":002})
+               keywords.update({"uid":portage_uid,"gid":portage_gid,"groups":userpriv_groups,"umask":002})
 
        if not free:
                free=((droppriv and "usersandbox" not in features) or \
@@ -2257,7 +2257,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
                                                spawn_keywords.update({
                                                        "uid"    : portage_uid,
                                                        "gid"    : portage_gid,
-                                                       "groups" : [portage_gid],
+                                                       "groups" : userpriv_groups,
                                                        "umask"  : 002})
 
                                        try:
index 3bbb1dd5826b94bbd7e783970e2fe77bc1d69a15..ba6000f946b9a4d8cf19ba65fb0d4ef52b461d5f 100644 (file)
@@ -3,6 +3,8 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
+if not hasattr(__builtins__, "set"):
+       from sets import Set as set
 
 import os,pwd,grp
 from portage_util import writemsg
@@ -107,3 +109,10 @@ if (uid!=0) and (portage_gid not in os.getgroups()):
        writemsg(red("*** Please add this user to the portage group if you wish to use portage.\n"))
        writemsg("\n")
        portage_group_warning()
+
+userpriv_groups = [portage_gid]
+if secpass >= 2:
+       for g in grp.getgrall():
+               if "portage" in g[3]:
+                       userpriv_groups.append(g[2])
+       userpriv_groups = list(set(userpriv_groups))