From: Mark Andrews Date: Wed, 26 Feb 2003 04:16:27 +0000 (+0000) Subject: 1439. [bug] Named could return NOERROR with certian NOTIFY X-Git-Tag: v9.2.3rc1~104^2~93 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=ee84964a7d29ae88769f67326a65256731769ea7;p=thirdparty%2Fbind9.git 1439. [bug] Named could return NOERROR with certian NOTIFY failures. Return NOTAUTH is the NOTIFY zone is not being served. 1438. [func] Log TSIG (if any) when logging NOTIFY requests. developer: marka reviewer: explorer --- diff --git a/CHANGES b/CHANGES index de5093dbd07..8fc0bbccf93 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +1439. [bug] Named could return NOERROR with certian NOTIFY + failures. Return NOTAUTH is the NOTIFY zone is + not being served. + +1438. [func] Log TSIG (if any) when logging NOTIFY requests. + 1437. [bug] Leave space for stdio to work in. [RT #5033] 1436. [func] dns_zonemgr_resumexfrs() can be used to restart diff --git a/bin/named/notify.c b/bin/named/notify.c index b218b94bf99..ea0eb01c166 100644 --- a/bin/named/notify.c +++ b/bin/named/notify.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: notify.c,v 1.28 2002/08/01 06:51:32 marka Exp $ */ +/* $Id: notify.c,v 1.29 2003/02/26 04:16:27 marka Exp $ */ #include @@ -76,15 +76,18 @@ ns_notify_start(ns_client_t *client) { dns_name_t *zonename; dns_rdataset_t *zone_rdataset; dns_zone_t *zone = NULL; - char str[DNS_NAME_FORMATSIZE]; + char namebuf[DNS_NAME_FORMATSIZE]; + char tsigbuf[DNS_NAME_FORMATSIZE + sizeof(": TSIG ''")]; + dns_name_t *tsigname; /* * Interpret the question section. */ result = dns_message_firstname(request, DNS_SECTION_QUESTION); if (result != ISC_R_SUCCESS) { - notify_log(client, ISC_LOG_NOTICE, "notify question section empty"); - goto failure; + notify_log(client, ISC_LOG_NOTICE, + "notify question section empty"); + goto formerr; } /* @@ -96,7 +99,7 @@ ns_notify_start(ns_client_t *client) { if (ISC_LIST_NEXT(zone_rdataset, link) != NULL) { notify_log(client, ISC_LOG_NOTICE, "notify question section contains multiple RRs"); - goto failure; + goto formerr; } /* The zone section must have exactly one name. */ @@ -104,46 +107,53 @@ ns_notify_start(ns_client_t *client) { if (result != ISC_R_NOMORE) { notify_log(client, ISC_LOG_NOTICE, "notify question section contains multiple RRs"); - goto failure; + goto formerr; } /* The one rdataset must be an SOA. */ if (zone_rdataset->type != dns_rdatatype_soa) { notify_log(client, ISC_LOG_NOTICE, "notify question section contains no SOA"); - goto failure; + goto formerr; } + tsigname = NULL; + if (dns_message_gettsig(request, &tsigname) != NULL) { + dns_name_format(tsigname, namebuf, sizeof(namebuf)); + snprintf(tsigbuf, sizeof(tsigbuf), ": TSIG '%s'", namebuf); + } else + tsigbuf[0] = '\0'; + dns_name_format(zonename, namebuf, sizeof(namebuf)); result = dns_zt_find(client->view->zonetable, zonename, 0, NULL, &zone); - if (result != ISC_R_SUCCESS) { - dns_name_format(zonename, str, sizeof(str)); - notify_log(client, ISC_LOG_NOTICE, - "received notify for zone '%s': not authoritative", - str); - goto failure; - } + if (result != ISC_R_SUCCESS) + goto notauth; switch (dns_zone_gettype(zone)) { case dns_zone_master: case dns_zone_slave: case dns_zone_stub: /* Allow dialup passive to work. */ - dns_name_format(zonename, str, sizeof(str)); notify_log(client, ISC_LOG_INFO, - "received notify for zone '%s'", str); + "received notify for zone '%s'%s", namebuf, tsigbuf); respond(client, dns_zone_notifyreceive(zone, ns_client_getsockaddr(client), request)); break; default: - dns_name_format(zonename, str, sizeof(str)); - notify_log(client, ISC_LOG_NOTICE, - "received notify for zone '%s': not authoritative", - str); - goto failure; + goto notauth; } dns_zone_detach(&zone); return; + notauth: + notify_log(client, ISC_LOG_NOTICE, + "received notify for zone '%s'%s: not authoritative", + namebuf, tsigbuf); + result = DNS_R_NOTAUTH; + goto failure; + + formerr: + result = DNS_R_FORMERR; + failure: if (zone != NULL) dns_zone_detach(&zone);