mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-18 18:18:06 -05:00
add network timeout (ITS#2413 reworked)
This commit is contained in:
parent
8c880563ba
commit
0864531e58
3 changed files with 24 additions and 0 deletions
|
|
@ -146,6 +146,7 @@ struct metadncache {
|
|||
struct metainfo {
|
||||
int ntargets;
|
||||
int defaulttarget;
|
||||
int network_timeout;
|
||||
#define META_DEFAULT_TARGET_NONE -1
|
||||
struct metatarget **targets;
|
||||
|
||||
|
|
|
|||
|
|
@ -312,6 +312,16 @@ meta_back_db_config(
|
|||
li->cache.ttl = atol( argv[ 1 ] );
|
||||
}
|
||||
|
||||
/* network timeout when connecting to ldap servers */
|
||||
} else if ( strcasecmp( argv[ 0 ], "network-timeout" ) == 0 ) {
|
||||
if ( argc != 2 ) {
|
||||
fprintf( stderr,
|
||||
"%s: line %d: missing network timeout in \"network-timeout <seconds>\" line\n",
|
||||
fname, lineno );
|
||||
return 1;
|
||||
}
|
||||
li->network_timeout = atol(argv[ 1 ]);
|
||||
|
||||
/* name to use for meta_back_group */
|
||||
} else if ( strcasecmp( argv[ 0 ], "binddn" ) == 0 ) {
|
||||
int i = li->ntargets-1;
|
||||
|
|
|
|||
|
|
@ -235,6 +235,7 @@ init_one_conn(
|
|||
struct metasingleconn *lsc
|
||||
)
|
||||
{
|
||||
struct metainfo *li = ( struct metainfo * )op->o_bd->be_private;
|
||||
int vers;
|
||||
dncookie dc;
|
||||
|
||||
|
|
@ -262,6 +263,18 @@ init_one_conn(
|
|||
/* FIXME: configurable? */
|
||||
ldap_set_option(lsc->ld, LDAP_OPT_REFERRALS, LDAP_OPT_ON);
|
||||
|
||||
/*
|
||||
* Set the network timeout if set
|
||||
*/
|
||||
if (li->network_timeout != 0){
|
||||
struct timeval network_timeout;
|
||||
|
||||
network_timeout.tv_usec = 0;
|
||||
network_timeout.tv_sec = li->network_timeout;
|
||||
|
||||
ldap_set_option( lsc->ld, LDAP_OPT_NETWORK_TIMEOUT, (void *) &network_timeout);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets a cookie for the rewrite session
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue