diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-07-31 21:36:58 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-07-31 08:56:03 -0400 |
commit | 2e276efc7b0398a3086629a52970bdd4ab7252f9 (patch) | |
tree | 72df97e7316d21826096dba6b2f9c3627941e835 /src/resolve/resolved-dns-rr.c | |
parent | 946c70944ebdf428ffeb9991a7449edbd4011461 (diff) |
resolved: TXT records
Diffstat (limited to 'src/resolve/resolved-dns-rr.c')
-rw-r--r-- | src/resolve/resolved-dns-rr.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c index 2e13b9c51a..9131b4b349 100644 --- a/src/resolve/resolved-dns-rr.c +++ b/src/resolve/resolved-dns-rr.c @@ -19,6 +19,8 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include "strv.h" + #include "resolved-dns-domain.h" #include "resolved-dns-rr.h" @@ -234,6 +236,8 @@ DnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr) { else if (rr->key->type == DNS_TYPE_HINFO) { free(rr->hinfo.cpu); free(rr->hinfo.os); + } else if (rr->key->type == DNS_TYPE_TXT) { + strv_free(rr->txt.strings); } else if (rr->key->type == DNS_TYPE_SOA) { free(rr->soa.mname); free(rr->soa.rname); @@ -305,6 +309,15 @@ 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_TXT: { + int i; + + for (i = 0; a->txt.strings[i] || b->txt.strings[i]; i++) + if (!streq_ptr(a->txt.strings[i], b->txt.strings[i])) + return false; + return true; + } + case DNS_TYPE_A: return memcmp(&a->a.in_addr, &b->a.in_addr, sizeof(struct in_addr)) == 0; @@ -364,6 +377,20 @@ int dns_resource_record_to_string(const DnsResourceRecord *rr, char **ret) { return -ENOMEM; break; + case DNS_TYPE_TXT: { + _cleanup_free_ char *t; + + t = strv_join_quoted(rr->txt.strings); + if (!t) + return -ENOMEM; + + s = strjoin(k, " ", t, NULL); + if (!s) + return -ENOMEM; + + break; + } + case DNS_TYPE_A: { _cleanup_free_ char *x = NULL; |