* Revert "make copies of RRs before returning them (#4409)"

This reverts commit 8b2ff6c388.

* Document copying responses

See #4409 and the comments. This documents that issue, but doesn't
change the in-tree plugins just yet.

Signed-off-by: Miek Gieben <miek@miek.nl>

* Update plugin.md

Co-authored-by: Chris O'Haver <cohaver@infoblox.com>

Co-authored-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
Miek Gieben
2021-01-28 16:50:35 +01:00
committed by GitHub
parent d8d2c16905
commit 60e1490ed6
2 changed files with 10 additions and 6 deletions

View File

@@ -171,12 +171,7 @@ func (z *Zone) Lookup(ctx context.Context, state request.Request, qname string)
return z.externalLookup(ctx, state, elem, rrs)
}
treeRRs := elem.Type(qtype)
// make a copy of the element RRs to prevent response writers from mutating the tree
rrs := make([]dns.RR, len(treeRRs))
for i, rr := range treeRRs {
rrs[i] = dns.Copy(rr)
}
rrs := elem.Type(qtype)
// NODATA
if len(rrs) == 0 {