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) { ...@@ -220,7 +220,7 @@ func (c *conf) hostLookupOrder(hostname string) (ret hostLookupOrder) {
var first string var first string
for _, src := range srcs { for _, src := range srcs {
if src.source == "myhostname" { if src.source == "myhostname" {
if hasDot { if hostname == "" || hasDot {
continue continue
} }
return fallbackOrder return fallbackOrder
......
...@@ -257,6 +257,7 @@ func TestConfHostLookupOrder(t *testing.T) { ...@@ -257,6 +257,7 @@ func TestConfHostLookupOrder(t *testing.T) {
hostTests: []nssHostTest{ hostTests: []nssHostTest{
{"x.com", hostLookupFilesDNS}, {"x.com", hostLookupFilesDNS},
{"somehostname", hostLookupCgo}, {"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