From: Gary Lockyer Date: Tue, 13 Mar 2018 03:43:54 +0000 (+1300) Subject: ldb-samba: require pid match for cached ldb X-Git-Tag: ldb-1.4.0~626 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=040a526a3bbcafeeebb6dd50a563a4635dd79fea;p=thirdparty%2Fsamba.git ldb-samba: require pid match for cached ldb Signed-off-by: Gary Lockyer Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/lib/ldb-samba/ldb_wrap.c b/lib/ldb-samba/ldb_wrap.c index 53255556e7c..143e128d5d7 100644 --- a/lib/ldb-samba/ldb_wrap.c +++ b/lib/ldb-samba/ldb_wrap.c @@ -94,6 +94,8 @@ static struct ldb_wrap { /* the context is what we use to tell if two ldb * connections are exactly equivalent */ + pid_t pid; /* We want to re-open in a new PID due to + * the LMDB backend */ const char *url; struct tevent_context *ev; struct loadparm_context *lp_ctx; @@ -186,10 +188,12 @@ char *wrap_casefold(void *context, void *mem_ctx, const char *s, size_t n) struct cli_credentials *credentials, unsigned int flags) { + pid_t pid = getpid(); struct ldb_wrap *w; /* see if we can re-use an existing ldb */ for (w=ldb_wrap_list; w; w=w->next) { - if (w->context.ev == ev && + if (w->context.pid == pid && + w->context.ev == ev && w->context.lp_ctx == lp_ctx && w->context.session_info == session_info && w->context.credentials == credentials && @@ -249,6 +253,7 @@ int samba_ldb_connect(struct ldb_context *ldb, struct loadparm_context *lp_ctx, return false; } + c.pid = getpid(); c.url = url; c.ev = ev; c.lp_ctx = lp_ctx;