summaryrefslogtreecommitdiffstats
path: root/bin/check/named-checkconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/check/named-checkconf.c')
-rw-r--r--bin/check/named-checkconf.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/bin/check/named-checkconf.c b/bin/check/named-checkconf.c
index 20983b5..521ed31 100644
--- a/bin/check/named-checkconf.c
+++ b/bin/check/named-checkconf.c
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: named-checkconf.c,v 1.46.222.4 2010-09-07 23:46:05 tbox Exp $ */
+/* $Id: named-checkconf.c,v 1.54 2010-09-07 01:49:08 marka Exp $ */
/*! \file */
@@ -59,9 +59,12 @@ isc_log_t *logc = NULL;
} while (0)
/*% usage */
+ISC_PLATFORM_NORETURN_PRE static void
+usage(void) ISC_PLATFORM_NORETURN_POST;
+
static void
usage(void) {
- fprintf(stderr, "usage: %s [-h] [-j] [-v] [-z] [-t directory] "
+ fprintf(stderr, "usage: %s [-h] [-j] [-p] [-v] [-z] [-t directory] "
"[named.conf]\n", program);
exit(1);
}
@@ -203,6 +206,24 @@ configure_zone(const char *vclass, const char *view,
zfile = cfg_obj_asstring(fileobj);
obj = NULL;
+ if (get_maps(maps, "check-dup-records", &obj)) {
+ if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
+ zone_options |= DNS_ZONEOPT_CHECKDUPRR;
+ zone_options &= ~DNS_ZONEOPT_CHECKDUPRRFAIL;
+ } else if (strcasecmp(cfg_obj_asstring(obj), "fail") == 0) {
+ zone_options |= DNS_ZONEOPT_CHECKDUPRR;
+ zone_options |= DNS_ZONEOPT_CHECKDUPRRFAIL;
+ } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
+ zone_options &= ~DNS_ZONEOPT_CHECKDUPRR;
+ zone_options &= ~DNS_ZONEOPT_CHECKDUPRRFAIL;
+ } else
+ INSIST(0);
+ } else {
+ zone_options |= DNS_ZONEOPT_CHECKDUPRR;
+ zone_options &= ~DNS_ZONEOPT_CHECKDUPRRFAIL;
+ }
+
+ obj = NULL;
if (get_maps(maps, "check-mx", &obj)) {
if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
zone_options |= DNS_ZONEOPT_CHECKMX;
@@ -387,6 +408,15 @@ load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx) {
return (result);
}
+static void
+output(void *closure, const char *text, int textlen) {
+ UNUSED(closure);
+ if (fwrite(text, 1, textlen, stdout) != (size_t)textlen) {
+ perror("fwrite");
+ exit(1);
+ }
+}
+
/*% The main processing routine */
int
main(int argc, char **argv) {
@@ -399,10 +429,11 @@ main(int argc, char **argv) {
int exit_status = 0;
isc_entropy_t *ectx = NULL;
isc_boolean_t load_zones = ISC_FALSE;
+ isc_boolean_t print = ISC_FALSE;
isc_commandline_errprint = ISC_FALSE;
- while ((c = isc_commandline_parse(argc, argv, "dhjt:vz")) != EOF) {
+ while ((c = isc_commandline_parse(argc, argv, "dhjt:pvz")) != EOF) {
switch (c) {
case 'd':
debug++;
@@ -421,6 +452,10 @@ main(int argc, char **argv) {
}
break;
+ case 'p':
+ print = ISC_TRUE;
+ break;
+
case 'v':
printf(VERSION "\n");
exit(0);
@@ -485,6 +520,8 @@ main(int argc, char **argv) {
exit_status = 1;
}
+ if (print && exit_status == 0)
+ cfg_print(config, output, NULL);
cfg_obj_destroy(parser, &config);
cfg_parser_destroy(&parser);
OpenPOWER on IntegriCloud