mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 10:43:17 -04:00
plugin/rewrite: prevent illegal names (#1972)
Log and returns an error when the name rewrite creates a name that is illegal. Add test in name_test.go to see if an error is returned. Possible followup could be the only check this if a name-rewrite is done. Fixes: #1638 Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
committed by
Paul Greenberg
parent
8d9cf95ee8
commit
d9b9a955ba
@@ -17,7 +17,7 @@ type ResponseRule struct {
|
||||
|
||||
// ResponseReverter reverses the operations done on the question section of a packet.
|
||||
// This is need because the client will otherwise disregards the response, i.e.
|
||||
// dig will complain with ';; Question section mismatch: got miek.nl/HINFO/IN'
|
||||
// dig will complain with ';; Question section mismatch: got example.org/HINFO/IN'
|
||||
type ResponseReverter struct {
|
||||
dns.ResponseWriter
|
||||
originalQuestion dns.Question
|
||||
@@ -64,10 +64,3 @@ func (r *ResponseReverter) Write(buf []byte) (int, error) {
|
||||
n, err := r.ResponseWriter.Write(buf)
|
||||
return n, err
|
||||
}
|
||||
|
||||
// Hijack implements dns.Hijacker. It simply wraps the underlying
|
||||
// ResponseWriter's Hijack method if there is one, or returns an error.
|
||||
func (r *ResponseReverter) Hijack() {
|
||||
r.ResponseWriter.Hijack()
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user