diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-07-31 21:47:51 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-07-31 08:56:03 -0400 |
commit | 9de3e3294065e8697ff10130b53f274319cdcf6f (patch) | |
tree | 68546968bcb42b3f65ee24647b4f01e4cb3d3f60 /src/resolve | |
parent | 2e276efc7b0398a3086629a52970bdd4ab7252f9 (diff) |
resolved: SPF records
Diffstat (limited to 'src/resolve')
-rw-r--r-- | src/resolve/resolved-dns-packet.c | 2 | ||||
-rw-r--r-- | src/resolve/resolved-dns-rr.c | 28 | ||||
-rw-r--r-- | src/resolve/resolved-dns-rr.h | 2 |
3 files changed, 26 insertions, 6 deletions
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c index 3d64c27ceb..f22582971e 100644 --- a/src/resolve/resolved-dns-packet.c +++ b/src/resolve/resolved-dns-packet.c @@ -513,6 +513,7 @@ int dns_packet_append_rr(DnsPacket *p, const DnsResourceRecord *rr, size_t *star r = dns_packet_append_string(p, rr->hinfo.os, NULL); break; + case DNS_TYPE_SPF: /* exactly the same as TXT */ case DNS_TYPE_TXT: { char **s; @@ -933,6 +934,7 @@ int dns_packet_read_rr(DnsPacket *p, DnsResourceRecord **ret, size_t *start) { r = dns_packet_read_string(p, &rr->hinfo.os, NULL); break; + case DNS_TYPE_SPF: /* exactly the same as TXT */ case DNS_TYPE_TXT: { char *s; diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c index 9131b4b349..1ee93fe8c5 100644 --- a/src/resolve/resolved-dns-rr.c +++ b/src/resolve/resolved-dns-rr.c @@ -231,20 +231,33 @@ DnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr) { } if (rr->key) { - if (IN_SET(rr->key->type, DNS_TYPE_PTR, DNS_TYPE_NS, DNS_TYPE_CNAME)) + switch(rr->key->type) { + case DNS_TYPE_PTR: + case DNS_TYPE_NS: + case DNS_TYPE_CNAME: free(rr->ptr.name); - else if (rr->key->type == DNS_TYPE_HINFO) { + break; + case DNS_TYPE_HINFO: free(rr->hinfo.cpu); free(rr->hinfo.os); - } else if (rr->key->type == DNS_TYPE_TXT) { + break; + case DNS_TYPE_SPF: + case DNS_TYPE_TXT: strv_free(rr->txt.strings); - } else if (rr->key->type == DNS_TYPE_SOA) { + break; + case DNS_TYPE_SOA: free(rr->soa.mname); free(rr->soa.rname); - } else if (rr->key->type == DNS_TYPE_MX) { + break; + case DNS_TYPE_MX: free(rr->mx.exchange); - } else if (!IN_SET(rr->key->type, DNS_TYPE_A, DNS_TYPE_AAAA)) + break; + case DNS_TYPE_A: + case DNS_TYPE_AAAA: + break; + default: free(rr->generic.data); + } dns_resource_key_unref(rr->key); } @@ -309,6 +322,7 @@ int dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecor return strcaseeq(a->hinfo.cpu, b->hinfo.cpu) && strcaseeq(a->hinfo.os, b->hinfo.os); + case DNS_TYPE_SPF: /* exactly the same as TXT */ case DNS_TYPE_TXT: { int i; @@ -377,6 +391,7 @@ int dns_resource_record_to_string(const DnsResourceRecord *rr, char **ret) { return -ENOMEM; break; + case DNS_TYPE_SPF: /* exactly the same as TXT */ case DNS_TYPE_TXT: { _cleanup_free_ char *t; @@ -500,6 +515,7 @@ static const struct { { DNS_TYPE_AAAA, "AAAA" }, { DNS_TYPE_SRV, "SRV" }, { DNS_TYPE_SSHFP, "SSHFP" }, + { DNS_TYPE_SPF, "SPF" }, { DNS_TYPE_DNAME, "DNAME" }, { DNS_TYPE_ANY, "ANY" }, { DNS_TYPE_OPT, "OPT" }, diff --git a/src/resolve/resolved-dns-rr.h b/src/resolve/resolved-dns-rr.h index 92ffeab203..afd623a382 100644 --- a/src/resolve/resolved-dns-rr.h +++ b/src/resolve/resolved-dns-rr.h @@ -55,6 +55,8 @@ enum { DNS_TYPE_DNAME = 0x27, DNS_TYPE_SSHFP = 0x2C, + DNS_TYPE_SPF = 0x63, + /* Special records */ DNS_TYPE_ANY = 0xFF, DNS_TYPE_OPT = 0x29, /* EDNS0 option */ |