2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

fixed closing comment error introduced by my last revision

This commit is contained in:
David Lawrence 2000-05-24 05:02:19 +00:00
parent 2fda9d9e1b
commit e38d22f566

View File

@ -36,7 +36,8 @@
static isc_result_t static isc_result_t
t_create(char *db_type, char *origin, char *class, char *cache, t_create(char *db_type, char *origin, char *class, char *cache,
isc_mem_t *mctx, dns_db_t **db) { isc_mem_t *mctx, dns_db_t **db)
{
int len; int len;
isc_result_t dns_result; isc_result_t dns_result;
isc_boolean_t iscache; isc_boolean_t iscache;
@ -84,7 +85,6 @@ t_create(char *db_type, char *origin, char *class, char *cache,
static int static int
t_dns_db_load(char **av) { t_dns_db_load(char **av) {
char *filename; char *filename;
char *db_type; char *db_type;
char *origin; char *origin;
@ -201,8 +201,7 @@ t_dns_db_load(char **av) {
dns_result_totext(dns_result), dns_result_totext(dns_result),
dns_result_totext(exp_find_result)); dns_result_totext(exp_find_result));
result = T_FAIL; result = T_FAIL;
} } else {
else {
result = T_PASS; result = T_PASS;
} }
@ -224,7 +223,7 @@ static char *a1 =
"the database in filename into db."; "the database in filename into db.";
static void static void
t1() { t1(void) {
int result; int result;
t_assert("dns_db_load", 1, T_REQUIRED, a1); t_assert("dns_db_load", 1, T_REQUIRED, a1);
@ -240,7 +239,8 @@ static char *a2 =
static int static int
t_dns_db_zc_x(char *filename, char *db_type, char *origin, char *class, t_dns_db_zc_x(char *filename, char *db_type, char *origin, char *class,
isc_boolean_t cache, isc_boolean_t(*cf)(dns_db_t *), isc_boolean_t cache, isc_boolean_t(*cf)(dns_db_t *),
isc_boolean_t exp_result) { isc_boolean_t exp_result)
{
int result; int result;
int len; int len;
dns_db_t *db; dns_db_t *db;
@ -303,8 +303,7 @@ t_dns_db_zc_x(char *filename, char *db_type, char *origin, char *class,
result = T_PASS; result = T_PASS;
else else
result = T_FAIL; result = T_FAIL;
} } else {
else {
t_info("dns_db_load failed %s\n", t_info("dns_db_load failed %s\n",
dns_result_totext(dns_result)); dns_result_totext(dns_result));
result = T_FAIL; result = T_FAIL;
@ -317,7 +316,8 @@ t_dns_db_zc_x(char *filename, char *db_type, char *origin, char *class,
static int static int
test_dns_db_zc_x(char *filename, isc_boolean_t cache, test_dns_db_zc_x(char *filename, isc_boolean_t cache,
isc_boolean_t(*cf)(dns_db_t *), isc_boolean_t exp_result) { isc_boolean_t(*cf)(dns_db_t *), isc_boolean_t exp_result)
{
FILE *fp; FILE *fp;
char *p; char *p;
@ -346,39 +346,36 @@ test_dns_db_zc_x(char *filename, isc_boolean_t cache,
cnt = t_bustline(p, tokens); cnt = t_bustline(p, tokens);
if (cnt == 4) { if (cnt == 4) {
result = t_dns_db_zc_x( result = t_dns_db_zc_x(tokens[0], /* file */
tokens[0], /* filename */
tokens[1], /* type */ tokens[1], /* type */
tokens[2], /* origin */ tokens[2], /* origin */
tokens[3], /* class */ tokens[3], /* class */
cache, /* cache */ cache, /* cache */
cf, /* check func */ cf, /* check func */
exp_result); /* exp result */ exp_result);/* expect */
if (result != T_PASS) { if (result != T_PASS) {
if (result == T_FAIL) if (result == T_FAIL)
++nfails; ++nfails;
else else
++nprobs; ++nprobs;
} }
} } else {
else {
t_info("bad format in %s at line %d\n", t_info("bad format in %s at line %d\n",
filename, line); filename, line);
++nprobs; ++nprobs;
} }
(void) free(p); (void)free(p);
} }
(void) fclose(fp); (void)fclose(fp);
} } else {
else {
t_info("Missing datafile %s\n", filename); t_info("Missing datafile %s\n", filename);
++nprobs; ++nprobs;
} }
result = T_UNRESOLVED; result = T_UNRESOLVED;
if ((nfails == 0) && (nprobs == 0)) if (nfails == 0 && nprobs == 0)
result = T_PASS; result = T_PASS;
else if (nfails) else if (nfails)
result = T_FAIL; result = T_FAIL;
@ -387,7 +384,7 @@ test_dns_db_zc_x(char *filename, isc_boolean_t cache,
} }
static void static void
t2() { t2(void) {
int result; int result;
t_assert("dns_db_iscache", 2, T_REQUIRED, a2); t_assert("dns_db_iscache", 2, T_REQUIRED, a2);
@ -403,7 +400,7 @@ static char *a3 =
static void static void
t3() { t3(void) {
int result; int result;
t_assert("dns_db_iscache", 3, T_REQUIRED, a3); t_assert("dns_db_iscache", 3, T_REQUIRED, a3);
@ -419,7 +416,7 @@ static char *a4 =
static void static void
t4() { t4(void) {
int result; int result;
t_assert("dns_db_iszone", 4, T_REQUIRED, a4); t_assert("dns_db_iszone", 4, T_REQUIRED, a4);
@ -434,7 +431,7 @@ static char *a5 =
"dns_db_iszone(db) returns ISC_FALSE."; "dns_db_iszone(db) returns ISC_FALSE.";
static void static void
t5() { t5(void) {
int result; int result;
t_assert("dns_db_iszone", 5, T_REQUIRED, a5); t_assert("dns_db_iszone", 5, T_REQUIRED, a5);
@ -509,11 +506,11 @@ t_dns_db_origin(char **av) {
isc_mem_destroy(&mctx); isc_mem_destroy(&mctx);
return(T_UNRESOLVED); return(T_UNRESOLVED);
} }
order = dns_name_compare(dns_fixedname_name(&dns_origin), dns_db_origin(db)); order = dns_name_compare(dns_fixedname_name(&dns_origin),
dns_db_origin(db));
if (order == 0) { if (order == 0) {
result = T_PASS; result = T_PASS;
} } else {
else {
t_info("dns_name_compare returned %d\n", order); t_info("dns_name_compare returned %d\n", order);
result = T_FAIL; result = T_FAIL;
} }
@ -528,7 +525,7 @@ static char *a6 =
"A call to dns_db_origin(db) returns the origin of the database."; "A call to dns_db_origin(db) returns the origin of the database.";
static void static void
t6() { t6(void) {
int result; int result;
t_assert("dns_db_origin", 6, T_REQUIRED, a6); t_assert("dns_db_origin", 6, T_REQUIRED, a6);
@ -619,7 +616,7 @@ t_dns_db_class(char **av) {
} }
static void static void
t7() { t7(void) {
int result; int result;
t_assert("dns_db_class", 7, T_REQUIRED, a7); t_assert("dns_db_class", 7, T_REQUIRED, a7);
@ -770,7 +767,9 @@ t_dns_db_currentversion(char **av) {
return(T_UNRESOLVED); return(T_UNRESOLVED);
} }
/* delete the found rdataset in the new version */ /*
* Delete the found rdataset in the new version.
*/
dns_result = dns_db_deleterdataset(db, nodep, nversionp, rdatatype, 0); dns_result = dns_db_deleterdataset(db, nodep, nversionp, rdatatype, 0);
if (dns_result != ISC_R_SUCCESS) { if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_deleterdataset failed %s\n", t_info("dns_db_deleterdataset failed %s\n",
@ -784,12 +783,16 @@ t_dns_db_currentversion(char **av) {
return(T_UNRESOLVED); return(T_UNRESOLVED);
} }
/* don't need these now */ /*
* Don't need these now.
*/
dns_rdataset_disassociate(&rdataset); dns_rdataset_disassociate(&rdataset);
dns_db_detachnode(db, &nodep); dns_db_detachnode(db, &nodep);
nodep = NULL; nodep = NULL;
/* find the deleted rdataset and expect it to fail */ /*
* Find the deleted rdataset and expect it to fail.
*/
dns_result = dns_db_find(db, dns_result = dns_db_find(db,
dns_fixedname_name(&dns_findname), dns_fixedname_name(&dns_findname),
nversionp, nversionp,
@ -810,25 +813,25 @@ t_dns_db_currentversion(char **av) {
return(T_FAIL); return(T_FAIL);
} }
/* close/commit the new version */ /*
* Close/commit the new version.
*/
dns_db_closeversion(db, &nversionp, ISC_TRUE); dns_db_closeversion(db, &nversionp, ISC_TRUE);
/* find the deleted rdata in the current version */ /*
dns_result = dns_db_find(db, * Find the deleted rdata in the current version.
dns_fixedname_name(&dns_findname), */
cversionp, dns_result = dns_db_find(db, dns_fixedname_name(&dns_findname),
rdatatype, cversionp, rdatatype, DNS_DBFIND_GLUEOK,
DNS_DBFIND_GLUEOK, 0, &nodep, dns_fixedname_name(&dns_foundname),
0,
&nodep,
dns_fixedname_name(&dns_foundname),
&rdataset, NULL); &rdataset, NULL);
/* and expect it to succeed */ /*
* And expect it to succeed.
*/
if (dns_result == ISC_R_SUCCESS) { if (dns_result == ISC_R_SUCCESS) {
result = T_PASS; result = T_PASS;
} } else {
else {
t_info("cound not find %s using current version\n", findname); t_info("cound not find %s using current version\n", findname);
dns_db_closeversion(db, &cversionp, ISC_FALSE); dns_db_closeversion(db, &cversionp, ISC_FALSE);
dns_db_detach(&db); dns_db_detach(&db);
@ -847,7 +850,7 @@ t_dns_db_currentversion(char **av) {
} }
static void static void
t8() { t8(void) {
int result; int result;
t_assert("dns_db_currentversion", 8, T_REQUIRED, a8); t_assert("dns_db_currentversion", 8, T_REQUIRED, a8);
@ -905,9 +908,10 @@ t_dns_db_newversion(char **av) {
db = NULL; db = NULL;
mctx = NULL; mctx = NULL;
/* open a new version, add some data, commit it, /*
* Open a new version, add some data, commit it,
* close it, open a new version, and check that changes * close it, open a new version, and check that changes
* are present * are present.
*/ */
t_info("testing using file %s and name %s\n", filename, newname); t_info("testing using file %s and name %s\n", filename, newname);
@ -935,7 +939,7 @@ t_dns_db_newversion(char **av) {
} }
/* /*
* add a new name * Add a new name.
*/ */
dns_fixedname_init(&dns_newname); dns_fixedname_init(&dns_newname);
@ -964,7 +968,7 @@ t_dns_db_newversion(char **av) {
} }
/* /*
* open a new version and associate some rdata with the new name * Open a new version and associate some rdata with the new name.
*/ */
textregion.base = newtype; textregion.base = newtype;
@ -1040,34 +1044,34 @@ t_dns_db_newversion(char **av) {
return(T_UNRESOLVED); return(T_UNRESOLVED);
} }
/* close and commit the version */ /*
* Close and commit the version.
*/
dns_db_closeversion(db, &nversionp, ISC_TRUE); dns_db_closeversion(db, &nversionp, ISC_TRUE);
dns_db_detachnode(db, &nodep); dns_db_detachnode(db, &nodep);
if (dns_rdataset_isassociated(&added_rdataset)) if (dns_rdataset_isassociated(&added_rdataset))
dns_rdataset_disassociate(&added_rdataset); dns_rdataset_disassociate(&added_rdataset);
nodep = NULL; nodep = NULL;
/* open a new version and find the data we added */ /*
* Open a new version and find the data we added.
*/
dns_fixedname_init(&dns_foundname); dns_fixedname_init(&dns_foundname);
dns_rdataset_init(&found_rdataset); dns_rdataset_init(&found_rdataset);
nversionp = NULL; nversionp = NULL;
found_nodep = NULL; found_nodep = NULL;
dns_db_newversion(db, &nversionp); dns_db_newversion(db, &nversionp);
/* find the recently added name and rdata */ /*
dns_result = dns_db_find(db, * Find the recently added name and rdata.
dns_fixedname_name(&dns_newname), */
nversionp, dns_result = dns_db_find(db, dns_fixedname_name(&dns_newname),
rdatatype, nversionp, rdatatype, 0, 0, &found_nodep,
0,
0,
&found_nodep,
dns_fixedname_name(&dns_foundname), dns_fixedname_name(&dns_foundname),
&found_rdataset, &found_rdataset, NULL);
NULL);
if (dns_result != ISC_R_SUCCESS) { if (dns_result != ISC_R_SUCCESS) {
/* ZZZ - NXRRSET ??? reference counts ??? */ /* XXXWPK - NXRRSET ??? reference counts ??? */
t_info("dns_db_find failed %s\n", t_info("dns_db_find failed %s\n",
dns_result_totext(dns_result)); dns_result_totext(dns_result));
dns_db_closeversion(db, &nversionp, ISC_FALSE); dns_db_closeversion(db, &nversionp, ISC_FALSE);
@ -1092,19 +1096,22 @@ t_dns_db_newversion(char **av) {
return(T_FAIL); return(T_FAIL);
} }
/* now make sure its what we expect */ /*
* Now make sure its what we expect.
*/
dns_rdata_init(&found_rdata); dns_rdata_init(&found_rdata);
dns_rdataset_current(&found_rdataset, &found_rdata); dns_rdataset_current(&found_rdataset, &found_rdata);
rval = dns_rdata_compare(&added_rdata, &found_rdata); rval = dns_rdata_compare(&added_rdata, &found_rdata);
if (rval == 0) { if (rval == 0) {
result = T_PASS; result = T_PASS;
} } else {
else {
t_info("dns_rdata_compare returned %d\n", rval); t_info("dns_rdata_compare returned %d\n", rval);
result = T_FAIL; result = T_FAIL;
} }
/* don't need these now */ /*
* Don't need these now.
*/
dns_db_closeversion(db, &nversionp, ISC_FALSE); dns_db_closeversion(db, &nversionp, ISC_FALSE);
if (dns_rdataset_isassociated(&found_rdataset)) if (dns_rdataset_isassociated(&found_rdataset))
dns_rdataset_disassociate(&found_rdataset); dns_rdataset_disassociate(&found_rdataset);
@ -1116,7 +1123,7 @@ t_dns_db_newversion(char **av) {
} }
static void static void
t9() { t9(void) {
int result; int result;
t_assert("dns_db_newversion", 9, T_REQUIRED, a9); t_assert("dns_db_newversion", 9, T_REQUIRED, a9);
@ -1182,9 +1189,10 @@ t_dns_db_closeversion_1(char **av) {
db = NULL; db = NULL;
mctx = NULL; mctx = NULL;
/* open a new version, add some data, /*
* Open a new version, add some data,
* remove some data, close with commit, open the current * remove some data, close with commit, open the current
* version and check that changes are present * version and check that changes are present.
*/ */
t_info("testing using file %s and name %s\n", filename, new_name); t_info("testing using file %s and name %s\n", filename, new_name);
@ -1212,7 +1220,7 @@ t_dns_db_closeversion_1(char **av) {
} }
/* /*
* remove all rdata for an existing name * Remove all rdata for an existing name.
*/ */
dns_fixedname_init(&dns_existingname); dns_fixedname_init(&dns_existingname);
@ -1265,7 +1273,8 @@ t_dns_db_closeversion_1(char **av) {
return(T_UNRESOLVED); return(T_UNRESOLVED);
} }
dns_result = dns_db_deleterdataset(db, nodep, nversionp, existing_rdatatype, 0); dns_result = dns_db_deleterdataset(db, nodep, nversionp,
existing_rdatatype, 0);
if (dns_result != ISC_R_SUCCESS) { if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_deleterdataset failed %s\n", t_info("dns_db_deleterdataset failed %s\n",
dns_result_totext(dns_result)); dns_result_totext(dns_result));
@ -1397,7 +1406,7 @@ t_dns_db_closeversion_1(char **av) {
&found_rdataset, NULL); &found_rdataset, NULL);
if (dns_result != ISC_R_SUCCESS) { if (dns_result != ISC_R_SUCCESS) {
/* ZZZ NXRRSET ??? reference counting ??? */ /* XXXWPK NXRRSET ??? reference counting ??? */
t_info("dns_db_find failed %s\n", t_info("dns_db_find failed %s\n",
dns_result_totext(dns_result)); dns_result_totext(dns_result));
dns_db_closeversion(db, &cversionp, ISC_FALSE); dns_db_closeversion(db, &cversionp, ISC_FALSE);
@ -1422,7 +1431,9 @@ t_dns_db_closeversion_1(char **av) {
return(T_FAIL); return(T_FAIL);
} }
/* now make sure its what we expect */ /*
* Now make sure its what we expect.
*/
dns_rdata_init(&found_rdata); dns_rdata_init(&found_rdata);
dns_rdataset_current(&found_rdataset, &found_rdata); dns_rdataset_current(&found_rdataset, &found_rdata);
rval = dns_rdata_compare(&added_rdata, &found_rdata); rval = dns_rdata_compare(&added_rdata, &found_rdata);
@ -1431,7 +1442,9 @@ t_dns_db_closeversion_1(char **av) {
++nfails; ++nfails;
} }
/* now check the rdata deletion */ /*
* Now check the rdata deletion.
*/
if (dns_rdataset_isassociated(&found_rdataset)) if (dns_rdataset_isassociated(&found_rdataset))
dns_rdataset_disassociate(&found_rdataset); dns_rdataset_disassociate(&found_rdataset);
@ -1440,13 +1453,9 @@ t_dns_db_closeversion_1(char **av) {
nodep = NULL; nodep = NULL;
dns_fixedname_init(&dns_foundname); dns_fixedname_init(&dns_foundname);
dns_result = dns_db_find(db, dns_result = dns_db_find(db, dns_fixedname_name(&dns_existingname),
dns_fixedname_name(&dns_existingname), cversionp, existing_rdatatype,
cversionp, 0, 0, &nodep,
existing_rdatatype,
0,
0,
&nodep,
dns_fixedname_name(&dns_foundname), dns_fixedname_name(&dns_foundname),
&found_rdataset, NULL); &found_rdataset, NULL);
@ -1472,7 +1481,7 @@ t_dns_db_closeversion_1(char **av) {
} }
static void static void
t10() { t10(void) {
int result; int result;
t_assert("dns_db_closeversion", 10, T_REQUIRED, a10); t_assert("dns_db_closeversion", 10, T_REQUIRED, a10);
@ -1539,9 +1548,10 @@ t_dns_db_closeversion_2(char **av) {
db = NULL; db = NULL;
mctx = NULL; mctx = NULL;
/* open a new version, add some data, /*
* Open a new version, add some data,
* remove some data, close with commit, open the current * remove some data, close with commit, open the current
* version and check that changes are present * version and check that changes are present.
*/ */
t_info("testing using file %s and name %s\n", filename, new_name); t_info("testing using file %s and name %s\n", filename, new_name);
@ -1569,7 +1579,7 @@ t_dns_db_closeversion_2(char **av) {
} }
/* /*
* remove all rdata for an existing name * Remove all rdata for an existing name.
*/ */
dns_fixedname_init(&dns_existingname); dns_fixedname_init(&dns_existingname);
@ -1610,7 +1620,9 @@ t_dns_db_closeversion_2(char **av) {
return(T_UNRESOLVED); return(T_UNRESOLVED);
} }
/* open a new version */ /*
* Open a new version.
*/
nversionp = NULL; nversionp = NULL;
dns_result = dns_db_newversion(db, &nversionp); dns_result = dns_db_newversion(db, &nversionp);
if (dns_result != ISC_R_SUCCESS) { if (dns_result != ISC_R_SUCCESS) {
@ -1622,7 +1634,8 @@ t_dns_db_closeversion_2(char **av) {
return(T_UNRESOLVED); return(T_UNRESOLVED);
} }
dns_result = dns_db_deleterdataset(db, nodep, nversionp, existing_rdatatype, 0); dns_result = dns_db_deleterdataset(db, nodep, nversionp,
existing_rdatatype, 0);
if (dns_result != ISC_R_SUCCESS) { if (dns_result != ISC_R_SUCCESS) {
t_info("dns_db_deleterdataset failed %s\n", t_info("dns_db_deleterdataset failed %s\n",
dns_result_totext(dns_result)); dns_result_totext(dns_result));
@ -1727,24 +1740,23 @@ t_dns_db_closeversion_2(char **av) {
return(T_UNRESOLVED); return(T_UNRESOLVED);
} }
/* check that our changes took */ /*
* Check that our changes took.
*/
dns_db_detachnode(db, &nodep); dns_db_detachnode(db, &nodep);
nodep = NULL; nodep = NULL;
dns_fixedname_init(&dns_foundname); dns_fixedname_init(&dns_foundname);
dns_rdataset_init(&found_rdataset); dns_rdataset_init(&found_rdataset);
/* find the recently added name and rdata */ /*
dns_result = dns_db_find(db, * Find the recently added name and rdata.
dns_fixedname_name(&dns_newname), */
nversionp, dns_result = dns_db_find(db, dns_fixedname_name(&dns_newname),
new_rdatatype, nversionp, new_rdatatype, 0, 0, &nodep,
0,
0,
&nodep,
dns_fixedname_name(&dns_foundname), dns_fixedname_name(&dns_foundname),
&found_rdataset, NULL); &found_rdataset, NULL);
if ( (dns_result == ISC_R_NOTFOUND) || if ((dns_result == ISC_R_NOTFOUND) ||
(dns_result == DNS_R_NXDOMAIN) || (dns_result == DNS_R_NXDOMAIN) ||
(dns_result == DNS_R_NXRRSET)) { (dns_result == DNS_R_NXRRSET)) {
@ -1772,7 +1784,9 @@ t_dns_db_closeversion_2(char **av) {
return(T_FAIL); return(T_FAIL);
} }
/* now make sure its what we expect */ /*
* Now make sure its what we expect.
*/
dns_rdata_init(&found_rdata); dns_rdata_init(&found_rdata);
dns_rdataset_current(&found_rdataset, &found_rdata); dns_rdataset_current(&found_rdataset, &found_rdata);
rval = dns_rdata_compare(&added_rdata, &found_rdata); rval = dns_rdata_compare(&added_rdata, &found_rdata);
@ -1781,8 +1795,9 @@ t_dns_db_closeversion_2(char **av) {
++nfails; ++nfails;
} }
/* now check the rdata deletion */ /*
* Now check the rdata deletion.
*/
if (dns_rdataset_isassociated(&found_rdataset)) if (dns_rdataset_isassociated(&found_rdataset))
dns_rdataset_disassociate(&found_rdataset); dns_rdataset_disassociate(&found_rdataset);
dns_rdataset_init(&found_rdataset); dns_rdataset_init(&found_rdataset);
@ -1811,16 +1826,22 @@ t_dns_db_closeversion_2(char **av) {
} }
/* close the version without a commit */ /*
* Close the version without a commit.
*/
dns_db_closeversion(db, &nversionp, ISC_FALSE); dns_db_closeversion(db, &nversionp, ISC_FALSE);
/* open the current version and check changes */ /*
* Open the current version and check changes.
*/
dns_fixedname_init(&dns_foundname); dns_fixedname_init(&dns_foundname);
dns_rdataset_init(&found_rdataset); dns_rdataset_init(&found_rdataset);
cversionp = NULL; cversionp = NULL;
dns_db_currentversion(db, &cversionp); dns_db_currentversion(db, &cversionp);
/* find the recently added name and rdata */ /*
* Find the recently added name and rdata.
*/
dns_result = dns_db_find(db, dns_result = dns_db_find(db,
dns_fixedname_name(&dns_newname), dns_fixedname_name(&dns_newname),
cversionp, cversionp,
@ -1842,24 +1863,20 @@ t_dns_db_closeversion_2(char **av) {
return(T_FAIL); return(T_FAIL);
} }
/* now check the rdata deletion */ /*
* Now check the rdata deletion.
*/
nodep = NULL; nodep = NULL;
dns_rdataset_init(&found_rdataset); dns_rdataset_init(&found_rdataset);
dns_fixedname_init(&dns_foundname); dns_fixedname_init(&dns_foundname);
dns_result = dns_db_find(db, dns_result = dns_db_find(db, dns_fixedname_name(&dns_existingname),
dns_fixedname_name(&dns_existingname), cversionp, existing_rdatatype, 0, 0,
cversionp, &nodep, dns_fixedname_name(&dns_foundname),
existing_rdatatype,
0,
0,
&nodep,
dns_fixedname_name(&dns_foundname),
&found_rdataset, NULL); &found_rdataset, NULL);
if ( (dns_result == ISC_R_NOTFOUND) || if ((dns_result == ISC_R_NOTFOUND) ||
(dns_result == DNS_R_NXDOMAIN) || (dns_result == DNS_R_NXDOMAIN) ||
(dns_result == DNS_R_NXRRSET)) { (dns_result == DNS_R_NXRRSET)) {
@ -1885,7 +1902,7 @@ t_dns_db_closeversion_2(char **av) {
} }
static void static void
t11() { t11(void) {
int result; int result;
t_assert("dns_db_closeversion", 11, T_REQUIRED, a11); t_assert("dns_db_closeversion", 11, T_REQUIRED, a11);
@ -1937,8 +1954,9 @@ t_dns_db_expirenode(char **av) {
result = T_UNRESOLVED; result = T_UNRESOLVED;
/* find a node, mark it as stale, /*
* do a dns_db_find on the name and expect it to fail * Find a node, mark it as stale, do a dns_db_find on the name and
* expect it to fail.
*/ */
t_info("testing using file %s and name %s\n", filename, existing_name); t_info("testing using file %s and name %s\n", filename, existing_name);
@ -1987,11 +2005,11 @@ t_dns_db_expirenode(char **av) {
nodep = NULL; nodep = NULL;
/* check that the node is there */ /*
dns_result = dns_db_findnode(db, * Check that the node is there.
dns_fixedname_name(&dns_existingname), */
ISC_FALSE, dns_result = dns_db_findnode(db, dns_fixedname_name(&dns_existingname),
&nodep); ISC_FALSE, &nodep);
if (dns_result != ISC_R_SUCCESS) { if (dns_result != ISC_R_SUCCESS) {
t_info("unable to find %s\n", existing_name); t_info("unable to find %s\n", existing_name);
dns_db_detach(&db); dns_db_detach(&db);
@ -1999,7 +2017,9 @@ t_dns_db_expirenode(char **av) {
return(T_UNRESOLVED); return(T_UNRESOLVED);
} }
/* expire it */ /*
* Expire it.
*/
if (node_expire_time != 0) if (node_expire_time != 0)
node_expire_time += now; node_expire_time += now;
@ -2033,20 +2053,19 @@ t_dns_db_expirenode(char **av) {
if (dns_result == exp_result) { if (dns_result == exp_result) {
result = T_PASS; result = T_PASS;
} } else {
else {
t_info("dns_db_find %s returned %s\n", existing_name, t_info("dns_db_find %s returned %s\n", existing_name,
dns_result_totext(dns_result)); dns_result_totext(dns_result));
result = T_FAIL; result = T_FAIL;
} }
if ( (dns_result != ISC_R_NOTFOUND) && if ((dns_result != ISC_R_NOTFOUND) &&
(dns_result != DNS_R_NXDOMAIN) && (dns_result != DNS_R_NXDOMAIN) &&
(dns_result != DNS_R_NXRRSET)) { (dns_result != DNS_R_NXRRSET)) {
/* /*
* don't need to disassociate the rdataset because * Don't need to disassociate the rdataset because
* we're searching with dns_rdatatype_any * we're searching with dns_rdatatype_any.
*/ */
dns_db_detachnode(db, &nodep); dns_db_detachnode(db, &nodep);
} }
@ -2059,7 +2078,7 @@ t_dns_db_expirenode(char **av) {
} }
static void static void
t12() { t12(void) {
int result; int result;
t_assert("dns_db_expirenode", 12, T_REQUIRED, a12); t_assert("dns_db_expirenode", 12, T_REQUIRED, a12);
@ -2187,16 +2206,14 @@ t_dns_db_findnode_1(char **av) {
if (dns_result == ISC_R_SUCCESS) { if (dns_result == ISC_R_SUCCESS) {
dns_rdataset_disassociate(&rdataset); dns_rdataset_disassociate(&rdataset);
result = T_PASS; result = T_PASS;
} } else {
else {
t_info("dns_db_findrdataset failed %s\n", t_info("dns_db_findrdataset failed %s\n",
dns_result_totext(dns_result)); dns_result_totext(dns_result));
result = T_FAIL; result = T_FAIL;
} }
dns_db_closeversion(db, &cversionp, ISC_FALSE); dns_db_closeversion(db, &cversionp, ISC_FALSE);
dns_db_detachnode(db, &nodep); dns_db_detachnode(db, &nodep);
} } else {
else {
result = T_PASS; result = T_PASS;
} }
@ -2207,7 +2224,7 @@ t_dns_db_findnode_1(char **av) {
} }
static void static void
t13() { t13(void) {
int result; int result;
t_assert("dns_db_findnode", 13, T_REQUIRED, a13); t_assert("dns_db_findnode", 13, T_REQUIRED, a13);
@ -2284,7 +2301,9 @@ t_dns_db_findnode_2(char **av) {
nodep = NULL; nodep = NULL;
dns_fixedname_init(&dns_name); dns_fixedname_init(&dns_name);
/* make sure the name isn't there */ /*
* Make sure the name isn't there
*/
len = strlen(newname); len = strlen(newname);
isc_buffer_init(&name_buffer, newname, len); isc_buffer_init(&name_buffer, newname, len);
isc_buffer_add(&name_buffer, len); isc_buffer_add(&name_buffer, len);
@ -2293,10 +2312,9 @@ t_dns_db_findnode_2(char **av) {
dns_result = dns_db_findnode(db, dns_fixedname_name(&dns_name), dns_result = dns_db_findnode(db, dns_fixedname_name(&dns_name),
ISC_FALSE, &nodep); ISC_FALSE, &nodep);
if ( (dns_result != ISC_R_NOTFOUND) && if ((dns_result != ISC_R_NOTFOUND) &&
(dns_result != DNS_R_NXDOMAIN) && (dns_result != DNS_R_NXDOMAIN) &&
(dns_result != DNS_R_NXRRSET)) { (dns_result != DNS_R_NXRRSET)) {
t_info("dns_db_findnode %s\n", t_info("dns_db_findnode %s\n",
dns_result_totext(dns_result)); dns_result_totext(dns_result));
dns_db_detachnode(db, &nodep); dns_db_detachnode(db, &nodep);
@ -2305,7 +2323,9 @@ t_dns_db_findnode_2(char **av) {
return(T_UNRESOLVED); return(T_UNRESOLVED);
} }
/* add it */ /*
* Add it.
*/
dns_result = dns_db_findnode(db, dns_fixedname_name(&dns_name), dns_result = dns_db_findnode(db, dns_fixedname_name(&dns_name),
ISC_TRUE, &nodep); ISC_TRUE, &nodep);
if (dns_result != ISC_R_SUCCESS) { if (dns_result != ISC_R_SUCCESS) {
@ -2316,14 +2336,18 @@ t_dns_db_findnode_2(char **av) {
return(T_FAIL); return(T_FAIL);
} }
/* check it */ /*
* Check it.
*/
newnodep = NULL; newnodep = NULL;
dns_rdataset_init(&rdataset); dns_rdataset_init(&rdataset);
dns_fixedname_init(&dns_foundname); dns_fixedname_init(&dns_foundname);
cversionp = NULL; cversionp = NULL;
dns_db_currentversion(db, &cversionp); dns_db_currentversion(db, &cversionp);
/* first try dns_db_find DNS_R_NXDOMAIN */ /*
* First try dns_db_find DNS_R_NXDOMAIN.
*/
dns_result = dns_db_find(db, dns_result = dns_db_find(db,
dns_fixedname_name(&dns_name), dns_fixedname_name(&dns_name),
cversionp, cversionp,
@ -2343,13 +2367,15 @@ t_dns_db_findnode_2(char **av) {
++nfails; ++nfails;
} }
/* then try dns_db_findnode ISC_R_SUCCESS */ /*
dns_result = dns_db_findnode(db, dns_fixedname_name(&dns_name), ISC_FALSE, &newnodep); * Then try dns_db_findnode ISC_R_SUCCESS.
*/
dns_result = dns_db_findnode(db, dns_fixedname_name(&dns_name),
ISC_FALSE, &newnodep);
t_info("dns_db_findnode %s\n", dns_result_totext(dns_result)); t_info("dns_db_findnode %s\n", dns_result_totext(dns_result));
if (dns_result == ISC_R_SUCCESS) { if (dns_result == ISC_R_SUCCESS) {
dns_db_detachnode(db, &newnodep); dns_db_detachnode(db, &newnodep);
} } else {
else {
t_info("dns_db_findnode %s failed %s\n", newname, t_info("dns_db_findnode %s failed %s\n", newname,
dns_result_totext(dns_result)); dns_result_totext(dns_result));
++nfails; ++nfails;
@ -2370,7 +2396,7 @@ t_dns_db_findnode_2(char **av) {
} }
static void static void
t14() { t14(void) {
int result; int result;
t_assert("dns_db_findnode", 14, T_REQUIRED, a14); t_assert("dns_db_findnode", 14, T_REQUIRED, a14);
@ -2426,7 +2452,8 @@ t_dns_db_find_x(char **av) {
mctx = NULL; mctx = NULL;
opts = 0; opts = 0;
t_info("testing using %s, name %s, type %s\n", dbfile, findname, findtype); t_info("testing using %s, name %s, type %s\n", dbfile, findname,
findtype);
isc_result = isc_mem_create(0, 0, &mctx); isc_result = isc_mem_create(0, 0, &mctx);
if (isc_result != ISC_R_SUCCESS) { if (isc_result != ISC_R_SUCCESS) {
@ -2512,8 +2539,7 @@ t_dns_db_find_x(char **av) {
findname, findtype, dns_result_totext(dns_result), findname, findtype, dns_result_totext(dns_result),
dns_result_totext(exp_result)); dns_result_totext(exp_result));
result = T_FAIL; result = T_FAIL;
} } else {
else {
result = T_PASS; result = T_PASS;
} }
@ -2540,7 +2566,7 @@ static char *a15 =
"of 'db'."; "of 'db'.";
static void static void
t15() { t15(void) {
int result; int result;
t_assert("dns_db_find", 15, T_REQUIRED, a15); t_assert("dns_db_find", 15, T_REQUIRED, a15);
@ -2556,7 +2582,7 @@ static char *a16 =
"returns DNS_R_GLUE."; "returns DNS_R_GLUE.";
static void static void
t16() { t16(void) {
int result; int result;
t_assert("dns_db_find", 16, T_REQUIRED, a16); t_assert("dns_db_find", 16, T_REQUIRED, a16);
@ -2569,7 +2595,7 @@ static char *a17 =
"requested is beneath a zone cut."; "requested is beneath a zone cut.";
static void static void
t17() { t17(void) {
int result; int result;
t_assert("dns_db_find", 17, T_REQUIRED, a17); t_assert("dns_db_find", 17, T_REQUIRED, a17);
@ -2582,7 +2608,7 @@ static char *a18 =
"dns_rdatatype_any and the desired node is a zone cut."; "dns_rdatatype_any and the desired node is a zone cut.";
static void static void
t18() { t18(void) {
int result; int result;
t_assert("dns_db_find", 18, T_REQUIRED, a18); t_assert("dns_db_find", 18, T_REQUIRED, a18);
@ -2595,7 +2621,7 @@ static char *a19 =
"requested is beneath a DNAME."; "requested is beneath a DNAME.";
static void static void
t19() { t19(void) {
int result; int result;
t_assert("dns_db_find", 19, T_REQUIRED, a19); t_assert("dns_db_find", 19, T_REQUIRED, a19);
@ -2608,7 +2634,7 @@ static char *a20 =
"rdataset was not found but there is a CNAME at the desired name."; "rdataset was not found but there is a CNAME at the desired name.";
static void static void
t20() { t20(void) {
int result; int result;
t_assert("dns_db_find", 20, T_REQUIRED, a20); t_assert("dns_db_find", 20, T_REQUIRED, a20);
@ -2621,7 +2647,7 @@ static char *a21 =
"does not exist."; "does not exist.";
static void static void
t21() { t21(void) {
int result; int result;
t_assert("dns_db_find", 21, T_REQUIRED, a21); t_assert("dns_db_find", 21, T_REQUIRED, a21);
@ -2634,7 +2660,7 @@ static char *a22 =
"the desired name exists, but the desired type does not."; "the desired name exists, but the desired type does not.";
static void static void
t22() { t22(void) {
int result; int result;
t_assert("dns_db_find", 22, T_REQUIRED, a22); t_assert("dns_db_find", 22, T_REQUIRED, a22);
@ -2648,7 +2674,7 @@ static char *a23 =
"and no delegation could be found."; "and no delegation could be found.";
static void static void
t23() { t23(void) {
int result; int result;
t_assert("dns_db_find", 23, T_REQUIRED, a23); t_assert("dns_db_find", 23, T_REQUIRED, a23);
@ -2661,7 +2687,7 @@ static char *a24 =
"if at least one rdataset at the found node expires after 'now'."; "if at least one rdataset at the found node expires after 'now'.";
static void static void
t24() { t24(void) {
int result; int result;
t_assert("dns_db_find", 24, T_REQUIRED, a24); t_assert("dns_db_find", 24, T_REQUIRED, a24);