]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: rr - SSHFP contains the fingerprint, not the key
authorTom Gundersen <teg@jklm.no>
Thu, 23 Jul 2015 11:09:35 +0000 (13:09 +0200)
committerTom Gundersen <teg@jklm.no>
Thu, 23 Jul 2015 16:01:50 +0000 (18:01 +0200)
Rename the field to make this clearer.

src/resolve/resolved-dns-packet.c
src/resolve/resolved-dns-rr.c
src/resolve/resolved-dns-rr.h

index 955d513d7c7c4ac05192b87c87a462bf0f827f86..af219ce4ff453cfd088f421f795af527f8c139d9 100644 (file)
@@ -761,7 +761,7 @@ int dns_packet_append_rr(DnsPacket *p, const DnsResourceRecord *rr, size_t *star
                 if (r < 0)
                         goto fail;
 
-                r = dns_packet_append_blob(p, rr->sshfp.key, rr->sshfp.key_size, NULL);
+                r = dns_packet_append_blob(p, rr->sshfp.fingerprint, rr->sshfp.fingerprint_size, NULL);
                 break;
 
         case DNS_TYPE_DNSKEY:
@@ -1531,10 +1531,10 @@ int dns_packet_read_rr(DnsPacket *p, DnsResourceRecord **ret, size_t *start) {
                         goto fail;
 
                 r = dns_packet_read_memdup(p, rdlength - 2,
-                                           &rr->sshfp.key, &rr->sshfp.key_size,
+                                           &rr->sshfp.fingerprint, &rr->sshfp.fingerprint_size,
                                            NULL);
 
-                if (rr->sshfp.key_size <= 0) {
+                if (rr->sshfp.fingerprint_size <= 0) {
                         /* the accepted size depends on the algorithm, but for now
                            just ensure that the value is greater than zero */
                         r = -EBADMSG;
index 9efe4b3c0855f24739a3cb2e1be4ab1e48dc2eed..2bc9f2b52056357108e0cfa4cda897316fed8d40 100644 (file)
@@ -276,7 +276,7 @@ DnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr) {
                         break;
 
                 case DNS_TYPE_SSHFP:
-                        free(rr->sshfp.key);
+                        free(rr->sshfp.fingerprint);
                         break;
 
                 case DNS_TYPE_DNSKEY:
@@ -434,8 +434,8 @@ int dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecor
         case DNS_TYPE_SSHFP:
                 return a->sshfp.algorithm == b->sshfp.algorithm &&
                        a->sshfp.fptype == b->sshfp.fptype &&
-                       a->sshfp.key_size == b->sshfp.key_size &&
-                       memcmp(a->sshfp.key, b->sshfp.key, a->sshfp.key_size) == 0;
+                       a->sshfp.fingerprint_size == b->sshfp.fingerprint_size &&
+                       memcmp(a->sshfp.fingerprint, b->sshfp.fingerprint, a->sshfp.fingerprint_size) == 0;
 
         case DNS_TYPE_DNSKEY:
                 return a->dnskey.zone_key_flag == b->dnskey.zone_key_flag &&
@@ -687,7 +687,7 @@ int dns_resource_record_to_string(const DnsResourceRecord *rr, char **ret) {
                 break;
 
         case DNS_TYPE_SSHFP:
-                t = hexmem(rr->sshfp.key, rr->sshfp.key_size);
+                t = hexmem(rr->sshfp.fingerprint, rr->sshfp.fingerprint_size);
                 if (!t)
                         return -ENOMEM;
 
index dc51126f9769b5fa5e9aae99cb642a725a67d1b7..0f40f3ceef1410bd6907846a2912caa69a31b70c 100644 (file)
@@ -117,11 +117,12 @@ struct DnsResourceRecord {
                         size_t digest_size;
                 } ds;
 
+                /* https://tools.ietf.org/html/rfc4255#section-3.1 */
                 struct {
                         uint8_t algorithm;
                         uint8_t fptype;
-                        void *key;
-                        size_t key_size;
+                        void *fingerprint;
+                        size_t fingerprint_size;
                 } sshfp;
 
                 /* http://tools.ietf.org/html/rfc4034#section-2.1 */