Pull request: 2582 invalid hostname vol.2
Merge in DNS/adguard-home from 2582-invalid-hostname-2 to master
Updates #2582.
Squashed commit of the following:
commit 9d3ceb289e3869b2c3d12e91ec104fb25d7931ee
Merge: 91c68e46 90054974
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 5 19:11:49 2021 +0300
Merge branch 'master' into 2582-invalid-hostname-2
commit 91c68e468c5f5b12a2fb509ff391133483c9d915
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 5 18:28:14 2021 +0300
all: mv trimming from home to dhcpd
commit f51faf35288577b6f610f172b26e7ac13aa24f72
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 5 16:28:00 2021 +0300
home: add more host sanitizings
This commit is contained in:
@@ -290,29 +290,3 @@ func TestClientsCustomUpstream(t *testing.T) {
|
||||
assert.Equal(t, 1, len(config.Upstreams))
|
||||
assert.Equal(t, 1, len(config.DomainReservedUpstreams))
|
||||
}
|
||||
|
||||
func TestProcessHost(t *testing.T) {
|
||||
const (
|
||||
name int = iota
|
||||
host
|
||||
want
|
||||
|
||||
fieldsNum
|
||||
)
|
||||
|
||||
testCases := [][fieldsNum]string{{
|
||||
name: "valid",
|
||||
host: "abc",
|
||||
want: "abc",
|
||||
}, {
|
||||
name: "with_trailing_zero_byte",
|
||||
host: "abc\x00",
|
||||
want: "abc",
|
||||
}}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc[name], func(t *testing.T) {
|
||||
assert.Equal(t, tc[want], sanitizeHost(tc[host]))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user