]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Use DNSName in Pipe backend
authorAki Tuomi <cmouse@cmouse.fi>
Mon, 15 Jun 2015 10:48:44 +0000 (13:48 +0300)
committermind04 <mind04@monshouwer.org>
Tue, 30 Jun 2015 06:12:48 +0000 (08:12 +0200)
modules/pipebackend/pipebackend.cc
modules/pipebackend/pipebackend.hh

index 2d6e9b78f55ff8453485522f62e3102aaf20b47f..573defa661458daa72351757a3462bf3952496a4 100644 (file)
@@ -109,11 +109,11 @@ PipeBackend::PipeBackend(const string &suffix)
    }
 }
 
-void PipeBackend::lookup(const QType &qtype,const string &qname, DNSPacket *pkt_p,  int zoneId)
+void PipeBackend::lookup(const QType& qtype,const DNSName& qname, DNSPacket *pkt_p,  int zoneId)
 {
    try {
       d_disavow=false;
-      if(d_regex && !d_regex->match(qname+";"+qtype.getName())) { 
+      if(d_regex && !d_regex->match(qname.toStringNoDot()+";"+qtype.getName())) { 
          if(::arg().mustDo("query-logging"))
             L<<Logger::Error<<"Query for '"<<qname<<"' type '"<<qtype.getName()<<"' failed regex '"<<d_regexstr<<"'"<<endl;
          d_disavow=true; // don't pass to backend
@@ -129,7 +129,7 @@ void PipeBackend::lookup(const QType &qtype,const string &qname, DNSPacket *pkt_
          }
          // pipebackend-abi-version = 1
          // type    qname           qclass  qtype   id      remote-ip-address
-         query<<"Q\t"<<qname<<"\tIN\t"<<qtype.getName()<<"\t"<<zoneId<<"\t"<<remoteIP;
+         query<<"Q\t"<<qname.toStringNoDot()<<"\tIN\t"<<qtype.getName()<<"\t"<<zoneId<<"\t"<<remoteIP;
 
          // add the local-ip-address if pipebackend-abi-version is set to 2
          if (d_abiVersion >= 2)
@@ -150,7 +150,7 @@ void PipeBackend::lookup(const QType &qtype,const string &qname, DNSPacket *pkt_
    d_qname=qname;
 }
 
-bool PipeBackend::list(const string &target, int inZoneId, bool include_disabled)
+bool PipeBackend::list(const DNSName& target, int inZoneId, bool include_disabled)
 {
    try {
       d_disavow=false;
@@ -159,7 +159,7 @@ bool PipeBackend::list(const string &target, int inZoneId, bool include_disabled
 
 // type    qname           qclass  qtype   id      ip-address
       if (d_abiVersion >= 4)
-        query<<"AXFR\t"<<inZoneId<<"\t"<<target;
+        query<<"AXFR\t"<<inZoneId<<"\t"<<target.toStringNoDot();
       else
         query<<"AXFR\t"<<inZoneId;
 
index fe51bfc35e7defe3cd0d3e7c264ceac5d9e44d5b..e1b732327eafe1f7d62c8bc05b29bcb4e123d5c6 100644 (file)
@@ -37,15 +37,15 @@ class PipeBackend : public DNSBackend
 public:
   PipeBackend(const string &suffix="");
   ~PipeBackend();
-  void lookup(const QType &, const string &qdomain, DNSPacket *p=0, int zoneId=-1);
-  bool list(const string &target, int domain_id, bool include_disabled=false);
+  void lookup(const QType&, const DNSName& qdomain, DNSPacket *p=0, int zoneId=-1);
+  bool list(const DNSName& target, int domain_id, bool include_disabled=false);
   bool get(DNSResourceRecord &r);
   
   static DNSBackend *maker();
   
 private:
   shared_ptr<CoWrapper> d_coproc;
-  string d_qname;
+  DNSName d_qname;
   QType d_qtype;
   Regex* d_regex;
   string d_regexstr;