summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-08-17 18:29:42 +1000
committerAndrew Tridgell <tridge@samba.org>2010-08-17 21:21:51 +1000
commitbb2ba90663609c4051bf9cbedb4246802216126a (patch)
treea9b0abd6f42586ac8940b65cb56e0e945b51105c /source4/lib
parent8835a360cad78feabb17be6802e43fe7aa763fa4 (diff)
downloadsamba-bb2ba90663609c4051bf9cbedb4246802216126a.tar.gz
samba-bb2ba90663609c4051bf9cbedb4246802216126a.tar.bz2
samba-bb2ba90663609c4051bf9cbedb4246802216126a.zip
s4-ldbwrap: ensure session_info in ldb opaque remains valid
A DRS DsBind handle can be re-used in a later connection. This implies reuse of the session_info for the connection. If the first connection is shutdown then the session_info in the sam context on the 2nd connection must remain valid.
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb-samba/ldb_wrap.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source4/lib/ldb-samba/ldb_wrap.c b/source4/lib/ldb-samba/ldb_wrap.c
index 365b67b6af..13ab3edefe 100644
--- a/source4/lib/ldb-samba/ldb_wrap.c
+++ b/source4/lib/ldb-samba/ldb_wrap.c
@@ -248,6 +248,21 @@ static int ldb_wrap_destructor(struct ldb_wrap *w)
return NULL;
}
+ if (session_info) {
+ /* take a reference to the session_info, as it is
+ * possible for the ldb to live longer than the
+ * session_info. This happens when a DRS DsBind call
+ * reuses a handle, but the original connection is
+ * shutdown. The token for the new connection is still
+ * valid, so we need the session_info to remain valid for
+ * ldb modules to use
+ */
+ if (talloc_reference(w, session_info) == NULL) {
+ talloc_free(ldb);
+ return NULL;
+ }
+ }
+
w->ldb = ldb;
DLIST_ADD(ldb_wrap_list, w);