named-checkconf.c revision ec5347e2c775f027573ce5648b910361aa926c01
/*
* Copyright (C) 2004-2007 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.45 2007/06/18 23:47:17 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 "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 */
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);
}
}
/*% configure the zone */
static isc_result_t
{
int i = 0;
const char *zclass;
const char *zname;
const char *zfile;
if (!cfg_obj_isstring(classobj))
else
}
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_R_FAILURE);
} else
INSIST(0);
} else {
}
if (cfg_obj_asboolean(obj))
else
}
} else
INSIST(0);
} else {
}
} else
INSIST(0);
} else {
}
if (cfg_obj_asboolean(obj))
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);
}
/*% The main processing routine */
int
int c;
int exit_status = 0;
switch (c) {
case 'd':
debug++;
break;
case 'j':
break;
case 't':
if (result != ISC_R_SUCCESS) {
exit(1);
}
if (result != ISC_R_SUCCESS) {
exit(1);
}
break;
case 'v':
exit(0);
case 'z':
break;
case '?':
if (isc_commandline_option != '?')
case 'h':
usage();
default:
exit(1);
}
}
usage();
== ISC_R_SUCCESS);
exit(1);
if (result != ISC_R_SUCCESS)
exit_status = 1;
if (result != ISC_R_SUCCESS)
exit_status = 1;
}
return (exit_status);
}