From: Marc Fournier Date: Wed, 20 Aug 2014 10:13:31 +0000 (+0200) Subject: openldap: add missing support for "Timeout" config option X-Git-Tag: collectd-5.5.0~152^2~10 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=215a29e1d4cbe5904d348ad5622a6579d089b0ec;p=collectd.git openldap: add missing support for "Timeout" config option --- diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index a2961702..74fb19fe 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -4278,6 +4278,11 @@ File that holds one or more SSL certificates. If you want to use TLS/SSL you may possibly need this option. What CA certificates come bundled with C and are checked by default depends on the distribution you use. +=item B I + +Set the timeout value for ldap operations. Defaults to B<-1> which results in +an infinite timeout. + =back =head2 Plugin C diff --git a/src/openldap.c b/src/openldap.c index 9763a06c..08c65033 100644 --- a/src/openldap.c +++ b/src/openldap.c @@ -77,6 +77,9 @@ static int ldap_init_host (ldap_t *st) /* {{{ */ ldap_set_option (st->ld, LDAP_OPT_PROTOCOL_VERSION, &st->version); + ldap_set_option (st->ld, LDAP_OPT_TIMEOUT, + &(const struct timeval){st->timeout, 0}); + if(st->cacert != NULL) ldap_set_option (st->ld, LDAP_OPT_X_TLS_CACERTFILE, st->cacert); @@ -624,6 +627,7 @@ static int ldap_config_add (oconfig_item_t *ci) /* {{{ */ return (status); } + st->timeout = -1; st->verifyhost = 1; st->version = LDAP_VERSION3;