summaryrefslogtreecommitdiff
path: root/source3/libads
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-10-03 21:43:09 +0000
committerGerald Carter <jerry@samba.org>2003-10-03 21:43:09 +0000
commit48958b0105dce32888497e79106e08c70af7e3ef (patch)
tree387d64cac98b02025c9cb4f6df1397ec65c327fb /source3/libads
parentc81c09d66ff4ed5c524312f73540862ded3335d2 (diff)
downloadsamba-48958b0105dce32888497e79106e08c70af7e3ef.tar.gz
samba-48958b0105dce32888497e79106e08c70af7e3ef.tar.bz2
samba-48958b0105dce32888497e79106e08c70af7e3ef.zip
don't call ads_destroy() twice; fixes segfault in winbindd when DC goes down; bug 437
(This used to be commit 1cfbd92404270e0c67a3b295fc9cf461b29d3503)
Diffstat (limited to 'source3/libads')
-rw-r--r--source3/libads/ldap.c3
-rw-r--r--source3/libads/ldap_utils.c7
2 files changed, 8 insertions, 2 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 48401cc3d8..8c3185ea5e 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -1787,7 +1787,8 @@ ADS_STATUS ads_USN(ADS_STRUCT *ads, uint32 *usn)
void *res;
status = ads_do_search_retry(ads, "", LDAP_SCOPE_BASE, "(objectclass=*)", attrs, &res);
- if (!ADS_ERR_OK(status)) return status;
+ if (!ADS_ERR_OK(status))
+ return status;
if (ads_count_replies(ads, res) != 1) {
return ADS_ERROR(LDAP_NO_RESULTS_RETURNED);
diff --git a/source3/libads/ldap_utils.c b/source3/libads/ldap_utils.c
index 1fa9ebfc97..4142bceabc 100644
--- a/source3/libads/ldap_utils.c
+++ b/source3/libads/ldap_utils.c
@@ -54,15 +54,20 @@ ADS_STATUS ads_do_search_retry(ADS_STRUCT *ads, const char *bind_path, int scope
return status;
}
- if (*res) ads_msgfree(ads, *res);
+ if (*res)
+ ads_msgfree(ads, *res);
*res = NULL;
+
DEBUG(3,("Reopening ads connection to realm '%s' after error %s\n",
ads->config.realm, ads_errstr(status)));
+
if (ads->ld) {
ldap_unbind(ads->ld);
}
+
ads->ld = NULL;
status = ads_connect(ads);
+
if (!ADS_ERR_OK(status)) {
DEBUG(1,("ads_search_retry: failed to reconnect (%s)\n",
ads_errstr(status)));