From bc419636d00e8ff7ce5acb08b5320fe41f8d29c8 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 19 Oct 2006 23:04:26 +0000 Subject: For userpriv, call setgroups with all groups that the portage user belongs to (bug #137610). svn path=/main/trunk/; revision=4760 --- pym/portage.py | 6 +++--- pym/portage_data.py | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'pym') 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)) -- cgit v1.2.3-1-g7c22