named-checkconf.c revision a7c412f37cc73d0332887a746e81220cbf09dd00
/*
* Copyright (C) 2004-2007, 2009-2014 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2002 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-checkconf.c,v 1.56 2011/03/12 04:59:46 tbox Exp $ */
/*! \file */
#include <config.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <isc/commandline.h>
#include <isccfg/namedconf.h>
#include <dns/fixedname.h>
#include <dns/rdataclass.h>
#include "check-tool.h"
static const char *program = "named-checkconf";
#define CHECK(r)\
do { \
result = (r); \
if (result != ISC_R_SUCCESS) \
goto cleanup; \
} while (0)
/*% usage */
ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void
usage(void) {
"[named.conf]\n", program);
exit(1);
}
/*% directory callback */
static isc_result_t
const char *directory;
/*
* Change directory.
*/
if (result != ISC_R_SUCCESS) {
"change directory to '%s' failed: %s\n",
return (result);
}
return (ISC_R_SUCCESS);
}
static isc_boolean_t
int i;
for (i = 0;; i++) {
return (ISC_FALSE);
return (ISC_TRUE);
}
}
static isc_boolean_t
const cfg_listelt_t *element;
const cfg_obj_t *checknames;
int i;
for (i = 0;; i++) {
return (ISC_FALSE);
checknames = NULL;
if (result != ISC_R_SUCCESS)
continue;
*obj = checknames;
return (ISC_TRUE);
}
continue;
return (ISC_TRUE);
}
}
}
static isc_result_t
int i;
for (i = 0;; i++) {
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
}
}
static isc_result_t
return (ISC_R_FAILURE);
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS)
return (result);
dns_db_detach(&db);
return (ISC_R_SUCCESS);
}
/*% configure the zone */
static isc_result_t
{
int i = 0;
const char *zclass;
const char *zname;
if (!cfg_obj_isstring(classobj))
else
}
return (ISC_R_FAILURE);
/*
* Check hints files for hint zones.
* Skip loading checks for any type other than
* master and redirect
*/
return (ISC_R_SUCCESS);
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
} else
INSIST(0);
} else {
}
} else
INSIST(0);
} else {
}
if (cfg_obj_asboolean(obj))
else
} else
} else
INSIST(0);
} else {
}
} else
INSIST(0);
} else {
}
if (cfg_obj_asboolean(obj))
else
}
} else
INSIST(0);
} else {
}
} else
INSIST(0);
} else {
}
if (result == ISC_R_SUCCESS) {
else
INSIST(0);
}
if (result != ISC_R_SUCCESS)
return (result);
}
/*% configure a view */
static isc_result_t
{
const cfg_listelt_t *element;
else
{
if (tresult != ISC_R_SUCCESS)
}
return (result);
}
/*% load zones from the configuration */
static isc_result_t
const cfg_listelt_t *element;
const char *vclass;
{
const char *vname;
vclass = "IN";
if (cfg_obj_isstring(classobj))
}
if (tresult != ISC_R_SUCCESS)
}
if (tresult != ISC_R_SUCCESS)
}
return (result);
}
static void
perror("fwrite");
exit(1);
}
}
/*% The main processing routine */
int
int c;
int exit_status = 0;
unsigned int flags = 0;
switch (c) {
case 'd':
debug++;
break;
case 'j':
break;
case 't':
if (result != ISC_R_SUCCESS) {
exit(1);
}
break;
case 'p':
break;
case 'v':
exit(0);
case 'x':
break;
case 'z':
break;
case '?':
if (isc_commandline_option != '?')
/* FALLTHROUGH */
case 'h':
usage();
default:
exit(1);
}
}
exit(1);
}
usage();
#ifdef _WIN32
InitSockets();
#endif
== ISC_R_SUCCESS);
exit(1);
if (result != ISC_R_SUCCESS)
exit_status = 1;
if (result != ISC_R_SUCCESS)
exit_status = 1;
}
if (print && exit_status == 0)
#ifdef _WIN32
#endif
return (exit_status);
}