]> granicus.if.org Git - pdns/commitdiff
dnsdist: Don't end the KVS plain text names with a dot
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 14 Aug 2019 12:17:51 +0000 (14:17 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 14 Aug 2019 12:17:51 +0000 (14:17 +0200)
pdns/dnsdistdist/dnsdist-kvs.cc
pdns/dnsdistdist/dnsdist-kvs.hh
pdns/dnsdistdist/test-dnsdistkvs_cc.cc
regression-tests.dnsdist/test_LMDB.py

index d5f7438381b760f7e9203b1aaf4a922872fbfed1..814551bfec3734a970de667fff0bcd9d1d35a1fd 100644 (file)
@@ -58,7 +58,7 @@ std::vector<std::string> KeyValueLookupKeySuffix::getKeys(const DNSName& qname)
   result.reserve(labelsCount);
 
   while(!lowerQName.isRoot()) {
-    result.emplace_back(d_wireFormat ? lowerQName.toDNSString() : lowerQName.toString());
+    result.emplace_back(d_wireFormat ? lowerQName.toDNSString() : lowerQName.toStringRootDot());
     labelsCount--;
     if (!lowerQName.chopOff() || labelsCount == 0) {
       break;
index 892123f141d8da84816e8b0ab2c14552ac72b756..c9cd7fc2afc705c47aae543d1e97d888a2ba259a 100644 (file)
@@ -62,7 +62,7 @@ public:
     if (d_wireFormat) {
       return {qname.toDNSStringLC()};
     }
-    return {qname.makeLowerCase().toString()};
+    return {qname.makeLowerCase().toStringRootDot()};
   }
 
   std::vector<std::string> getKeys(const DNSQuestion& dq) override
index 0b27a31a735051c4ad2f10e797a0e0c03235a796..adf0939735adff7b1da0fcc8cf06bdca6afd9d69 100644 (file)
@@ -146,7 +146,7 @@ static void doKVSChecks(std::unique_ptr<KeyValueStore>& kvs, const ComboAddress&
     auto keys = lookupKey->getKeys(dq);
     BOOST_CHECK_EQUAL(keys.size(), dq.qname->countLabels());
     BOOST_REQUIRE(!keys.empty());
-    BOOST_CHECK_EQUAL(keys.at(0), dq.qname->toString());
+    BOOST_CHECK_EQUAL(keys.at(0), dq.qname->toStringRootDot());
     std::string value;
     BOOST_CHECK_EQUAL(kvs->getValue(keys.at(0), value), false);
     value.clear();
@@ -227,7 +227,7 @@ BOOST_AUTO_TEST_CASE(test_LMDB) {
     auto dbi = transaction.openDB("db-name", MDB_CREATE);
     transaction.put(dbi, MDBInVal(std::string(reinterpret_cast<const char*>(&rem.sin4.sin_addr.s_addr), sizeof(rem.sin4.sin_addr.s_addr))), MDBInVal("this is the value for the remote addr"));
     transaction.put(dbi, MDBInVal(qname.toDNSStringLC()), MDBInVal("this is the value for the qname"));
-    transaction.put(dbi, MDBInVal(plaintextDomain.toString()), MDBInVal("this is the value for the plaintext domain"));
+    transaction.put(dbi, MDBInVal(plaintextDomain.toStringRootDot()), MDBInVal("this is the value for the plaintext domain"));
     transaction.commit();
   }
 
@@ -279,7 +279,7 @@ BOOST_AUTO_TEST_CASE(test_CDB) {
     CDBWriter writer(fd);
     BOOST_REQUIRE(writer.addEntry(std::string(reinterpret_cast<const char*>(&rem.sin4.sin_addr.s_addr), sizeof(rem.sin4.sin_addr.s_addr)), "this is the value for the remote addr"));
     BOOST_REQUIRE(writer.addEntry(qname.toDNSStringLC(), "this is the value for the qname"));
-    BOOST_REQUIRE(writer.addEntry(plaintextDomain.toString(), "this is the value for the plaintext domain"));
+    BOOST_REQUIRE(writer.addEntry(plaintextDomain.toStringRootDot(), "this is the value for the plaintext domain"));
     writer.close();
   }
 
index c074a1f92eec632d96acba67c0cd617cb943e0de..7529ddd45666306a7513e77d58073ea3ca235b4a 100644 (file)
@@ -63,8 +63,8 @@ class TestLMDB(DNSDistTest):
             txn.put(socket.inet_aton('127.0.0.1'), b'this is the value of the source address tag')
             txn.put(b'this is the value of the qname tag', b'this is the value of the second tag')
             txn.put(b'\x06suffix\x04lmdb\x05tests\x08powerdns\x03com\x00', b'this is the value of the suffix tag')
-            txn.put(b'qname-plaintext.lmdb.tests.powerdns.com.', b'this is the value of the plaintext tag')
-            txn.put(b'kvs-rule.lmdb.tests.powerdns.com.', b'the value does not matter')
+            txn.put(b'qname-plaintext.lmdb.tests.powerdns.com', b'this is the value of the plaintext tag')
+            txn.put(b'kvs-rule.lmdb.tests.powerdns.com', b'the value does not matter')
 
     @classmethod
     def setUpClass(cls):