From: Peter van Dijk Date: Sun, 24 Feb 2019 10:32:12 +0000 (+0100) Subject: report checkKey errors upwards in makeFromISCFile exception X-Git-Tag: auth-4.2.0-rc1~17^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=be135eeb7e17137dd8be2fd28f7c532a6bc897a2;p=thirdparty%2Fpdns.git report checkKey errors upwards in makeFromISCFile exception --- diff --git a/pdns/dnssecinfra.cc b/pdns/dnssecinfra.cc index 8d9f9da625..233b228b12 100644 --- a/pdns/dnssecinfra.cc +++ b/pdns/dnssecinfra.cc @@ -63,8 +63,14 @@ shared_ptr DNSCryptoKeyEngine::makeFromISCFile(DNSKEYRecordC fp.reset(); shared_ptr dke = makeFromISCString(drc, isc); - if(!dke->checkKey()) { - throw runtime_error("Invalid DNS Private Key in file '"+string(fname)); + vector checkKeyErrors; + + if(!dke->checkKey(&checkKeyErrors)) { + string reason; + if(checkKeyErrors.size()) { + reason = " ("+boost::algorithm::join(checkKeyErrors, ", ")+")"; + } + throw runtime_error("Invalid DNS Private Key in file '"+string(fname)+"'"+reason); } return dke; }