create unique index namealgoindex on tsigkeys(name, algorithm);
-insert into domains (name,type) VALUES('example.com','NATIVE');
-insert into domains (name,type) VALUES('up.example.com','NATIVE');
+insert into domains (name,type) VALUES('example.com.','NATIVE');
+insert into domains (name,type) VALUES('up.example.com.','NATIVE');
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "example.com", "SOA", "120", "ns1.example.com hostmaster.example.com 2000010101 28800 7200 1209600 120", "", 1 FROM domains WHERE name = "example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "example.com", "NS", "120", "ns1.example.com", "", 1 FROM domains WHERE name = "example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "example.com", "NS", "120", "ns2.example.com", "", 1 FROM domains WHERE name = "example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "outpost.example.com", "A", "120", "192.168.2.1", "outpost", 1 FROM domains WHERE name = "example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "outpost.example.com", "AAAA", "120", "fe80::1", "outpost", 1 FROM domains WHERE name = "example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "www.example.com", "A", "120", "192.168.2.255", "www", 1 FROM domains WHERE name = "example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "NS", "120", "ns1.example.com", "up", 0 FROM domains WHERE name = "example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "NS", "120", "ns2.example.com", "up", 0 FROM domains WHERE name = "example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "ns1.example.com", "A", "120", "192.168.2.2", "ns1", 1 FROM domains WHERE name = "example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "ns2.example.com", "A", "120", "192.168.2.3", "ns2", 1 FROM domains WHERE name = "example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "SOA", "120", "ns1.example.com hostmaster.example.com 2000010101 28800 7200 1209600 120", "", 1 FROM domains WHERE name = "up.example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "NS", "120", "ns1.example.com", "", 1 FROM domains WHERE name = "up.example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "NS", "120", "ns2.example.com", "", 1 FROM domains WHERE name = "up.example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "jump.up.example.com", "A", "120", "192.168.3.1", "jump", 1 FROM domains WHERE name = "up.example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "jump.up.example.com", "TXT", "120", "a very very long indeed text string that should pass out clean and proper thru the entire chain of powerdns processing", "jump", 1 FROM domains WHERE name = "up.example.com";
+insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "example.com.", "SOA", "120", "ns1.example.com. hostmaster.example.com. 2000010101 28800 7200 1209600 120", "", 1 FROM domains WHERE name = "example.com.";
+insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "example.com.", "NS", "120", "ns1.example.com.", "", 1 FROM domains WHERE name = "example.com.";
+insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "example.com.", "NS", "120", "ns2.example.com.", "", 1 FROM domains WHERE name = "example.com.";
+insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "outpost.example.com.", "A", "120", "192.168.2.1", "outpost", 1 FROM domains WHERE name = "example.com.";
+insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "outpost.example.com.", "AAAA", "120", "fe80::1", "outpost", 1 FROM domains WHERE name = "example.com.";
+insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "www.example.com.", "A", "120", "192.168.2.255", "www", 1 FROM domains WHERE name = "example.com.";
+insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com.", "NS", "120", "ns1.example.com.", "up", 0 FROM domains WHERE name = "example.com.";
+insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com.", "NS", "120", "ns2.example.com.", "up", 0 FROM domains WHERE name = "example.com.";
+insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "ns1.example.com.", "A", "120", "192.168.2.2", "ns1", 1 FROM domains WHERE name = "example.com.";
+insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "ns2.example.com.", "A", "120", "192.168.2.3", "ns2", 1 FROM domains WHERE name = "example.com.";
+insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com.", "SOA", "120", "ns1.example.com. hostmaster.example.com. 2000010101 28800 7200 1209600 120", "", 1 FROM domains WHERE name = "up.example.com.";
+insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com.", "NS", "120", "ns1.example.com.", "", 1 FROM domains WHERE name = "up.example.com.";
+insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com.", "NS", "120", "ns2.example.com.", "", 1 FROM domains WHERE name = "up.example.com.";
+insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "jump.up.example.com.", "A", "120", "192.168.3.1", "jump", 1 FROM domains WHERE name = "up.example.com.";
+insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "jump.up.example.com.", "TXT", "120", "a very very long indeed text string that should pass out clean and proper thru the entire chain of powerdns processing", "jump", 1 FROM domains WHERE name = "up.example.com.";
commit;
BOOST_AUTO_TEST_CASE(test_method_lookup) {
BOOST_TEST_MESSAGE("Testing lookup method");
DNSResourceRecord rr;
- be->lookup(QType(QType::SOA), DNSName("unit.test"));
+ be->lookup(QType(QType::SOA), DNSName("unit.test."));
// then try to get()
BOOST_CHECK(be->get(rr)); // and this should be TRUE.
// then we check rr contains what we expect
BOOST_CHECK_EQUAL(rr.qname.toString(), "unit.test.");
BOOST_CHECK_MESSAGE(rr.qtype == QType::SOA, "returned qtype was not SOA");
- BOOST_CHECK_EQUAL(rr.content, "ns.unit.test hostmaster.unit.test 1 2 3 4 5 6");
+ BOOST_CHECK_EQUAL(rr.content, "ns.unit.test. hostmaster.unit.test. 1 2 3 4 5 6");
BOOST_CHECK_EQUAL(rr.ttl, 300);
}
BOOST_AUTO_TEST_CASE(test_method_lookup_empty) {
BOOST_TEST_MESSAGE("Testing lookup method with empty result");
DNSResourceRecord rr;
- be->lookup(QType(QType::SOA), DNSName("empty.unit.test"));
+ be->lookup(QType(QType::SOA), DNSName("empty.unit.test."));
// then try to get()
BOOST_CHECK(!be->get(rr)); // and this should be FALSE
}
DNSResourceRecord rr;
BOOST_TEST_MESSAGE("Testing list method");
- be->list(DNSName("unit.test"), -1);
+ be->list(DNSName("unit.test."), -1);
while(be->get(rr)) record_count++;
BOOST_CHECK_EQUAL(record_count, 5); // number of records our test domain has
std::vector<std::string> meta;
meta.push_back("VALUE");
BOOST_TEST_MESSAGE("Testing setDomainMetadata method");
- BOOST_CHECK(be->setDomainMetadata(DNSName("unit.test"),"TEST", meta));
+ BOOST_CHECK(be->setDomainMetadata(DNSName("unit.test."),"TEST", meta));
}
BOOST_AUTO_TEST_CASE(test_method_getDomainMetadata) {
std::vector<std::string> meta;
BOOST_TEST_MESSAGE("Testing getDomainMetadata method");
- be->getDomainMetadata(DNSName("unit.test"),"TEST", meta);
+ be->getDomainMetadata(DNSName("unit.test."),"TEST", meta);
BOOST_CHECK_EQUAL(meta.size(), 1);
// in case we got more than one value, which would be unexpected
// but not fatal
BOOST_AUTO_TEST_CASE(test_method_getAllDomainMetadata) {
std::map<std::string, std::vector<std::string> > meta;
BOOST_TEST_MESSAGE("Testing getAllDomainMetadata method");
- be->getAllDomainMetadata(DNSName("unit.test"), meta);
+ be->getAllDomainMetadata(DNSName("unit.test."), meta);
BOOST_CHECK_EQUAL(meta.size(), 1);
// in case we got more than one value, which would be unexpected
// but not fatal
BOOST_AUTO_TEST_CASE(test_method_addDomainKey) {
BOOST_TEST_MESSAGE("Testing addDomainKey method");
- BOOST_CHECK_EQUAL(be->addDomainKey(DNSName("unit.test"),k1), 1);
- BOOST_CHECK_EQUAL(be->addDomainKey(DNSName("unit.test"),k2), 2);
+ BOOST_CHECK_EQUAL(be->addDomainKey(DNSName("unit.test."),k1), 1);
+ BOOST_CHECK_EQUAL(be->addDomainKey(DNSName("unit.test."),k2), 2);
}
BOOST_AUTO_TEST_CASE(test_method_getDomainKeys) {
std::vector<DNSBackend::KeyData> keys;
BOOST_TEST_MESSAGE("Testing getDomainKeys method");
// we expect to get two keys
- be->getDomainKeys(DNSName("unit.test"),0,keys);
+ be->getDomainKeys(DNSName("unit.test."),0,keys);
BOOST_CHECK_EQUAL(keys.size(), 2);
// in case we got more than 2 keys, which would be unexpected
// but not fatal
BOOST_AUTO_TEST_CASE(test_method_deactivateDomainKey) {
BOOST_TEST_MESSAGE("Testing deactivateDomainKey method");
- BOOST_CHECK(be->deactivateDomainKey(DNSName("unit.test"),1));
+ BOOST_CHECK(be->deactivateDomainKey(DNSName("unit.test."),1));
}
BOOST_AUTO_TEST_CASE(test_method_activateDomainKey) {
BOOST_TEST_MESSAGE("Testing activateDomainKey method");
- BOOST_CHECK(be->activateDomainKey(DNSName("unit.test"),1));
+ BOOST_CHECK(be->activateDomainKey(DNSName("unit.test."),1));
}
BOOST_AUTO_TEST_CASE(test_method_removeDomainKey) {
- BOOST_CHECK(be->removeDomainKey(DNSName("unit.test"),2));
- BOOST_CHECK(be->removeDomainKey(DNSName("unit.test"),1));
+ BOOST_CHECK(be->removeDomainKey(DNSName("unit.test."),2));
+ BOOST_CHECK(be->removeDomainKey(DNSName("unit.test."),1));
}
BOOST_AUTO_TEST_CASE(test_method_getBeforeAndAfterNamesAbsolute) {
std::string before,after;
BOOST_TEST_MESSAGE("Testing getBeforeAndAfterNamesAbsolute method");
- be->getBeforeAndAfterNamesAbsolute(-1, "middle.unit.test", unhashed, before, after);
+ be->getBeforeAndAfterNamesAbsolute(-1, "middle.unit.test.", unhashed, before, after);
BOOST_CHECK_EQUAL(unhashed.toString(), "middle.");
- BOOST_CHECK_EQUAL(before, "begin");
- BOOST_CHECK_EQUAL(after, "stop");
+ BOOST_CHECK_EQUAL(before, "begin.");
+ BOOST_CHECK_EQUAL(after, "stop.");
}
BOOST_AUTO_TEST_CASE(test_method_setTSIGKey) {
std::string algorithm, content;
BOOST_TEST_MESSAGE("Testing setTSIGKey method");
- BOOST_CHECK_MESSAGE(be->setTSIGKey(DNSName("unit.test"),DNSName("hmac-md5"),"kp4/24gyYsEzbuTVJRUMoqGFmN3LYgVDzJ/3oRSP7ys="), "did not return true");
+ BOOST_CHECK_MESSAGE(be->setTSIGKey(DNSName("unit.test."),DNSName("hmac-md5."),"kp4/24gyYsEzbuTVJRUMoqGFmN3LYgVDzJ/3oRSP7ys="), "did not return true");
}
BOOST_AUTO_TEST_CASE(test_method_getTSIGKey) {
DNSName algorithm;
std::string content;
BOOST_TEST_MESSAGE("Testing getTSIGKey method");
- be->getTSIGKey(DNSName("unit.test"),&algorithm,&content);
+ be->getTSIGKey(DNSName("unit.test."),&algorithm,&content);
BOOST_CHECK_EQUAL(algorithm.toString(), "hmac-md5.");
BOOST_CHECK_EQUAL(content, "kp4/24gyYsEzbuTVJRUMoqGFmN3LYgVDzJ/3oRSP7ys=");
}
BOOST_AUTO_TEST_CASE(test_method_deleteTSIGKey) {
std::string algorithm, content;
BOOST_TEST_MESSAGE("Testing deleteTSIGKey method");
- BOOST_CHECK_MESSAGE(be->deleteTSIGKey(DNSName("unit.test")), "did not return true");
+ BOOST_CHECK_MESSAGE(be->deleteTSIGKey(DNSName("unit.test.")), "did not return true");
}
BOOST_AUTO_TEST_CASE(test_method_getTSIGKeys) {
BOOST_AUTO_TEST_CASE(test_method_getDomainInfo) {
DomainInfo di;
BOOST_TEST_MESSAGE("Testing getDomainInfo method");
- be->getDomainInfo(DNSName("unit.test"), di);
+ be->getDomainInfo(DNSName("unit.test."), di);
BOOST_CHECK_EQUAL(di.zone.toString(), "unit.test.");
BOOST_CHECK_EQUAL(di.serial, 2);
BOOST_CHECK_EQUAL(di.notified_serial, 2);
BOOST_AUTO_TEST_CASE(test_method_isMaster) {
BOOST_TEST_MESSAGE("Testing isMaster method");
- BOOST_CHECK(be->isMaster(DNSName("ns1.unit.test"), "10.0.0.1"));
- BOOST_CHECK(!be->isMaster(DNSName("ns2.unit.test"), "10.0.0.2"));
+ BOOST_CHECK(be->isMaster(DNSName("ns1.unit.test."), "10.0.0.1"));
+ BOOST_CHECK(!be->isMaster(DNSName("ns2.unit.test."), "10.0.0.2"));
}
BOOST_AUTO_TEST_CASE(test_method_superMasterBackend) {
DNSBackend *dbd;
BOOST_TEST_MESSAGE("Testing superMasterBackend method");
- rr.qname = DNSName("example.com");
+ rr.qname = DNSName("example.com.");
rr.qtype = QType::NS;
rr.qclass = QClass::IN;
rr.ttl = 300;
- rr.content = "ns1.example.com";
+ rr.content = "ns1.example.com.";
nsset.push_back(rr);
- rr.qname = DNSName("example.com");
+ rr.qname = DNSName("example.com.");
rr.qtype = QType::NS;
rr.qclass = QClass::IN;
rr.ttl = 300;
- rr.content = "ns2.example.com";
+ rr.content = "ns2.example.com.";
nsset.push_back(rr);
- BOOST_CHECK(be->superMasterBackend("10.0.0.1", DNSName("example.com"), nsset, NULL, NULL, &dbd));
+ BOOST_CHECK(be->superMasterBackend("10.0.0.1", DNSName("example.com."), nsset, NULL, NULL, &dbd));
// let's see what we got
BOOST_CHECK_EQUAL(dbd, be);
BOOST_AUTO_TEST_CASE(test_method_createSlaveDomain) {
BOOST_TEST_MESSAGE("Testing createSlaveDomain method");
- BOOST_CHECK(be->createSlaveDomain("10.0.0.1", DNSName("pirate.unit.test"), "", ""));
+ BOOST_CHECK(be->createSlaveDomain("10.0.0.1", DNSName("pirate.unit.test."), "", ""));
}
BOOST_AUTO_TEST_CASE(test_method_feedRecord) {
DNSResourceRecord rr;
BOOST_TEST_MESSAGE("Testing feedRecord method");
- be->startTransaction(DNSName("example.com"),2);
- rr.qname = DNSName("example.com");
+ be->startTransaction(DNSName("example.com."),2);
+ rr.qname = DNSName("example.com.");
rr.qtype = QType::SOA;
rr.qclass = QClass::IN;
rr.ttl = 300;
- rr.content = "ns1.example.com hostmaster.example.com 2013013441 7200 3600 1209600 300";
+ rr.content = "ns1.example.com. hostmaster.example.com. 2013013441 7200 3600 1209600 300";
BOOST_CHECK(be->feedRecord(rr, NULL));
- rr.qname = DNSName("replace.example.com");
+ rr.qname = DNSName("replace.example.com.");
rr.qtype = QType::A;
rr.qclass = QClass::IN;
rr.ttl = 300;
}
BOOST_AUTO_TEST_CASE(test_method_replaceRRSet) {
- be->startTransaction(DNSName("example.com"),2);
+ be->startTransaction(DNSName("example.com."),2);
DNSResourceRecord rr;
std::vector<DNSResourceRecord> rrset;
BOOST_TEST_MESSAGE("Testing replaceRRSet method");
- rr.qname = DNSName("replace.example.com");
+ rr.qname = DNSName("replace.example.com.");
rr.qtype = QType::A;
rr.qclass = QClass::IN;
rr.ttl = 300;
rr.content = "1.1.1.1";
rrset.push_back(rr);
- BOOST_CHECK(be->replaceRRSet(2, DNSName("replace.example.com"), QType(QType::A), rrset));
+ BOOST_CHECK(be->replaceRRSet(2, DNSName("replace.example.com."), QType(QType::A), rrset));
be->commitTransaction();
}
BOOST_AUTO_TEST_CASE(test_method_feedEnts) {
BOOST_TEST_MESSAGE("Testing feedEnts method");
- be->startTransaction(DNSName("example.com"),2);
+ be->startTransaction(DNSName("example.com."),2);
map<DNSName, bool> nonterm = boost::assign::map_list_of(DNSName("_udp"), true)(DNSName("_sip._udp"), true);
BOOST_CHECK(be->feedEnts(2, nonterm));
be->commitTransaction();
ns3prc.d_iterations=1;
ns3prc.d_salt="\u00aa\u00bb\u00cc\u00dd";
map<DNSName, bool> nonterm = boost::assign::map_list_of(DNSName("_udp"), true)(DNSName("_sip._udp"), true);
- BOOST_CHECK(be->feedEnts3(2, DNSName("example.com"), nonterm, ns3prc, 0));
+ BOOST_CHECK(be->feedEnts3(2, DNSName("example.com."), nonterm, ns3prc, 0));
be->commitTransaction();
}
BOOST_AUTO_TEST_CASE(test_method_abortTransaction) {
BOOST_TEST_MESSAGE("Testing abortTransaction method");
- be->startTransaction(DNSName("example.com"),2);
+ be->startTransaction(DNSName("example.com."),2);
BOOST_CHECK(be->abortTransaction());
}
SOAData sd;
time_t serial;
- be->getSOA(DNSName("unit.test"),sd);
- BOOST_CHECK(be->calculateSOASerial(DNSName("unit.test"),sd,serial));
+ be->getSOA(DNSName("unit.test."),sd);
+ BOOST_CHECK(be->calculateSOASerial(DNSName("unit.test."),sd,serial));
BOOST_CHECK_EQUAL(serial, 2013060300);
}
$notified_serial = 1
$domain = {
- "unit.test" => {
- "SOA" => ["ns.unit.test hostmaster.unit.test 1 2 3 4 5 6"],
- "NS" => ["ns1.unit.test", "ns2.unit.test"],
+ "unit.test." => {
+ "SOA" => ["ns.unit.test. hostmaster.unit.test. 1 2 3 4 5 6"],
+ "NS" => ["ns1.unit.test.", "ns2.unit.test."],
},
- "ns1.unit.test" => {
+ "ns1.unit.test." => {
"A" => ["10.0.0.1"]
},
- "ns2.unit.test" => {
+ "ns2.unit.test." => {
"A" => ["10.0.0.2"]
},
- "empty.unit.test" => {}
+ "empty.unit.test." => {}
}
$meta = {}
$keys = {}
-$tsigkeys = { "test" => {:name => "test", :algorithm => "NULL", :content => "NULL"} }
+$tsigkeys = { "test." => {:name => "test.", :algorithm => "NULL.", :content => "NULL"} }
-$masters = { :name => "ns1.unit.test", :ip => "10.0.0.1" }
+$masters = { :name => "ns1.unit.test.", :ip => "10.0.0.1" }
class Handler
def initialize
def do_list(args)
ret = []
- if args["zonename"] == "unit.test"
+ if args["zonename"] == "unit.test."
$domain.each do |qname,rdata|
rdata.each do |rtype,rc|
rc.each do |rd|
end
def do_getbeforeandafternamesabsolute(args)
- return [ { :unhashed => "middle", :before => "begin", :after => "stop" } ] if args["qname"] == 'middle.unit.test'
+ return [ { :unhashed => "middle.", :before => "begin.", :after => "stop." } ] if args["qname"] == 'middle.unit.test.'
[false]
end
end
def do_getdomaininfo(args)
- if args["name"] == "unit.test"
+ if args["name"] == "unit.test."
return [{
:id => 1,
- :zone => "unit.test",
+ :zone => "unit.test.",
:masters => ["10.0.0.1"],
:notified_serial => $notified_serial,
:serial => $notified_serial,
end
def do_calculatesoaserial(args)
- return [2013060300] if args["sd"]["qname"] == "unit.test"
+ return [2013060300] if args["sd"]["qname"] == "unit.test."
[false]
end
$PDNSSEC --config-dir=. --config-name=remote secure-zone example.com
$PDNSSEC --config-dir=. --config-name=remote secure-zone up.example.com
- ./gsql_feed_ds.pl up.example.com example.com "$PDNSSEC --config-dir=. --config-name=remote" "sqlite3 $testsdir/remote.sqlite3"
+ ./gsql_feed_ds.pl up.example.com. example.com. "$PDNSSEC --config-dir=. --config-name=remote" "sqlite3 $testsdir/remote.sqlite3"
+
+ # fix dot
+ sqlite3 $testsdir/remote.sqlite3 "UPDATE records SET name = 'up.example.com.' WHERE name = 'up.example.com'"
if [ "$remotesec" = "nsec3" ]
then