check-tool.c revision 03e200df5dc283f24a6a349f0b31d3eab26da893
/*
* Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2002 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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-tool.c,v 1.20 2005/09/05 00:10:51 marka Exp $ */
/*! \file */
#include <config.h>
#include <stdio.h>
#include <string.h>
#include "check-tool.h"
#include <dns/fixedname.h>
#include <dns/rdataclass.h>
#include <dns/rdataset.h>
#ifdef HAVE_ADDRINFO
#ifdef HAVE_GETADDRINFO
#ifdef HAVE_GAISTRERROR
#define USE_GETADDRINFO
#endif
#endif
#endif
#define CHECK(r) \
do { \
result = (r); \
if (result != ISC_R_SUCCESS) \
goto cleanup; \
} while (0)
static const char *dbtype[] = { "rbt" };
int debug = 0;
unsigned int zone_options = DNS_ZONEOPT_CHECKNS |
/*
*/
static isc_logcategory_t categories[] = {
{ "", 0 },
{ "client", 0 },
{ "network", 0 },
{ "update", 0 },
{ "queries", 0 },
{ "unmatched", 0 },
{ "update-security", 0 },
{ NULL, 0 }
};
static isc_boolean_t
{
#ifdef USE_GETADDRINFO
char ownerbuf[DNS_NAME_FORMATSIZE];
char addrbuf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:123.123.123.123")];
const char *type;
int result;
a->type == dns_rdatatype_a);
/*
* Turn off search.
*/
switch (result) {
case 0:
"is a CNAME (illegal)",
}
break;
case EAI_NONAME:
case EAI_NODATA:
#endif
"has no addresses records (A or AAAA)",
return (ISC_FALSE);
default:
"getaddrinfo(%s) failed: %s",
return (ISC_TRUE);
}
return (answer);
/*
* Check that all glue records really exist.
*/
if (!dns_rdataset_isassociated(a))
goto checkaaaa;
result = dns_rdataset_first(a);
while (result == ISC_R_SUCCESS) {
dns_rdataset_current(a, &rdata);
continue;
break;
}
}
if (!match) {
"extra GLUE A record (%s)",
}
result = dns_rdataset_next(a);
}
if (!dns_rdataset_isassociated(aaaa))
goto checkmissing;
while (result == ISC_R_SUCCESS) {
continue;
break;
}
}
if (!match) {
"extra GLUE AAAA record (%s)",
}
}
/*
* Check that all addresses appear in the glue.
*/
case AF_INET:
rdataset = a;
type = "A";
break;
case AF_INET6:
type = "AAAA";
break;
default:
continue;
}
else
}
if (!match) {
"missing GLUE %s record (%s)",
}
}
return (answer);
#else
return (ISC_TRUE);
#endif
}
static isc_boolean_t
#ifdef USE_GETADDRINFO
char ownerbuf[DNS_NAME_FORMATSIZE];
int result;
/*
* Turn off search.
*/
switch (result) {
case 0:
"is a CNAME (illegal)",
break;
case EAI_NONAME:
case EAI_NODATA:
#endif
"has no addresses records (A or AAAA)",
return (ISC_FALSE);
default:
"getaddrinfo(%s) failed: %s",
return (ISC_TRUE);
}
#endif
return (ISC_TRUE);
}
static isc_boolean_t
#ifdef USE_GETADDRINFO
char ownerbuf[DNS_NAME_FORMATSIZE];
int result;
/*
* Turn off search.
*/
switch (result) {
case 0:
"is a CNAME (illegal)",
break;
case EAI_NONAME:
case EAI_NODATA:
#endif
"has no addresses records (A or AAAA)",
return (ISC_FALSE);
default:
"getaddrinfo(%s) failed: %s",
return (ISC_TRUE);
}
#endif
return (ISC_TRUE);
}
&destination, 0) == ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
}
/*% load the zone */
dns_zone_t **zonep)
{
if (debug)
if (docheckmx)
if (docheckns)
if (dochecksrv)
}
return (result);
}
/*% dump the zone */
{
if (debug) {
else
}
if (result != ISC_R_SUCCESS) {
"file \"%s\" for writing\n", filename);
return (ISC_R_FAILURE);
}
}
(void)isc_stdio_close(output);
return (result);
}