From: Pieter Lexis Date: Tue, 12 Mar 2019 11:47:26 +0000 (+0100) Subject: auth: report DomainInfo errors in the API X-Git-Tag: rec-4.2.0-rc1~35^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=27efa4be12a39dc25a5d5fb768d035ceb864628f;p=thirdparty%2Fpdns.git auth: report DomainInfo errors in the API --- diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index d2c3f9ae0d..df59b7eaf1 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -620,6 +620,11 @@ static void updateDomainSettingsFromDocument(UeberBackend& B, const DomainInfo& string master = value.string_value(); if (master.empty()) throw ApiException("Master can not be an empty string"); + try { + ComboAddress m(master); + } catch (const PDNSException &e) { + throw ApiException("Master (" + master + ") is not an IP address: " + e.reason); + } zonemaster.push_back(master); } @@ -1689,8 +1694,12 @@ static void apiServerZoneDetail(HttpRequest* req, HttpResponse* resp) { UeberBackend B; DomainInfo di; - if (!B.getDomainInfo(zonename, di)) { - throw HttpNotFoundException(); + try { + if (!B.getDomainInfo(zonename, di)) { + throw HttpNotFoundException(); + } + } catch(const PDNSException &e) { + throw HttpInternalServerErrorException("Could not retrieve Domain Info: " + e.reason); } if(req->method == "PUT") {