mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
ndots: produce error on negative numbers
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
b306706062
commit
341845b5f2
2 changed files with 8 additions and 0 deletions
|
@ -374,6 +374,8 @@ dnsOpt:
|
||||||
// if the user sets ndots, use the user setting
|
// if the user sets ndots, use the user setting
|
||||||
sb.ndotsSet = true
|
sb.ndotsSet = true
|
||||||
break dnsOpt
|
break dnsOpt
|
||||||
|
} else {
|
||||||
|
return fmt.Errorf("invalid number for ndots option: %v", num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,4 +103,10 @@ func TestDNSOptions(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
err = sb2.(*sandbox).rebuildDNS()
|
err = sb2.(*sandbox).rebuildDNS()
|
||||||
require.EqualError(t, err, "invalid number for ndots option: foobar")
|
require.EqualError(t, err, "invalid number for ndots option: foobar")
|
||||||
|
|
||||||
|
sb2.(*sandbox).config.dnsOptionsList = []string{"ndots:-1"}
|
||||||
|
err = sb2.(*sandbox).setupDNS()
|
||||||
|
require.NoError(t, err)
|
||||||
|
err = sb2.(*sandbox).rebuildDNS()
|
||||||
|
require.EqualError(t, err, "invalid number for ndots option: -1")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue