summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-04-11 23:43:40 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-04-11 23:43:40 +0000
commit4c0399915cde591cb06f99b50acd5e5bf48bc6cb (patch)
tree4541354d0b48ef412730466d57313bfceba7f8e5 /source3/smbd
parent440a0099ea30fbf47ad2be2f014a4a1df1eaf783 (diff)
downloadsamba-4c0399915cde591cb06f99b50acd5e5bf48bc6cb.tar.gz
samba-4c0399915cde591cb06f99b50acd5e5bf48bc6cb.tar.bz2
samba-4c0399915cde591cb06f99b50acd5e5bf48bc6cb.zip
Much better support for both non-algorithic RIDs (where the RID is stored in
the passdb) and RIDs not in the passdb, due to being NIS users etc. The main fix here is to add become_root()/unbecome_root() at critical places. This (finally) fixes the bug where you could not see local users's names in a file's security properties as non-root. Tested. The similar bug in uid_to_sid is also fixed, but is not (yet) Tested. Andrew Bartlett (This used to be commit 79327a305e20d78ab5ca21d01c39b5f49dc0d632)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/uid.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index 864d3d6c66..ac0b535c13 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -546,9 +546,12 @@ DOM_SID *uid_to_sid(DOM_SID *psid, uid_t uid)
return psid;
}
}
+
+ /* Make sure we report failure, (when psid == NULL) */
+ become_root();
+ psid = local_uid_to_sid(psid, uid);
+ unbecome_root();
- local_uid_to_sid(psid, uid);
-
DEBUG(10,("uid_to_sid: local %u -> %s\n", (unsigned int)uid, sid_to_string(sid, psid)));
return psid;
@@ -611,10 +614,14 @@ BOOL sid_to_uid(DOM_SID *psid, uid_t *puid, enum SID_NAME_USE *sidtype)
*/
if ( (!winbind_lookup_sid(psid, dom_name, name, &name_type)) || (name_type != SID_NAME_USER) ) {
+ BOOL result;
DEBUG(10,("sid_to_uid: winbind lookup for sid %s failed - trying local.\n",
sid_to_string(sid_str, psid) ));
- return local_sid_to_uid(puid, psid, sidtype);
+ become_root();
+ result = local_sid_to_uid(puid, psid, sidtype);
+ unbecome_root();
+ return result;
}
/*
@@ -634,9 +641,13 @@ BOOL sid_to_uid(DOM_SID *psid, uid_t *puid, enum SID_NAME_USE *sidtype)
*/
if (!winbind_sid_to_uid(puid, psid)) {
+ BOOL result;
DEBUG(10,("sid_to_uid: winbind lookup for sid %s failed.\n",
sid_to_string(sid_str, psid) ));
- return local_sid_to_uid(puid, psid, sidtype);
+ become_root();
+ result = local_sid_to_uid(puid, psid, sidtype);
+ unbecome_root();
+ return result;
}
DEBUG(10,("sid_to_uid: winbindd %s -> %u\n",
@@ -667,7 +678,6 @@ BOOL sid_to_gid(DOM_SID *psid, gid_t *pgid, enum SID_NAME_USE *sidtype)
if (!winbind_lookup_sid(psid, dom_name, name, &name_type)) {
DEBUG(10,("sid_to_gid: winbind lookup for sid %s failed - trying local.\n",
sid_to_string(sid_str, psid) ));
-
if (!local_sid_to_gid(pgid, psid, sidtype)) {
/* this was probably a foreign sid - assume its a group rid
and continue */