]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
713. [func] named-checkconf takes '-t directory' similar to named.
authorMark Andrews <marka@isc.org>
Mon, 29 Jan 2001 03:23:13 +0000 (03:23 +0000)
committerMark Andrews <marka@isc.org>
Mon, 29 Jan 2001 03:23:13 +0000 (03:23 +0000)
                        [RT #726]

CHANGES
bin/check/named-checkconf.c
doc/arm/Bv9ARM-book.xml

diff --git a/CHANGES b/CHANGES
index 78e420f7799879ec400a2069bca57d08f480f380..a7bf5c65f75dd5bf2e3004b7550a2a56d684ad8b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+ 713.  [func]          named-checkconf takes '-t directory' similar to named.
+                       [RT #726]
 
  712.  [bug]           Sending a large signed update message caused an
                        assertion failure. [RT #718]
index 869361749ba5082020cb83f5a76c8095cfec4c9e..d4ccad269ecfec7eea113b05289b677ca811bf7b 100644 (file)
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: named-checkconf.c,v 1.3 2001/01/09 21:39:10 bwelling Exp $ */
+/* $Id: named-checkconf.c,v 1.4 2001/01/29 03:23:11 marka Exp $ */
 
 #include <config.h>
 
 #include <errno.h>
 #include <stdlib.h>
+#include <stdio.h>
 
+#include <isc/commandline.h>
+#include <isc/dir.h>
 #include <isc/mem.h>
+#include <isc/result.h>
 #include <isc/string.h>
 #include <isc/util.h>
 
 
 #include "check-tool.h"
 
+static void
+usage(void) {
+        fprintf(stderr, "usage: named-checkconf [-t directory] [named.conf]\n");
+        exit(1);
+}
+
 static isc_result_t
 zonecbk(dns_c_ctx_t *ctx, dns_c_zone_t *zone, dns_c_view_t *view, void *uap) {
 
@@ -52,19 +62,43 @@ optscbk(dns_c_ctx_t *ctx, void *uap) {
 
 int
 main(int argc, char **argv) {
+       int c;
        dns_c_ctx_t *configctx = NULL;
        const char *conffile = NULL;
        isc_mem_t *mctx = NULL;
        dns_c_cbks_t callbacks;
        isc_log_t *log = NULL;
+       isc_result_t result;
 
        callbacks.zonecbk = zonecbk;
        callbacks.optscbk = optscbk;
        callbacks.zonecbkuap = NULL;
        callbacks.optscbkuap = NULL;
 
-       if (argc > 1)
-               conffile = argv[1];
+       while ((c = isc_commandline_parse(argc, argv, "t:")) != EOF) {
+               switch (c) {
+               case 't':
+                       result = isc_dir_chroot(isc_commandline_argument);
+                       if (result != ISC_R_SUCCESS) {
+                               fprintf(stderr, "isc_dir_chroot: %s\n",
+                                       isc_result_totext(result));
+                               exit(1);
+                       }
+                       result = isc_dir_chdir("/");
+                       if (result != ISC_R_SUCCESS) {
+                               fprintf(stderr, "isc_dir_chdir: %s\n",
+                                       isc_result_totext(result));
+                               exit(1);
+                       }
+                       break;
+
+               default:
+                       usage();
+               }
+       }
+
+       if (argv[isc_commandline_index] != NULL)
+               conffile = argv[isc_commandline_index];
        if (conffile == NULL || conffile[0] == '\0')
                conffile = "/etc/named.conf";
 
index 9290c966064d58763d3a173e063d5a6365c6359d..cc392211c8d8c4952630ddc5828a13b042111e2f 100644 (file)
@@ -2,7 +2,7 @@
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.0//EN"
                "http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd">
 
-<!-- File: $Id: Bv9ARM-book.xml,v 1.95 2001/01/29 00:50:28 marka Exp $ -->
+<!-- File: $Id: Bv9ARM-book.xml,v 1.96 2001/01/29 03:23:13 marka Exp $ -->
 
 <book>
 
@@ -682,6 +682,7 @@ of a server.</para>
              checks the syntax of a <filename>named.conf</filename> file.</para>
               <cmdsynopsis label="Usage">
                 <command>named-checkconf</command>
+               <arg>-t <replaceable>directory</replaceable></arg>
                 <arg><replaceable>filename</replaceable></arg>
               </cmdsynopsis>
             </listitem>