summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-06-23 18:29:09 +0000
committerGerald Carter <jerry@samba.org>2003-06-23 18:29:09 +0000
commitd21358308a2a2c86b4e9d23922c7c940b5d1b012 (patch)
treee93fa4e350be26f142dc88a3a15eb3cc81079350 /source3
parent7356d558ffc9c45fd5f42f29b3fffb1b8d9aee68 (diff)
downloadsamba-d21358308a2a2c86b4e9d23922c7c940b5d1b012.tar.gz
samba-d21358308a2a2c86b4e9d23922c7c940b5d1b012.tar.bz2
samba-d21358308a2a2c86b4e9d23922c7c940b5d1b012.zip
wrap group enuemration in brcome/unbecome_root() (bug #110)
(This used to be commit 3918fffc7f07202f4c0b940f877184eea7561135)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source3/rpc_server/srv_util.c b/source3/rpc_server/srv_util.c
index 5040b094a8..03e53118a8 100644
--- a/source3/rpc_server/srv_util.c
+++ b/source3/rpc_server/srv_util.c
@@ -147,6 +147,8 @@ NTSTATUS get_alias_user_groups(TALLOC_CTX *ctx, DOM_SID *sid, int *numgroups, ui
return NT_STATUS_UNSUCCESSFUL;
}
+ become_root();
+
for (i=0;i<num_groups;i++) {
if (!get_group_from_gid(groups[i], &map)) {
@@ -195,6 +197,8 @@ NTSTATUS get_alias_user_groups(TALLOC_CTX *ctx, DOM_SID *sid, int *numgroups, ui
break;
}
+ unbecome_root();
+
if(num_groups) free(groups);
/* now check for the user's gid (the primary group rid) */
@@ -209,11 +213,15 @@ NTSTATUS get_alias_user_groups(TALLOC_CTX *ctx, DOM_SID *sid, int *numgroups, ui
DEBUG(10,("get_alias_user_groups: looking for gid %d of user %s\n", (int)gid, user_name));
+ become_root();
+
if(!get_group_from_gid(gid, &map)) {
DEBUG(0,("get_alias_user_groups: gid of user %s doesn't exist. Check your /etc/passwd and /etc/group files\n", user_name));
goto done;
}
+ unbecome_root();
+
/* the primary group isn't an alias */
if (map.sid_name_use!=SID_NAME_ALIAS) {
DEBUG(10,("get_alias_user_groups: not returing %s, not an ALIAS group.\n", map.nt_name));
@@ -281,11 +289,17 @@ BOOL get_domain_user_groups(TALLOC_CTX *ctx, int *numgroups, DOM_GID **pgids, SA
DEBUG(10,("get_domain_user_groups: searching domain groups [%s] is a member of\n", user_name));
+ /* we must wrap this is become/unbecome root for ldap backends */
+ become_root();
+
/* first get the list of the domain groups */
if (!pdb_enum_group_mapping(SID_NAME_DOM_GRP, &map, &num_entries, ENUM_ONLY_MAPPED))
return False;
DEBUG(10,("get_domain_user_groups: there are %d mapped groups\n", num_entries));
+ unbecome_root();
+ /* end wrapper for group enumeration */
+
/*
* alloc memory. In the worse case, we alloc memory for nothing.
* but I prefer to alloc for nothing