Commit 04a96983 authored by W. Trevor King's avatar W. Trevor King

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
parent 03260a92
......@@ -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")
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment