summaryrefslogtreecommitdiffstats
path: root/source3/passdb
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2009-11-13 15:51:33 +0100
committerKarolin Seeger <kseeger@samba.org>2010-02-15 14:46:53 +0100
commita635050ef60bfc4c3e3820132cfc85f41bad4e57 (patch)
treece04546262de948136d4d5eac5661834730c5f94 /source3/passdb
parent12f4e9a31a37446660d9b4eb4a2a958759b4b8df (diff)
downloadsamba-a635050ef60bfc4c3e3820132cfc85f41bad4e57.tar.gz
samba-a635050ef60bfc4c3e3820132cfc85f41bad4e57.tar.xz
samba-a635050ef60bfc4c3e3820132cfc85f41bad4e57.zip
s3:smbd: make idmap cache persistent for "ldapsam:trusted".
This stores the mappings found in the idmap cache (which lives inside gencache). This cache is already read in sid_to_Xid() and Xid_to_sid() for ldapsam:trusted, this fills the opposite direction, massively reducing the number of ldap roundtrips across smbd restarts. Michael (cherry picked from commit d5537cbbf931f0bca519371bfd084fb0051acd57) Signed-off-by: Stefan Metzmacher <metze@samba.org> (cherry picked from commit c7220ff3a8281867ffc1a3bcaa992ca9eafba6ed)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/pdb_ldap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 9bf40b1fe58..c8971870155 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -1037,6 +1037,7 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state,
/* We've got a uid, feed the cache */
uid_t uid = strtoul(temp, NULL, 10);
store_uid_sid_cache(pdb_get_user_sid(sampass), uid);
+ idmap_cache_set_sid2uid(pdb_get_user_sid(sampass), uid);
}
}
@@ -2437,6 +2438,7 @@ for gidNumber(%lu)\n",(unsigned long)map->gid));
if (lp_parm_bool(-1, "ldapsam", "trusted", false)) {
store_gid_sid_cache(&map->sid, map->gid);
+ idmap_cache_set_sid2gid(&map->sid, map->gid);
}
TALLOC_FREE(ctx);
@@ -4942,6 +4944,7 @@ static bool ldapsam_sid_to_id(struct pdb_methods *methods,
id->gid = strtoul(gid_str, NULL, 10);
*type = (enum lsa_SidType)strtoul(value, NULL, 10);
+ idmap_cache_set_sid2gid(sid, id->gid);
ret = True;
goto done;
}
@@ -4958,6 +4961,7 @@ static bool ldapsam_sid_to_id(struct pdb_methods *methods,
id->uid = strtoul(value, NULL, 10);
*type = SID_NAME_USER;
+ idmap_cache_set_sid2uid(sid, id->uid);
ret = True;
done: