From 04a969835eb06efbb0895a202d7c8d0c3b6c0780 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 16 May 2015 09:34:08 -0700 Subject: [PATCH] namesys/dns: Use SplitN to find dnslink references RFC 6763 requires printable ASCII except '=' for the key [1], but allows any character including '=' in the value [2]. This patch adjusts our parsing to avoid splitting on '=' in the value, and then ignoring anything after that split. [1]: https://tools.ietf.org/html/rfc6763#section-6.4 [2]: https://tools.ietf.org/html/rfc6763#section-6.5 --- namesys/dns.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/namesys/dns.go b/namesys/dns.go index 086adee9e..3e703d420 100644 --- a/namesys/dns.go +++ b/namesys/dns.go @@ -52,10 +52,10 @@ func parseEntry(txt string) (path.Path, error) { } func tryParseDnsLink(txt string) (path.Path, error) { - parts := strings.Split(txt, "=") - if len(parts) == 1 || parts[0] != "dnslink" { - return "", errors.New("not a valid dnslink entry") + parts := strings.SplitN(txt, "=", 2) + if len(parts) == 2 && parts[0] == "dnslink" { + return path.ParsePath(parts[1]) } - return path.ParsePath(parts[1]) + return "", errors.New("not a valid dnslink entry") }