diff options
author | Gerald Carter <jerry@samba.org> | 2003-12-10 16:42:44 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-12-10 16:42:44 +0000 |
commit | b90d6b16e4175526c5112b9541d7d509d5a64edf (patch) | |
tree | 4cdda7f2b196f853a09a7cee65c99477e35e8fd3 /source3/passdb | |
parent | caf641f2d2aa8edecd3f4d0a9b234e614b43f7e6 (diff) | |
download | samba-b90d6b16e4175526c5112b9541d7d509d5a64edf.tar.gz samba-b90d6b16e4175526c5112b9541d7d509d5a64edf.tar.bz2 samba-b90d6b16e4175526c5112b9541d7d509d5a64edf.zip |
more group lookup access fixes on the neverending bug 281
(This used to be commit 975ac6f5aa4d8d709733757e4e003f3c551fc9ba)
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/passdb.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index 82b1f9a0eb..b0c2430c09 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -707,6 +707,7 @@ BOOL local_lookup_sid(DOM_SID *sid, char *name, enum SID_NAME_USE *psid_name_use uint32 rid; SAM_ACCOUNT *sam_account = NULL; GROUP_MAP map; + BOOL ret; if (!sid_peek_check_rid(get_global_sam_sid(), sid, &rid)){ DEBUG(0,("local_lookup_sid: sid_peek_check_rid return False! SID: %s\n", @@ -736,9 +737,10 @@ BOOL local_lookup_sid(DOM_SID *sid, char *name, enum SID_NAME_USE *psid_name_use /* see if the passdb can help us with the name of the user */ + /* BEING ROOT BLLOCK */ become_root(); if (pdb_getsampwsid(sam_account, sid)) { - unbecome_root(); + unbecome_root(); /* -----> EXIT BECOME_ROOT() */ fstrcpy(name, pdb_get_username(sam_account)); *psid_name_use = SID_NAME_USER; @@ -746,10 +748,13 @@ BOOL local_lookup_sid(DOM_SID *sid, char *name, enum SID_NAME_USE *psid_name_use return True; } - unbecome_root(); pdb_free_sam(&sam_account); - - if (pdb_getgrsid(&map, *sid)) { + + ret = pdb_getgrsid(&map, *sid); + unbecome_root(); + /* END BECOME_ROOT BLOCK */ + + if ( ret ) { if (map.gid!=(gid_t)-1) { DEBUG(5,("local_lookup_sid: mapped group %s to gid %u\n", map.nt_name, (unsigned int)map.gid)); } else { @@ -1233,6 +1238,7 @@ BOOL local_sid_to_gid(gid_t *pgid, const DOM_SID *psid, enum SID_NAME_USE *name_ { uint32 rid; GROUP_MAP group; + BOOL ret; *name_type = SID_NAME_UNKNOWN; @@ -1241,8 +1247,12 @@ BOOL local_sid_to_gid(gid_t *pgid, const DOM_SID *psid, enum SID_NAME_USE *name_ /* we don't need to disable winbindd since the gid is stored in the GROUP_MAP object */ - - if ( !pdb_getgrsid(&group, *psid) ) { + + become_root(); + pdb_getgrsid(&group, *psid); + unbecome_root(); + + if ( !ret ) { /* fallback to rid mapping if enabled */ |