Index: openldap-src/doc/man/man5/ldap.conf.5 =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/doc/man/man5/ldap.conf.5,v retrieving revision 1.31 diff -u -r1.31 ldap.conf.5 --- openldap-src/doc/man/man5/ldap.conf.5 4 Jul 2005 10:01:19 -0000 1.31 +++ openldap-src/doc/man/man5/ldap.conf.5 26 Jul 2005 20:44:30 -0000 @@ -111,6 +111,19 @@ number should be a non-negative integer. \fITIMELIMIT\fP of zero (0) specifies unlimited search time to be used. .TP +.B NETWORKTIMEOUT +Specifies the timeout, in seconds, to use when contacting a server. If +the client does not recieve a reply from the server within +\fINETWORKTIMEOUT\fP seconds (for example, the server is offline) and +multiple URIs are specified, the client will attempt to contact the next +server in the URI list. The default is the operating system-specific +timeout for +.BR connect (2). + +Note that \fITIMELIMIT\fP specifies a time limit for the search once the +server has been contacted, whereas \fINETWORKTIMEOUT\fP specifies a time +limit on establishing the initial connection to the server. +.TP .B DEREF Specifies how alias dereferencing is done when performing a search. The .B Index: openldap-src/libraries/libldap/init.c =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldap/init.c,v retrieving revision 1.95 diff -u -r1.95 init.c --- openldap-src/libraries/libldap/init.c 10 Apr 2005 17:32:14 -0000 1.95 +++ openldap-src/libraries/libldap/init.c 26 Jul 2005 20:44:31 -0000 @@ -43,6 +43,8 @@ #define ATTR_SASL 6 #define ATTR_TLS 7 +#define ATTR_TIMEVAL 8 + struct ol_keyvalue { const char * key; int value; @@ -79,6 +81,7 @@ {0, ATTR_OPTION, "URI", NULL, LDAP_OPT_URI}, /* replaces HOST/PORT */ {0, ATTR_BOOL, "REFERRALS", NULL, LDAP_BOOL_REFERRALS}, {0, ATTR_BOOL, "RESTART", NULL, LDAP_BOOL_RESTART}, + {0, ATTR_TIMEVAL, "NETWORKTIMEOUT", NULL, LDAP_OPT_NETWORK_TIMEOUT}, #ifdef HAVE_CYRUS_SASL {1, ATTR_STRING, "SASL_MECH", NULL, @@ -119,6 +122,7 @@ char linebuf[128]; FILE *fp; int i; + struct timeval init_tv; char *cmd, *opt; char *start, *end; struct ldapoptions *gopts; @@ -241,6 +245,12 @@ ldap_int_tls_config( NULL, attrs[i].offset, opt ); #endif break; + case ATTR_TIMEVAL: + init_tv.tv_sec = atoi(opt); + init_tv.tv_usec = 0; + ldap_set_option( NULL, attrs[i].offset, + (char *) &init_tv); + break; } break; @@ -303,6 +313,7 @@ char buf[MAX_LDAP_ATTR_LEN+MAX_LDAP_ENV_PREFIX_LEN]; int len; int i; + struct timeval init_tv; void *p; char *value; @@ -377,6 +388,12 @@ ldap_int_tls_config( NULL, attrs[i].offset, value ); #endif break; + case ATTR_TIMEVAL: + init_tv.tv_sec = atoi(value); + init_tv.tv_usec = 0; + ldap_set_option( NULL, attrs[i].offset, + (char *) &init_tv); + break; } } }