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-packet.c | |
parent | 9c92ce6d67f88beb31dd6555d12ae3f632218a39 (diff) |
resolved: properly process SSHFP RRs
Diffstat (limited to 'src/resolve/resolved-dns-packet.c')
-rw-r--r-- | src/resolve/resolved-dns-packet.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c index 024ab0d0e6..3eda803144 100644 --- a/src/resolve/resolved-dns-packet.c +++ b/src/resolve/resolved-dns-packet.c @@ -617,6 +617,16 @@ int dns_packet_append_rr(DnsPacket *p, const DnsResourceRecord *rr, size_t *star break; case DNS_TYPE_SSHFP: + r = dns_packet_append_uint8(p, rr->sshfp.algorithm, NULL); + if (r < 0) + goto fail; + r = dns_packet_append_uint8(p, rr->sshfp.fptype, NULL); + if (r < 0) + goto fail; + + r = dns_packet_append_blob(p, rr->sshfp.key, rr->sshfp.key_size, NULL); + break; + case _DNS_TYPE_INVALID: /* unparseable */ default: @@ -1100,6 +1110,28 @@ int dns_packet_read_rr(DnsPacket *p, DnsResourceRecord **ret, size_t *start) { } case DNS_TYPE_SSHFP: + + r = dns_packet_read_uint8(p, &rr->sshfp.algorithm, NULL); + if (r < 0) + goto fail; + + r = dns_packet_read_uint8(p, &rr->sshfp.fptype, NULL); + if (r < 0) + goto fail; + + r = dns_packet_read(p, rdlength - 2, &d, NULL); + if (r < 0) + goto fail; + + rr->sshfp.key = memdup(d, rdlength - 2); + if (!rr->sshfp.key) { + r = -ENOMEM; + goto fail; + } + + rr->sshfp.key_size = rdlength - 2; + break; + default: r = dns_packet_read(p, rdlength, &d, NULL); if (r < 0) |