]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
pdnssec: fix segfault in list-all-zones without type
authorKees Monshouwer <mind04@monshouwer.org>
Wed, 14 May 2014 18:16:58 +0000 (20:16 +0200)
committermind04 <mind04@monshouwer.org>
Wed, 14 May 2014 18:16:58 +0000 (20:16 +0200)
pdns/pdnssec.cc

index 7238e356395987b7f5e4e777e7b285c0733966f4..f32c5058eb1848f0da3277bbd25f222c32834eb1 100644 (file)
@@ -640,7 +640,7 @@ int deleteZone(const string &zone) {
   return 1;
 }
 
-int listAllZones(const string &type) {
+int listAllZones(const string &type="") {
   scoped_ptr<UeberBackend> B(new UeberBackend("default"));
 
   vector<DomainInfo> domains;
@@ -654,6 +654,10 @@ int listAllZones(const string &type) {
       kindFilter = 1;
     else if (toUpper(type) == "NATIVE")
       kindFilter = 2;
+    else {
+      cerr<<"Syntax: pdnssec list-all-zones [master|slave|native]"<<endl;
+      return 1;
+    }
   }
 
   int count = 0;
@@ -1218,7 +1222,13 @@ try
     exit(checkAllZones(dk));
   }
   else if (cmds[0] == "list-all-zones") {
-    exit(listAllZones(cmds[1]));
+    if (cmds.size() > 2) {
+      cerr << "Syntax: pdnssec list-all-zones [master|slave|native]"<<endl;
+      return 0;
+    }
+    if (cmds.size() == 2)
+      return listAllZones(cmds[1]);
+    return listAllZones();
   }
   else if (cmds[0] == "test-zone") {
     cerr << "Did you mean check-zone?"<<endl;