[systemd-commits] 2 commits - TODO src/resolve
Lennart Poettering
lennart at kemper.freedesktop.org
Sun Nov 30 18:11:11 PST 2014
TODO | 2 +
src/resolve/resolved-dns-packet.c | 45 +++++++++++++++++++++++---------------
2 files changed, 30 insertions(+), 17 deletions(-)
New commits:
commit 1ccda9b7168e89141b60290295170e07e760efeb
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Dec 1 03:08:55 2014 +0100
resolved: make TXT RR generation and parsing more in-line with RFC 6763, section 6.1
The RFC says to encode an single empty TXT string instead of an empty
TXT array. It also says to treat a zero-length TXT RR as a TXT array
with a single zero-length string.
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
index a9bd8b1..cf5b618 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/resolved-dns-packet.c
@@ -547,10 +547,19 @@ int dns_packet_append_rr(DnsPacket *p, const DnsResourceRecord *rr, size_t *star
case DNS_TYPE_TXT: {
char **s;
- STRV_FOREACH(s, rr->txt.strings) {
- r = dns_packet_append_string(p, *s, NULL);
+ if (strv_isempty(rr->txt.strings)) {
+ /* RFC 6763, section 6.1 suggests to generate
+ * single empty string for an empty array. */
+
+ r = dns_packet_append_string(p, "", NULL);
if (r < 0)
goto fail;
+ } else {
+ STRV_FOREACH(s, rr->txt.strings) {
+ r = dns_packet_append_string(p, *s, NULL);
+ if (r < 0)
+ goto fail;
+ }
}
r = 0;
@@ -1111,29 +1120,31 @@ int dns_packet_read_rr(DnsPacket *p, DnsResourceRecord **ret, size_t *start) {
break;
case DNS_TYPE_SPF: /* exactly the same as TXT */
- case DNS_TYPE_TXT: {
- char *s;
-
- /* RFC 1035 says that TXT must be at least one
- string. Reject empty records. */
- if (!rdlength) {
- r = -EBADMSG;
- goto fail;
- }
+ case DNS_TYPE_TXT:
+ if (rdlength <= 0) {
+ /* RFC 6763, section 6.1 suggests to treat
+ * empty TXT RRs as equivalent to a TXT record
+ * with a single empty string. */
- while (p->rindex < offset + rdlength) {
- r = dns_packet_read_string(p, &s, NULL);
+ r = strv_extend(&rr->txt.strings, "");
if (r < 0)
goto fail;
+ } else {
+ while (p->rindex < offset + rdlength) {
+ char *s;
- r = strv_consume(&rr->txt.strings, s);
- if (r < 0)
- goto fail;
+ r = dns_packet_read_string(p, &s, NULL);
+ if (r < 0)
+ goto fail;
+
+ r = strv_consume(&rr->txt.strings, s);
+ if (r < 0)
+ goto fail;
+ }
}
r = 0;
break;
- }
case DNS_TYPE_A:
r = dns_packet_read_blob(p, &rr->a.in_addr, sizeof(struct in_addr), NULL);
commit 75e52a16f9ef476f1d18ec6d9c84e00149b80d03
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Dec 1 03:06:50 2014 +0100
update TODO
diff --git a/TODO b/TODO
index 57e7efc..a26f3e2 100644
--- a/TODO
+++ b/TODO
@@ -35,6 +35,8 @@ External:
Features:
+* figure out what to do with libmount and utab?
+
* We really should have a FOREACH macro to iterate through inotify events we read, similar to KDBUS_FOREACH_ITEM
* figure out when we can use the coarse timers
More information about the systemd-commits
mailing list