[ldns-users] drill -s

Miek Gieben miek at miek.nl
Thu Oct 14 13:15:55 UTC 2010


Hello,

I was wondering if there was a switch in drill which could print the
DS of the keys in the packet. Ofcourse such a switch was already 
there :-)

However it only prints the SHA1 hash. The following patch expands this
a little, so that the SHA256 is also printed. It would make our lives
here at SIDN a little easier.

Kind regards,
Miek Gieben


--- ldns-1.6.4-patched/drill/drill_util.c       2010-10-14 15:06:56.068236505 +0200
+++ ldns-1.6.4/drill/drill_util.c       2010-01-21 11:30:14.000000000 +0100
@@ -103,7 +103,7 @@
 {
        ldns_rr_list *keys;
        uint16_t i;
-       ldns_rr *ds1, *ds2;
+       ldns_rr *ds;
 
        /* TODO fix the section stuff, here or in ldns */
        keys = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_DNSKEY, 
@@ -114,17 +114,12 @@
 
        if (keys) {
                for (i = 0; i < ldns_rr_list_rr_count(keys); i++) {
-                       ds1 = ldns_key_rr2ds(ldns_rr_list_rr(keys, i), LDNS_SHA1);
-                       ds2 = ldns_key_rr2ds(ldns_rr_list_rr(keys, i), LDNS_SHA256);
-                       if (ds1) {
+                       ds = ldns_key_rr2ds(ldns_rr_list_rr(keys, i), LDNS_SHA1);
+                       if (ds) {
                                printf("; ");
-                               ldns_rr_print(stdout, ds1);
+                               ldns_rr_print(stdout, ds);
+                               printf("\n");
                        }
-                       if (ds2) {
-                               printf("; ");
-                               ldns_rr_print(stdout, ds2);
-                       }
-                       printf("\n");
                }
        }
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.nlnetlabs.nl/pipermail/ldns-users/attachments/20101014/fdde2e80/attachment.bin>


More information about the ldns-users mailing list