]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
spiff up pdnsutil show-zone output even further
authorbert hubert <bert.hubert@netherlabs.nl>
Sun, 31 Jan 2016 15:17:16 +0000 (16:17 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Sun, 31 Jan 2016 15:17:16 +0000 (16:17 +0100)
pdns/pdnsutil.cc

index 572697feeead4219dbc7aa3e7f18208982a198d8..1816433ee83220f9ae956514d1a9b43ae7d473ae 100644 (file)
@@ -1467,6 +1467,44 @@ bool showZone(DNSSECKeeper& dk, const DNSName& zone)
     return false;
   }
 
+  cout<<"This is a "<<DomainInfo::getKindString(di.kind)<<" zone"<<endl;
+  if(di.kind == DomainInfo::Master) {
+    cout<<"Last SOA serial number we notified: "<<di.notified_serial<<" ";
+    SOAData sd;
+    if(B.getSOAUncached(zone, sd)) {
+      if(sd.serial == di.notified_serial)
+        cout<< "== ";
+      else
+        cout << "!= ";
+      cout<<sd.serial<<" (serial in the database)"<<endl;
+    }
+    else
+      cout<<"- no serial found in database"<<endl;
+  }
+  else if(di.kind == DomainInfo::Slave) {
+    cout<<"Master"<<addS(di.masters)<<": ";
+    for(const auto& m : di.masters)
+      cout<<m<<" ";
+    cout<<endl;
+    struct tm tm;
+    localtime_r(&di.last_check, &tm);
+    char buf[80];
+    if(di.last_check)
+      strftime(buf, sizeof(buf)-1, "%a %F %H:%M:%S", &tm);
+    else
+      strncpy(buf, "Never", sizeof(buf)-1);
+
+    cout<<"Last time we got update from master: "<<buf<<endl;
+    SOAData sd;
+    if(B.getSOAUncached(zone, sd)) {
+      cout<<"SOA serial in database: "<<sd.serial<<endl;
+      cout<<"Refresh interval: "<<sd.refresh<<" seconds"<<endl;
+    }
+    else
+      cout<<"No SOA serial found in database"<<endl;
+  }
+
+
   if(!dk.isSecuredZone(zone)) {
     cout<<"Zone is not actively secured"<<endl;
   }
@@ -1486,7 +1524,11 @@ bool showZone(DNSSECKeeper& dk, const DNSName& zone)
   
   std::map<std::string, std::vector<std::string> > metamap;
   if(B.getAllDomainMetadata(zone, metamap)) {
-    cout<<"Meta data items: "<<endl;
+    cout<<"Metadata items: ";
+    if(metamap.empty())
+      cout<<"None";
+    cout<<endl;
+
     for(const auto& m : metamap) {
       for(const auto i : m.second)
         cout << '\t' << m.first<<'\t' << i <<endl;