]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Handle deprecated 'trusted-keys' style anchors
authorMark Andrews <marka@isc.org>
Wed, 20 May 2020 04:22:40 +0000 (14:22 +1000)
committerMark Andrews <marka@isc.org>
Mon, 25 May 2020 23:18:34 +0000 (09:18 +1000)
(cherry picked from commit d807febd25ed276cda720ef9a0841680f4295ee1)

bin/delv/delv.c

index 0525b2c6fa6431a478280949612bab1a45dca7f9..478d665d07117ddf0cebd9ca0bd77a517eb6c9e7 100644 (file)
@@ -606,6 +606,7 @@ key_fromconfig(const cfg_obj_t *key, dns_client_t *client) {
               INITIAL_DS,
               STATIC_DS,
               TRUSTED } anchortype;
+       const cfg_obj_t *obj;
 
        keynamestr = cfg_obj_asstring(cfg_tuple_get(key, "name"));
        CHECK(convert_name(&fkeyname, &keyname, keynamestr));
@@ -638,21 +639,30 @@ key_fromconfig(const cfg_obj_t *key, dns_client_t *client) {
        rdata3 = cfg_obj_asuint32(cfg_tuple_get(key, "rdata3"));
 
        /* What type of trust anchor is this? */
-       atstr = cfg_obj_asstring(cfg_tuple_get(key, "anchortype"));
-       if (strcasecmp(atstr, "static-key") == 0) {
+       obj = cfg_tuple_get(key, "anchortype");
+       if (cfg_obj_isvoid(obj)) {
+               /*
+                * "anchortype" is not defined, this must be a static-key
+                * configured with trusted-keys.
+                */
                anchortype = STATIC_KEY;
-       } else if (strcasecmp(atstr, "static-ds") == 0) {
-               anchortype = STATIC_DS;
-       } else if (strcasecmp(atstr, "initial-key") == 0) {
-               anchortype = INITIAL_KEY;
-       } else if (strcasecmp(atstr, "initial-ds") == 0) {
-               anchortype = INITIAL_DS;
        } else {
-               delv_log(ISC_LOG_ERROR,
-                        "key '%s': invalid initialization method '%s'",
-                        keynamestr, atstr);
-               result = ISC_R_FAILURE;
-               goto cleanup;
+               atstr = cfg_obj_asstring(obj);
+               if (strcasecmp(atstr, "static-key") == 0) {
+                       anchortype = STATIC_KEY;
+               } else if (strcasecmp(atstr, "static-ds") == 0) {
+                       anchortype = STATIC_DS;
+               } else if (strcasecmp(atstr, "initial-key") == 0) {
+                       anchortype = INITIAL_KEY;
+               } else if (strcasecmp(atstr, "initial-ds") == 0) {
+                       anchortype = INITIAL_DS;
+               } else {
+                       delv_log(ISC_LOG_ERROR,
+                                "key '%s': invalid initialization method '%s'",
+                                keynamestr, atstr);
+                       result = ISC_R_FAILURE;
+                       goto cleanup;
+               }
        }
 
        isc_buffer_init(&databuf, data, sizeof(data));