diff options
author | Alexander Werth <alexander.werth@de.ibm.com> | 2014-04-25 13:53:48 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2014-05-03 04:14:05 +0200 |
commit | 4b324f7f08829ca3df0af291301d5272ae5cede1 (patch) | |
tree | b7f6ec8e1e5a83871d076ea33f23d99cdf29496d /source3/passdb/pdb_interface.c | |
parent | a0ab8cb53712cf77cae1d46f49d8eb56e6d5703b (diff) | |
download | samba-4b324f7f08829ca3df0af291301d5272ae5cede1.tar.gz |
s3: Always cache idmapping results of pdb backend.
And don't cache in the pdb_ldap module on the id_to_sid calls.
Signed-off-by: Alexander Werth <alexander.werth@de.ibm.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Sat May 3 04:14:05 CEST 2014 on sn-devel-104
Diffstat (limited to 'source3/passdb/pdb_interface.c')
-rw-r--r-- | source3/passdb/pdb_interface.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index 7a0a824ba21..a984fcb0b34 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -35,6 +35,7 @@ #include "../lib/util/util_pw.h" #include "passdb/pdb_secrets.h" #include "lib/util_sid_passdb.h" +#include "idmap_cache.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_PASSDB @@ -1206,25 +1207,54 @@ bool pdb_get_seq_num(time_t *seq_num) bool pdb_uid_to_sid(uid_t uid, struct dom_sid *sid) { struct pdb_methods *pdb = pdb_get_methods(); - return pdb->uid_to_sid(pdb, uid, sid); + bool ret; + + ret = pdb->uid_to_sid(pdb, uid, sid); + + if (ret == true) { + struct unixid id; + id.id = uid; + id.type = ID_TYPE_UID; + idmap_cache_set_sid2unixid(sid, &id); + } + + return ret; } bool pdb_gid_to_sid(gid_t gid, struct dom_sid *sid) { struct pdb_methods *pdb = pdb_get_methods(); - return pdb->gid_to_sid(pdb, gid, sid); + bool ret; + + ret = pdb->gid_to_sid(pdb, gid, sid); + + if (ret == true) { + struct unixid id; + id.id = gid; + id.type = ID_TYPE_GID; + idmap_cache_set_sid2unixid(sid, &id); + } + + return ret; } bool pdb_sid_to_id(const struct dom_sid *sid, struct unixid *id) { struct pdb_methods *pdb = pdb_get_methods(); + bool ret; /* only ask the backend if it is responsible */ if (!sid_check_object_is_for_passdb(sid)) { return false; } - return pdb->sid_to_id(pdb, sid, id); + ret = pdb->sid_to_id(pdb, sid, id); + + if (ret == true) { + idmap_cache_set_sid2unixid(sid, id); + } + + return ret; } uint32_t pdb_capabilities(void) |