Skip to content

Commit

Permalink
Merge pull request #6014 from aerique/backport/5930-secpoll-order-agn…
Browse files Browse the repository at this point in the history
…ostic

Backport #5930: secpoll order agnostic
  • Loading branch information
Habbie committed Nov 30, 2017
2 parents 1e61e68 + 346e878 commit 72d524b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
14 changes: 13 additions & 1 deletion pdns/pdns_recursor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2024,7 +2024,19 @@ static void houseKeeping(void *)
try {
doSecPoll(&last_secpoll);
}
catch(...) {}
catch(std::exception& e)
{
L<<Logger::Error<<"Exception while performing security poll: "<<e.what()<<endl;
}
catch(PDNSException& e)
{
L<<Logger::Error<<"Exception while performing security poll: "<<e.reason<<endl;
}
catch(...)
{
L<<Logger::Error<<"Exception while performing security poll"<<endl;
}

}
}
s_running=false;
Expand Down
12 changes: 8 additions & 4 deletions pdns/secpoll-recursor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void doSecPoll(time_t* last_secpoll)
if (g_dnssecmode != DNSSECMode::Off)
sr.d_doDNSSEC=true;
vector<DNSRecord> ret;

string version = "recursor-" +pkgv;
string qstring(version.substr(0, 63)+ ".security-status."+::arg()["security-poll-suffix"]);

Expand All @@ -60,16 +60,20 @@ void doSecPoll(time_t* last_secpoll)
}

if(!res && !ret.empty()) {
string content=ret.begin()->d_content->getZoneRepresentation();
string content;
for(const auto&r : ret) {
if(r.d_type == QType::TXT)
content = r.d_content->getZoneRepresentation();
}

if(!content.empty() && content[0]=='"' && content[content.size()-1]=='"') {
content=content.substr(1, content.length()-2);
}

pair<string, string> split = splitField(content, ' ');

g_security_status = std::stoi(split.first);
g_security_message = split.second;

}
else {
if(pkgv.find("0.0."))
Expand Down

0 comments on commit 72d524b

Please sign in to comment.