]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix a typo RSASHA236 -> RSASHA256
authorTony Finch <fanf@isc.org>
Fri, 9 Dec 2022 12:52:05 +0000 (12:52 +0000)
committerTony Finch <fanf@isc.org>
Tue, 13 Dec 2022 16:58:02 +0000 (16:58 +0000)
Use dns_secalg_format() to avoid error-prone repetition.

CHANGES
lib/dns/zone.c

diff --git a/CHANGES b/CHANGES
index 224e8f8604b1e2780cf99c33e595cbee3c158f38..11e35c00af44d424846b04a591294f99d532da7a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+6044.  [bug]           There was an "RSASHA236" typo in a log message.
+                       [GL !7206]
+
 6043.  [bug]           The key file IO locks objects would never get
                        deleted from the hashtable due to off-by-one error.
                        [GL #3727]
index d60f06124195a27df79ae87154b944a5576ee227..7ec308c8ef7e0903cb8ec2aba58684c01f06c4f1 100644 (file)
@@ -3601,42 +3601,24 @@ zone_check_dnskeys(dns_zone_t *zone, dns_db_t *db) {
                 * fermat number).
                 */
                if (dnskey.datalen > 1 && dnskey.data[0] == 1 &&
-                   dnskey.data[1] == 3)
+                   dnskey.data[1] == 3 &&
+                   (dnskey.algorithm == DNS_KEYALG_RSAMD5 ||
+                    dnskey.algorithm == DNS_KEYALG_RSASHA1 ||
+                    dnskey.algorithm == DNS_KEYALG_NSEC3RSASHA1 ||
+                    dnskey.algorithm == DNS_KEYALG_RSASHA256 ||
+                    dnskey.algorithm == DNS_KEYALG_RSASHA512))
                {
-                       const char *algorithm = "";
+                       char algorithm[DNS_SECALG_FORMATSIZE];
                        isc_region_t r;
-                       bool logit = true;
 
                        dns_rdata_toregion(&rdata, &r);
+                       dns_secalg_format(dnskey.algorithm, algorithm,
+                                         sizeof(algorithm));
 
-                       switch (dnskey.algorithm) {
-                       case DNS_KEYALG_RSAMD5:
-                               algorithm = "RSAMD5";
-                               break;
-                       case DNS_KEYALG_RSASHA1:
-                               algorithm = "RSASHA1";
-                               break;
-                       case DNS_KEYALG_NSEC3RSASHA1:
-                               algorithm = "NSEC3RSASHA1";
-                               break;
-                       case DNS_KEYALG_RSASHA256:
-                               algorithm = "RSASHA236";
-                               break;
-                       case DNS_KEYALG_RSASHA512:
-                               algorithm = "RSASHA512";
-                               break;
-                       default:
-                               logit = false;
-                               break;
-                       }
-
-                       if (logit) {
-                               dnssec_log(zone, ISC_LOG_WARNING,
-                                          "weak %s (%u) key found "
-                                          "(exponent=3, id=%u)",
-                                          algorithm, dnskey.algorithm,
-                                          dst_region_computeid(&r));
-                       }
+                       dnssec_log(zone, ISC_LOG_WARNING,
+                                  "weak %s (%u) key found (exponent=3, id=%u)",
+                                  algorithm, dnskey.algorithm,
+                                  dst_region_computeid(&r));
                }
                dns_rdata_reset(&rdata);
        }