You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by bn...@apache.org on 2005/04/27 01:52:42 UTC
svn commit: r164919 - /httpd/httpd/trunk/modules/ldap/util_ldap.c
Author: bnicholes
Date: Tue Apr 26 16:52:41 2005
New Revision: 164919
URL: http://svn.apache.org/viewcvs?rev=164919&view=rev
Log:
Move the ldap_set_option() call to set the connection time from being global to being connection specific.
Modified:
httpd/httpd/trunk/modules/ldap/util_ldap.c
Modified: httpd/httpd/trunk/modules/ldap/util_ldap.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/ldap/util_ldap.c?rev=164919&r1=164918&r2=164919&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ldap/util_ldap.c (original)
+++ httpd/httpd/trunk/modules/ldap/util_ldap.c Tue Apr 26 16:52:41 2005
@@ -247,6 +247,10 @@
int failures = 0;
int version = LDAP_VERSION3;
apr_ldap_err_t *result = NULL;
+ struct timeval timeOut = {10,0}; /* 10 second connection timeout */
+ util_ldap_state_t *st =
+ (util_ldap_state_t *)ap_get_module_config(r->server->module_config,
+ &ldap_module);
/* sanity check for NULL */
if (!ldc) {
@@ -326,6 +330,22 @@
/* always default to LDAP V3 */
ldap_set_option(ldc->ldap, LDAP_OPT_PROTOCOL_VERSION, &version);
+#ifdef LDAP_OPT_NETWORK_TIMEOUT
+ if (st->connectionTimeout > 0) {
+ timeOut.tv_sec = st->connectionTimeout;
+ }
+
+ if (st->connectionTimeout >= 0) {
+ rc = apr_ldap_set_option(ldc->pool, ldc->ldap, LDAP_OPT_NETWORK_TIMEOUT,
+ (void *)&timeOut, &(result));
+ if (APR_SUCCESS != rc) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
+ "LDAP: Could not set the connection timeout");
+ }
+ }
+#endif
+
+
}
@@ -1773,7 +1793,6 @@
const char *userdata_key = "util_ldap_init";
apr_ldap_err_t *result_err = NULL;
int rc;
- struct timeval timeOut = {10,0}; /* 10 second connection timeout */
/* util_ldap_post_config() will be called twice. Don't bother
* going through all of the initialization on the first call
@@ -1907,22 +1926,6 @@
"LDAP: SSL support unavailable" );
}
-#ifdef LDAP_OPT_NETWORK_TIMEOUT
- if (st->connectionTimeout > 0) {
- timeOut.tv_sec = st->connectionTimeout;
- }
-
- if (st->connectionTimeout >= 0) {
- rc = apr_ldap_set_option(p, NULL, LDAP_OPT_NETWORK_TIMEOUT,
- (void *)&timeOut, &(result_err));
- if (APR_SUCCESS != rc) {
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
- "LDAP: Could not set the connection timeout");
- }
- }
-#endif
-
-
return(OK);
}