idmap_rfc2307: Fix a crash after connection problem to DC
authorChristof Schmitt <cs@samba.org>
Wed, 17 Sep 2014 20:23:11 +0000 (13:23 -0700)
committerKarolin Seeger <kseeger@samba.org>
Thu, 9 Oct 2014 19:23:05 +0000 (21:23 +0200)
When the connection to the DC has a problem, the code behind
ads_do_search_retry closes the current connection and opens a new one.
The new connection has a new struct LDAP to represent the connection. In
this case, the LDAP pointer in the idmap_rfc2307_context becomes
invalid.

Fix this problem by updating the local pointer after calling
ads_do_search_retry.

Signed-off-by: Christof Schmitt <cs@samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10837
winbind crash in idmap_rfc2307 module

source3/winbindd/idmap_rfc2307.c

index 2b7a593a15ca8b57407457e95c1ea32b84a7870d..db8bab633581032c79ecf86bd311ab846b2082a3 100644 (file)
@@ -103,6 +103,7 @@ static NTSTATUS idmap_rfc2307_ads_search(struct idmap_rfc2307_context *ctx,
 
        status = ads_do_search_retry(ctx->ads, bind_path,
                                     LDAP_SCOPE_SUBTREE, expr, attrs, result);
+       ctx->ldap = ctx->ads->ldap.ld;
        return ads_ntstatus(status);
 }