summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-05-12 08:33:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:53 -0500
commit848cec55a0001866289148ea84175378ba6578f0 (patch)
tree12b07ddc5915a63309120ac9034476980ba59ab6 /source3
parent121c115eceeaed478949c9d8d3bc6571b9b27547 (diff)
downloadsamba-848cec55a0001866289148ea84175378ba6578f0.tar.gz
samba-848cec55a0001866289148ea84175378ba6578f0.tar.bz2
samba-848cec55a0001866289148ea84175378ba6578f0.zip
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)
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/pdb_ldap.c11
1 files changed, 8 insertions, 3 deletions
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);