]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
pdnsutil: Check for domain before setting metadata
authorPieter Lexis <pieter.lexis@powerdns.com>
Mon, 16 Oct 2017 13:00:35 +0000 (15:00 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Tue, 7 Nov 2017 20:26:24 +0000 (21:26 +0100)
Closes #5787

(cherry picked from commit ed99fac4e9bb61c360e68cc71056cfb9f5c80a21)

pdns/pdnsutil.cc

index 2361bee48077b10a0a84fcad0b35f7dfa95ca358..65a4fcca132a653c8288853a91ad11aaf035f14e 100644 (file)
@@ -2915,6 +2915,12 @@ loadMainConfig(g_vm["config-dir"].as<string>());
     string kind = cmds[2];
     vector<string> meta(cmds.begin() + 3, cmds.end());
 
+    DomainInfo di;
+    if (!B.getDomainInfo(zone, di)){
+      cerr << "No such zone in the database" << endl;
+      return false;
+    }
+
     if (!B.setDomainMetadata(zone, kind, meta)) {
       cerr << "Unable to set meta for '" << zone << "'" << endl;
       return 1;