#include <config.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <isc/commandline.h>
#include <isc/dir.h>
#include <isc/entropy.h>
#include <isc/hash.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
#include <isccfg/namedconf.h>
#include <bind9/check.h>
#include <dns/db.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#include <dns/result.h>
#include <dns/rootns.h>
#include <dns/zone.h>
#include "check-tool.h"
Go to the source code of this file.
Defines | |
#define | CHECK(r) |
#define | CMDLINE_FLAGS "dhjm:t:pvxz" |
Functions | |
static ISC_PLATFORM_NORETURN_PRE void | usage (void) |
usage | |
static isc_result_t | directory_callback (const char *clausename, const cfg_obj_t *obj, void *arg) |
directory callback | |
static isc_boolean_t | get_maps (const cfg_obj_t **maps, const char *name, const cfg_obj_t **obj) |
static isc_boolean_t | get_checknames (const cfg_obj_t **maps, const cfg_obj_t **obj) |
static isc_result_t | configure_hint (const char *zfile, const char *zclass, isc_mem_t *mctx) |
static isc_result_t | configure_zone (const char *vclass, const char *view, const cfg_obj_t *zconfig, const cfg_obj_t *vconfig, const cfg_obj_t *config, isc_mem_t *mctx) |
configure the zone | |
static isc_result_t | configure_view (const char *vclass, const char *view, const cfg_obj_t *config, const cfg_obj_t *vconfig, isc_mem_t *mctx) |
configure a view | |
static isc_result_t | load_zones_fromconfig (const cfg_obj_t *config, isc_mem_t *mctx) |
load zones from the configuration | |
static void | output (void *closure, const char *text, int textlen) |
int | main (int argc, char **argv) |
The main processing routine. | |
Variables | |
static const char * | program = "named-checkconf" |
isc_log_t * | logc = NULL |
Definition in file named-checkconf.c.
#define CHECK | ( | r | ) |
Value:
do { \ result = (r); \ if (result != ISC_R_SUCCESS) \ goto cleanup; \ } while (0)
Definition at line 57 of file named-checkconf.c.
#define CMDLINE_FLAGS "dhjm:t:pvxz" |
Referenced by main().
static ISC_PLATFORM_NORETURN_PRE void usage | ( | void | ) | [static] |
usage
Definition at line 66 of file named-checkconf.c.
References program.
Referenced by dash_option(), main(), parse_command_line(), and plus_option().
static isc_result_t directory_callback | ( | const char * | clausename, | |
const cfg_obj_t * | obj, | |||
void * | arg | |||
) | [static] |
directory callback
Definition at line 77 of file named-checkconf.c.
References cfg_obj_asstring(), cfg_obj_log(), directory, isc_dir_chdir(), ISC_LOG_ERROR, ISC_R_SUCCESS, isc_result_totext(), REQUIRE, and UNUSED.
Referenced by load_configuration(), and main().
static isc_boolean_t get_maps | ( | const cfg_obj_t ** | maps, | |
const char * | name, | |||
const cfg_obj_t ** | obj | |||
) | [static] |
Definition at line 102 of file named-checkconf.c.
References cfg_map_get(), ISC_FALSE, ISC_R_SUCCESS, and ISC_TRUE.
Referenced by configure_zone().
static isc_boolean_t get_checknames | ( | const cfg_obj_t ** | maps, | |
const cfg_obj_t ** | obj | |||
) | [static] |
Definition at line 113 of file named-checkconf.c.
References cfg_list_first(), cfg_list_next(), cfg_listelt_value(), cfg_map_get(), cfg_obj_asstring(), cfg_obj_islist(), cfg_tuple_get(), checknames, ISC_FALSE, ISC_R_SUCCESS, and ISC_TRUE.
Referenced by configure_zone().
static isc_result_t configure_hint | ( | const char * | zfile, | |
const char * | zclass, | |||
isc_mem_t * | mctx | |||
) | [static] |
Definition at line 146 of file named-checkconf.c.
References isc_textregion::base, DE_CONST, dns_db_detach(), dns_rdataclass_fromtext(), dns_rootns_create(), ISC_R_FAILURE, ISC_R_SUCCESS, isc_textregion::length, r, and rdclass.
Referenced by configure_zone().
static isc_result_t configure_zone | ( | const char * | vclass, | |
const char * | view, | |||
const cfg_obj_t * | zconfig, | |||
const cfg_obj_t * | vconfig, | |||
const cfg_obj_t * | config, | |||
isc_mem_t * | mctx | |||
) | [static] |
configure the zone
Definition at line 171 of file named-checkconf.c.
References cfg_map_get(), cfg_obj_asboolean(), cfg_obj_asstring(), cfg_obj_asuint32(), cfg_obj_isstring(), cfg_tuple_get(), configure_hint(), dns_masterformat_map, dns_masterformat_raw, dns_masterformat_text, dns_result_totext(), DNS_ZONEOPT2_CHECKTTL, DNS_ZONEOPT_CHECKDUPRR, DNS_ZONEOPT_CHECKDUPRRFAIL, DNS_ZONEOPT_CHECKINTEGRITY, DNS_ZONEOPT_CHECKMX, DNS_ZONEOPT_CHECKMXFAIL, DNS_ZONEOPT_CHECKNAMES, DNS_ZONEOPT_CHECKNAMESFAIL, DNS_ZONEOPT_CHECKNS, DNS_ZONEOPT_CHECKSIBLING, DNS_ZONEOPT_CHECKSPF, DNS_ZONEOPT_IGNOREMXCNAME, DNS_ZONEOPT_IGNORESRVCNAME, DNS_ZONEOPT_MANYERRORS, DNS_ZONEOPT_WARNMXCNAME, DNS_ZONEOPT_WARNSRVCNAME, get_checknames(), get_maps(), INSIST, ISC_R_FAILURE, ISC_R_SUCCESS, load_zone(), maxttl, zname, zone_options, and zone_options2.
Referenced by configure_view(), do_addzone(), and do_modzone().
static isc_result_t configure_view | ( | const char * | vclass, | |
const char * | view, | |||
const cfg_obj_t * | config, | |||
const cfg_obj_t * | vconfig, | |||
isc_mem_t * | mctx | |||
) | [static] |
configure a view
Definition at line 406 of file named-checkconf.c.
References cfg_list_first(), cfg_list_next(), cfg_listelt_value(), cfg_map_get(), cfg_tuple_get(), configure_zone(), and ISC_R_SUCCESS.
Referenced by load_configuration(), and load_zones_fromconfig().
static isc_result_t load_zones_fromconfig | ( | const cfg_obj_t * | config, | |
isc_mem_t * | mctx | |||
) | [static] |
load zones from the configuration
Definition at line 441 of file named-checkconf.c.
References cfg_list_first(), cfg_list_next(), cfg_listelt_value(), cfg_map_get(), cfg_obj_asstring(), cfg_obj_isstring(), cfg_tuple_get(), configure_view(), and ISC_R_SUCCESS.
Referenced by main().
static void output | ( | void * | closure, | |
const char * | text, | |||
int | textlen | |||
) | [static] |
Definition at line 481 of file named-checkconf.c.
References UNUSED.
Referenced by _dns_tkey_dumpmessage(), ATF_TC_BODY(), dump_zone(), main(), ns_server_signing(), and printtime().
int main | ( | int | argc, | |
char ** | argv | |||
) |
The main processing routine.
Definition at line 491 of file named-checkconf.c.
References bind9_check_namedconf(), cfg_obj_destroy(), cfg_parse_file(), cfg_parser_create(), cfg_parser_destroy(), cfg_parser_setcallback(), CFG_PRINTER_XKEY, cfg_printx(), cfg_type_namedconf, CMDLINE_FLAGS, debug, directory_callback(), dns_name_destroy(), DNS_NAME_MAXWIRE, dns_result_register(), docheckmx, docheckns, dochecksrv, ectx, isc_commandline_argument, isc_commandline_errprint, isc_commandline_index, isc_commandline_option, isc_commandline_parse(), isc_commandline_reset, isc_dir_chroot(), isc_entropy_create(), isc_entropy_detach(), ISC_FALSE, isc_hash_create(), isc_hash_destroy(), isc_log_destroy(), isc_mem_create(), ISC_MEM_DEBUGCTX, isc_mem_debugging, ISC_MEM_DEBUGRECORD, ISC_MEM_DEBUGSIZE, ISC_MEM_DEBUGTRACE, ISC_MEM_DEBUGUSAGE, isc_mem_destroy(), ISC_R_SUCCESS, isc_result_totext(), ISC_TRUE, load_zones(), load_zones_fromconfig(), mctx, nomerge, output(), program, RUNTIME_CHECK, setup_logging(), usage(), and VERSION.
const char* program = "named-checkconf" [static] |
Definition at line 53 of file named-checkconf.c.
Referenced by ISC_LIST(), loadkey(), logkey(), main(), setsoaserial(), setup_logging(), usage(), vbprintf(), and warnifallksk().