* 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 <config.h>
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;
}
/*
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. */
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);