aboutsummaryrefslogtreecommitdiff
path: root/src/net/lookup.go
diff options
context:
space:
mode:
authorRoland Shoemaker <roland@golang.org>2021-06-30 14:28:18 -0700
committerRoland Shoemaker <roland@golang.org>2021-07-08 16:45:40 +0000
commit0579cf14060179a51300c157f3952528a6d25997 (patch)
treef1d3701924b5a7894b5d1ae191548dd01770d7f1 /src/net/lookup.go
parentb51bf4febc32dfa6bb3c1cf467f1513a1d6d8b75 (diff)
downloadgo-0579cf14060179a51300c157f3952528a6d25997.tar.gz
go-0579cf14060179a51300c157f3952528a6d25997.zip
[release-branch.go1.15] net: don't reject null mx records
Bypass hostname validity checking when a null mx record is returned as, defined in RFC 7505. Updates #46979 Updates #47012 Change-Id: Ibe683bd6b47333a8ff30909fb2680ec8e10696ef Reviewed-on: https://go-review.googlesource.com/c/go/+/332094 Trust: Roland Shoemaker <roland@golang.org> Trust: Katie Hockman <katie@golang.org> Run-TryBot: Roland Shoemaker <roland@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org> (cherry picked from commit 03761ede028d811dd7d7cf8a2690d4bfa2771d85) Reviewed-on: https://go-review.googlesource.com/c/go/+/332372 Run-TryBot: Katie Hockman <katie@golang.org>
Diffstat (limited to 'src/net/lookup.go')
-rw-r--r--src/net/lookup.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/net/lookup.go b/src/net/lookup.go
index 0660268249..01c81dbaaf 100644
--- a/src/net/lookup.go
+++ b/src/net/lookup.go
@@ -488,7 +488,9 @@ func (r *Resolver) LookupMX(ctx context.Context, name string) ([]*MX, error) {
if mx == nil {
continue
}
- if !isDomainName(mx.Host) {
+ // Bypass the hostname validity check for targets which contain only a dot,
+ // as this is used to represent a 'Null' MX record.
+ if mx.Host != "." && !isDomainName(mx.Host) {
return nil, &DNSError{Err: "MX target is invalid", Name: name}
}
}