New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: LookupTXT fails when TXT record contains multiple strings #10482

Closed
DenBeke opened this Issue Apr 16, 2015 · 2 comments

Comments

Projects
None yet
5 participants
@DenBeke
Copy link
Contributor

DenBeke commented Apr 16, 2015

What version of Go are you using (go version)?
Go 1.4

What operating system and processor architecture are you using?
OS X 10.10.3

What did you do?
DNS TXT lookup on _spf.facebook.com:

package main

import "fmt"
import "net"

func main() {
    txt, err := net.LookupTXT("_spf.facebook.com")
    fmt.Println(err)
    fmt.Println(txt)
}

What did you expect to see?
"v=spf1 ip4:69.63.179.25 ip4:69.63.178.128/25 ip4:69.63.184.0/25 ip4:66.220.144.128/25 ip4:66.220.155.0/24 ip4:69.171.232.0/25 i" "p4:66.220.157.0/25 ip4:69.171.244.0/24 mx -all"

dig _spf.facebook.com TXT returns this:

;; QUESTION SECTION:
;_spf.facebook.com.     IN  TXT

;; ANSWER SECTION:
_spf.facebook.com.  3599    IN  TXT "v=spf1 ip4:69.63.179.25 ip4:69.63.178.128/25 ip4:69.63.184.0/25 ip4:66.220.144.128/25 ip4:66.220.155.0/24 ip4:69.171.232.0/25 i" "p4:66.220.157.0/25 ip4:69.171.244.0/24 mx -all"

What did you see instead?
lookup _spf.facebook.com on 8.8.8.8:53: no such host

Go fails to lookup TXT records which consist of multiple character strings.
RFC 1035 3.3.14.

3.3.14. TXT RDATA format

    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    /                   TXT-DATA                    /
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where:

TXT-DATA        One or more <character-string>s.

<character-string> is defined in section 3.3. of the same RFC 1035

<character-string> is a single
length octet followed by that number of characters.  <character-string>
is treated as binary information, and can be up to 256 characters in
length (including the length octet).

@ianlancetaylor ianlancetaylor added this to the Go1.5Maybe milestone Apr 16, 2015

@ianlancetaylor ianlancetaylor changed the title net.LookupTXT() fails when TXT record contains multiple strings net: LookupTXT fails when TXT record contains multiple strings Apr 16, 2015

@trtstm

This comment has been minimized.

Copy link
Contributor

trtstm commented Apr 16, 2015

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Apr 25, 2015

CL https://golang.org/cl/8966 mentions this issue.

@mikioh mikioh modified the milestones: Go1.5, Go1.5Maybe May 5, 2015

@golang golang locked and limited conversation to collaborators Jun 25, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.