ns.2.ghost.example.net. 10 IN A $PREFIX.19
EOF
+cat > $PREFIX.17/prequery.lua <<EOF
+require 'posix'
+
+function prequery ( dnspacket )
+ qname, qtype = dnspacket:getQuestion()
+ if (string.sub(qname, -20) == ".1.ghost.example.net" and posix.stat('drop-1')) or
+ (string.sub(qname, -20) == ".2.ghost.example.net" and posix.stat('drop-2'))
+ then
+ dnspacket:setRcode(pdns.NXDOMAIN)
+ ret = {}
+ ret[1] = {qname="ghost.example.net", qtype=pdns.SOA, content="$SOA", place=2}
+ dnspacket:addRecords(ret)
+ return true
+ end
+ return false
+end
+EOF
+
### ghost domain with ever-changing NSset
mkdir $PREFIX.18
cat > $PREFIX.18/1.ghost.example.net.zone <<EOF
--- /dev/null
+#!/bin/sh
+. vars
+rm configs/$PREFIX.17/drop-2
+cleandig a.www.2.ghost.example.net a | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
+sleep 5
+touch configs/$PREFIX.17/drop-2
+cleandig b.www.2.ghost.example.net a | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
+sleep 5
+cleandig c.www.2.ghost.example.net a | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
+sleep 5
+cleandig d.www.2.ghost.example.net a | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
+sleep 5
+cleandig e.www.2.ghost.example.net a | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
--- /dev/null
+0 a.www.2.ghost.example.net. IN A 3600 192.0.2.8
+Rcode: 0, RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
+Reply to question for qname='a.www.2.ghost.example.net.', qtype=A
+0 b.www.2.ghost.example.net. IN A 3600 192.0.2.8
+Rcode: 0, RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
+Reply to question for qname='b.www.2.ghost.example.net.', qtype=A
+0 c.www.2.ghost.example.net. IN A 3600 192.0.2.8
+Rcode: 0, RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
+Reply to question for qname='c.www.2.ghost.example.net.', qtype=A
+1 ghost.example.net. IN SOA 3600 ns.example.net. hostmaster.example.net. 1 3600 1800 1209600 300
+Rcode: 3, RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
+Reply to question for qname='d.www.2.ghost.example.net.', qtype=A
+1 ghost.example.net. IN SOA 3600 ns.example.net. hostmaster.example.net. 1 3600 1800 1209600 300
+Rcode: 3, RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
+Reply to question for qname='e.www.2.ghost.example.net.', qtype=A