summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage.py6
-rw-r--r--pym/portage_data.py9
2 files changed, 12 insertions, 3 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 4d6c86a04..218677625 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -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:
diff --git a/pym/portage_data.py b/pym/portage_data.py
index 3bbb1dd58..ba6000f94 100644
--- a/pym/portage_data.py
+++ b/pym/portage_data.py
@@ -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))