Commit fafd792d authored by Russ Cox's avatar Russ Cox Committed by Brad Fitzpatrick

net: fix hostLookupOrder("")

Fixes #13623.

Change-Id: I1bd96aa7b6b715e4dbdcf0c37c2d29228df6565c
Reviewed-on: https://go-review.googlesource.com/18329Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent eeca3ba9
......@@ -220,7 +220,7 @@ func (c *conf) hostLookupOrder(hostname string) (ret hostLookupOrder) {
var first string
for _, src := range srcs {
if src.source == "myhostname" {
if hasDot {
if hostname == "" || hasDot {
continue
}
return fallbackOrder
......
......@@ -257,6 +257,7 @@ func TestConfHostLookupOrder(t *testing.T) {
hostTests: []nssHostTest{
{"x.com", hostLookupFilesDNS},
{"somehostname", hostLookupCgo},
{"", hostLookupFilesDNS}, // Issue 13623
},
},
{
......
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