From 63faa7c9657e9c5ede85de0c9793bdaf276dbf9a Mon Sep 17 00:00:00 2001 From: Christian Hofstaedtler Date: Sat, 2 Jan 2016 19:55:28 +0100 Subject: [PATCH] Fix uncaught DNSName build error in DLNotifyRetrieveHandler --- pdns/dynhandler.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pdns/dynhandler.cc b/pdns/dynhandler.cc index 7aff1d8cf..2a1ae34e6 100644 --- a/pdns/dynhandler.cc +++ b/pdns/dynhandler.cc @@ -235,18 +235,24 @@ string DLNotifyRetrieveHandler(const vector&parts, Utility::pid_t ppid) if(parts.size()!=2) return "syntax: retrieve domain"; - const string& domain=parts[1]; + DNSName domain; + try { + domain = DNSName(parts[1]); + } catch (...) { + return "Failed to parse domain as valid DNS name"; + } + DomainInfo di; UeberBackend B; - if(!B.getDomainInfo(DNSName(domain), di)) - return "Domain '"+domain+"' unknown"; + if(!B.getDomainInfo(domain, di)) + return "Domain '"+domain.toString()+"' unknown"; if(di.masters.empty()) - return "Domain '"+domain+"' is not a slave domain (or has no master defined)"; + return "Domain '"+domain.toString()+"' is not a slave domain (or has no master defined)"; random_shuffle(di.masters.begin(), di.masters.end()); - Communicator.addSuckRequest(DNSName(domain), di.masters.front()); - return "Added retrieval request for '"+domain+"' from master "+di.masters.front(); + Communicator.addSuckRequest(domain, di.masters.front()); + return "Added retrieval request for '"+domain.toString()+"' from master "+di.masters.front(); } string DLNotifyHostHandler(const vector&parts, Utility::pid_t ppid) -- 2.40.0