]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Parse the new web ACL before clearing the existing one 9229/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 15 Jun 2020 13:25:40 +0000 (15:25 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 15 Jun 2020 13:25:40 +0000 (15:25 +0200)
Otherwise we end up with an empty ACL (everything will be refused)
if the new one is not valid.

pdns/dnsdist-web.cc

index 99a7a4aca14a820ae2b595421256ed0e82e3d805..1ec5cf3058e94428ffd698c89700b9c2e9e909dd 100644 (file)
@@ -1235,10 +1235,13 @@ void setWebserverPassword(const std::string& password)
 
 void setWebserverACL(const std::string& acl)
 {
-  std::lock_guard<std::mutex> lock(g_webserverConfig.lock);
+  NetmaskGroup newACL;
+  newACL.toMasks(acl);
 
-  g_webserverConfig.acl.clear();
-  g_webserverConfig.acl.toMasks(acl);
+  {
+    std::lock_guard<std::mutex> lock(g_webserverConfig.lock);
+    g_webserverConfig.acl = std::move(newACL);
+  }
 }
 
 void setWebserverCustomHeaders(const boost::optional<std::map<std::string, std::string> > customHeaders)