t_master.c revision 70e5a7403f0e0a3bd292b8287c5fed5772c15270
/*
* Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1998-2001, 2003 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: t_master.c,v 1.36 2007/06/19 23:47:00 tbox Exp $ */
#include <config.h>
#include <ctype.h>
#include <stdlib.h>
#include <dns/callbacks.h>
#include <dns/rdataclass.h>
#include <dns/rdataset.h>
#define BUFLEN 255
static isc_result_t
static isc_result_t
&target);
if (result != ISC_R_SUCCESS)
return(result);
}
static int
{
int result;
int len;
else
if (isc_result != ISC_R_SUCCESS) {
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdataclass_fromtext failed %s\n",
return(T_UNRESOLVED);
}
T1_mctx);
if (dns_result == exp_result)
else {
t_info("dns_master_loadfile: got %s, expected %s\n",
}
return(result);
}
static int
test_master_x(const char *filename) {
char *p;
int line;
int cnt;
int result;
line = 0;
++line;
/*
* Skip comment lines.
*/
(void)free(p);
continue;
}
/*
* Name of data file, origin, zclass, expected result.
*/
if (cnt == 4) {
Tokens[2],
} else {
t_info("bad format in %s at line %d\n",
}
(void)free(p);
}
} else {
}
return(result);
}
static const char *a1 = "dns_master_loadfile loads a valid master file and "
"returns ISC_R_SUCCESS";
static void
t1(void) {
int result;
}
static const char *a2 =
"dns_master_loadfile returns ISC_R_UNEXPECTEDEND when the "
"masterfile input ends unexpectedly";
static void
t2(void) {
int result;
}
static const char *a3 = "dns_master_loadfile returns DNS_R_NOOWNER when the "
"an ownername is not specified";
static void
t3() {
int result;
}
static const char *a4 = "dns_master_loadfile accepts broken zone files "
"where the first record has an undefined TTL, "
"as long as it is a SOA";
static void
t4() {
int result;
}
static const char *a5 = "dns_master_loadfile returns DNS_R_BADCLASS when the "
"the record class did not match the zone class";
static void
t5() {
int result;
}
static const char *a6 =
"dns_master_loadfile understands DNSKEY RR specifications "
"containing key material";
static void
t6() {
int result;
}
static const char *a7 =
"dns_master_loadfile understands DNSKEY RR specifications "
"containing no key material";
static void
t7() {
int result;
}
static const char *a8 =
"dns_master_loadfile understands $INCLUDE";
static void
t8() {
int result;
}
static const char *a9 =
"dns_master_loadfile understands $INCLUDE with failure";
static void
t9() {
int result;
}
static const char *a10 =
"dns_master_loadfile non-empty blank lines";
static void
t10() {
int result;
}
static const char *a11 =
"dns_master_loadfile allow leading zeros in SOA";
static void
t11() {
int result;
}
testspec_t T_testlist[] = {
{ t1, "ISC_R_SUCCESS" },
{ t2, "ISC_R_UNEXPECTEDEND" },
{ t3, "DNS_NOOWNER" },
{ t4, "DNS_NOTTL" },
{ t5, "DNS_BADCLASS" },
{ t6, "DNSKEY RR 1" },
{ t7, "DNSKEY RR 2" },
{ t8, "$INCLUDE" },
{ t9, "$INCLUDE w/ DNS_BADCLASS" },
{ t10, "non empty blank lines" },
{ t11, "leading zeros in serial" },
};