t_db.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 1999-2001, 2004, 2005, 2007, 2009, 2011-2013, 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: t_db.c,v 1.41 2011/03/12 04:59:46 tbox Exp $ */
#include <config.h>
#include <ctype.h>
#include <stdlib.h>
#include <dns/fixedname.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
static isc_result_t
{
int len;
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
return(dns_result);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdataclass_fromtext failed %s\n",
return(dns_result);
}
if (dns_result != ISC_R_SUCCESS)
t_info("dns_db_create failed %s\n",
return(dns_result);
}
static int
t_dns_db_load(char **av) {
char *filename;
char *db_type;
char *origin;
char *model;
char *class;
char *expected_load_result;
char *findname;
char *find_type;
char *expected_find_result;
int result;
int len;
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_entropy_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_hash_create failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
return(T_UNRESOLVED);
}
if (dns_result != exp_load_result) {
t_info("dns_db_load returned %s, expected %s\n",
dns_db_detach(&db);
return(T_FAIL);
}
if (dns_result != ISC_R_SUCCESS) {
goto cleanup_db;
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdatatype_fromtext %s failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_db_iszone(db))
0,
&nodep,
if (dns_result != exp_find_result) {
t_info("dns_db_find returned %s, expected %s\n",
} else {
}
if (dns_result != ISC_R_NOTFOUND) {
}
if (dns_db_iszone(db))
dns_db_detach(&db);
return(result);
}
static const char *a1 =
"A call to dns_db_load(db, filename) loads the contents of "
"the database in filename into db.";
static void
t1(void) {
int result;
}
static const char *a2 =
"When the database db has cache semantics, a call to "
"dns_db_iscache(db) returns ISC_TRUE.";
static int
{
int result;
int len;
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);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_entropy_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_hash_create failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_create failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result == ISC_R_SUCCESS) {
else
} else {
t_info("dns_db_load failed %s\n",
}
dns_db_detach(&db);
return(result);
}
static int
{
char *p;
int line;
int cnt;
int result;
int nfails;
int nprobs;
nfails = 0;
nprobs = 0;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 4) {
dbtype, /* cache */
cf, /* check func */
exp_result);/* expect */
++nfails;
else
++nprobs;
}
} else {
t_info("bad format in %s at line %d\n",
++nprobs;
}
(void)free(p);
}
} else {
++nprobs;
}
else if (nfails)
return(result);
}
static void
t2(void) {
int result;
}
static const char *a3 =
"When the database db has zone semantics, a call to "
"dns_db_iscache(db) returns ISC_FALSE.";
static void
t3(void) {
int result;
}
static const char *a4 =
"When the database db has zone semantics, a call to "
"dns_db_iszone(db) returns ISC_TRUE.";
static void
t4(void) {
int result;
}
static const char *a5 =
"When the database db has cache semantics, a call to "
"dns_db_iszone(db) returns ISC_FALSE.";
static void
t5(void) {
int result;
}
static int
t_dns_db_origin(char **av) {
char *filename;
char *origin;
int result;
int len;
int order;
t_info("testing with database %s and origin %s\n",
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_entropy_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_hash_create failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("t_create failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_load failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
dns_db_origin(db));
if (order == 0) {
} else {
}
dns_db_detach(&db);
return(result);
}
static const char *a6 =
"A call to dns_db_origin(db) returns the origin of the database.";
static void
t6(void) {
int result;
}
static const char *a7 =
"A call to dns_db_class(db) returns the class of the database.";
#define CLASSBUFLEN 256
static int
t_dns_db_class(char **av) {
char *filename;
char *class;
int result;
t_info("testing with database %s and class %s\n",
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdataclass_fromtext failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_entropy_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_hash_create failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("t_create failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_load failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (db_rdataclass == rdataclass)
else {
t_info("dns_db_class returned %s, expected %s\n",
}
dns_db_detach(&db);
return(result);
}
static void
t7(void) {
int result;
}
static const char *a8 =
"A call to dns_db_currentversion() opens the current "
"version for reading.";
static int
t_dns_db_currentversion(char **av) {
char *filename;
char *db_type;
char *origin;
char *class;
char *model;
char *findname;
char *findtype;
int result;
int len;
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_entropy_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_hash_create failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_load returned %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdatatype_fromtext %s failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* find a name we know is there
*/
0,
0,
&nodep,
if (dns_result != ISC_R_SUCCESS) {
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* create a new version
* delete the found rdataset in the new version
* attempt to find the rdataset again and expect the find to fail
* attempt to find the rdataset in the current version and
* expect the find to succeed
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_newversion failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* Delete the found rdataset in the new version.
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_deleterdataset failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* Don't need these now.
*/
/*
* Find the deleted rdataset and expect it to fail.
*/
0,
0,
&nodep,
t_info("unexpectedly found %s using current version\n",
findname);
dns_db_detach(&db);
return(T_FAIL);
}
/*
*/
/*
* Find the deleted rdata in the current version.
*/
/*
* And expect it to succeed.
*/
if (dns_result == ISC_R_SUCCESS) {
} else {
dns_db_detach(&db);
}
dns_db_detach(&db);
return(result);
}
static void
t8(void) {
int result;
}
static const char *a9 =
"A call to dns_db_newversion() opens a new version for "
"reading and writing.";
static int
t_dns_db_newversion(char **av) {
char *filename;
char *db_type;
char *origin;
char *class;
char *model;
char *newname;
char *newtype;
int result;
int len;
int rval;
const char * added_rdata_data;
/*
* Open a new version, add some data, commit it,
* close it, open a new version, and check that changes
* are present.
*/
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_entropy_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_hash_create failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_load returned %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* Add a new name.
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_findnode failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* Open a new version and associate some rdata with the new name.
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdatatype_fromtext %s failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdataclass_fromtext failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
added_rdata_data = "\x10\x00\x00\x01";
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdatalist_tordataset failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_newversion failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
&added_rdataset, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_addrdataset failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* Close and commit the version.
*/
/*
* Open a new version and find the data we added.
*/
found_nodep = NULL;
/*
* Find the recently added name and rdata.
*/
&found_rdataset, NULL);
if (dns_result != ISC_R_SUCCESS) {
/* XXXWPK - NXRRSET ??? reference counts ??? */
t_info("dns_db_find failed %s\n",
dns_db_detach(&db);
return(T_FAIL);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdataset_first failed %s\n",
dns_db_detach(&db);
return(T_FAIL);
}
/*
* Now make sure its what we expect.
*/
if (rval == 0) {
} else {
}
/*
* Don't need these now.
*/
dns_db_detach(&db);
return(result);
}
static void
t9(void) {
int result;
}
static const char *a10 =
"When versionp points to a read-write version and commit is "
"ISC_TRUE, a call to dns_db_closeversion(db, versionp, commit) "
"causes all changes made in the version to take effect, "
"and returns ISC_R_SUCCESS.";
static int
t_dns_db_closeversion_1(char **av) {
char *filename;
char *db_type;
char *origin;
char *class;
char *model;
char *new_name;
char *new_type;
char *existing_name;
char *existing_type;
int result;
int len;
int rval;
int nfails;
const char * added_rdata_data;
nfails = 0;
/*
* Open a new version, add some data,
* remove some data, close with commit, open the current
* version and check that changes are present.
*/
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_entropy_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_hash_create failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_load returned %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* Remove all rdata for an existing name.
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdatatype_fromtext %s failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_findnode %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/* open a new version */
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_newversion failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
existing_rdatatype, 0);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_deleterdataset failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* add a new name and associate some rdata with it
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_findnode failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* associate some rdata with the new name
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdatatype_fromtext %s failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdataclass_fromtext failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
added_rdata_data = "\x10\x00\x00\x01";
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdatalist_tordataset failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
&added_rdataset, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_addrdataset failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/* close and commit the version */
/* open the current version and check changes */
/* find the recently added name and rdata */
0,
0,
&nodep,
&found_rdataset, NULL);
if (dns_result != ISC_R_SUCCESS) {
/* XXXWPK NXRRSET ??? reference counting ??? */
t_info("dns_db_find failed %s\n",
dns_db_detach(&db);
return(T_FAIL);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdataset_first failed %s\n",
dns_db_detach(&db);
return(T_FAIL);
}
/*
* Now make sure its what we expect.
*/
if (rval != 0) {
++nfails;
}
/*
* Now check the rdata deletion.
*/
0, 0, &nodep,
&found_rdataset, NULL);
++nfails;
}
dns_db_detach(&db);
if (nfails == 0)
else
return(result);
}
static void
t10(void) {
int result;
}
static const char *a11 =
"When versionp points to a read-write version and commit is "
"ISC_FALSE, a call to dns_db_closeversion(db, versionp, commit) "
"causes all changes made in the version to to be rolled back, "
"and returns ISC_R_SUCCESS.";
static int
t_dns_db_closeversion_2(char **av) {
char *filename;
char *db_type;
char *origin;
char *class;
char *model;
char *new_name;
char *new_type;
char *existing_name;
char *existing_type;
int result;
int len;
int rval;
int nfails;
const char * added_rdata_data;
nfails = 0;
/*
* Open a new version, add some data,
* remove some data, close with commit, open the current
* version and check that changes are present.
*/
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_entropy_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_hash_create failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_load returned %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* Remove all rdata for an existing name.
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdatatype_fromtext %s failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_findnode %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* Open a new version.
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_newversion failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
existing_rdatatype, 0);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_deleterdataset failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* add a new name and associate some rdata with it
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_findnode failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdatatype_fromtext %s failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdataclass_fromtext failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
added_rdata_data = "\x10\x00\x00\x01";
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdatalist_tordataset failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
&added_rdataset, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_addrdataset failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* Check that our changes took.
*/
/*
* Find the recently added name and rdata.
*/
&found_rdataset, NULL);
if ((dns_result == ISC_R_NOTFOUND) ||
(dns_result == DNS_R_NXDOMAIN) ||
(dns_result == DNS_R_NXRRSET)) {
t_info("dns_db_find failed %s\n",
dns_db_detach(&db);
return(T_FAIL);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdataset_first failed %s\n",
dns_db_detach(&db);
return(T_FAIL);
}
/*
* Now make sure its what we expect.
*/
if (rval != 0) {
++nfails;
}
/*
* Now check the rdata deletion.
*/
0,
0,
&nodep,
&found_rdataset, NULL);
++nfails;
}
/*
* Close the version without a commit.
*/
/*
* Open the current version and check changes.
*/
/*
* Find the recently added name and rdata.
*/
0,
0,
&nodep,
&found_rdataset, NULL);
dns_db_detach(&db);
return(T_FAIL);
}
/*
* Now check the rdata deletion.
*/
cversionp, existing_rdatatype, 0, 0,
&found_rdataset, NULL);
if ((dns_result == ISC_R_NOTFOUND) ||
(dns_result == DNS_R_NXDOMAIN) ||
(dns_result == DNS_R_NXRRSET)) {
++nfails;
}
dns_db_detach(&db);
if (nfails == 0)
else
return(result);
}
static void
t11(void) {
int result;
}
static const char *a12 =
"A call to dns_db_expirenode() marks as stale all records at node "
"which expire at or before 'now'. If 'now' is zero, then the current "
"time will be used.";
static int
t_dns_db_expirenode(char **av) {
char *filename;
char *db_type;
char *origin;
char *class;
char *existing_name;
char *node_xtime;
char *find_xtime;
char *exp_find_result;
int result;
int len;
/*
* Find a node, mark it as stale, do a dns_db_find on the name and
* expect it to fail.
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_entropy_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_hash_create failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_load returned %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* Check that the node is there.
*/
if (dns_result != ISC_R_SUCCESS) {
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* Expire it.
*/
if (node_expire_time != 0)
node_expire_time += now;
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_expirenode failed %s\n",
dns_db_detach(&db);
return(T_FAIL);
}
if (find_expire_time != 0)
find_expire_time += now;
NULL,
0,
&nodep,
if (dns_result == exp_result) {
} else {
}
if ((dns_result != ISC_R_NOTFOUND) &&
(dns_result != DNS_R_NXDOMAIN) &&
(dns_result != DNS_R_NXRRSET)) {
/*
* Don't need to disassociate the rdataset because
* we're searching with dns_rdatatype_any.
*/
}
dns_db_detach(&db);
return(result);
}
static void
t12(void) {
int result;
}
static const char *a13 =
"If the node name exists, then a call to "
"dns_db_findnode(db, name, ISC_FALSE, nodep) initializes nodep "
"to point to the node and returns ISC_R_SUCCESS, otherwise "
"it returns ISC_R_NOTFOUND.";
static int
t_dns_db_findnode_1(char **av) {
char *filename;
char *db_type;
char *origin;
char *class;
char *model;
char *find_name;
char *find_type;
char *expected_result;
int result;
int len;
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdatatype_fromtext %s failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_entropy_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_hash_create failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_load returned %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != exp_result) {
t_info("dns_db_findnode failed %s\n",
if (dns_result == ISC_R_SUCCESS)
dns_db_detach(&db);
return(T_FAIL);
}
/*
* if we're expecting the find to succeed and it did,
* check that the node has been initialized
* by checking for the specified type of rdata
* and expecting the search to succeed
*/
if (dns_result == ISC_R_SUCCESS) {
rdatatype, 0,
if (dns_result == ISC_R_SUCCESS) {
} else {
t_info("dns_db_findrdataset failed %s\n",
}
} else {
}
dns_db_detach(&db);
return(result);
}
static void
t13(void) {
int result;
}
static const char *a14 =
"If the node name does not exist and create is ISC_TRUE, "
"then a call to dns_db_findnode(db, name, create, nodep) "
"creates the node, initializes nodep to point to the node, "
"and returns ISC_R_SUCCESS.";
static int
t_dns_db_findnode_2(char **av) {
char *filename;
char *db_type;
char *origin;
char *class;
char *model;
char *newname;
int nfails;
int result;
int len;
nfails = 0;
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_entropy_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_hash_create failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_load returned %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* Make sure the name isn't there
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext returned %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if ((dns_result != ISC_R_NOTFOUND) &&
(dns_result != DNS_R_NXDOMAIN) &&
(dns_result != DNS_R_NXRRSET)) {
t_info("dns_db_findnode %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
/*
* Add it.
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_findnode %s\n",
dns_db_detach(&db);
return(T_FAIL);
}
/*
* Check it.
*/
/*
* First try dns_db_find DNS_R_NXDOMAIN.
*/
0,
0,
&newnodep,
}
if (dns_result != DNS_R_NXDOMAIN) {
t_info("dns_db_find %s\n",
++nfails;
}
/*
* Then try dns_db_findnode ISC_R_SUCCESS.
*/
if (dns_result == ISC_R_SUCCESS) {
} else {
++nfails;
}
dns_db_detach(&db);
if (nfails == 0)
else
return(result);
}
static void
t14(void) {
int result;
}
static int
t_dns_db_find_x(char **av) {
char *dbfile;
char *dbtype;
char *dborigin;
char *dbclass;
char *dbmodel;
char *findname;
char *findtype;
char *findopts;
char *findtime;
char *expected_result;
int result;
int len;
int opts;
opts = 0;
findtype);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_entropy_create failed %s\n",
return(T_UNRESOLVED);
}
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_hash_create failed %s\n",
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_load returned %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_rdatatype_fromtext %s failed %s\n",
dns_db_detach(&db);
return(T_UNRESOLVED);
}
if (ftime != 0)
if (dns_db_iszone(db))
opts,
&nodep,
if (dns_result != exp_result) {
t_info("dns_db_find %s %s unexpectedly returned %s, "
"expected %s\n",
} else {
}
if ((dns_result != DNS_R_NXRRSET) &&
(dns_result != DNS_R_ZONECUT))
}
if (dns_db_iszone(db))
dns_db_detach(&db);
return(result);
}
static const char *a15 =
"A call to dns_db_find(db, name, version, type, options, now, ...) "
"finds the best match for 'name' and 'type' in version 'version' "
"of 'db'.";
static void
t15(void) {
int result;
}
static const char *a16 =
"When the desired node and type were found, but are glue, "
"and the DNS_DBFIND_GLUEOK option is set, a call to "
"dns_db_find(db, name, version, type, options, now, ...) "
"returns DNS_R_GLUE.";
static void
t16(void) {
int result;
}
static const char *a17 =
"A call to dns_db_find() returns DNS_R_DELEGATION when the data "
"requested is beneath a zone cut.";
static void
t17(void) {
int result;
}
static const char *a18 =
"A call to dns_db_find() returns DNS_R_DELEGATION when type is "
"dns_rdatatype_any and the desired node is a zone cut.";
static void
t18(void) {
int result;
}
static const char *a19 =
"A call to dns_db_find() returns DNS_R_DNAME when the data "
"requested is beneath a DNAME.";
static void
t19(void) {
int result;
}
static const char *a20 =
"A call to dns_db_find() returns DNS_R_CNAME when the requested "
"rdataset was not found but there is a CNAME at the desired name.";
static void
t20(void) {
int result;
}
static const char *a21 =
"A call to dns_db_find() returns DNS_R_NXDOMAIN when name "
"does not exist.";
static void
t21(void) {
int result;
}
static const char *a22 =
"A call to dns_db_find() returns DNS_R_NXRRSET when "
"the desired name exists, but the desired type does not.";
static void
t22(void) {
int result;
}
static const char *a23 =
"When db is a cache database, a call to dns_db_find() "
"returns ISC_R_NOTFOUND when the desired name does not exist, "
"and no delegation could be found.";
static void
t23(void) {
int result;
}
static const char *a24 =
"When db is a cache database, an rdataset will be found only "
"if at least one rdataset at the found node expires after 'now'.";
static void
t24(void) {
int result;
}
static const char *a25 =
"A call to dns_db_load(db, filename) returns DNS_R_NOTZONETOP "
"when the zone data contains a SOA not at the zone apex.";
static void
t25(void) {
int result;
}
testspec_t T_testlist[] = {
};
#ifdef WIN32
int
}
#endif