From 27efa4be12a39dc25a5d5fb768d035ceb864628f Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Tue, 12 Mar 2019 12:47:26 +0100 Subject: [PATCH] auth: report DomainInfo errors in the API --- pdns/ws-auth.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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") { -- 2.39.5