summaryrefslogtreecommitdiffstats
path: root/source/smbd/uid.c
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
commit4ab9ca31a02b3388aa89a00e0390ea9e4c76283a (patch)
treece721ed2b042f1dd87e3ea868f56474d2a04f7b8 /source/smbd/uid.c
parentd6318add27f6bca5be00cbedf2226b642341297a (diff)
downloadsamba-4ab9ca31a02b3388aa89a00e0390ea9e4c76283a.tar.gz
samba-4ab9ca31a02b3388aa89a00e0390ea9e4c76283a.tar.xz
samba-4ab9ca31a02b3388aa89a00e0390ea9e4c76283a.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.
Diffstat (limited to 'source/smbd/uid.c')
-rw-r--r--source/smbd/uid.c44
1 files changed, 30 insertions, 14 deletions
diff --git a/source/smbd/uid.c b/source/smbd/uid.c
index 4329e3fb76a..14b0290e334 100644
--- a/source/smbd/uid.c
+++ b/source/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;
}