]> granicus.if.org Git - pdns/commitdiff
stubquery: Fix handling of optional type arg.
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 4 Jun 2019 09:22:40 +0000 (11:22 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 4 Jun 2019 09:22:40 +0000 (11:22 +0200)
pdns/stubquery.cc

index afffa27b432e8bcc75ec3029cef86aba12cd66cf..1da9644a2d9b7bebac56d2eedecba2d558ad2099 100644 (file)
@@ -38,11 +38,13 @@ try
     }
   }
 
-  if(argc < 2) {
+  if(argc <= 1) {
     usage();
     exit(EXIT_FAILURE);
   }
 
+  string type(argc == 2 ? "A" : argv[2]);
+
   ::arg().set("resolver","Use this resolver for ALIAS and the internal stub resolver")="no"; 
 
   reportAllTypes();
@@ -50,7 +52,7 @@ try
 
   vector<DNSZoneRecord> ret;
 
-  int res=stubDoResolve(DNSName(argv[1]), DNSRecordContent::TypeToNumber(argv[2]), ret);
+  int res=stubDoResolve(DNSName(argv[1]), DNSRecordContent::TypeToNumber(type), ret);
 
   cout<<"res: "<<res<<endl;
   for(const auto& r : ret) {