diff options
author | Andrew Bartlett <abartlet@samba.org> | 2018-03-15 13:44:52 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2018-04-12 05:15:17 +0200 |
commit | a7cdec9ded016d6a1996a0d68dc9b7b029e78c7f (patch) | |
tree | f96d1631bb5365e0075980017a95030a03facdb2 /lib/ldb-samba | |
parent | 132e932da2f203d005abea4412fcf2c483b7c489 (diff) | |
download | samba-a7cdec9ded016d6a1996a0d68dc9b7b029e78c7f.tar.gz |
ldb_wrap: Remove the magic cache of database handles except for sam.ldb
sam.ldb is handled in samdb_connect_url(), not this function.
This cache caused issues when "private dir" was changed in a testing script, but also
just generates many-owner shared mutable state that is frowned upon these days.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'lib/ldb-samba')
-rw-r--r-- | lib/ldb-samba/ldb_wrap.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/ldb-samba/ldb_wrap.c b/lib/ldb-samba/ldb_wrap.c index 8c3bf6f7bf3..53255556e7c 100644 --- a/lib/ldb-samba/ldb_wrap.c +++ b/lib/ldb-samba/ldb_wrap.c @@ -303,9 +303,13 @@ int samba_ldb_connect(struct ldb_context *ldb, struct loadparm_context *lp_ctx, struct ldb_context *ldb; int ret; - ldb = ldb_wrap_find(url, ev, lp_ctx, session_info, credentials, flags); - if (ldb != NULL) - return talloc_reference(mem_ctx, ldb); + /* + * Unlike samdb_connect_url() do not try and cache the LDB + * handle, get a new one each time. Only sam.ldb is + * punitively expensive to open and helpful caches like this + * cause challenges (such as if the value for 'private dir' + * changes). + */ ldb = samba_ldb_init(mem_ctx, ev, lp_ctx, session_info, credentials); @@ -318,11 +322,6 @@ int samba_ldb_connect(struct ldb_context *ldb, struct loadparm_context *lp_ctx, return NULL; } - if (!ldb_wrap_add(url, ev, lp_ctx, session_info, credentials, flags, ldb)) { - talloc_free(ldb); - return NULL; - } - DEBUG(3,("ldb_wrap open of %s\n", url)); return ldb; |