Skip to content

Commit

Permalink
Fix connection_timeout of zero
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Jun 15, 2016
1 parent 045d03a commit b0b3575
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/modules/rlm_ldap/ldap.c
Expand Up @@ -1738,7 +1738,20 @@ void *mod_conn_create(TALLOC_CTX *ctx, void *instance, struct timeval const *tim
}

#ifdef LDAP_OPT_NETWORK_TIMEOUT
do_ldap_option(LDAP_OPT_NETWORK_TIMEOUT, "pool.connect_timeout", &timeout);
/*
* A value of zero results in an instant failure.
*
* When most people specify zero they mean infinite.
*
* libldap requires tv_sec to be -1 to mean that.
*/
{
struct timeval ldap_timeout = *timeout;

if ((ldap_timeout.tv_usec == 0) && (ldap_timeout.tv_sec == 0)) ldap_timeout.tv_sec = -1;

do_ldap_option(LDAP_OPT_NETWORK_TIMEOUT, "pool.connect_timeout", &ldap_timeout);
}
#endif

do_ldap_option(LDAP_OPT_TIMELIMIT, "srv_timelimit", &(inst->srv_timelimit));
Expand Down

0 comments on commit b0b3575

Please sign in to comment.