summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-11-26 04:27:51 +0000
committerTim Potter <tpot@samba.org>2001-11-26 04:27:51 +0000
commit64dd6c3412f961239ad4c6989aab67250d312c9d (patch)
treeca574f52b73672257cac3a26121cfc7ff05d77a8 /source3/smbd
parent178f6a64b26d828db6b516392d7072e9c29f6233 (diff)
downloadsamba-64dd6c3412f961239ad4c6989aab67250d312c9d.tar.gz
samba-64dd6c3412f961239ad4c6989aab67250d312c9d.tar.bz2
samba-64dd6c3412f961239ad4c6989aab67250d312c9d.zip
Another merge from appliance-head: in [ug]id_to_sid don't call the
winbind function if the id is obviously going to be local. Cleanup of winbind [ug]id parameter handling. (This used to be commit 4ab9ca31a02b3388aa89a00e0390ea9e4c76283a)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/uid.c44
1 files changed, 30 insertions, 14 deletions
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index 4329e3fb76..14b0290e33 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -551,16 +551,24 @@ BOOL lookup_sid(DOM_SID *sid, fstring dom_name, fstring name, enum SID_NAME_USE
DOM_SID *uid_to_sid(DOM_SID *psid, uid_t uid)
{
+ uid_t low, high;
fstring sid;
- if (!winbind_uid_to_sid(psid, uid)) {
- DEBUG(10,("uid_to_sid: winbind lookup for uid %u failed - trying local.\n", (unsigned int)uid ));
+ if (lp_winbind_uid(&low, &high) && uid >= low && uid <= high) {
+ if (winbind_uid_to_sid(psid, uid)) {
- return local_uid_to_sid(psid, uid);
- }
+ DEBUG(10,("uid_to_sid: winbindd %u -> %s\n",
+ (unsigned int)uid,
+ sid_to_string(sid, psid)));
+
+ return psid;
+ }
+ }
- DEBUG(10,("uid_to_sid: winbindd %u -> %s\n",
- (unsigned int)uid, sid_to_string(sid, psid) ));
+ 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;
}
@@ -573,16 +581,24 @@ DOM_SID *uid_to_sid(DOM_SID *psid, uid_t uid)
DOM_SID *gid_to_sid(DOM_SID *psid, gid_t gid)
{
+ gid_t low, high;
fstring sid;
- if (!winbind_gid_to_sid(psid, gid)) {
- DEBUG(10,("gid_to_sid: winbind lookup for gid %u failed - trying local.\n", (unsigned int)gid ));
-
- return local_gid_to_sid(psid, gid);
- }
-
- DEBUG(10,("gid_to_sid: winbindd %u -> %s\n",
- (unsigned int)gid, sid_to_string(sid,psid) ));
+ if (lp_winbind_gid(&low, &high) && gid >= low && gid <= high) {
+ if (winbind_gid_to_sid(psid, gid)) {
+
+ DEBUG(10,("gid_to_sid: winbindd %u -> %s\n",
+ (unsigned int)gid,
+ sid_to_string(sid, psid)));
+
+ return psid;
+ }
+ }
+
+ local_gid_to_sid(psid, gid);
+
+ DEBUG(10,("gid_to_sid: local %u -> %s\n",
+ (unsigned int)gid, sid_to_string(sid, psid)));
return psid;
}