t_db.c revision 6e49e91bd08778d7eae45a2229dcf41ed97cc636
/*
* 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.
*/
#include <config.h>
#include <ctype.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <isc/assertions.h>
#include <dns/fixedname.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatastruct.h>
#include <dns/compress.h>
#include <dns/dbiterator.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 *cache;
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 (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) {
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 char *a1 =
"A call to dns_db_load(db, filename) loads the contents of "
"the database in filename into db.";
static void
t1() {
int result;
}
static char *a2 =
"When the database db has cache semantics, a call to "
"dns_db_iscache(db) returns ISC_TRUE.";
static int
t_dns_db_zc_x(char *filename,
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 (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((int)*p)) || (*p == '#'))
continue;
if (cnt == 4) {
tokens[0], /* filename */
cache, /* cache */
cf, /* check func */
exp_result); /* exp result */
++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() {
int result;
}
static char *a3 =
"When the database db has zone semantics, a call to "
"dns_db_iscache(db) returns ISC_FALSE.";
static void
t3() {
int result;
}
static char *a4 =
"When the database db has zone semantics, a call to "
"dns_db_iszone(db) returns ISC_TRUE.";
static void
t4() {
int result;
}
static char *a5 =
"When the database db has cache semantics, a call to "
"dns_db_iszone(db) returns ISC_FALSE.";
static void
t5() {
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 (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);
}
if (order == 0) {
}
else {
}
dns_db_detach(&db);
return(result);
}
static char *a6 =
"A call to dns_db_origin(db) returns the origin of the database.";
static void
t6() {
int result;
}
static 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;
char buf[CLASSBUFLEN];
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 (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() {
int result;
}
static 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 *cache;
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 (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,
dns_db_detach(&db);
return(T_FAIL);
}
/* find the deleted rdata in the current version */
0,
&nodep,
/* 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() {
int result;
}
static 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 *cache;
char *newname;
char *newtype;
int result;
int len;
int rval;
/* 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 (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);
}
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 */
0,
0,
NULL);
if (dns_result != ISC_R_SUCCESS) {
/* ZZZ - 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() {
int result;
}
static 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 *cache;
char *new_name;
char *new_type;
char *existing_name;
char *existing_type;
int result;
int len;
int rval;
int nfails;
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 (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);
}
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);
}
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) {
/* ZZZ 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() {
int result;
}
static 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 *cache;
char *new_name;
char *new_type;
char *existing_name;
char *existing_type;
int result;
int len;
int rval;
int nfails;
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 (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);
}
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);
}
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 */
0,
0,
&nodep,
&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 */
0,
0,
&nodep,
&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() {
int result;
}
static 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 (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 */
&nodep);
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() {
int result;
}
static 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 *cache;
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 (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 != 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() {
int result;
}
static 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 *cache;
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 (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_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() {
int result;
}
static int
t_dns_db_find_x(char **av) {
char *dbfile;
char *dbtype;
char *dborigin;
char *dbclass;
char *dbcache;
char *findname;
char *findtype;
char *findopts;
char *findtime;
char *expected_result;
int result;
int len;
int opts;
opts = 0;
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_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_db_iszone(db))
dns_db_detach(&db);
return(result);
}
static 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() {
int result;
}
static 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() {
int result;
}
static char *a17 =
"A call to dns_db_find() returns DNS_R_DELEGATION when the data "
"requested is beneath a zone cut.";
static void
t17() {
int result;
}
static char *a18 =
"A call to dns_db_find() returns DNS_R_ZONECUT when type is "
"dns_rdatatype_any and the desired node is a zone cut.";
static void
t18() {
int result;
}
static char *a19 =
"A call to dns_db_find() returns DNS_R_DNAME when the data "
"requested is beneath a DNAME.";
static void
t19() {
int result;
}
static 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() {
int result;
}
static char *a21 =
"A call to dns_db_find() returns DNS_R_NXDOMAIN when name "
"does not exist.";
static void
t21() {
int result;
}
static 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() {
int result;
}
static 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() {
int result;
}
static 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() {
int result;
}
testspec_t T_testlist[] = {
{ t1, "dns_db_load" },
{ t2, "dns_db_iscache" },
{ t3, "dns_db_iscache" },
{ t4, "dns_db_iszone" },
{ t5, "dns_db_iszone" },
{ t6, "dns_db_origin" },
{ t7, "dns_db_class" },
{ t8, "dns_db_currentversion" },
{ t9, "dns_db_newversion" },
{ t10, "dns_db_closeversion" },
{ t11, "dns_db_closeversion" },
{ t12, "dns_db_expirenode" },
{ t13, "dns_db_findnode" },
{ t14, "dns_db_findnode" },
{ t15, "dns_db_find" },
{ t16, "dns_db_find" },
{ t17, "dns_db_find" },
{ t18, "dns_db_find" },
{ t19, "dns_db_find" },
{ t20, "dns_db_find" },
{ t21, "dns_db_find" },
{ t22, "dns_db_find" },
{ t23, "dns_db_find" },
{ t24, "dns_db_find" },
};