]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Auth: always initialize id passed to dk.addKey 12086/head
authorChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Sat, 12 Aug 2023 13:31:44 +0000 (15:31 +0200)
committerChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Sat, 12 Aug 2023 13:31:44 +0000 (15:31 +0200)
pdns/pdnsutil.cc
pdns/ws-auth.cc

index bdf0d3347b977f1cc8e93512ff311dbf611f18ab..52ea3bd029dc6a6af5d895b34c9a3e4457e508a8 100644 (file)
@@ -2265,7 +2265,7 @@ static bool showZone(DNSSECKeeper& dk, const DNSName& zone, bool exportDS = fals
 static bool secureZone(DNSSECKeeper& dk, const DNSName& zone)
 {
   // temp var for addKey
-  int64_t id;
+  int64_t id{-1};
 
   // parse attribute
   string k_algo = ::arg()["default-ksk-algorithm"];
@@ -3068,7 +3068,7 @@ try
         return EXIT_FAILURE;
       }
     }
-    int64_t id;
+    int64_t id{-1};
     if (!dk.addKey(zone, keyOrZone, algorithm, id, bits, active, published)) {
       cerr<<"Adding key failed, perhaps DNSSEC not enabled in configuration?"<<endl;
       return 1;
@@ -3577,7 +3577,7 @@ try
     }
     dpk.setKey(key, flags, algo);
 
-    int64_t id;
+    int64_t id{-1};
     if (!dk.addKey(DNSName(zone), dpk, id)) {
       cerr << "Adding key failed, perhaps DNSSEC not enabled in configuration?" << endl;
       return 1;
@@ -3633,7 +3633,7 @@ try
     }
     dpk.setKey(key, flags, algo);
 
-    int64_t id;
+    int64_t id{-1};
     if (!dk.addKey(DNSName(zone), dpk, id, active, published)) {
       cerr<<"Adding key failed, perhaps DNSSEC not enabled in configuration?"<<endl;
       return 1;
@@ -3963,7 +3963,6 @@ try
         return 1;
       }
 
-      int64_t id;
       bool keyOrZone = (cmds.at(4) == "ksk" ? true : false);
       string module = cmds.at(5);
       string slot = cmds.at(6);
@@ -3996,8 +3995,8 @@ try
 
       // make sure this key isn't being reused.
       B.getDomainKeys(zone, keys);
-      id = -1;
 
+      int64_t id{-1};
       for(DNSBackend::KeyData& kd :  keys) {
         if (kd.content == iscString.str()) {
           // it's this one, I guess...
index 8f6775c6e1b28e16cee13c0ab2857d01edc42430..fc8d7832fa3ab9fe5abcc4f5bd2046ef64a8d462 100644 (file)
@@ -629,14 +629,14 @@ static void addDefaultDNSSECKeys(DNSSECKeeper& dk, const DNSName& zonename) {
   int z_size = arg().asNum("default-zsk-size");
 
   if (k_algo != -1) {
-    int64_t id;
+    int64_t id{-1};
     if (!dk.addKey(zonename, true, k_algo, id, k_size)) {
       throwUnableToSecure(zonename);
     }
   }
 
   if (z_algo != -1) {
-    int64_t id;
+    int64_t id{-1};
     if (!dk.addKey(zonename, false, z_algo, id, z_size)) {
       throwUnableToSecure(zonename);
     }