Commit 75d927bd authored by Andreas Gustafsson's avatar Andreas Gustafsson
Browse files

renamed check-zone to named-checkzone and check-conf to named-checkzone

to reduce /usr/local/bin namespace pollution; added a CHANGES entry for them
parent bb1cf189
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* 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 INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM 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: check-conf.c,v 1.1 2000/12/14 21:33:11 marka Exp $ */
#include <config.h>
#include <errno.h>
#include <stdlib.h>
#include <isc/mem.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/log.h>
#include <dns/namedconf.h>
#include "check-tool.h"
static isc_result_t
zonecbk(dns_c_ctx_t *ctx, dns_c_zone_t *zone, dns_c_view_t *view, void *uap) {
UNUSED(ctx);
UNUSED(uap);
UNUSED(zone);
UNUSED(view);
return (ISC_R_SUCCESS);
}
static isc_result_t
optscbk(dns_c_ctx_t *ctx, void *uap) {
UNUSED(ctx);
UNUSED(uap);
return (ISC_R_SUCCESS);
}
int
main (int argc, char **argv) {
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;
callbacks.zonecbk = zonecbk;
callbacks.optscbk = optscbk;
callbacks.zonecbkuap = NULL;
callbacks.optscbkuap = NULL;
if (argc > 1)
conffile = argv[1];
if (conffile == NULL || conffile[0] == '\0')
conffile = "/etc/named.conf";
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(setup_logging(mctx, &log) == ISC_R_SUCCESS);
if (dns_c_parse_namedconf(conffile, mctx, &configctx, &callbacks) !=
ISC_R_SUCCESS) {
exit(1);
}
dns_c_ctx_delete(&configctx);
isc_log_destroy(&log);
isc_mem_destroy(&mctx);
return (0);
}
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* 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 INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM 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: check-zone.c,v 1.3 2000/12/14 21:33:34 marka Exp $ */
#include <config.h>
#include <stdlib.h>
#include <isc/app.h>
#include <isc/commandline.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/socket.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <dns/db.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/rdataclass.h>
#include <dns/rdataset.h>
#include <dns/result.h>
#include <dns/zone.h>
#include "check-tool.h"
static int debug = 0;
static int quiet = 0;
static isc_mem_t *mctx = NULL;
dns_zone_t *zone = NULL;
dns_zonetype_t zonetype = dns_zone_master;
static const char *dbtype[] = { "rbt" };
#define ERRRET(result, function) \
do { \
if (result != ISC_R_SUCCESS) { \
if (!quiet) \
fprintf(stderr, "%s() returned %s\n", \
function, dns_result_totext(result)); \
return (result); \
} \
} while (0)
static void
usage() {
fprintf(stderr,
"usage: zone_test [-dq] [-c class] zone [filename]\n");
exit(1);
}
static isc_result_t
setup(char *zonename, char *filename, char *classname) {
isc_result_t result;
dns_rdataclass_t rdclass;
isc_textregion_t region;
isc_buffer_t buffer;
dns_fixedname_t fixorigin;
dns_name_t *origin;
if (debug)
fprintf(stderr, "loading \"%s\" from \"%s\" class \"%s\"\n",
zonename, filename, classname);
result = dns_zone_create(&zone, mctx);
ERRRET(result, "dns_zone_new");
dns_zone_settype(zone, zonetype);
isc_buffer_init(&buffer, zonename, strlen(zonename));
isc_buffer_add(&buffer, strlen(zonename));
dns_fixedname_init(&fixorigin);
result = dns_name_fromtext(dns_fixedname_name(&fixorigin),
&buffer, dns_rootname, ISC_FALSE, NULL);
ERRRET(result, "dns_name_fromtext");
origin = dns_fixedname_name(&fixorigin);
result = dns_zone_setorigin(zone, origin);
ERRRET(result, "dns_zone_setorigin");
result = dns_zone_setdbtype(zone, 1, (const char * const *) dbtype);
ERRRET(result, "dns_zone_setdatabase");
result = dns_zone_setfile(zone, filename);
ERRRET(result, "dns_zone_setdatabase");
region.base = classname;
region.length = strlen(classname);
result = dns_rdataclass_fromtext(&rdclass, &region);
ERRRET(result, "dns_rdataclass_fromtext");
dns_zone_setclass(zone, rdclass);
result = dns_zone_load(zone);
return (result);
}
static void
destroy(void) {
if (zone != NULL)
dns_zone_detach(&zone);
}
int
main(int argc, char **argv) {
int c;
char *origin = NULL;
char *filename = NULL;
const char *classname = "IN";
isc_log_t *lctx = NULL;
isc_result_t result;
while ((c = isc_commandline_parse(argc, argv, "c:dqs")) != EOF) {
switch (c) {
case 'c':
classname = isc_commandline_argument;
break;
case 'd':
debug++;
break;
case 'q':
quiet++;
break;
default:
usage();
}
}
if (argv[isc_commandline_index] == NULL)
usage();
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
if (!quiet)
RUNTIME_CHECK(setup_logging(mctx, &lctx) == ISC_R_SUCCESS);
origin = argv[isc_commandline_index];
isc_commandline_index++;
if (argv[isc_commandline_index] != NULL)
filename = argv[isc_commandline_index];
else
filename = origin;
result = setup(origin, filename, (char *)classname);
if (!quiet && result == ISC_R_SUCCESS)
fprintf(stdout, "OK\n ");
destroy();
if (lctx != NULL)
isc_log_destroy(&lctx);
isc_mem_destroy(&mctx);
return ((result == ISC_R_SUCCESS) ? 0 : 1);
}
......@@ -13,30 +13,30 @@
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" $Id: named-checkzone.8,v 1.1 2000/12/14 00:52:44 marka Exp $
.\" $Id: named-checkzone.8,v 1.2 2000/12/19 19:48:10 gson Exp $
.Dd Jun 13, 2000
.Dt CHECK-ZONE 1
.Dt NAMED-CHECKZONE 1
.Os BIND9 9
.ds vT BIND9 Programmer's Manual
.Sh NAME
.Nm check-zone
.Nm named-checkzone
.Nd Zone validity checking tool.
.Sh SYNOPSIS
.Nm check-zone
.Nm named-checkzone
.Op Fl dq
.Op Fl c Ar class
.Ar zone
.Op filename
.Sh DESCRIPTION
.Pp
.Nm check-zone
.Nm named-checkzone
is a tool for performing integrity checks on a zones contents.
It uses the same integrity checks as
.Nm named .
.Pp
The options to
.Nm check-zone
.Nm named-checkzone
are as follows:
.Bl -tag -width Ds
.It Fl d
......@@ -53,9 +53,9 @@ the name of the file containing the zone.
If not specified it defaults to the zone name.
.Sh RETURN VALUES
.Pp
.Nm check-zone
return a zero exit value if no errors were detected,
otherwise it returns 1.
.Nm named-checkzone
return a an exit status of 1 if errors were detected,
0 otherwise.
.Sh SEE ALSO
.Xr named 8 ,
.Xr RFC1035 .
.\" Copyright (C) 2000 Internet Software Consortium.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" 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 INTERNET SOFTWARE CONSORTIUM
.\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
.\" INTERNET SOFTWARE CONSORTIUM 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: check-conf.1,v 1.1 2000/12/14 21:41:50 marka Exp $
.Dd Jun 14, 2000
.Dt CHECK-CONF 1
.Os BIND9 9
.ds vT BIND9 Programmer's Manual
.Sh NAME
.Nm check-conf
.Nd Configuration file syntax checking tool.
.Sh SYNOPSIS
.Nm check-conf
.Op filename
.Sh DESCRIPTION
.Pp
.Nm check-conf
is a tool to check the syntax, but not sematics, of the configuration file
for named.
.Pp
The options to
.Nm check-conf
are as follows:
.Bl -tag -width Ds
.It Ar filename
the name of the configuration file to be checked.
If not specified it defaults /etc/named.conf.
.Sh RETURN VALUES
.Pp
.Nm check-conf
return a zero exit value if no errors were detected,
otherwise it returns 1.
.Sh SEE ALSO
.Xr named 8 ,
.Xr RFC1035 .
.\" Copyright (C) 2000 Internet Software Consortium.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" 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 INTERNET SOFTWARE CONSORTIUM
.\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
.\" INTERNET SOFTWARE CONSORTIUM 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: check-zone.1,v 1.1 2000/12/14 00:52:44 marka Exp $
.Dd Jun 13, 2000
.Dt CHECK-ZONE 1
.Os BIND9 9
.ds vT BIND9 Programmer's Manual
.Sh NAME
.Nm check-zone
.Nd Zone validity checking tool.
.Sh SYNOPSIS
.Nm check-zone
.Op Fl dq
.Op Fl c Ar class
.Ar zone
.Op filename
.Sh DESCRIPTION
.Pp
.Nm check-zone
is a tool for performing integrity checks on a zones contents.
It uses the same integrity checks as
.Nm named .
.Pp
The options to
.Nm check-zone
are as follows:
.Bl -tag -width Ds
.It Fl d
enable debugging.
.It Fl q
quiet mode - exit code only.
.It Fl c Ar class
specify the class of the zone.
If not specified "IN" is assumed.
.It Ar zone
the name of the zone being loaded.
.It Op filename
the name of the file containing the zone.
If not specified it defaults to the zone name.
.Sh RETURN VALUES
.Pp
.Nm check-zone
return a zero exit value if no errors were detected,
otherwise it returns 1.
.Sh SEE ALSO
.Xr named 8 ,
.Xr RFC1035 .
......@@ -13,26 +13,26 @@
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" $Id: named-checkconf.1,v 1.1 2000/12/14 21:41:50 marka Exp $
.\" $Id: named-checkconf.1,v 1.2 2000/12/19 19:48:09 gson Exp $
.Dd Jun 14, 2000
.Dt CHECK-CONF 1
.Dt NAMED-CHECKCONF 1
.Os BIND9 9
.ds vT BIND9 Programmer's Manual
.Sh NAME
.Nm check-conf
.Nm named-checkconf
.Nd Configuration file syntax checking tool.
.Sh SYNOPSIS
.Nm check-conf
.Nm named-checkconf
.Op filename
.Sh DESCRIPTION
.Pp
.Nm check-conf
.Nm named-checkconf
is a tool to check the syntax, but not sematics, of the configuration file
for named.
.Pp
The options to
.Nm check-conf
.Nm named-checkconf
are as follows:
.Bl -tag -width Ds
.It Ar filename
......@@ -40,9 +40,9 @@ the name of the configuration file to be checked.
If not specified it defaults /etc/named.conf.
.Sh RETURN VALUES
.Pp
.Nm check-conf
return a zero exit value if no errors were detected,
otherwise it returns 1.
.Nm named-checkconf
return a an exit status of 1 if errors were detected,
0 otherwise.
.Sh SEE ALSO
.Xr named 8 ,
.Xr RFC1035 .
......@@ -13,30 +13,30 @@
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" $Id: named-checkzone.1,v 1.1 2000/12/14 00:52:44 marka Exp $
.\" $Id: named-checkzone.1,v 1.2 2000/12/19 19:48:10 gson Exp $
.Dd Jun 13, 2000
.Dt CHECK-ZONE 1
.Dt NAMED-CHECKZONE 1
.Os BIND9 9
.ds vT BIND9 Programmer's Manual
.Sh NAME
.Nm check-zone
.Nm named-checkzone
.Nd Zone validity checking tool.
.Sh SYNOPSIS
.Nm check-zone
.Nm named-checkzone
.Op Fl dq
.Op Fl c Ar class
.Ar zone
.Op filename
.Sh DESCRIPTION
.Pp
.Nm check-zone
.Nm named-checkzone
is a tool for performing integrity checks on a zones contents.
It uses the same integrity checks as
.Nm named .
.Pp
The options to
.Nm check-zone
.Nm named-checkzone
are as follows:
.Bl -tag -width Ds
.It Fl d
......@@ -53,9 +53,9 @@ the name of the file containing the zone.
If not specified it defaults to the zone name.
.Sh RETURN VALUES
.Pp
.Nm check-zone
return a zero exit value if no errors were detected,
otherwise it returns 1.
.Nm named-checkzone
return a an exit status of 1 if errors were detected,
0 otherwise.
.Sh SEE ALSO
.Xr named 8 ,
.Xr RFC1035 .
......@@ -674,8 +674,8 @@
./doc/dev/results TXT.BRIEF 1999,2000
./doc/dev/tests TXT.BRIEF 2000
./doc/dev/unexpected TXT.BRIEF 1999,2000
./doc/man/bin/check-conf.1 MAN 2000
./doc/man/bin/check-zone.1 MAN 2000
./doc/man/bin/named-checkconf.1 MAN 2000
./doc/man/bin/named-checkzone.1 MAN 2000
./doc/man/bin/dig.1 MAN 2000
./doc/man/bin/host.1 MAN 2000
./doc/man/bin/lwresd.8 MAN 2000
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment