]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Make add-zone-key try to retrieve it back to confirm operation. 15025/head
authorMiod Vallat <miod.vallat@open-xchange.com>
Thu, 9 Jan 2025 14:55:16 +0000 (15:55 +0100)
committerMiod Vallat <miod.vallat@open-xchange.com>
Thu, 9 Jan 2025 14:55:16 +0000 (15:55 +0100)
pdns/pdnsutil.cc

index a808f4711e73be9470d2d5a50a68bbcb83d4cfb4..866a442d534bc52c3df267230b92f8d8bf654a22 100644 (file)
@@ -2590,8 +2590,15 @@ static int addZoneKey(vector<string>& cmds, DNSSECKeeper& dk) //NOLINT(readabili
     cerr<<std::to_string(id)<<": Key was added, but backend does not support returning of key id"<<endl;
   } else if (id < -1) {
     cerr<<std::to_string(id)<<": Key was added, but there was a failure while returning the key id"<<endl;
+    return 1;
   } else {
-    cout<<std::to_string(id)<<endl;
+    try {
+      dk.getKeyById(zone, id);
+      cout<<std::to_string(id)<<endl;
+    } catch (std::exception& e) {
+      cerr<<std::to_string(id)<<": Key was added, but there was a failure while reading it back: " <<e.what()<<endl;
+      return 1;
+    }
   }
   return 0;
 }