summaryrefslogtreecommitdiffstats
path: root/source3/passdb
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2015-01-05 16:34:29 +0100
committerVolker Lendecke <vl@samba.org>2015-01-07 12:00:09 +0100
commit2ec910dba4b7f5d6b96904bc38bf0899a4b46eab (patch)
treeca1c093ce030a1e87bce753d959b945f3657c482 /source3/passdb
parentce85c98caa27105a73f60223e92ea0184804780c (diff)
downloadsamba-2ec910dba4b7f5d6b96904bc38bf0899a4b46eab.tar.gz
samba-2ec910dba4b7f5d6b96904bc38bf0899a4b46eab.tar.xz
samba-2ec910dba4b7f5d6b96904bc38bf0899a4b46eab.zip
passdb: Cache output from pdb_[ug]id_to_sid
A customer complained that after upgrading to Samba 4.0 fileserver its LDAP server was flooded with uid2sid and gid2sid request for id 0. With 4.0 we do a lot more user-space ACL checking which involves uid2sid/gid2sid. This caches the corresponding results. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Jan 7 12:00:10 CET 2015 on sn-devel-104
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/lookup_sid.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c
index 494a8407c0..c5b28d83fc 100644
--- a/source3/passdb/lookup_sid.c
+++ b/source3/passdb/lookup_sid.c
@@ -1049,6 +1049,13 @@ static void legacy_uid_to_sid(struct dom_sid *psid, uid_t uid)
uid_to_unix_users_sid(uid, psid);
+ {
+ struct unixid xid = {
+ .id = uid, .type = ID_TYPE_UID
+ };
+ idmap_cache_set_sid2unixid(psid, &xid);
+ }
+
done:
DEBUG(10,("LEGACY: uid %u -> sid %s\n", (unsigned int)uid,
sid_string_dbg(psid)));
@@ -1083,6 +1090,13 @@ static void legacy_gid_to_sid(struct dom_sid *psid, gid_t gid)
gid_to_unix_groups_sid(gid, psid);
+ {
+ struct unixid xid = {
+ .id = gid, .type = ID_TYPE_GID
+ };
+ idmap_cache_set_sid2unixid(psid, &xid);
+ }
+
done:
DEBUG(10,("LEGACY: gid %u -> sid %s\n", (unsigned int)gid,
sid_string_dbg(psid)));