diff options
author | Andrew Bartlett <abartlet@samba.org> | 2006-05-07 15:05:32 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:16:54 -0500 |
commit | 60493551d1fe928b6d4c8a25dc642a70d01bc7d5 (patch) | |
tree | 097eab72f7081ca7fbe22315b823752f0ccdea21 /source3/libads | |
parent | ce5f1afc75d0ece2ebc06eb06ec404c2a8467480 (diff) | |
download | samba-60493551d1fe928b6d4c8a25dc642a70d01bc7d5.tar.gz samba-60493551d1fe928b6d4c8a25dc642a70d01bc7d5.tar.bz2 samba-60493551d1fe928b6d4c8a25dc642a70d01bc7d5.zip |
r15492: Without this patch, the LDAP client libs will call abort() in
ldap_get_values_len, because they were handed a NULL msgs pointer, for
example in ads_pull_sid().
This occurs when the AD server fails at the connect stage. (The
toubled AD server is actually Samba4 in my example).
Andrew Bartlett
(This used to be commit 221a6de7d028f5c9bb9da038650868582d44e7e5)
Diffstat (limited to 'source3/libads')
-rw-r--r-- | source3/libads/ldap_utils.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/source3/libads/ldap_utils.c b/source3/libads/ldap_utils.c index 105fd2e5b9..58f1c20ad2 100644 --- a/source3/libads/ldap_utils.c +++ b/source3/libads/ldap_utils.c @@ -48,15 +48,16 @@ ADS_STATUS ads_do_search_retry(ADS_STRUCT *ads, const char *bind_path, int scope return ADS_ERROR_NT(NT_STATUS_NO_MEMORY); } - while (count--) { - *res = NULL; - status = ads_do_search_all(ads, bp, scope, expr, attrs, res); - if (ADS_ERR_OK(status)) { - DEBUG(5,("Search for %s gave %d replies\n", - expr, ads_count_replies(ads, *res))); - SAFE_FREE(bp); - return status; - } + *res = NULL; + status = ads_do_search_all(ads, bp, scope, expr, attrs, res); + if (ADS_ERR_OK(status)) { + DEBUG(5,("Search for %s gave %d replies\n", + expr, ads_count_replies(ads, *res))); + SAFE_FREE(bp); + return status; + } + + while (--count) { if (*res) ads_msgfree(ads, *res); @@ -79,6 +80,15 @@ ADS_STATUS ads_do_search_retry(ADS_STRUCT *ads, const char *bind_path, int scope SAFE_FREE(bp); return status; } + + *res = NULL; + status = ads_do_search_all(ads, bp, scope, expr, attrs, res); + if (ADS_ERR_OK(status)) { + DEBUG(5,("Search for %s gave %d replies\n", + expr, ads_count_replies(ads, *res))); + SAFE_FREE(bp); + return status; + } } SAFE_FREE(bp); |