From: Chris Hofstaedtler Date: Mon, 9 Nov 2020 18:31:58 +0000 (+0100) Subject: pdnsutil: check for domain existence in (de)activate-tsig-key X-Git-Tag: dnsdist-1.6.0-alpha0~18^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a3a785ada31947c71f9e2edbd0ed3706bf1d1a2;p=thirdparty%2Fpdns.git pdnsutil: check for domain existence in (de)activate-tsig-key --- diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index 3e002afcd3..af34a87645 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -1318,7 +1318,6 @@ static int addOrReplaceRecord(bool addOrReplace, const vector& cmds) { UeberBackend B; DomainInfo di; - if(!B.getDomainInfo(zone, di)) { cerr<<"Domain '"< meta; if (!B.getDomainMetadata(zname, metaKey, meta)) { cerr << "Failure enabling TSIG key " << name << " for " << zname << endl; @@ -3194,6 +3198,11 @@ try } UeberBackend B("default"); + DomainInfo di; + if (!B.getDomainInfo(zname, di)) { + cerr << "Domain '" << zname << "' does not exist" << endl; + return 1; + } std::vector meta; if (!B.getDomainMetadata(zname, metaKey, meta)) { cerr << "Failure disabling TSIG key " << name << " for " << zname << endl; @@ -3217,8 +3226,8 @@ try } DNSName zone(cmds[1]); vector keys; - DomainInfo di; + DomainInfo di; if (!B.getDomainInfo(zone, di)) { cerr << "Invalid zone '" << zone << "'" << endl; return 1;