]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Prevent launching identical backends 3817/head
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 4 May 2016 17:18:01 +0000 (19:18 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Tue, 10 May 2016 09:13:28 +0000 (11:13 +0200)
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

index a7b4d016b5b71096ae4d55f00d952989e918174c..ac728e7605188a48e2be4a3e70b1f7829518f1f6 100644 (file)
@@ -134,6 +134,10 @@ void BackendMakerClass::launch(const string &instr)
   vector<string> 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<string>::const_iterator i=parts.begin();i!=parts.end();++i) {
     const string &part=*i;