named-checkzone.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 1999-2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $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:l:m:n:qr:s:t:o:vw:DF:M:S:T: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 '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 'T':
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);
if (snset) {
}
if (logdump) {
}
if (logdump)
}
destroy();
#ifdef _WIN32
#endif
}