From 3deb283ecadc55be49759a13d1d9cf8f84b750d9 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 20 Dec 2019 13:04:23 +0100 Subject: [PATCH] auth: Clear the TSIG algo between iterations in the API Otherwise `GSQLBackend::getTSIGKey()` will try to match the algorithm in `keyAlgo` if it's set, which will prevent retrieving a key with a different algorithm that the previous one. --- pdns/ws-auth.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 85d64d7752..a7a2850b4b 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -778,10 +778,10 @@ static void updateDomainSettingsFromDocument(UeberBackend& B, const DomainInfo& if (!document["master_tsig_key_ids"].is_null()) { vector metadata; - DNSName keyAlgo; - string keyContent; for(auto value : document["master_tsig_key_ids"].array_items()) { auto keyname(apiZoneIdToName(value.string_value())); + DNSName keyAlgo; + string keyContent; B.getTSIGKey(keyname, &keyAlgo, &keyContent); if (keyAlgo.empty() || keyContent.empty()) { throw ApiException("A TSIG key with the name '"+keyname.toLogString()+"' does not exist"); @@ -794,10 +794,10 @@ static void updateDomainSettingsFromDocument(UeberBackend& B, const DomainInfo& } if (!document["slave_tsig_key_ids"].is_null()) { vector metadata; - DNSName keyAlgo; - string keyContent; for(auto value : document["slave_tsig_key_ids"].array_items()) { auto keyname(apiZoneIdToName(value.string_value())); + DNSName keyAlgo; + string keyContent; B.getTSIGKey(keyname, &keyAlgo, &keyContent); if (keyAlgo.empty() || keyContent.empty()) { throw ApiException("A TSIG key with the name '"+keyname.toLogString()+"' does not exist"); -- 2.47.2