2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

SOA in authoritative negative responses had wrong TTL (RT #212)

This commit is contained in:
Andreas Gustafsson 2000-08-08 00:46:00 +00:00
parent 992b1b2aee
commit 2ebe19d1a2

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: query.c,v 1.120 2000/08/01 01:11:57 tale Exp $ */
/* $Id: query.c,v 1.121 2000/08/08 00:46:00 gson Exp $ */
#include <config.h>
@ -29,6 +29,7 @@
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatastruct.h>
#include <dns/rdatatype.h>
#include <dns/resolver.h>
#include <dns/result.h>
@ -1454,6 +1455,24 @@ query_addsoa(ns_client_t *client, dns_db_t *db) {
*/
eresult = DNS_R_SERVFAIL;
} else {
/*
* Extract the SOA MINIMUM.
*/
dns_rdata_soa_t soa;
dns_rdata_t rdata;
result = dns_rdataset_first(rdataset);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
dns_rdataset_current(rdataset, &rdata);
dns_rdata_tostruct(&rdata, &soa, NULL);
/*
* Add the SOA and its SIG to the response, with the
* TTLs adjusted per RFC2308 section 3.
*/
if (rdataset->ttl > soa.minimum)
rdataset->ttl = soa.minimum;
if (sigrdataset->ttl > soa.minimum)
sigrdataset->ttl = soa.minimum;
query_addrrset(client, &name, &rdataset, &sigrdataset, NULL,
DNS_SECTION_AUTHORITY);
}