]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add option to dnssec-dsfromkey to chop up rdata
authorMatthijs Mekking <matthijs@isc.org>
Mon, 4 Mar 2024 09:14:56 +0000 (10:14 +0100)
committerMatthijs Mekking <matthijs@isc.org>
Fri, 19 Apr 2024 11:52:21 +0000 (13:52 +0200)
The new option 'w' allows us to print DS rdata with the base64 portions
split up in chunks. This is mainly done for testing purposes.

bin/dnssec/dnssec-dsfromkey.c

index 863573ddbac13768ba8487a81b9c6369674e4a00..422abad267f4c4445ea7497ca7ea8e05800abb79 100644 (file)
@@ -54,6 +54,7 @@ static dns_name_t *name = NULL;
 static isc_mem_t *mctx = NULL;
 static uint32_t ttl;
 static bool emitttl = false;
+static unsigned int split_width = 0;
 
 static isc_result_t
 initname(char *setname) {
@@ -279,8 +280,8 @@ emit(dns_dsdigest_t dt, bool showall, bool cds, dns_rdata_t *rdata) {
                fatal("can't print name");
        }
 
-       result = dns_rdata_tofmttext(&ds, (dns_name_t *)NULL, 0, 0, 0, "",
-                                    &textb);
+       result = dns_rdata_tofmttext(&ds, (dns_name_t *)NULL, 0, 0, split_width,
+                                    "", &textb);
 
        if (result != ISC_R_SUCCESS) {
                fatal("can't print rdata");
@@ -347,6 +348,7 @@ usage(void) {
                        "    -f zonefile: read keys from a zone file\n"
                        "    -h: print help information\n"
                        "    -K directory: where to find key or keyset files\n"
+                       "    -w split base64 rdata text into chunks\n"
                        "    -s: read keys from keyset-<dnsname> file\n"
                        "    -T: TTL of output records (omitted by default)\n"
                        "    -v level: verbosity\n"
@@ -380,7 +382,7 @@ main(int argc, char **argv) {
 
        isc_commandline_errprint = false;
 
-#define OPTIONS "12Aa:Cc:d:Ff:K:l:sT:v:hV"
+#define OPTIONS "12Aa:Cc:d:Ff:K:l:sT:v:whV"
        while ((ch = isc_commandline_parse(argc, argv, OPTIONS)) != -1) {
                switch (ch) {
                case '1':
@@ -432,6 +434,9 @@ main(int argc, char **argv) {
                                fatal("-v must be followed by a number");
                        }
                        break;
+               case 'w':
+                       split_width = UINT_MAX;
+                       break;
                case 'F':
                        /* Reserved for FIPS mode */
                        FALLTHROUGH;