Skip to content

Commit

Permalink
pdnssec check-zone, more tolerant IPv6 format check
Browse files Browse the repository at this point in the history
  • Loading branch information
mind04 committed Nov 22, 2013
1 parent 0dde9d0 commit edb255f
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions pdns/pdnssec.cc
Expand Up @@ -375,10 +375,23 @@ int checkZone(DNSSECKeeper &dk, UeberBackend &B, const std::string& zone)
shared_ptr<DNSRecordContent> drc(DNSRecordContent::mastermake(rr.qtype.getCode(), 1, rr.content));
string tmp=drc->serialize(rr.qname);
tmp = drc->getZoneRepresentation();
if (!pdns_iequals(tmp, rr.content)) {
cout<<"[Warning] Parsed and original record content are not equal: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " '" << rr.content<<"' (Content parsed as '"<<tmp<<"')"<<endl;
if (rr.qtype.getCode() != QType::AAAA) {
if (!pdns_iequals(tmp, rr.content)) {
cout<<"[Warning] Parsed and original record content are not equal: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " '" << rr.content<<"' (Content parsed as '"<<tmp<<"')"<<endl;
rr.content=tmp;
numwarnings++;
}
} else {
struct addrinfo hint, *res;
memset(&hint, 0, sizeof(hint));
hint.ai_family = AF_INET6;
hint.ai_flags = AI_NUMERICHOST;
if(getaddrinfo(rr.content.c_str(), 0, &hint, &res)) {
cout<<"[Warning] Folowing record is not a vallid IPv6 address: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " '" << rr.content<<"'"<<endl;
numwarnings++;
} else
freeaddrinfo(res);
rr.content=tmp;
numwarnings++;
}
}
catch(std::exception& e)
Expand Down

0 comments on commit edb255f

Please sign in to comment.