From 215a29e1d4cbe5904d348ad5622a6579d089b0ec Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Wed, 20 Aug 2014 12:13:31 +0200 Subject: [PATCH] openldap: add missing support for "Timeout" config option --- src/collectd.conf.pod | 5 +++++ src/openldap.c | 4 ++++ 2 files changed, 9 insertions(+) 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; -- 2.11.0