nsupdate.c revision 51f99a878d7449a4280b2a8db4c84acb3735f259
d3498432822fb487e58f8f72bb5f880dd8307d7dMichael Sawyer * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 2000-2003 Internet Software Consortium.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark 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.
8826a72394a3cf136c791e4c97b745611f233f0aAutomatic Updater * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
c51203011182577cbb53a6d16d496aa9697fff5cAndreas Gustafsson * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
c51203011182577cbb53a6d16d496aa9697fff5cAndreas Gustafsson * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
c51203011182577cbb53a6d16d496aa9697fff5cAndreas Gustafsson * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
0e9dcd548051a8ec34744bfa18b4e09fea742a39Andreas Gustafsson * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
0e9dcd548051a8ec34744bfa18b4e09fea742a39Andreas Gustafsson * PERFORMANCE OF THIS SOFTWARE.
0e9dcd548051a8ec34744bfa18b4e09fea742a39Andreas Gustafsson/* $Id: nsupdate.c,v 1.135 2004/09/16 02:10:42 marka Exp $ */
#ifdef HAVE_ADDRINFO
#ifdef HAVE_GETADDRINFO
#ifdef HAVE_GAISTRERROR
#define USE_GETADDRINFO
#ifndef USE_GETADDRINFO
#ifndef ISC_PLATFORM_NONSTDHERRNO
extern int h_errno;
#ifndef RESOLV_CONF
static int ns_inuse = 0;
static int ns_total = 0;
static int requests = 0;
typedef struct nsu_requestinfo {
static dns_rdataclass_t
getzoneclass(void) {
return (zoneclass);
static isc_boolean_t
return (ISC_FALSE);
return (ISC_TRUE);
if (debugging) {
if (ddebugging) {
return (NULL);
if (dc == 0)
sc = *s;
*stringp = s;
return (string);
return (string);
reset_system(void) {
&updatemsg);
setup_keystr(void) {
int secretlen;
char *secretstr;
goto failure;
setup_keyfile(void) {
&dstkey);
doshutdown(void) {
if (is_dst_up) {
if (have_ipv4)
if (have_ipv6)
maybeshutdown(void) {
if (requests != 0)
doshutdown();
setup_system(void) {
if (ns_total <= 0) {
/* No name servers in resolv.conf; default to loopback. */
for (i = 0; i < ns_total; i++) {
if (have_ipv6) {
if (have_ipv4) {
setup_keystr();
int count;
int ch;
switch (ch) {
if (timeout == 0)
if (udp_timeout == 0)
argv[0]);
static isc_uint16_t
char *word;
if (*word == 0) {
return (STATUS_SYNTAX);
return (STATUS_MORE);
static isc_uint16_t
isc_region_t r;
cmdline++;
if (*cmdline != 0) {
&callbacks);
return (STATUS_SYNTAX);
return (STATUS_MORE);
static isc_uint16_t
char *word;
return (retval);
if (isrrset) {
if (*word == 0) {
goto failure;
goto failure;
if (*word == 0) {
goto failure;
goto failure;
goto failure;
goto failure;
if (ispositive) {
return (STATUS_MORE);
return (STATUS_SYNTAX);
static isc_uint16_t
char *word;
if (*word == 0) {
return (STATUS_SYNTAX);
return (STATUS_SYNTAX);
static isc_uint16_t
long port;
if (*word == 0) {
return (STATUS_SYNTAX);
if (*word == 0)
char *endp;
if (*endp != 0) {
return (STATUS_SYNTAX);
return (STATUS_SYNTAX);
return (STATUS_MORE);
static isc_uint16_t
long port;
if (*word == 0) {
return (STATUS_SYNTAX);
if (*word == 0)
port = 0;
char *endp;
if (*endp != 0) {
return (STATUS_SYNTAX);
return (STATUS_SYNTAX);
return (STATUS_SYNTAX);
return (STATUS_MORE);
static isc_uint16_t
char *namestr;
char *secretstr;
isc_buffer_t b;
int secretlen;
if (*namestr == 0) {
return (STATUS_SYNTAX);
return (STATUS_SYNTAX);
if (*secretstr == 0) {
return (STATUS_SYNTAX);
return (STATUS_SYNTAX);
return (STATUS_SYNTAX);
return (STATUS_MORE);
static isc_uint16_t
char *word;
isc_buffer_t b;
if (*word == 0) {
return (STATUS_SYNTAX);
NULL);
return (STATUS_SYNTAX);
return (STATUS_MORE);
static isc_uint16_t
char *word;
if (*word == 0) {
return (STATUS_SYNTAX);
return (STATUS_SYNTAX);
switch (rdclass) {
case dns_rdataclass_none:
case dns_rdataclass_any:
case dns_rdataclass_reserved0:
return (STATUS_SYNTAX);
return (STATUS_MORE);
static isc_uint16_t
char *word;
return (retval);
if (*word == 0) {
if (!isdelete) {
goto failure;
ttl = 0;
goto doneparsing;
if (isdelete) {
ttl = 0;
goto parseclass;
goto failure;
if (isdelete)
ttl = 0;
goto failure;
if (*word == 0) {
if (isdelete) {
goto doneparsing;
goto failure;
goto failure;
if (*word == 0) {
if (isdelete) {
goto doneparsing;
goto failure;
goto failure;
goto failure;
rdata);
goto failure;
if (isdelete) {
goto failure;
return (STATUS_MORE);
return (STATUS_SYNTAX);
static isc_uint16_t
char *word;
if (*word == 0) {
return (STATUS_SYNTAX);
return (STATUS_SYNTAX);
int bufsz;
static isc_uint16_t
get_next_command(void) {
char *cmdline;
char *word;
if (interactive)
return (STATUS_QUIT);
return (STATUS_QUIT);
if (*word == 0)
return (STATUS_SEND);
return (STATUS_MORE);
return (STATUS_QUIT);
return (STATUS_SEND);
return (STATUS_MORE);
return (STATUS_MORE);
return (STATUS_SYNTAX);
static isc_boolean_t
user_interaction(void) {
return (ISC_TRUE);
return (ISC_FALSE);
done_update(void) {
requests--;
if (shuttingdown) {
goto done;
switch (result) {
case ISC_R_SUCCESS:
case DNS_R_CLOCKSKEW:
case DNS_R_EXPECTEDTSIG:
case DNS_R_TSIGERRORSET:
case DNS_R_TSIGVERIFYFAILURE:
case DNS_R_UNEXPECTEDTSIG:
if (!debugging) {
isc_buffer_t b;
if (debugging) {
int bufsz;
done:
done_update();
unsigned int options = 0;
if (usevc)
if (debugging) {
if (debugging)
requests++;
int pass = 0;
unsigned int nlabels;
requests--;
if (shuttingdown) {
&request);
requests++;
if (debugging) {
int bufsz;
if (pass == 0)
goto droplabel;
pass++;
goto lookforsoa;
&soaset);
pass++;
goto lookforsoa;
if (seencname)
goto droplabel;
if (debugging) {
if (debugging) {
out:
&request);
goto out;
requests++;
start_update(void) {
done_update();
&soaquery);
ns_inuse = 0;
cleanup(void) {
if (memdebugging)
if (shuttingdown) {
reset_system();
if (!more) {
start_update();
setup_system();
(void)isc_app_run();
cleanup();
if (seenerror)