bdr.qtype=qtype.getCode();
bdr.content=content;
bdr.nsec3hash = hashed;
+ // cerr<<"qname '"<<bdr.qname<<"' nsec3hash '"<<hashed<<"' qtype '"<<qtype.getName()<<"'"<<endl;
if (!qtype.getCode()) // Set auth on empty non-terminals
bdr.auth=true;
uint32_t maxent = ::arg().asNum("max-ent-entries");
BOOST_FOREACH(const Bind2DNSRecord& bdr, *bb2.d_records)
- if (bdr.auth)
+ if (bdr.auth && (bdr.qtype != QType::RRSIG))
qnames.insert(labelReverse(bdr.qname));
BOOST_FOREACH(const string& qname, qnames)
}
DNSResourceRecord rr;
- rr.qtype="0";
+ rr.qtype="#0";
rr.content="";
rr.ttl=0;
rr.priority=0;
DNSResourceRecord rr;
string hashed;
while(zpt.get(rr)) {
- if(nsec3zone)
- hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname)));
+ if(nsec3zone) {
+ if(rr.qtype.getCode() != QType::NSEC3 && rr.qtype.getCode() != QType::RRSIG)
+ hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname)));
+ else
+ hashed="";
+ }
insert(staging, bbd->d_id, rr.qname, rr.qtype, rr.content, rr.ttl, rr.priority, hashed);
}
NSEC3PARAMRecordContent ns3pr;
bool nsec3zone=getNSEC3PARAM(bbd->d_name, &ns3pr);
while(zpt.get(rr)) {
- if(nsec3zone)
- hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname)));
+ if(nsec3zone) {
+ if(rr.qtype.getCode() != QType::NSEC3 && rr.qtype.getCode() != QType::RRSIG)
+ hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname)));
+ else
+ hashed="";
+ }
insert(staging, bbd->d_id, rr.qname, rr.qtype, rr.content, rr.ttl, rr.priority, hashed);
}
// cerr<<"Start sort of "<<staging->id_zone_map[bbd->d_id].d_records->size()<<" records"<<endl;
iter = hashindex.end();
}
- while(iter == hashindex.end() || !(iter->auth))
+ while(iter == hashindex.end() || !(iter->auth) || iter->nsec3hash.empty())
{
iter--;
if(iter == hashindex.begin())
iter = hashindex.begin();
}
- while(!(iter->auth))
+ while(!(iter->auth) || iter->nsec3hash.empty())
{
iter++;
if(iter == hashindex.end())
shared_ptr<State> state = s_state;
name_id_map_t::const_iterator iditer;
- while((iditer=state->name_id_map.find(domain)) == state->name_id_map.end() && chopOff(domain))
- ;
+ do {
+ iditer=state->name_id_map.find(domain);
+ } while ((iditer == state->name_id_map.end() || (zoneId != iditer->second && zoneId != -1)) && chopOff(domain));
if(iditer==state->name_id_map.end()) {
if(mustlog)
bindwait ()
{
+ configname=$1
domcount=$(grep -c zone named.conf)
while sleep 10
do
- done=$( (../pdns/pdns_control --socket-dir=. --no-config bind-domain-status || true) | grep -c 'parsed into memory' || true )
+ done=$( (../pdns/pdns_control --config-name=$configname --socket-dir=. --no-config bind-domain-status || true) | grep -c 'parsed into memory' || true )
if [ $done = $domcount ]
then
return
$RUNWRAPPER ../pdns/pdns_server --daemon=no --local-port=$port --socket-dir=./ \
--no-shuffle --launch=bind --bind-config=./named.conf \
--bind-dnssec-db=./dnssec.sqlite3 \
- --send-root-referral \
+ --send-root-referral \
--cache-ttl=0 --no-config &
bindwait
;;
export skipreasons
export testsdir
-if [ $presigned = yes ] && [ ${context:0:6} = gmysql ]
+if [ $presigned = yes ]
then
- context=${context}-presigned
- [ -z "$GMYSQL2DB" ] && GMYSQL2DB=pdnstest2
- [ -z "$GMYSQL2USER" ] && GMYSQL2USER=root
- [ -z "$GMYSQL2HOST" ] && GMYSQL2HOST=localhost
- [ -z "$GMYSQL2PASSWD" ] && GMYSQL2PASSWD=''
-
- mysqladmin --user="$GMYSQL2USER" --password="$GMYSQL2PASSWD" --host="$GMYSQL2HOST" --force drop "$GMYSQL2DB" \
- || echo ignoring mysqladmin drop failure
- mysqladmin --user="$GMYSQL2USER" --password="$GMYSQL2PASSWD" --host="$GMYSQL2HOST" create "$GMYSQL2DB"
- mysql --user="$GMYSQL2USER" --password="$GMYSQL2PASSWD" --host="$GMYSQL2HOST" \
- "$GMYSQL2DB" < ../pdns/no-dnssec.schema.mysql.sql
- mysql --user="$GMYSQL2USER" --password="$GMYSQL2PASSWD" --host="$GMYSQL2HOST" \
- "$GMYSQL2DB" < ../pdns/dnssec.schema.mysql.sql
-
- for zone in $(grep zone named.conf | cut -f2 -d\")
- do
+ if [ ${context:0:6} = gmysql ]
+ then
+ context=${context}-presigned
+ [ -z "$GMYSQL2DB" ] && GMYSQL2DB=pdnstest2
+ [ -z "$GMYSQL2USER" ] && GMYSQL2USER=root
+ [ -z "$GMYSQL2HOST" ] && GMYSQL2HOST=localhost
+ [ -z "$GMYSQL2PASSWD" ] && GMYSQL2PASSWD=''
+
+ mysqladmin --user="$GMYSQL2USER" --password="$GMYSQL2PASSWD" --host="$GMYSQL2HOST" --force drop "$GMYSQL2DB" \
+ || echo ignoring mysqladmin drop failure
+ mysqladmin --user="$GMYSQL2USER" --password="$GMYSQL2PASSWD" --host="$GMYSQL2HOST" create "$GMYSQL2DB"
mysql --user="$GMYSQL2USER" --password="$GMYSQL2PASSWD" --host="$GMYSQL2HOST" \
- "$GMYSQL2DB" \
- -e "INSERT INTO domains (name, type, master) VALUES('$zone','SLAVE','127.0.0.1:$port')"
- done
-
- port=$((port+100))
-
- $RUNWRAPPER ../pdns/pdns_server --daemon=no --local-port=$port --socket-dir=./ \
- --no-shuffle --launch=gmysql --gmysql-dnssec \
- --fancy-records --send-root-referral \
- --cache-ttl=0 --query-cache-ttl=0 --no-config --slave --retrieval-threads=1 \
- --gmysql-dbname="$GMYSQL2DB" \
- --gmysql-user="$GMYSQL2USER" \
- --gmysql-host="$GMYSQL2HOST" \
- --gmysql-password="$GMYSQL2PASSWD" \
- --config-name=gmysql2 |& egrep -v "update records set ordername|insert into records" &
- echo 'waiting for zones to be slaved'
- while sleep 10
- do
- todo=$(mysql --user="$GMYSQL2USER" --password="$GMYSQL2PASSWD" --host="$GMYSQl2HOST" \
- "$GMYSQL2DB" -ss -e 'SELECT COUNT(id) FROM domains WHERE last_check IS NULL')
- if [ $todo = 0 ]
- then
- break
- fi
- done
+ "$GMYSQL2DB" < ../pdns/no-dnssec.schema.mysql.sql
+ mysql --user="$GMYSQL2USER" --password="$GMYSQL2PASSWD" --host="$GMYSQL2HOST" \
+ "$GMYSQL2DB" < ../pdns/dnssec.schema.mysql.sql
+
+ for zone in $(grep zone named.conf | cut -f2 -d\" | tac)
+ do
+ mysql --user="$GMYSQL2USER" --password="$GMYSQL2PASSWD" --host="$GMYSQL2HOST" \
+ "$GMYSQL2DB" \
+ -e "INSERT INTO domains (name, type, master) VALUES('$zone','SLAVE','127.0.0.1:$port')"
+ done
+
+ port=$((port+100))
+
+ $RUNWRAPPER ../pdns/pdns_server --daemon=no --local-port=$port --socket-dir=./ \
+ --no-shuffle --launch=gmysql --gmysql-dnssec \
+ --fancy-records --send-root-referral \
+ --cache-ttl=0 --query-cache-ttl=0 --no-config --slave --retrieval-threads=1 \
+ --gmysql-dbname="$GMYSQL2DB" \
+ --gmysql-user="$GMYSQL2USER" \
+ --gmysql-host="$GMYSQL2HOST" \
+ --gmysql-password="$GMYSQL2PASSWD" \
+ --config-name=gmysql2 |& egrep -v "update records set ordername|insert into records" &
+ echo 'waiting for zones to be slaved'
+ while sleep 10
+ do
+ todo=$(mysql --user="$GMYSQL2USER" --password="$GMYSQL2PASSWD" --host="$GMYSQl2HOST" \
+ "$GMYSQL2DB" -ss -e 'SELECT COUNT(id) FROM domains WHERE last_check IS NULL')
+ if [ $todo = 0 ]
+ then
+ break
+ fi
+ done
+ elif [ ${context:0:4} = bind ]
+ then
+ context=${context}-presigned
+ sed -e 's/type master;/type slave;\n\tmasters { 127.0.0.1:'$port'; };/' -e 's/file "\([^"]\+\)/file "\1-slave/' < named.conf > named-slave.conf
+
+ for zone in $(grep zone named.conf | cut -f2 -d\")
+ do
+ rm -rf $zone-slave
+ done
+
+ rm -f dnssec-slave.sqlite3
+ ../pdns/pdnssec --config-dir=. create-bind-db dnssec-slave.sqlite3
+ port=$((port+100))
+
+ $RUNWRAPPER ../pdns/pdns_server --daemon=no --local-port=$port --socket-dir=./ \
+ --no-shuffle --launch=bind --bind-config=./named-slave.conf --slave \
+ --send-root-referral --retrieval-threads=1 --config-name=bind-slave \
+ --cache-ttl=0 --no-config --bind-dnssec-db=./dnssec-slave.sqlite3 &
+ echo 'waiting for zones to be loaded'
+ bindwait bind-slave
+ echo 'reloading zones to work around metadata bug'
+ for zone in $(grep zone named.conf | cut -f2 -d\")
+ do
+ ../pdns/pdns_control --no-config --socket-dir=. --config-name=bind-slave bind-reload-now $zone
+ done
+ fi
fi
## TODO: give pdns a few seconds to startup or fail, then check if it did not fail