mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 00:04:15 -04:00
request.Match check Response bit as well (#1775)
* request.Match check Response bit as well We should check this bit and reject them as invalid. * Fix test
This commit is contained in:
@@ -380,6 +380,10 @@ func (r *Request) Match(reply *dns.Msg) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
if reply.Response == false {
|
||||
return false
|
||||
}
|
||||
|
||||
if strings.ToLower(reply.Question[0].Name) != r.Name() {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -162,6 +162,7 @@ func TestRequestScrubAnswerExact(t *testing.T) {
|
||||
func TestRequestMatch(t *testing.T) {
|
||||
st := testRequest()
|
||||
reply := new(dns.Msg)
|
||||
reply.Response = true
|
||||
|
||||
reply.SetQuestion("example.com.", dns.TypeMX)
|
||||
if b := st.Match(reply); b {
|
||||
|
||||
Reference in New Issue
Block a user