]> granicus.if.org Git - pdns/commitdiff
test-dnsrecords: handle TSIG like everything else
authorStefan Bühler <stbuehler@web.de>
Thu, 28 Dec 2017 21:38:42 +0000 (22:38 +0100)
committerStefan Bühler <stbuehler@web.de>
Thu, 28 Dec 2017 21:38:42 +0000 (22:38 +0100)
pdns/test-dnsrecords_cc.cc

index 70d7af45906d6ab7d9132031ce1cb02bac252a63..413fb26b7f66394371bc696540fadae2cb92ffba 100644 (file)
@@ -193,31 +193,26 @@ BOOST_AUTO_TEST_CASE(test_record_types) {
    BOOST_TEST_MESSAGE("Checking record type " << q.getName() << " test #" << n);
    try {
       std::string recData;
-      if (q.getCode() != QType::TSIG) {
-        auto rec = DNSRecordContent::mastermake(q.getCode(), 1, val.get<1>());
-        BOOST_CHECK_MESSAGE(rec != NULL, "mastermake( " << q.getCode() << ", 1, " << val.get<1>() << ") returned NULL");
-        if (rec == NULL) continue;
-        // now verify the record (note that this will be same as *zone* value (except for certain QTypes)
-
-        switch(q.getCode()) {
-        case QType::NS:
-        case QType::PTR:
-        case QType::MX:
-        case QType::CNAME:
-        case QType::SOA:
-        case QType::TXT:
-           // check *input* value instead 
-           REC_CHECK_EQUAL(rec->getZoneRepresentation(), val.get<1>());
-           break;
-        default:
-           REC_CHECK_EQUAL(rec->getZoneRepresentation(), val.get<2>());
-        }
-        recData = rec->serialize(DNSName("rec.test"));
-      } else {
-        std::shared_ptr<DNSRecordContent> rec3 = DNSRecordContent::unserialize(DNSName("rec.test"),q.getCode(),(val.get<3>()));
-        // TSIG special, only works the other way
-        recData = rec3->serialize(DNSName("rec.test"));
+      auto rec = DNSRecordContent::mastermake(q.getCode(), 1, val.get<1>());
+      BOOST_CHECK_MESSAGE(rec != NULL, "mastermake( " << q.getCode() << ", 1, " << val.get<1>() << ") returned NULL");
+      if (rec == NULL) continue;
+      // now verify the record (note that this will be same as *zone* value (except for certain QTypes)
+
+      switch(q.getCode()) {
+      case QType::NS:
+      case QType::PTR:
+      case QType::MX:
+      case QType::CNAME:
+      case QType::SOA:
+      case QType::TXT:
+          // check *input* value instead
+          REC_CHECK_EQUAL(rec->getZoneRepresentation(), val.get<1>());
+          break;
+      default:
+          REC_CHECK_EQUAL(rec->getZoneRepresentation(), val.get<2>());
       }
+      recData = rec->serialize(DNSName("rec.test"));
+
       std::shared_ptr<DNSRecordContent> rec2 = DNSRecordContent::unserialize(DNSName("rec.test"),q.getCode(),recData);
       BOOST_CHECK_MESSAGE(rec2 != NULL, "unserialize(rec.test, " << q.getCode() << ", recData) returned NULL");
       if (rec2 == NULL) continue;