a853d87fc422f5ade566a5e264bbb1a6914dbef6Tinderbox User * Copyright (C) 1999-2007, 2016, 2018 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
70e5a7403f0e0a3bd292b8287c5fed5772c15270Automatic Updater/* $Id: notify.c,v 1.37 2007/06/19 23:46:59 tbox Exp $ */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * This module implements notify as in RFC1996.
8e40433e347bc487cd70f02487fc7ce947a2422aMark Andrewsnotify_log(ns_client_t *client, int level, const char *fmt, ...) {
8e40433e347bc487cd70f02487fc7ce947a2422aMark Andrews ns_client_logv(client, DNS_LOGCATEGORY_NOTIFY, NS_LOGMODULE_NOTIFY,
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graffrespond(ns_client_t *client, isc_result_t result) {
f6a9dd2c61911bf4902d6de02a18a31c9d5497f7Mark Andrews msg_result = dns_message_reply(message, ISC_TRUE);
f6a9dd2c61911bf4902d6de02a18a31c9d5497f7Mark Andrews msg_result = dns_message_reply(message, ISC_FALSE);
ee84964a7d29ae88769f67326a65256731769ea7Mark Andrews char tsigbuf[DNS_NAME_FORMATSIZE + sizeof(": TSIG ''")];
d0aee194aad64f4c4c54933c0250ee58d47212f4Mark Andrews * Interpret the question section.
d0aee194aad64f4c4c54933c0250ee58d47212f4Mark Andrews result = dns_message_firstname(request, DNS_SECTION_QUESTION);
ee84964a7d29ae88769f67326a65256731769ea7Mark Andrews "notify question section empty");
d0aee194aad64f4c4c54933c0250ee58d47212f4Mark Andrews * The question section must contain exactly one question.
d0aee194aad64f4c4c54933c0250ee58d47212f4Mark Andrews dns_message_currentname(request, DNS_SECTION_QUESTION, &zonename);
eeb77542a8b85f04665b2cfe34496cdab844a1b1Brian Wellington if (ISC_LIST_NEXT(zone_rdataset, link) != NULL) {
eeb77542a8b85f04665b2cfe34496cdab844a1b1Brian Wellington "notify question section contains multiple RRs");
d0aee194aad64f4c4c54933c0250ee58d47212f4Mark Andrews /* The zone section must have exactly one name. */
d0aee194aad64f4c4c54933c0250ee58d47212f4Mark Andrews result = dns_message_nextname(request, DNS_SECTION_ZONE);
eeb77542a8b85f04665b2cfe34496cdab844a1b1Brian Wellington "notify question section contains multiple RRs");
eeb77542a8b85f04665b2cfe34496cdab844a1b1Brian Wellington /* The one rdataset must be an SOA. */
eeb77542a8b85f04665b2cfe34496cdab844a1b1Brian Wellington if (zone_rdataset->type != dns_rdatatype_soa) {
eeb77542a8b85f04665b2cfe34496cdab844a1b1Brian Wellington "notify question section contains no SOA");
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrews dns_name_format(&tsigkey->name, namebuf, sizeof(namebuf));
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrews snprintf(tsigbuf, sizeof(tsigbuf), ": TSIG '%s' (%s)",
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrews snprintf(tsigbuf, sizeof(tsigbuf), ": TSIG '%s'",
ee84964a7d29ae88769f67326a65256731769ea7Mark Andrews dns_name_format(zonename, namebuf, sizeof(namebuf));
929329d2d66a7e1083c70a9c918381935bf12799Mukund Sivaraman result = dns_zt_find(client->view->zonetable, zonename, 0, NULL, &zone);
929329d2d66a7e1083c70a9c918381935bf12799Mukund Sivaraman dns_zonetype_t zonetype = dns_zone_gettype(zone);
929329d2d66a7e1083c70a9c918381935bf12799Mukund Sivaraman isc_sockaddr_t *from = ns_client_getsockaddr(client);
929329d2d66a7e1083c70a9c918381935bf12799Mukund Sivaraman isc_sockaddr_t *to = ns_client_getdestaddr(client);
929329d2d66a7e1083c70a9c918381935bf12799Mukund Sivaraman "received notify for zone '%s'%s",
929329d2d66a7e1083c70a9c918381935bf12799Mukund Sivaraman result = dns_zone_notifyreceive2(zone, from, to,
ee84964a7d29ae88769f67326a65256731769ea7Mark Andrews "received notify for zone '%s'%s: not authoritative",