From: Pieter Lexis Date: Tue, 12 Jul 2016 17:20:34 +0000 (+0200) Subject: Add some sanity checking to rec_control wipe-cache X-Git-Tag: rec-3.7.4~1^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F4165%2Fhead;p=thirdparty%2Fpdns.git Add some sanity checking to rec_control wipe-cache Closes #4098 --- diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index aefce242de..2b96b2a5f1 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -242,8 +242,22 @@ template string doWipeCache(T begin, T end) { int count=0, countNeg=0; + + vector toWipe; + for(T i=begin; i != end; ++i) { string canon=toCanonic("", *i); + + if (canon[0] == '.') + return "dot found in the first place of " + canon + ". Nothing wiped.\n"; + + if (canon.find("..") != string::npos) + return "double dot found in " + canon + ". Nothing wiped.\n"; + + toWipe.push_back(canon); + } + + BOOST_FOREACH(const string& canon, toWipe) { count+= broadcastAccFunction(boost::bind(pleaseWipeCache, canon)); countNeg+=broadcastAccFunction(boost::bind(pleaseWipeAndCountNegCache, canon)); }