]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: Fix getTSIGKeys() return value in GSQL and LMDB backends 11755/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 4 Jul 2022 17:04:44 +0000 (19:04 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 4 Jul 2022 17:04:44 +0000 (19:04 +0200)
These Bind and remote backends return true when at least a TSIG key
is returned, as expected by the API and pdnsutil code, but the GSQL
backend returned false if at least a key was returned and true
otherwise. The LMDB backend always returned false.
This caused `pdnsutil b2b-migrate` not to migrate TSIG keys from a
GSQL or LMDB backend, amongst other things.

modules/lmdbbackend/lmdbbackend.cc
pdns/backends/gsql/gsqlbackend.cc

index e287a0b892390c00068faaf319e76645b6fa7f07..92dbb97293369f0abafde474f55cef22b04fd1cd 100644 (file)
@@ -1745,7 +1745,7 @@ bool LMDBBackend::getTSIGKeys(std::vector<struct TSIGKey>& keys)
   for (auto iter = txn.begin(); iter != txn.end(); ++iter) {
     keys.push_back(*iter);
   }
-  return false;
+  return !keys.empty();
 }
 
 class LMDBFactory : public BackendFactory
index dc9a31947848428a011797fe2396179f1b107597..ab8ef9f5b074dfecfc7f8d9641184d7eb1edbb85 100644 (file)
@@ -976,7 +976,7 @@ bool GSQLBackend::getTSIGKeys(std::vector< struct TSIGKey > &keys)
     throw PDNSException("GSQLBackend unable to retrieve TSIG keys: "+e.txtReason());
   }
 
-  return keys.empty();
+  return !keys.empty();
 }
 
 bool GSQLBackend::getDomainKeys(const DNSName& name, std::vector<KeyData>& keys)