mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-20 08:20:26 -05:00
When query processing hits a delegation from a locally configured zone, an attempt may be made to look for a better answer in the cache. In such a case, the zone-sourced delegation data is set aside and the lookup is retried using the cache database. When that lookup is completed, a decision is made whether the answer found in the cache is better than the answer found in the zone. Currently, if the zone-sourced answer turns out to be better than the one found in the cache: - qctx->zdb is not restored into qctx->db, - qctx->node, holding the zone database node found, is not even saved. Thus, in such a case both qctx->db and qctx->node will point at cache data. This is not an issue for BIND versions which do not support mirror zones because in these versions non-recursive queries always cause the zone-sourced delegation to be returned and thus the non-recursive part of query_delegation() is never reached if the delegation is coming from a zone. With mirror zones, however, non-recursive queries may cause cache lookups even after a zone delegation is found. Leaving qctx->db assigned to the cache database when query_delegation() determines that the zone-sourced delegation is the best answer to the client's query prevents DS records from being added to delegations coming from mirror zones. Fix this issue by keeping the zone database and zone node in qctx while the cache is searched for an answer and then restoring them into qctx->db and qctx->node, respectively, if the zone-sourced delegation turns out to be the best answer. Since this change means that qctx->zdb cannot be used as the glue database any more as it will be reset to NULL by RESTORE(), ensure that qctx->db is not a cache database before attaching it to qctx->client->query.gluedb. Furthermore, current code contains a conditional statement which prevents a mirror zone from being used as a source of glue records. Said statement was added to prevent assertion failures caused by attempting to use a zone database's glue cache for finding glue for an NS RRset coming from a cache database. However, that check is overly strict since it completely prevents glue from being added to delegations coming from mirror zones. With the changes described above in place, the scenario this check was preventing can no longer happen, so remove the aforementioned check. If qctx->zdb is not NULL, qctx->zfname will also not be NULL; qctx->zsigrdataset may be NULL in such a case, but query_putrdataset() handles pointers to NULL pointers gracefully. Remove redundant conditional expressions to make the cleanup code in query_freedata() match the corresponding sequences of SAVE() / RESTORE() macros more closely. |
||
|---|---|---|
| .. | ||
| bigtest | ||
| optional | ||
| pkcs11 | ||
| startperf | ||
| system | ||
| testdata/wire | ||
| virtual-time | ||
| win32 | ||
| .gitignore | ||
| cfg_test.c | ||
| fromhex.pl | ||
| headerdep_test.sh.in | ||
| Makefile.in | ||
| makejournal.c | ||
| named.conf | ||
| wire_test.c | ||