Skip to content
Snippets Groups Projects
Commit 6a293c65 authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

line up network-timeout with back-meta

parent c1019fbf
No related branches found
No related tags found
No related merge requests found
......@@ -485,6 +485,14 @@ ldap_back_prepare_conn( ldapconn_t **lcp, Operation *op, SlapReply *rs, ldap_bac
ldap_set_option( ld, LDAP_OPT_REFERRALS,
LDAP_BACK_CHASE_REFERRALS( li ) ? LDAP_OPT_ON : LDAP_OPT_OFF );
if ( li->li_network_timeout > 0 ) {
struct timeval tv;
tv.tv_sec = li->li_network_timeout;
tv.tv_usec = 0;
ldap_set_option( ld, LDAP_OPT_NETWORK_TIMEOUT, (const void *)&tv );
}
#ifdef HAVE_TLS
rs->sr_err = ldap_back_start_tls( ld, op->o_protocol, &is_tls,
li->li_uri, li->li_flags, li->li_nretries, &rs->sr_text );
......
......@@ -62,6 +62,7 @@ enum {
LDAP_BACK_CFG_TIMEOUT,
LDAP_BACK_CFG_IDLE_TIMEOUT,
LDAP_BACK_CFG_CONN_TTL,
LDAP_BACK_CFG_NETWORK_TIMEOUT,
LDAP_BACK_CFG_REWRITE,
LDAP_BACK_CFG_LAST
......@@ -232,6 +233,14 @@ static ConfigTable ldapcfg[] = {
"SYNTAX OMsDirectoryString "
"SINGLE-VALUE )",
NULL, NULL },
{ "network-timeout", "timeout", 2, 0, 0,
ARG_MAGIC|LDAP_BACK_CFG_NETWORK_TIMEOUT,
ldap_back_cf_gen, "( OLcfgDbAt:3.17 "
"NAME 'olcDbNetworkTimeout' "
"DESC 'connection network timeout' "
"SYNTAX OMsDirectoryString "
"SINGLE-VALUE )",
NULL, NULL },
{ "suffixmassage", "[virtual]> <real", 2, 3, 0,
ARG_STRING|ARG_MAGIC|LDAP_BACK_CFG_REWRITE,
ldap_back_cf_gen, NULL, NULL, NULL },
......@@ -583,6 +592,19 @@ ldap_back_cf_gen( ConfigArgs *c )
value_add_one( &c->rvalue_vals, &bv );
} break;
case LDAP_BACK_CFG_NETWORK_TIMEOUT: {
char buf[ SLAP_TEXT_BUFLEN ];
if ( li->li_network_timeout == 0 ) {
return 1;
}
snprintf( buf, sizeof( buf ), "%ld",
(long)li->li_network_timeout );
ber_str2bv( buf, 0, 0, &bv );
value_add_one( &c->rvalue_vals, &bv );
} break;
default:
/* FIXME: we need to handle all... */
assert( 0 );
......@@ -668,6 +690,10 @@ ldap_back_cf_gen( ConfigArgs *c )
li->li_conn_ttl = 0;
break;
case LDAP_BACK_CFG_NETWORK_TIMEOUT:
li->li_network_timeout;
break;
default:
/* FIXME: we need to handle all... */
assert( 0 );
......@@ -1205,6 +1231,19 @@ done_url:;
li->li_conn_ttl = (time_t)t;
} break;
case LDAP_BACK_CFG_NETWORK_TIMEOUT: {
unsigned long t;
if ( lutil_parse_time( c->argv[ 1 ], &t ) != 0 ) {
snprintf( c->msg, sizeof( c->msg),
"unable to parse network timeout \"%s\"",
c->argv[ 1 ] );
Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->msg, 0 );
return 1;
}
li->li_network_timeout = (time_t)t;
} break;
case LDAP_BACK_CFG_REWRITE:
snprintf( c->msg, sizeof( c->msg ),
"rewrite/remap capabilities have been moved "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment