notify.c revision 542189f21b3ea9b27b0fbc047d832a34dcaf75bc
/*
* Copyright (C) 1999 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/taskpool.h>
#include <dns/dbiterator.h>
#include <dns/fixedname.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatastruct.h>
/*
* This module implements notify as in RFC 1996.
*/
/**************************************************************************/
/*
* Convenience macro of common isc_log_write() arguments
* to use in reportings server errors.
*/
#define NOTIFY_ERROR_LOGARGS \
/*
* Convenience macro of common isc_log_write() arguments
* to use in tracing dynamic update protocol requests.
*/
#define NOTIFY_PROTOCOL_LOGARGS \
/*
* Convenience macro of common isc_log_write() arguments
* to use in low-level debug tracing.
*/
#define NOTIFY_DEBUG_LOGARGS \
/*
* Check an operation for failure. These macros all assume that
* the function using them has a 'result' variable and a 'failure'
* label.
*/
} while (0)
/*
* Fail unconditionally with result 'code', which must not
* be DNS_R_SUCCESS. The reason for failure presumably has
* been logged already.
*/
do { \
goto failure; \
} while (0)
/*
* Fail unconditionally and log as a client error.
*/
do { \
"notify failed: %s (%s)", \
goto failure; \
} while (0)
/*
* Fail unconditionally and log as a server error.
*/
do { \
"notify error: %s: %s", \
goto failure; \
} while (0)
/**************************************************************************/
static void
if (msg_result != ISC_R_SUCCESS)
if (msg_result != ISC_R_SUCCESS) {
return;
}
}
void
{
/*
* Interpret the question section.
*/
if (result != DNS_R_SUCCESS)
"notify question section empty");
/*
* The question section must contain exactly one question.
*/
"notify question section contains multiple RRs");
/* The zone section must have exactly one name. */
if (result != DNS_R_NOMORE)
"notify question section contains multiple RRs");
if (result != DNS_R_SUCCESS)
"not authoritative for update zone");
switch(dns_zone_gettype(zone)) {
case dns_zone_master:
case dns_zone_slave:
break;
default:
"not authoritative for update zone");
}
return;
/*
* We failed without having sent an update event to the zone.
* We are still in the client task context, so we can
* simply give an error response without switching tasks.
*/
}