From c52dd6afc57cd374e011e904804c0f07ef38104c Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Wed, 4 May 2016 19:18:01 +0200 Subject: [PATCH] Prevent launching identical backends This catches configuration bugs (mostly when includes are used) where a line `launch=backend` and a line `launch+=backend` occur in the sum of the configuration. Closes #3615 --- pdns/dnsbackend.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pdns/dnsbackend.cc b/pdns/dnsbackend.cc index a7b4d016b5..ac728e7605 100644 --- a/pdns/dnsbackend.cc +++ b/pdns/dnsbackend.cc @@ -134,6 +134,10 @@ void BackendMakerClass::launch(const string &instr) vector parts; stringtok(parts,instr,", "); + for (const auto part : parts) + if (count(parts.begin(), parts.end(), part) > 1) + throw ArgException("Refusing to launch multiple backends with the same name '" + part + "', verify all 'launch' statements in your configuration"); + for(vector::const_iterator i=parts.begin();i!=parts.end();++i) { const string &part=*i; -- 2.47.2