From: Kees Monshouwer Date: Tue, 12 Jul 2022 10:24:58 +0000 (+0200) Subject: auth: speedup secondary tests and make pdns_control catalog type aware X-Git-Tag: auth-4.8.0-alpha0~7^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f115fbc97b9760bdfbff307e4de72a9cb3df0990;p=thirdparty%2Fpdns.git auth: speedup secondary tests and make pdns_control catalog type aware --- diff --git a/pdns/dynhandler.cc b/pdns/dynhandler.cc index 31869cb1f8..82125a84d3 100644 --- a/pdns/dynhandler.cc +++ b/pdns/dynhandler.cc @@ -273,8 +273,8 @@ string DLNotifyRetrieveHandler(const vector&parts, Utility::pid_t ppid) di.masters.push_back(master_ip); } - if(!override_master && (di.kind != DomainInfo::Slave || di.masters.empty())) - return "Zone '" + domain.toString() + "' is not a secondary zone (or has no primary defined)"; + if (!override_master && (!di.isSecondaryType() || di.masters.empty())) + return "Zone '" + domain.toString() + "' is not a secondary/consumer zone (or has no primary defined)"; shuffle(di.masters.begin(), di.masters.end(), pdns::dns_random_engine()); const auto& master = di.masters.front(); @@ -328,7 +328,7 @@ string DLNotifyHandler(const vector&parts, Utility::pid_t ppid) int total = 0; int notified = 0; for (const auto& di : domains) { - if (di.kind == DomainInfo::Master || di.kind == DomainInfo::Slave) { // Primary and secondary if secondary-do-renotify is enabled + if (di.kind != DomainInfo::Native) { // Primary and secondary if secondary-do-renotify is enabled total++; if(Communicator.notifyDomain(di.zone, &B)) notified++; @@ -337,7 +337,7 @@ string DLNotifyHandler(const vector&parts, Utility::pid_t ppid) if (total != notified) return itoa(notified)+" out of "+itoa(total)+" zones added to queue - see log"; - return "Added "+itoa(total)+" MASTER/SLAVE zones to queue"; + return "Added " + itoa(total) + " MASTER/SLAVE/PRODUCER/CONSUMER zones to queue"; } else { DNSName domain; try { @@ -382,28 +382,29 @@ string DLListZones(const vector&parts, Utility::pid_t ppid) vector domains; B.getAllDomains(&domains, false, false); ostringstream ret; - int kindFilter = -1; + DomainInfo::DomainKind kind; if (parts.size() > 1) { - if (toUpper(parts[1]) == "PRIMARY" || toUpper(parts[1]) == "MASTER") - kindFilter = 0; - else if (toUpper(parts[1]) == "SECONDARY" || toUpper(parts[1]) == "SLAVE") - kindFilter = 1; - else if (toUpper(parts[1]) == "NATIVE") - kindFilter = 2; + kind = DomainInfo::stringToKind(parts[1]); + } + else { + kind = DomainInfo::All; } int count = 0; for (const auto& di: domains) { - if (di.kind == kindFilter || kindFilter == -1) { + if (di.kind == kind || kind == DomainInfo::All) { ret<