X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fopenldap.c;h=7dc8f7390895e69ed3a77852141b58a296e4bce2;hp=afe2479e4374792ddab8e024b1c797ea93ddb80a;hb=8f6aa6970bf787e6a11e095322af3338ec781d78;hpb=2700666217249cd4794dfc17b4ac3b28f3dca56b diff --git a/src/openldap.c b/src/openldap.c index afe2479e..7dc8f739 100644 --- a/src/openldap.c +++ b/src/openldap.c @@ -28,8 +28,8 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" +#include "utils/common/common.h" #if defined(__APPLE__) #pragma clang diagnostic push @@ -47,10 +47,10 @@ struct cldap_s /* {{{ */ char *password; char *cacert; char *host; - _Bool starttls; + bool starttls; int timeout; char *url; - _Bool verifyhost; + bool verifyhost; int version; LDAP *ld; @@ -105,12 +105,12 @@ static int cldap_init_host(cldap_t *st) /* {{{ */ if (st->cacert != NULL) ldap_set_option(st->ld, LDAP_OPT_X_TLS_CACERTFILE, st->cacert); - if (st->verifyhost == 0) { + if (st->verifyhost == false) { int never = LDAP_OPT_X_TLS_NEVER; ldap_set_option(st->ld, LDAP_OPT_X_TLS_REQUIRE_CERT, &never); } - if (st->starttls != 0) { + if (st->starttls) { rc = ldap_start_tls_s(st->ld, NULL, NULL); if (rc != LDAP_SUCCESS) { ERROR("openldap plugin: Failed to start tls on %s: %s", st->url, @@ -306,7 +306,7 @@ static int cldap_read_host(user_data_t *ud) /* {{{ */ if ((olmbdb_list = ldap_get_values_len(st->ld, e, "olmBDBEntryCache")) != NULL) { olmbdb_data = *olmbdb_list[0]; - snprintf(typeinst, sizeof(typeinst), "bdbentrycache-%s", + ssnprintf(typeinst, sizeof(typeinst), "bdbentrycache-%s", nc_data.bv_val); cldap_submit_gauge("cache_size", typeinst, atoll(olmbdb_data.bv_val), st); @@ -316,7 +316,7 @@ static int cldap_read_host(user_data_t *ud) /* {{{ */ if ((olmbdb_list = ldap_get_values_len(st->ld, e, "olmBDBDNCache")) != NULL) { olmbdb_data = *olmbdb_list[0]; - snprintf(typeinst, sizeof(typeinst), "bdbdncache-%s", nc_data.bv_val); + ssnprintf(typeinst, sizeof(typeinst), "bdbdncache-%s", nc_data.bv_val); cldap_submit_gauge("cache_size", typeinst, atoll(olmbdb_data.bv_val), st); ldap_value_free_len(olmbdb_list); @@ -325,7 +325,7 @@ static int cldap_read_host(user_data_t *ud) /* {{{ */ if ((olmbdb_list = ldap_get_values_len(st->ld, e, "olmBDBIDLCache")) != NULL) { olmbdb_data = *olmbdb_list[0]; - snprintf(typeinst, sizeof(typeinst), "bdbidlcache-%s", + ssnprintf(typeinst, sizeof(typeinst), "bdbidlcache-%s", nc_data.bv_val); cldap_submit_gauge("cache_size", typeinst, atoll(olmbdb_data.bv_val), st); @@ -397,9 +397,9 @@ static int cldap_config_add(oconfig_item_t *ci) /* {{{ */ return status; } - st->starttls = 0; + st->starttls = false; st->timeout = (long)CDTIME_T_TO_TIME_T(plugin_get_interval()); - st->verifyhost = 1; + st->verifyhost = true; st->version = LDAP_VERSION3; for (int i = 0; i < ci->children_num; i++) { @@ -462,7 +462,7 @@ static int cldap_config_add(oconfig_item_t *ci) /* {{{ */ char callback_name[3 * DATA_MAX_NAME_LEN] = {0}; - snprintf(callback_name, sizeof(callback_name), "openldap/%s/%s", + ssnprintf(callback_name, sizeof(callback_name), "openldap/%s/%s", (st->host != NULL) ? st->host : hostname_g, (st->name != NULL) ? st->name : "default");