dont panic on empty SRV segments (#5173)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
parent
daace98352
commit
4349b6fa63
2 changed files with 5 additions and 0 deletions
|
@ -82,6 +82,9 @@ func parseRequest(name, zone string) (r recordRequest, err error) {
|
|||
|
||||
// stripUnderscore removes a prefixed underscore from s.
|
||||
func stripUnderscore(s string) string {
|
||||
if len(s) == 0 {
|
||||
return s
|
||||
}
|
||||
if s[0] != '_' {
|
||||
return s
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ func TestParseRequest(t *testing.T) {
|
|||
{"svc.inter.webs.tests.", "....."},
|
||||
// bare pod type
|
||||
{"pod.inter.webs.tests.", "....."},
|
||||
// SRV request with empty segments
|
||||
{"..webs.mynamespace.svc.inter.webs.tests.", "...webs.mynamespace.svc"},
|
||||
}
|
||||
for i, tc := range tests {
|
||||
m := new(dns.Msg)
|
||||
|
|
Loading…
Add table
Reference in a new issue