From: W.C.A. Wijngaards Date: Fri, 9 Oct 2020 06:57:23 +0000 (+0200) Subject: - Fix dnstap socket and the chroot not applied properly to the dnstap X-Git-Tag: release-1.13.0rc1~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=795a33c6e54aac7c7c0217da37d20faaf78898ef;p=thirdparty%2Funbound.git - Fix dnstap socket and the chroot not applied properly to the dnstap socket path. --- diff --git a/dnstap/dnstap.c b/dnstap/dnstap.c index 0c8c6c4d4..b8a321670 100644 --- a/dnstap/dnstap.c +++ b/dnstap/dnstap.c @@ -134,15 +134,13 @@ 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; - } + char* p = cfg->dnstap_socket_path; + if(cfg->chrootdir && cfg->chrootdir[0] && strncmp(p, + cfg->chrootdir, strlen(cfg->chrootdir)) == 0) + p += strlen(cfg->chrootdir); verbose(VERB_OPS, "attempting to connect to dnstap socket %s", 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 b0918c52c..f1ace3c34 100644 --- a/dnstap/dtstream.c +++ b/dnstap/dtstream.c @@ -341,15 +341,19 @@ int dt_io_thread_apply_cfg(struct dt_io_thread* dtio, struct config_file *cfg) dtio->is_bidirectional = cfg->dnstap_bidirectional; if(dtio->upstream_is_unix) { + char* nm; if(!cfg->dnstap_socket_path || cfg->dnstap_socket_path[0]==0) { log_err("dnstap setup: no dnstap-socket-path for " "socket connect"); return 0; } + nm = cfg->dnstap_socket_path; + if(cfg->chrootdir && cfg->chrootdir[0] && strncmp(nm, + cfg->chrootdir, strlen(cfg->chrootdir)) == 0) + nm += strlen(cfg->chrootdir); free(dtio->socket_path); - dtio->socket_path = fname_after_chroot(cfg->dnstap_socket_path, - cfg, 1); + dtio->socket_path = strdup(nm); if(!dtio->socket_path) { log_err("dnstap setup: malloc failure"); return 0; diff --git a/doc/Changelog b/doc/Changelog index c59352cfd..035d040a9 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +9 October 2020: Wouter + - Fix dnstap socket and the chroot not applied properly to the dnstap + socket path. + 8 October 2020: Wouter - Tag for 1.12.0 release. - Current repo is version 1.12.1 in development.