X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnetwork.c;h=9a0f429aad88b64bca940484f107978c0f8d0016;hb=b847e8ff2fd928813397466a941947c8fce66d66;hp=1458a0ae88f66c5665bce965bec01ca0674cd5cf;hpb=e1d4681088e33d3ec256c296dff4dbaeb70b883a;p=collectd.git diff --git a/src/network.c b/src/network.c index 1458a0ae..9a0f429a 100644 --- a/src/network.c +++ b/src/network.c @@ -29,7 +29,6 @@ #include "plugin.h" #include "common.h" -#include "configfile.h" #include "utils_fbhash.h" #include "utils_cache.h" #include "utils_complain.h" @@ -2086,33 +2085,28 @@ static int sockent_init_crypto (sockent_t *se) /* {{{ */ } else /* (se->type == SOCKENT_TYPE_SERVER) */ { - if (se->data.server.security_level > SECURITY_LEVEL_NONE) + if ((se->data.server.security_level > SECURITY_LEVEL_NONE) + && (se->data.server.auth_file == NULL)) + { + ERROR ("network plugin: Server socket with security requested, " + "but no \"AuthFile\" is configured."); + return (-1); + } + if (se->data.server.auth_file != NULL) { if (network_init_gcrypt () < 0) { - ERROR ("network plugin: Cannot configure server socket with " - "security: Failed to initialize crypto library."); + ERROR ("network plugin: Cannot configure server socket with security: " + "Failed to initialize crypto library."); return (-1); } - if (se->data.server.auth_file == NULL) - { - ERROR ("network plugin: Server socket with " - "security requested, but no " - "password file is configured."); - return (-1); - } - } - if (se->data.server.auth_file != NULL) - { se->data.server.userdb = fbh_create (se->data.server.auth_file); if (se->data.server.userdb == NULL) { - ERROR ("network plugin: Reading password file " - "`%s' failed.", + ERROR ("network plugin: Reading password file \"%s\" failed.", se->data.server.auth_file); - if (se->data.server.security_level > SECURITY_LEVEL_NONE) - return (-1); + return (-1); } } } @@ -3450,14 +3444,6 @@ static int network_init (void) return (0); have_init = 1; -#if HAVE_LIBGCRYPT - if (network_init_gcrypt () < 0) - { - ERROR ("network plugin: Failed to initialize crypto library."); - return (-1); - } -#endif - if (network_config_stats) plugin_register_read ("network", network_stats_read);