From 70aad5655e46a67ccd2f11bda76dd57d3816e0be Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Fri, 20 Sep 2019 15:21:47 +0200 Subject: [PATCH] auth API: make disabled optional for Record `disabled` defaults to false. --- docs/http-api/swagger/authoritative-api-swagger.yaml | 3 +-- pdns/ws-auth.cc | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/http-api/swagger/authoritative-api-swagger.yaml b/docs/http-api/swagger/authoritative-api-swagger.yaml index 1d037c5f72..574eebd67e 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 32d6fd66f9..c7d1a6e371 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 { -- 2.47.2