]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: print records and sigs in negcache dump 5511/head
authorPieter Lexis <pieter.lexis@powerdns.com>
Mon, 10 Jul 2017 12:24:00 +0000 (14:24 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Mon, 10 Jul 2017 13:27:41 +0000 (15:27 +0200)
pdns/recursordist/negcache.cc
pdns/recursordist/test-negcache_cc.cc

index 49f4e2448eb65256ece0dddcc4662f9baea04471..662341dd9a1e28ecc503ebeafc867bd99a206315 100644 (file)
@@ -170,6 +170,12 @@ uint64_t NegCache::dumpToFile(FILE* fp) {
   for(const NegCacheEntry& ne : sidx) {
     ret++;
     fprintf(fp, "%s %d IN %s VIA %s\n", ne.d_name.toString().c_str(), (unsigned int) (ne.d_ttd - now), ne.d_qtype.getName().c_str(), ne.d_auth.toString().c_str());
+    for (const auto& rec : ne.DNSSECRecords.records) {
+      fprintf(fp, "%s %" PRId64 " IN %s %s ; (%s)\n", ne.d_name.toString().c_str(), static_cast<int64_t>(ne.d_ttd - now), DNSRecordContent::NumberToType(ne.d_qtype.getCode()).c_str(), rec.d_content->getZoneRepresentation().c_str(), vStates[ne.d_validationState]);
+    }
+    for (const auto& sig : ne.DNSSECRecords.signatures) {
+      fprintf(fp, "%s %" PRId64 " IN RRSIG %s ;\n", ne.d_name.toString().c_str(), static_cast<int64_t>(ne.d_ttd - now), sig.d_content->getZoneRepresentation().c_str());
+    }
   }
   return ret;
 }
index 7340884700ce65f44f5d4704faab649a14ec144b..bc25c3a5ccce1c3216daf8e86a7f404cdaf8c4e2 100644 (file)
@@ -336,7 +336,11 @@ BOOST_AUTO_TEST_CASE(test_dumpToFile) {
   NegCache cache;
   vector<string> expected;
   expected.push_back("www1.powerdns.com. 600 IN TYPE0 VIA powerdns.com.\n");
+  expected.push_back("www1.powerdns.com. 600 IN ENT deadbeef. ; (Indeterminate)\n");
+  expected.push_back("www1.powerdns.com. 600 IN RRSIG NSEC 5 3 600 21000101000000 21000101000000 24567 dummy. data ;\n");
   expected.push_back("www2.powerdns.com. 600 IN TYPE0 VIA powerdns.com.\n");
+  expected.push_back("www2.powerdns.com. 600 IN ENT deadbeef. ; (Indeterminate)\n");
+  expected.push_back("www2.powerdns.com. 600 IN RRSIG NSEC 5 3 600 21000101000000 21000101000000 24567 dummy. data ;\n");
 
   struct timeval now;
   Utility::gettimeofday(&now, 0);