mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Add timeout / network timeout to bindconf
This commit is contained in:
parent
2432378de8
commit
b5d8341569
@ -1033,6 +1033,8 @@ static slap_cf_aux_table bindkey[] = {
|
||||
{ BER_BVC("uri="), offsetof(slap_bindconf, sb_uri), 'b', 1, NULL },
|
||||
{ BER_BVC("version="), offsetof(slap_bindconf, sb_version), 'i', 0, versionkey },
|
||||
{ BER_BVC("bindmethod="), offsetof(slap_bindconf, sb_method), 'i', 0, methkey },
|
||||
{ BER_BVC("timeout="), offsetof(slap_bindconf, sb_timeout_api), 'i', 0, NULL },
|
||||
{ BER_BVC("network-timeout="), offsetof(slap_bindconf, sb_timeout_net), 'i', 0, NULL },
|
||||
{ BER_BVC("binddn="), offsetof(slap_bindconf, sb_binddn), 'b', 1, (slap_verbmasks *)dnNormalize },
|
||||
{ BER_BVC("credentials="), offsetof(slap_bindconf, sb_cred), 'b', 1, NULL },
|
||||
{ BER_BVC("saslmech="), offsetof(slap_bindconf, sb_saslmech), 'b', 0, NULL },
|
||||
@ -1503,6 +1505,7 @@ slap_client_connect( LDAP **ldp, slap_bindconf *sb )
|
||||
{
|
||||
LDAP *ld = NULL;
|
||||
int rc;
|
||||
struct timeval tv;
|
||||
|
||||
/* Init connection to master */
|
||||
rc = ldap_initialize( &ld, sb->sb_uri.bv_val );
|
||||
@ -1519,6 +1522,18 @@ slap_client_connect( LDAP **ldp, slap_bindconf *sb )
|
||||
(const void *)&sb->sb_version );
|
||||
}
|
||||
|
||||
if ( sb->sb_timeout_api ) {
|
||||
tv.tv_sec = sb->sb_timeout_api;
|
||||
tv.tv_usec = 0;
|
||||
ldap_set_option( ld, LDAP_OPT_TIMEOUT, &tv );
|
||||
}
|
||||
|
||||
if ( sb->sb_timeout_net ) {
|
||||
tv.tv_sec = sb->sb_timeout_net;
|
||||
tv.tv_usec = 0;
|
||||
ldap_set_option( ld, LDAP_OPT_NETWORK_TIMEOUT, &tv );
|
||||
}
|
||||
|
||||
#ifdef HAVE_TLS
|
||||
if ( sb->sb_tls_do_init ) {
|
||||
rc = bindconf_tls_set( sb, ld );
|
||||
|
@ -1538,6 +1538,8 @@ typedef struct slap_bindconf {
|
||||
int sb_version;
|
||||
int sb_tls;
|
||||
int sb_method;
|
||||
int sb_timeout_api;
|
||||
int sb_timeout_net;
|
||||
struct berval sb_binddn;
|
||||
struct berval sb_cred;
|
||||
struct berval sb_saslmech;
|
||||
|
Loading…
Reference in New Issue
Block a user