xfrout.c revision 499b34cea04a46823d003d4c0520c8b03e8513cb
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * Copyright (C) 1999-2001 Internet Software Consortium.
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * Permission to use, copy, modify, and distribute this software for any
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * purpose with or without fee is hereby granted, provided that the above
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * copyright notice and this permission notice appear in all copies.
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
c9297d37593b36de9978c122dbeaf1bb7ae8d19dMark Andrews/* $Id: xfrout.c,v 1.90 2001/01/09 21:40:09 bwelling Exp $ */
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * Outgoing AXFR and IXFR.
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * - IXFR over UDP
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews ns_g_lctx, DNS_LOGCATEGORY_XFER_OUT, NS_LOGMODULE_XFER_OUT
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecicki * Fail unconditionally and log as a client error.
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * The test against ISC_R_SUCCESS is there to keep the Solaris compiler
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * from complaining about "end-of-loop code not reached".
4040ff974c6971121b6e7f380c3cab472d485490Mark Andrews ns_client_log(client, DNS_LOGCATEGORY_XFER_OUT, \
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews "bad zone transfer request: %s (%s)", \
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews/**************************************************************************/
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * A db_rr_iterator_t is an iterator that iterates over an entire database,
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrews * returning one RR at a time, in some arbitrary order.
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrewsdb_rr_iterator_init(db_rr_iterator_t *it, dns_db_t *db, dns_dbversion_t *ver,
8462dfb880040cde3a60f047ec18808737fd7e85Mark Andrewsdb_rr_iterator_current(db_rr_iterator_t *it, dns_name_t **name,
static isc_result_t
return (result);
static isc_result_t
static isc_result_t
typedef struct rrstream {
} rrstream_t;
struct rrstream_methods {
dns_name_t **,
isc_uint32_t *,
dns_rdata_t **);
typedef struct ixfr_rrstream {
static isc_result_t
const char *journal_filename,
ixfr_rrstream_t *s;
if (s == NULL)
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
static isc_result_t
if (s->journal != 0)
typedef struct axfr_rrstream {
int state;
static isc_result_t
axfr_rrstream_t *s;
if (s == NULL)
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
return (result);
return (result);
static isc_result_t
return (result);
if (s->it_valid)
typedef struct soa_rrstream {
static isc_result_t
soa_rrstream_t *s;
if (s == NULL)
return (ISC_R_NOMEMORY);
&s->soa_tuple));
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
return (ISC_R_SUCCESS);
static isc_result_t
return (ISC_R_NOMORE);
typedef struct compound_rrstream {
int state;
static isc_result_t
static isc_result_t
if (s == NULL)
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
static isc_result_t
s->state = 0;
return (s->result);
static isc_result_t
return (ISC_R_NOMORE);
s->state++;
return (s->result);
void *txmem;
unsigned int txmemlen;
} xfrout_ctx_t;
static isc_result_t
unsigned int maxtime,
unsigned int idletime,
const char *fmt, ...);
switch (reqtype) {
case dns_rdatatype_axfr:
case dns_rdatatype_ixfr:
INSIST(0);
goto failure;
&zone);
case dns_zone_master:
case dns_zone_slave:
&soa_name);
goto got_soa;
goto axfr_fallback;
if (! have_soa)
goto have_stream;
&data_stream);
goto axfr_fallback;
&data_stream));
&stream));
&xfr));
static isc_result_t
unsigned int len;
void *mem;
return (ISC_R_NOMEMORY);
goto failure;
goto failure;
return (ISC_R_SUCCESS);
return (result);
int n_rrs;
isc_region_t r;
goto failure;
goto failure;
unsigned int size;
isc_region_t r;
if (n_rrs == 0) {
goto failure;
goto failure;
goto failure;
goto failure;
goto failure;
xfr));
const char *fmt, ...)