]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add directory to dst_key structure
authorMatthijs Mekking <matthijs@isc.org>
Wed, 9 Mar 2022 10:27:03 +0000 (11:27 +0100)
committerMatthijs Mekking <matthijs@isc.org>
Thu, 25 Jan 2024 13:41:25 +0000 (14:41 +0100)
Store key directory when reading the key from file. This is the
directory it was read from and can be used when saving the key back
to disk.

lib/dns/dst_api.c
lib/dns/dst_internal.h

index ca814100896d3b3f102d79332523ba12456e8047..803214c096f3c867d5da0ae4daf805d357f58247 100644 (file)
@@ -691,6 +691,10 @@ dst_key_fromnamedfile(const char *filename, const char *dirname, int type,
        }
 
        key->modified = false;
+
+       if (dirname != NULL) {
+               key->directory = isc_mem_strdup(mctx, dirname);
+       }
        *keyp = key;
        key = NULL;
 
@@ -1395,6 +1399,9 @@ dst_key_free(dst_key_t **keyp) {
                        INSIST(key->func->destroy != NULL);
                        key->func->destroy(key);
                }
+               if (key->directory != NULL) {
+                       isc_mem_free(mctx, key->directory);
+               }
                if (key->engine != NULL) {
                        isc_mem_free(mctx, key->engine);
                }
index a4fcc05bd8455bf940e8d20ef85ba401d71a2f86..7026e7ffae8cd3f441857644b95352bc955f6856 100644 (file)
@@ -91,6 +91,7 @@ struct dst_key {
        dns_rdataclass_t key_class; /*%< class of the key record */
        dns_ttl_t key_ttl;          /*%< default/initial dnskey ttl */
        isc_mem_t *mctx;            /*%< memory context */
+       char *directory;            /*%< key directory */
        char *engine;               /*%< engine name (HSM) */
        char *label;                /*%< engine label (HSM) */
        char *object;               /*%< engine object (HSM) */