]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
remote-backend: change nonterm type for feedENT() and feedEnt3()
authorKees Monshouwer <mind04@monshouwer.org>
Fri, 21 Feb 2014 23:17:20 +0000 (00:17 +0100)
committermind04 <mind04@monshouwer.org>
Fri, 21 Feb 2014 23:46:20 +0000 (00:46 +0100)
modules/remotebackend/remotebackend.cc
modules/remotebackend/remotebackend.hh
modules/remotebackend/test-remotebackend.cc

index fc3d9799ddac5a6739d8a6c50ceed855599bbb0f..580c890e9de8c9185a79b5b3f33638c61c72ca99 100644 (file)
@@ -777,7 +777,7 @@ bool RemoteBackend::feedRecord(const DNSResourceRecord &rr, string *ordername) {
    return true; // XXX FIXME this API should not return 'true' I think -ahu
 }
 
-bool RemoteBackend::feedEnts(int domain_id, set<string>& nonterm) {
+bool RemoteBackend::feedEnts(int domain_id, map<string,bool>& nonterm) {
    rapidjson::Document query,answer;
    rapidjson::Value parameters;
    rapidjson::Value nts;
@@ -787,8 +787,9 @@ bool RemoteBackend::feedEnts(int domain_id, set<string>& nonterm) {
    JSON_ADD_MEMBER(parameters, "domain_id", domain_id, query.GetAllocator());
    JSON_ADD_MEMBER(parameters, "trxid", d_trxid, query.GetAllocator());
    nts.SetArray();
-   BOOST_FOREACH(const string &t, nonterm) {
-      nts.PushBack(t.c_str(), query.GetAllocator());
+   pair<string,bool> t;
+   BOOST_FOREACH(t, nonterm) {
+      nts.PushBack(t.first.c_str(), query.GetAllocator());
    }
    parameters.AddMember("nonterm", nts, query.GetAllocator());
    query.AddMember("parameters", parameters, query.GetAllocator());
@@ -798,7 +799,7 @@ bool RemoteBackend::feedEnts(int domain_id, set<string>& nonterm) {
    return true; 
 }
 
-bool RemoteBackend::feedEnts3(int domain_id, const string &domain, set<string> &nonterm, unsigned int times, const string &salt, bool narrow) {
+bool RemoteBackend::feedEnts3(int domain_id, const string &domain, map<string,bool> &nonterm, unsigned int times, const string &salt, bool narrow) {
    rapidjson::Document query,answer;
    rapidjson::Value parameters;
    rapidjson::Value nts;
@@ -813,8 +814,9 @@ bool RemoteBackend::feedEnts3(int domain_id, const string &domain, set<string> &
    JSON_ADD_MEMBER(parameters, "trxid", d_trxid, query.GetAllocator());
 
    nts.SetArray();
-   BOOST_FOREACH(const string &t, nonterm) {
-      nts.PushBack(t.c_str(), query.GetAllocator());
+   pair<string,bool> t;
+   BOOST_FOREACH(t, nonterm) {
+      nts.PushBack(t.first.c_str(), query.GetAllocator());
    }
    parameters.AddMember("nonterm", nts, query.GetAllocator());
    query.AddMember("parameters", parameters, query.GetAllocator());
index 9bfa087ffeba2843079e14cc0825ca1d7e8f058e..f695c43740706e870a1894dbbb707491b5579907 100644 (file)
@@ -149,8 +149,8 @@ class RemoteBackend : public DNSBackend
   virtual bool createSlaveDomain(const string &ip, const string &domain, const string &nameserver, const string &account);
   virtual bool replaceRRSet(uint32_t domain_id, const string& qname, const QType& qt, const vector<DNSResourceRecord>& rrset);
   virtual bool feedRecord(const DNSResourceRecord &r, string *ordername);
-  virtual bool feedEnts(int domain_id, set<string>& nonterm);
-  virtual bool feedEnts3(int domain_id, const string &domain, set<string> &nonterm, unsigned int times, const string &salt, bool narrow);
+  virtual bool feedEnts(int domain_id, map<string,bool>& nonterm);
+  virtual bool feedEnts3(int domain_id, const string &domain, map<string,bool> &nonterm, unsigned int times, const string &salt, bool narrow);
   virtual bool startTransaction(const string &domain, int domain_id);
   virtual bool commitTransaction();
   virtual bool abortTransaction();
index 8057d199a7f01fa7d03969121b6d79665e5b9c8b..2e55e00fd92c04e341f61e47a37c63ea6a907259 100644 (file)
@@ -258,7 +258,7 @@ BOOST_AUTO_TEST_CASE(test_method_replaceRRSet) {
 BOOST_AUTO_TEST_CASE(test_method_feedEnts) {
    BOOST_TEST_MESSAGE("Testing feedEnts method");
    be->startTransaction("example.com",2);
-   set<string> nonterm = boost::assign::list_of("_udp")("_sip._udp");
+   map<string, bool> nonterm = boost::assign::map_list_of("_udp", true)("_sip._udp", true);
    BOOST_CHECK(be->feedEnts(2, nonterm));
    be->commitTransaction();
 }
@@ -266,7 +266,7 @@ BOOST_AUTO_TEST_CASE(test_method_feedEnts) {
 BOOST_AUTO_TEST_CASE(test_method_feedEnts3) {
    BOOST_TEST_MESSAGE("Testing feedEnts3 method");
    be->startTransaction("example.com",2);
-   set<string> nonterm = boost::assign::list_of("_udp")("_sip._udp");
+   map<string, bool> nonterm = boost::assign::map_list_of("_udp", true)("_sip._udp", true);
    BOOST_CHECK(be->feedEnts3(2, "example.com", nonterm, 1, "\xaa\xbb\xcc\xdd", 0));
    be->commitTransaction();
 }