summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-06-30 13:49:05 +1000
committerAndrew Tridgell <tridge@samba.org>2010-07-02 12:49:04 +1000
commitf9022a1a30dbe57c6b6226c1f3d749b0ba87ce66 (patch)
tree4eba0a7f69bbdb4b58ac0aba02b72cc11cd99749
parent2671b5aeb0442b1c2a67ba9c43113ba3eec6bc15 (diff)
downloadsamba-f9022a1a30dbe57c6b6226c1f3d749b0ba87ce66.tar.gz
samba-f9022a1a30dbe57c6b6226c1f3d749b0ba87ce66.tar.bz2
samba-f9022a1a30dbe57c6b6226c1f3d749b0ba87ce66.zip
s4-dsdb: fixed use after free of sasl mechanisms opaque
the supportedSASLMechanisms opaque must live for at least as long as the ldb, or we can crash when the first connection is torn down Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--source4/ldap_server/ldap_backend.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c
index 086069fe19..23210fa176 100644
--- a/source4/ldap_server/ldap_backend.c
+++ b/source4/ldap_server/ldap_backend.c
@@ -219,6 +219,12 @@ NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn)
}
}
talloc_unlink(conn, ops);
+
+ /* ldb can have a different lifetime to conn, so we
+ need to ensure that sasl_mechs lives as long as the
+ ldb does */
+ talloc_steal(conn->ldb, sasl_mechs);
+
ldb_set_opaque(conn->ldb, "supportedSASLMechanisms", sasl_mechs);
}