Skip to content

Commit

Permalink
Not every LDAP library supports setting Network Timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Jun 11, 2014
1 parent a9e0405 commit 0d4eef6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/modules/rlm_ldap/ldap.c
Expand Up @@ -1176,10 +1176,14 @@ void *mod_conn_create(void *instance)
}
}

memset(&tv, 0, sizeof(tv));
tv.tv_sec = inst->net_timeout;
#ifdef LDAP_OPT_NETWORK_TIMEOUT
if (inst->net_timeout) {
memset(&tv, 0, sizeof(tv));
tv.tv_sec = inst->net_timeout;

do_ldap_option(LDAP_OPT_NETWORK_TIMEOUT, "net_timeout", &tv);
do_ldap_option(LDAP_OPT_NETWORK_TIMEOUT, "net_timeout", &tv);
}
#endif

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

Expand Down
4 changes: 4 additions & 0 deletions src/modules/rlm_ldap/ldap.h
Expand Up @@ -33,6 +33,10 @@
# define LDAP_OPT_RESULT_CODE LDAP_OPT_ERROR_NUMBER
#endif

#ifndef LDAP_CONST
# define LDAP_CONST
#endif

#define LDAP_MAX_ATTRMAP 128 //!< Maximum number of mappings between LDAP and
//!< FreeRADIUS attributes.
#define LDAP_MAP_RESERVED 4 //!< Number of additional items to allocate in expanded
Expand Down
2 changes: 2 additions & 0 deletions src/modules/rlm_ldap/rlm_ldap.c
Expand Up @@ -181,8 +181,10 @@ static CONF_PARSER option_config[] = {

{ "rebind", FR_CONF_OFFSET(PW_TYPE_BOOLEAN, ldap_instance_t, rebind), NULL },

#ifdef LDAP_OPT_NETWORK_TIMEOUT
/* timeout on network activity */
{ "net_timeout", FR_CONF_OFFSET(PW_TYPE_INTEGER, ldap_instance_t, net_timeout), "10" },
#endif

/* timeout for search results */
{ "res_timeout", FR_CONF_OFFSET(PW_TYPE_INTEGER, ldap_instance_t, res_timeout), "20" },
Expand Down

0 comments on commit 0d4eef6

Please sign in to comment.