summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-01-11 02:13:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:53:50 -0500
commitd16a5c4381397efa7f4de2d8c7e9299bec492eb8 (patch)
tree0241c1d8b75a5eb4bc2f20f8199830eb1765ce35
parent57e3af57fd9707156e9e5f18f6cb6095360cd51f (diff)
downloadsamba-d16a5c4381397efa7f4de2d8c7e9299bec492eb8.tar.gz
samba-d16a5c4381397efa7f4de2d8c7e9299bec492eb8.tar.bz2
samba-d16a5c4381397efa7f4de2d8c7e9299bec492eb8.zip
r4665: Fix inspired by posting from Joe Meadows <jameadows@webopolis.com>.
Make all LDAP timeouts consistent. Jeremy. (This used to be commit 0f0281c2348b10ffdea744ecade6b2be0814c872)
-rw-r--r--source3/include/ads.h3
-rw-r--r--source3/libads/ldap.c20
2 files changed, 10 insertions, 13 deletions
diff --git a/source3/include/ads.h b/source3/include/ads.h
index de020f2a3f..27f9384d5d 100644
--- a/source3/include/ads.h
+++ b/source3/include/ads.h
@@ -76,9 +76,6 @@ typedef void **ADS_MODLIST;
/* time between reconnect attempts */
#define ADS_RECONNECT_TIME 5
-/* timeout on searches */
-#define ADS_SEARCH_TIMEOUT 10
-
/* ldap control oids */
#define ADS_PAGE_CTL_OID "1.2.840.113556.1.4.319"
#define ADS_NO_REFERRALS_OID "1.2.840.113556.1.4.1339"
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 8c37a90e73..494bd930e4 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -75,20 +75,24 @@ static int ldap_search_with_timeout(LDAP *ld,
int attrsonly,
LDAPControl **sctrls,
LDAPControl **cctrls,
- struct timeval *timeout,
int sizelimit,
LDAPMessage **res )
{
+ struct timeval timeout;
int result;
- /* Setup timeout */
+ /* Setup timeout for the ldap_search_ext_s call - local and remote. */
+ timeout.tv_sec = lp_ldap_timeout();
+ timeout.tv_usec = 0;
+
+ /* Setup alarm timeout.... Do we need both of these ? JRA. */
gotalarm = 0;
CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig);
alarm(lp_ldap_timeout());
/* End setup timeout. */
result = ldap_search_ext_s(ld, base, scope, filter, attrs,
- attrsonly, sctrls, cctrls, timeout,
+ attrsonly, sctrls, cctrls, &timeout,
sizelimit, res);
/* Teardown timeout. */
@@ -504,14 +508,14 @@ ADS_STATUS ads_do_paged_search(ADS_STRUCT *ads, const char *bind_path,
rc = ldap_search_with_timeout(ads->ld, utf8_path, scope, utf8_expr,
search_attrs, 0, controls,
- NULL, NULL, LDAP_NO_LIMIT,
+ NULL, LDAP_NO_LIMIT,
(LDAPMessage **)res);
ber_free(cookie_be, 1);
ber_bvfree(cookie_bv);
if (rc) {
- DEBUG(3,("ldap_search_with_timeout(%s) -> %s\n", expr,
+ DEBUG(3,("ads_do_paged_search: ldap_search_with_timeout(%s) -> %s\n", expr,
ldap_err2string(rc)));
goto done;
}
@@ -655,7 +659,6 @@ ADS_STATUS ads_do_search(ADS_STRUCT *ads, const char *bind_path, int scope,
const char *expr,
const char **attrs, void **res)
{
- struct timeval timeout;
int rc;
char *utf8_expr, *utf8_path, **search_attrs = NULL;
TALLOC_CTX *ctx;
@@ -689,15 +692,12 @@ ADS_STATUS ads_do_search(ADS_STRUCT *ads, const char *bind_path, int scope,
}
}
- timeout.tv_sec = ADS_SEARCH_TIMEOUT;
- timeout.tv_usec = 0;
-
/* see the note in ads_do_paged_search - we *must* disable referrals */
ldap_set_option(ads->ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF);
rc = ldap_search_with_timeout(ads->ld, utf8_path, scope, utf8_expr,
search_attrs, 0, NULL, NULL,
- &timeout, LDAP_NO_LIMIT,
+ LDAP_NO_LIMIT,
(LDAPMessage **)res);
if (rc == LDAP_SIZELIMIT_EXCEEDED) {