From 45d4cbaa420d2e1ce2ea2a21a9ed3d9666655bc6 Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Mon, 24 Aug 2020 14:55:16 +0200 Subject: [PATCH] - Fix to apply chroot to dnstap-socket-path, if chroot is enabled. --- dnstap/dnstap.c | 10 ++++++++-- dnstap/dtstream.c | 3 ++- doc/Changelog | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dnstap/dnstap.c b/dnstap/dnstap.c index cc5449dff..bda837876 100644 --- a/dnstap/dnstap.c +++ b/dnstap/dnstap.c @@ -134,9 +134,15 @@ dt_create(struct config_file* cfg) if(cfg->dnstap && cfg->dnstap_socket_path && cfg->dnstap_socket_path[0] && (cfg->dnstap_ip==NULL || cfg->dnstap_ip[0]==0)) { + char* p = fname_after_chroot(cfg->dnstap_socket_path, cfg, 1); + if(!p) { + log_err("malloc failure"); + return NULL; + } verbose(VERB_OPS, "attempting to connect to dnstap socket %s", - cfg->dnstap_socket_path); - check_socket_file(cfg->dnstap_socket_path); + p); + check_socket_file(p); + free(p); } env = (struct dt_env *) calloc(1, sizeof(struct dt_env)); diff --git a/dnstap/dtstream.c b/dnstap/dtstream.c index 7c8a08604..63d517cb8 100644 --- a/dnstap/dtstream.c +++ b/dnstap/dtstream.c @@ -279,7 +279,8 @@ int dt_io_thread_apply_cfg(struct dt_io_thread* dtio, struct config_file *cfg) return 0; } free(dtio->socket_path); - dtio->socket_path = strdup(cfg->dnstap_socket_path); + dtio->socket_path = fname_after_chroot(cfg->dnstap_socket_path, + cfg, 1); if(!dtio->socket_path) { log_err("dnstap setup: malloc failure"); return 0; diff --git a/doc/Changelog b/doc/Changelog index 1923c17ad..37931d395 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,7 @@ - Fix that dnstap reconnects do not spam the log with the repeated attempts. Attempts on the timer are only logged on high verbosity, if they produce a connection failure error. + - Fix to apply chroot to dnstap-socket-path, if chroot is enabled. 20 August 2020: Ralph - Fix stats double count issue (#289).