diff options
author | Gerald Carter <jerry@samba.org> | 2003-07-09 16:44:47 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-07-09 16:44:47 +0000 |
commit | 1111bc7b0c7165e1cdf8d90eb49f4c368d2eded6 (patch) | |
tree | 2a7b6689c049b982d8c134e9803aab50e08f7985 /source/smbd/uid.c | |
parent | f005f1cf12b839f3985ab00315da63c584ce803e (diff) | |
download | samba-1111bc7b0c7165e1cdf8d90eb49f4c368d2eded6.tar.gz samba-1111bc7b0c7165e1cdf8d90eb49f4c368d2eded6.tar.xz samba-1111bc7b0c7165e1cdf8d90eb49f4c368d2eded6.zip |
Large set of changes to add UNIX account/group management
to winbindd. See README.idmap-and-winbind-changes for details.
Diffstat (limited to 'source/smbd/uid.c')
-rw-r--r-- | source/smbd/uid.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/source/smbd/uid.c b/source/smbd/uid.c index 6ca2aa336d3..8d8ce136a94 100644 --- a/source/smbd/uid.c +++ b/source/smbd/uid.c @@ -809,17 +809,28 @@ NTSTATUS sid_to_uid(const DOM_SID *psid, uid_t *puid) if (fetch_uid_from_cache(puid, psid)) return NT_STATUS_OK; - /* - * First we must look up the name and decide if this is a user sid. - */ + /* if this is our DIS then go straight to a local lookup */ + + if ( sid_compare_domain(get_global_sam_sid(), psid) == 0 ) { + DEBUG(10,("sid_to_uid: my domain (%s) - trying local.\n", + sid_string_static(psid) )); + + if ( (ret = local_sid_to_uid(puid, psid, &name_type)) == True ) + store_uid_sid_cache(psid, *puid); + + return (ret ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL); + } + + + /* look up the name and decide if this is a user sid */ if ( (!winbind_lookup_sid(psid, dom_name, name, &name_type)) || (name_type != SID_NAME_USER) ) { DEBUG(10,("sid_to_uid: winbind lookup for sid %s failed - trying local.\n", - sid_to_string(sid_str, psid) )); + sid_string_static(psid) )); - ret = local_sid_to_uid(puid, psid, &name_type); - if (ret) + if ( (ret = local_sid_to_uid(puid, psid, &name_type)) == True ) store_uid_sid_cache(psid, *puid); + return (ret ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL); } |