diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-07-31 18:41:41 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-07-31 18:41:41 +0200 |
commit | 42cc2eebb01056beb7acd3ecfe8e533558237f84 (patch) | |
tree | f6d632ce803b51dd885f919ec94412fcd10087f2 /src/resolve/resolved-dns-rr.c | |
parent | 9c92ce6d67f88beb31dd6555d12ae3f632218a39 (diff) |
resolved: properly process SSHFP RRs
Diffstat (limited to 'src/resolve/resolved-dns-rr.c')
-rw-r--r-- | src/resolve/resolved-dns-rr.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c index 9ef3135c23..04004de5e7 100644 --- a/src/resolve/resolved-dns-rr.c +++ b/src/resolve/resolved-dns-rr.c @@ -265,6 +265,10 @@ DnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr) { free(rr->mx.exchange); break; + case DNS_TYPE_SSHFP: + free(rr->sshfp.key); + break; + case DNS_TYPE_LOC: case DNS_TYPE_A: case DNS_TYPE_AAAA: @@ -393,6 +397,12 @@ int dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecor a->loc.longitude == b->loc.longitude && a->loc.altitude == b->loc.altitude; + 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; + default: return a->generic.size == b->generic.size && memcmp(a->generic.data, b->generic.data, a->generic.size) == 0; @@ -430,7 +440,6 @@ static char* format_location(uint32_t latitude, uint32_t longitude, uint32_t alt return s; } - int dns_resource_record_to_string(const DnsResourceRecord *rr, char **ret) { _cleanup_free_ char *k = NULL; char *s; @@ -555,6 +564,23 @@ int dns_resource_record_to_string(const DnsResourceRecord *rr, char **ret) { break; } + case DNS_TYPE_SSHFP: { + _cleanup_free_ char *x = NULL; + + x = hexmem(rr->sshfp.key, rr->sshfp.key_size); + if (!x) + return -ENOMEM; + + r = asprintf(&s, "%s %u %u %s", + k, + rr->sshfp.algorithm, + rr->sshfp.fptype, + x); + if (r < 0) + return -ENOMEM; + break; + } + default: { _cleanup_free_ char *x = NULL; |