From: Pieter Lexis Date: Fri, 20 Sep 2019 13:21:47 +0000 (+0200) Subject: auth API: make disabled optional for Record X-Git-Tag: dnsdist-1.4.0-rc4~18^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=70aad5655e46a67ccd2f11bda76dd57d3816e0be;p=pdns auth API: make disabled optional for Record `disabled` defaults to false. --- diff --git a/docs/http-api/swagger/authoritative-api-swagger.yaml b/docs/http-api/swagger/authoritative-api-swagger.yaml index 1d037c5f7..574eebd67 100644 --- a/docs/http-api/swagger/authoritative-api-swagger.yaml +++ b/docs/http-api/swagger/authoritative-api-swagger.yaml @@ -1017,14 +1017,13 @@ definitions: description: The RREntry object represents a single record. required: - content - - disabled # PatchZone endpoint complains if this is missing properties: content: type: string description: 'The content of this record' disabled: type: boolean - description: 'Whether or not this record is disabled' + description: 'Whether or not this record is disabled. When unset, the record is not disabled' set-ptr: type: boolean description: 'If set to true, the server will find the matching reverse zone and create a PTR there. Existing PTR records are replaced. If no matching reverse Zone, an error is thrown. Only valid in client bodies, only valid for A and AAAA types. Not returned by the server. This feature is deprecated and will be removed in 4.3.0.' diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 32d6fd66f..c7d1a6e37 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -537,7 +537,10 @@ static void gatherRecords(const string& logprefix, const Json container, const D const auto& items = container["records"].array_items(); for(const auto& record : items) { string content = stringFromJson(record, "content"); - rr.disabled = boolFromJson(record, "disabled"); + rr.disabled = false; + if(!record["disabled"].is_null()) { + rr.disabled = boolFromJson(record, "disabled"); + } // validate that the client sent something we can actually parse, and require that data to be dotted. try {