plugin/template : add support for extended DNS errors (#5659)

* plugin/template : add support for extended DNS errors

Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
This commit is contained in:
Ondřej Benkovský
2022-10-03 17:04:56 +02:00
committed by GitHub
parent b9a31f2c89
commit 2fa9821c7e
5 changed files with 94 additions and 0 deletions

View File

@@ -161,6 +161,30 @@ func TestSetupParse(t *testing.T) {
}`,
false,
},
{
`template ANY ANY invalid {
rcode NXDOMAIN
authority "invalid. 60 {{ .Class }} SOA ns.invalid. hostmaster.invalid. (1 60 60 60 60)"
ederror 21 "Blocked according to RFC2606"
}`,
false,
},
{
`template ANY ANY invalid {
rcode NXDOMAIN
authority "invalid. 60 {{ .Class }} SOA ns.invalid. hostmaster.invalid. (1 60 60 60 60)"
ederror invalid "Blocked according to RFC2606"
}`,
true,
},
{
`template ANY ANY invalid {
rcode NXDOMAIN
authority "invalid. 60 {{ .Class }} SOA ns.invalid. hostmaster.invalid. (1 60 60 60 60)"
ederror too many arguments
}`,
true,
},
}
for i, test := range tests {
c := caddy.NewTestController("dns", test.inputFileRules)