named-checkconf.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 1999-2002, 2004-2007, 2009-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-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
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_SUCCESS);
return (ISC_R_FAILURE);
/*
* Skip checks when using an alternate data source.
*/
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
/*
* Check hints files for hint zones.
* Skip loading checks for any type other than
* master and redirect
*/
return (ISC_R_SUCCESS);
/*
* Is the redirect zone configured as a slave?
*/
if (mastersobj != NULL)
return (ISC_R_SUCCESS);
}
return (ISC_R_FAILURE);
} 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 {
}
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);
}
static isc_result_t
{
if (!cfg_obj_isstring(classobj)) {
return (ISC_R_SUCCESS);
}
return (dns_rdataclass_fromtext(classp, &r));
}
/*% load zones from the configuration */
static isc_result_t
const cfg_listelt_t *element;
{
const char *vname;
char buf[sizeof("CLASS65535")];
continue;
&viewclass));
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;
/*
* Process memory debugging argument first.
*/
#define CMDLINE_FLAGS "dhjm:t:pvxz"
switch (c) {
case 'm':
break;
default:
break;
}
}
switch (c) {
case 'd':
debug++;
break;
case 'j':
break;
case 'm':
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);
}