/*
* Copyright (C) 2004-2010, 2012 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2002 Internet Software Consortium.
*
* 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$ */
/*! \file */
#include <config.h>
#include <stdio.h>
#ifdef _WIN32
#include <Winsock2.h>
#endif
#include "check-tool.h"
#include <dns/fixedname.h>
#include <dns/rdataclass.h>
#include <dns/rdataset.h>
#ifndef CHECK_SIBLING
#endif
#ifndef CHECK_LOCAL
#endif
#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)
int debug = 0;
#if CHECK_LOCAL
#else
#endif
#if CHECK_SIBLING
#endif
/*
*/
{ "", 0 },
{ "client", 0 },
{ "network", 0 },
{ "update", 0 },
{ "queries", 0 },
{ "unmatched", 0 },
{ "update-security", 0 },
{ "query-errors", 0 },
{ NULL, 0 }
};
static void
}
static void
if (result != ISC_R_SUCCESS)
return;
}
if (result != ISC_R_SUCCESS)
return;
}
return;
if (result != ISC_R_SUCCESS)
}
static isc_boolean_t
return (ISC_FALSE);
if (result == ISC_R_SUCCESS)
return (ISC_TRUE);
return (ISC_FALSE);
}
static isc_boolean_t
{
#ifdef USE_GETADDRINFO
const char *type;
int result;
a->type == dns_rdatatype_a);
return (answer);
/*
* Turn off search.
*/
switch (result) {
case 0:
/*
* Work around broken getaddrinfo() implementations that
* fail to set ai_canonname on first entry.
*/
"is a CNAME '%s' (illegal)",
cur->ai_canonname);
/* XXX950 make fatal for 9.5.0 */
/* answer = ISC_FALSE; */
}
break;
case EAI_NONAME:
case EAI_NODATA:
#endif
"has no addresses records (A or AAAA)",
}
/* XXX950 make fatal for 9.5.0 */
return (ISC_TRUE);
default:
"getaddrinfo(%s) failed: %s",
}
return (ISC_TRUE);
}
/*
* 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;
}
}
"extra GLUE A record (%s)",
/* XXX950 make fatal for 9.5.0 */
/* answer = ISC_FALSE; */
}
result = dns_rdataset_next(a);
}
if (!dns_rdataset_isassociated(aaaa))
goto checkmissing;
while (result == ISC_R_SUCCESS) {
continue;
break;
}
}
"extra GLUE AAAA record (%s)",
/* XXX950 make fatal for 9.5.0. */
/* answer = ISC_FALSE; */
}
}
/*
* 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)",
/* XXX950 make fatal for 9.5.0. */
/* answer = ISC_FALSE; */
}
}
if (missing_glue)
}
return (answer);
#else
return (ISC_TRUE);
#endif
}
static isc_boolean_t
#ifdef USE_GETADDRINFO
int result;
/*
* Turn off search.
*/
switch (result) {
case 0:
/*
* Work around broken getaddrinfo() implementations that
* fail to set ai_canonname on first entry.
*/
if ((zone_options & DNS_ZONEOPT_WARNMXCNAME) != 0)
if ((zone_options & DNS_ZONEOPT_IGNOREMXCNAME) == 0) {
" is a CNAME '%s' "
"(illegal)",
cur->ai_canonname);
}
if (level == ISC_LOG_ERROR)
}
}
return (answer);
case EAI_NONAME:
case EAI_NODATA:
#endif
"has no addresses records (A or AAAA)",
}
/* XXX950 make fatal for 9.5.0. */
return (ISC_TRUE);
default:
"getaddrinfo(%s) failed: %s",
}
return (ISC_TRUE);
}
#else
return (ISC_TRUE);
#endif
}
static isc_boolean_t
#ifdef USE_GETADDRINFO
int result;
/*
* Turn off search.
*/
switch (result) {
case 0:
/*
* Work around broken getaddrinfo() implementations that
* fail to set ai_canonname on first entry.
*/
if ((zone_options & DNS_ZONEOPT_WARNSRVCNAME) != 0)
if ((zone_options & DNS_ZONEOPT_IGNORESRVCNAME) == 0) {
" (out of zone) is a "
"CNAME '%s' (illegal)",
cur->ai_canonname);
}
if (level == ISC_LOG_ERROR)
}
}
return (answer);
case EAI_NONAME:
case EAI_NODATA:
#endif
"has no addresses records (A or AAAA)",
}
/* XXX950 make fatal for 9.5.0. */
return (ISC_TRUE);
default:
"getaddrinfo(%s) failed: %s",
}
return (ISC_TRUE);
}
#else
return (ISC_TRUE);
#endif
}
&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 */
{
const char *flags;
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);
}
#ifdef _WIN32
void
InitSockets(void) {
int err;
if (err != 0) {
exit(1);
}
}
void
DestroySockets(void) {
WSACleanup();
}
#endif