mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #7236 from heyitsanthony/no-dns-bind
embed: reject domain names before binding (again)
This commit is contained in:
commit
9dbde1cc52
@ -405,8 +405,7 @@ func checkBindURLs(urls []url.URL) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if net.ParseIP(host) == nil {
|
if net.ParseIP(host) == nil {
|
||||||
err := fmt.Errorf("expected IP in URL for binding (%s)", url.String())
|
return fmt.Errorf("expected IP in URL for binding (%s)", url.String())
|
||||||
plog.Warning(err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -40,6 +40,8 @@ func TestEmbedEtcd(t *testing.T) {
|
|||||||
{wpeers: 1, wclients: 1},
|
{wpeers: 1, wclients: 1},
|
||||||
{wpeers: 2, wclients: 1},
|
{wpeers: 2, wclients: 1},
|
||||||
{wpeers: 1, wclients: 2},
|
{wpeers: 1, wclients: 2},
|
||||||
|
{werr: "expected IP"},
|
||||||
|
{werr: "expected IP"},
|
||||||
}
|
}
|
||||||
|
|
||||||
urls := newEmbedURLs(10)
|
urls := newEmbedURLs(10)
|
||||||
@ -58,6 +60,10 @@ func TestEmbedEtcd(t *testing.T) {
|
|||||||
setupEmbedCfg(&tests[5].cfg, []url.URL{urls[4]}, []url.URL{urls[5], urls[6]})
|
setupEmbedCfg(&tests[5].cfg, []url.URL{urls[4]}, []url.URL{urls[5], urls[6]})
|
||||||
setupEmbedCfg(&tests[6].cfg, []url.URL{urls[7], urls[8]}, []url.URL{urls[9]})
|
setupEmbedCfg(&tests[6].cfg, []url.URL{urls[7], urls[8]}, []url.URL{urls[9]})
|
||||||
|
|
||||||
|
dnsURL, _ := url.Parse("http://whatever.test:12345")
|
||||||
|
tests[7].cfg.LCUrls = []url.URL{*dnsURL}
|
||||||
|
tests[8].cfg.LPUrls = []url.URL{*dnsURL}
|
||||||
|
|
||||||
dir := path.Join(os.TempDir(), fmt.Sprintf("embed-etcd"))
|
dir := path.Join(os.TempDir(), fmt.Sprintf("embed-etcd"))
|
||||||
os.RemoveAll(dir)
|
os.RemoveAll(dir)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user