Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DNSName in Pipe backend #11

Merged
merged 1 commit into from
Jun 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions modules/pipebackend/pipebackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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;
Expand All @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions modules/pipebackend/pipebackend.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down