From 848cec55a0001866289148ea84175378ba6578f0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 12 May 2005 08:33:27 +0000 Subject: r6748: With reconnects, state->connection->ldap_struct can change in smbldap_search and friends. This should be a fix for bug 2701. Thanks to jht for giving me access to his box! Volker (This used to be commit 85320c12578f183d4ed0450949e0aee8d020e036) --- source3/passdb/pdb_ldap.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'source3/passdb') diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 7b3d84e43b..d8c7565b64 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -3390,7 +3390,7 @@ struct ldap_search_state { static BOOL ldapsam_search_firstpage(struct pdb_search *search) { struct ldap_search_state *state = search->private; - LDAP *ld = state->connection->ldap_struct; + LDAP *ld; int rc = LDAP_OPERATIONS_ERROR; state->entries = NULL; @@ -3423,8 +3423,13 @@ static BOOL ldapsam_search_firstpage(struct pdb_search *search) state->connection->paged_results = False; } - if ( ld ) - state->current_entry = ldap_first_entry(ld, state->entries); + ld = state->connection->ldap_struct; + if ( ld == NULL) { + DEBUG(5, ("Don't have an LDAP connection right after a " + "search\n")); + return False; + } + state->current_entry = ldap_first_entry(ld, state->entries); if (state->current_entry == NULL) { ldap_msgfree(state->entries); -- cgit