named-checkzone.c revision c9611b45736af157e2993c6ef852e55e8e24ca83
/*
* Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2003 Internet Software Consortium.
*
* 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
/* $Id: named-checkzone.c,v 1.65.32.2 2012/02/07 02:45:21 each Exp $ */
/*! \file */
#include <config.h>
#include <stdlib.h>
#include <isc/commandline.h>
#include <dns/fixedname.h>
#include <dns/masterdump.h>
#include <dns/rdataclass.h>
#include <dns/rdataset.h>
#include "check-tool.h"
static int quiet = 0;
static int dumpzone = 0;
static const char *output_filename;
do { \
if (result != ISC_R_SUCCESS) { \
if (!quiet) \
return (result); \
} \
} while (0)
ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void
usage(void) {
"usage: %s [-djqvD] [-c class] "
"[-f inputformat] [-F outputformat] [-J filename] "
"[-t directory] [-w directory] [-k (ignore|warn|fail)] "
"[-n (ignore|warn|fail)] [-m (ignore|warn|fail)] "
"[-r (ignore|warn|fail)] "
"[-i (full|full-sibling|local|local-sibling|none)] "
"[-M (ignore|warn|fail)] [-S (ignore|warn|fail)] "
"[-W (ignore|warn)] "
"%s zonename filename\n",
exit(1);
}
static void
destroy(void) {
}
/*% main processing routine */
int
int c;
char classname_in[] = "IN";
char *classname = classname_in;
const char *inputformatstr = NULL;
const char *outputformatstr = NULL;
char *endp;
/*
* Uncomment the following line if memory debugging is needed:
* isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
*/
prog_name++;
else
/*
* Libtool doesn't preserve the program name prior to final
* installation. Remove the libtool prefix ("lt-").
*/
prog_name += 3;
#define PROGCMP(X) \
if (PROGCMP("named-checkzone"))
else if (PROGCMP("named-compilezone"))
else
INSIST(0);
/* Compilation specific defaults */
if (progmode == progmode_compile) {
} else
"c:df:hi:jJ:k:L:m:n:qr:s:t:o:vw:DF:M:S:W:"))
!= EOF) {
switch (c) {
case 'c':
break;
case 'd':
debug++;
break;
case 'i':
if (ARGCMP("full")) {
} else if (ARGCMP("full-sibling")) {
} else if (ARGCMP("local")) {
} else if (ARGCMP("local-sibling")) {
} else if (ARGCMP("none")) {
} else {
exit(1);
}
break;
case 'f':
break;
case 'F':
break;
case 'j':
break;
case 'J':
break;
case 'k':
if (ARGCMP("warn")) {
} else if (ARGCMP("fail")) {
} else if (ARGCMP("ignore")) {
} else {
exit(1);
}
break;
case 'L':
if (*endp != '\0') {
"must be numeric");
exit(1);
}
break;
case 'n':
if (ARGCMP("ignore")) {
} else if (ARGCMP("warn")) {
} else if (ARGCMP("fail")) {
} else {
exit(1);
}
break;
case 'm':
if (ARGCMP("warn")) {
} else if (ARGCMP("fail")) {
} else if (ARGCMP("ignore")) {
zone_options &= ~(DNS_ZONEOPT_CHECKMX |
} else {
exit(1);
}
break;
case 'o':
break;
case 'q':
quiet++;
break;
case 'r':
if (ARGCMP("warn")) {
} else if (ARGCMP("fail")) {
} else if (ARGCMP("ignore")) {
} else {
exit(1);
}
break;
case 's':
if (ARGCMP("full"))
else if (ARGCMP("relative")) {
} else {
"unknown or unsupported style: %s\n",
exit(1);
}
break;
case 't':
if (result != ISC_R_SUCCESS) {
exit(1);
}
break;
case 'v':
exit(0);
case 'w':
break;
case 'D':
dumpzone++;
break;
case 'M':
if (ARGCMP("fail")) {
} else if (ARGCMP("warn")) {
} else if (ARGCMP("ignore")) {
} else {
exit(1);
}
break;
case 'S':
if (ARGCMP("fail")) {
} else if (ARGCMP("warn")) {
} else if (ARGCMP("ignore")) {
} else {
exit(1);
}
break;
case 'W':
if (ARGCMP("warn"))
else if (ARGCMP("ignore"))
break;
case '?':
if (isc_commandline_option != '?')
/* FALLTHROUGH */
case 'h':
usage();
default:
exit(1);
}
}
if (result != ISC_R_SUCCESS) {
exit(1);
}
}
if (inputformatstr != NULL) {
"WARNING: input format raw, version ignored\n");
} else {
exit(1);
}
}
if (outputformatstr != NULL) {
char *end;
rawversion > 1U) {
"unknown raw format version\n");
exit(1);
}
} else {
exit(1);
}
}
if (progmode == progmode_compile) {
if (output_filename == NULL) {
"output file required, but not specified\n");
usage();
}
}
if (output_filename != NULL)
dumpzone = 1;
/*
* If we are outputing to stdout then send the informational
* output to stderr.
*/
if (dumpzone &&
(output_filename == NULL ||
}
usage();
#ifdef _WIN32
InitSockets();
#endif
if (!quiet)
== ISC_R_SUCCESS);
== ISC_R_SUCCESS);
&zone);
if (snset) {
}
if (logdump) {
}
if (logdump)
}
destroy();
#ifdef _WIN32
#endif
}