net: fix hostLookupOrder("")

Fixes #13623.

Change-Id: I1bd96aa7b6b715e4dbdcf0c37c2d29228df6565c
Reviewed-on: https://go-review.googlesource.com/18329
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Russ Cox 2016-01-06 14:37:45 -05:00 committed by Brad Fitzpatrick
parent eeca3ba92f
commit fafd792de3
2 changed files with 2 additions and 1 deletions

View File

@ -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

View File

@ -257,6 +257,7 @@ func TestConfHostLookupOrder(t *testing.T) {
hostTests: []nssHostTest{
{"x.com", hostLookupFilesDNS},
{"somehostname", hostLookupCgo},
{"", hostLookupFilesDNS}, // Issue 13623
},
},
{