00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <config.h>
00022
00023 #include <atf-c.h>
00024
00025 #include <stdlib.h>
00026 #include <time.h>
00027 #include <unistd.h>
00028
00029 #include <isc/file.h>
00030 #include <isc/result.h>
00031 #include <isc/serial.h>
00032 #include <isc/stdtime.h>
00033 #include <isc/msgcat.h>
00034
00035 #include <dns/db.h>
00036 #include <dns/rdatalist.h>
00037 #include <dns/rdataset.h>
00038 #include <dns/rdatasetiter.h>
00039 #include <dns/nsec3.h>
00040
00041 #include "dnstest.h"
00042
00043 static char tempname[11] = "dtXXXXXXXX";
00044
00045 static void
00046 local_callback(const char *file, int line, isc_assertiontype_t type,
00047 const char *cond)
00048 {
00049 UNUSED(file); UNUSED(line); UNUSED(type); UNUSED(cond);
00050 if (strcmp(tempname, "dtXXXXXXXX"))
00051 unlink(tempname);
00052 atf_tc_pass();
00053 exit(0);
00054 }
00055
00056 static dns_db_t *db1 = NULL, *db2 = NULL;
00057 static dns_dbversion_t *v1 = NULL, *v2 = NULL;
00058
00059 static void
00060 setup_db(void) {
00061 isc_result_t result;
00062 result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
00063 dns_rdataclass_in, 0, NULL, &db1);
00064 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00065 dns_db_newversion(db1, &v1);
00066
00067 result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
00068 dns_rdataclass_in, 0, NULL, &db2);
00069 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00070 dns_db_newversion(db2, &v2);
00071 }
00072
00073 static void
00074 close_db(void) {
00075 if (v1 != NULL) {
00076 dns_db_closeversion(db1, &v1, ISC_FALSE);
00077 ATF_REQUIRE_EQ(v1, NULL);
00078 }
00079 if (db1 != NULL) {
00080 dns_db_detach(&db1);
00081 ATF_REQUIRE_EQ(db1, NULL);
00082 }
00083
00084 if (v2 != NULL) {
00085 dns_db_closeversion(db2, &v2, ISC_FALSE);
00086 ATF_REQUIRE_EQ(v2, NULL);
00087 }
00088 if (db2 != NULL) {
00089 dns_db_detach(&db2);
00090 ATF_REQUIRE_EQ(db2, NULL);
00091 }
00092 }
00093
00094 #define VERSION(callback) ((callback == NULL) ? v1 : v2)
00095 #define VERSIONP(callback) ((callback == NULL) ? &v1 : &v2)
00096
00097
00098
00099 static void
00100 attachversion(isc_assertioncallback_t callback) {
00101 isc_result_t result;
00102 dns_dbversion_t *v = NULL;
00103
00104 result = dns_test_begin(NULL, ISC_FALSE);
00105 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00106
00107 setup_db();
00108
00109 isc_assertion_setcallback(callback);
00110 dns_db_attachversion(db1, VERSION(callback), &v);
00111 if (callback != NULL)
00112 atf_tc_fail("dns_db_attachversion did not assert");
00113
00114 ATF_REQUIRE_EQ(v, v1);
00115 dns_db_closeversion(db1, &v, ISC_FALSE);
00116 ATF_REQUIRE_EQ(v, NULL);
00117
00118 close_db();
00119 dns_test_end();
00120 }
00121
00122 ATF_TC(attachversion);
00123 ATF_TC_HEAD(attachversion, tc) {
00124 atf_tc_set_md_var(tc, "descr", "check dns_db_attachversion passes with matching db/verison");
00125 }
00126 ATF_TC_BODY(attachversion, tc) {
00127
00128 UNUSED(tc);
00129
00130 attachversion(NULL);
00131 }
00132
00133 ATF_TC(attachversion_bad);
00134 ATF_TC_HEAD(attachversion_bad, tc) {
00135 atf_tc_set_md_var(tc, "descr", "check dns_db_attachversion aborts with mis-matching db/verison");
00136 }
00137 ATF_TC_BODY(attachversion_bad, tc) {
00138
00139 UNUSED(tc);
00140
00141 attachversion(local_callback);
00142 }
00143
00144 static void
00145 closeversion(isc_assertioncallback_t callback) {
00146 isc_result_t result;
00147
00148 result = dns_test_begin(NULL, ISC_FALSE);
00149 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00150
00151 setup_db();
00152
00153 isc_assertion_setcallback(callback);
00154 dns_db_closeversion(db1, VERSIONP(callback), ISC_FALSE);
00155 if (callback != NULL)
00156 atf_tc_fail("dns_db_closeversion did not assert");
00157 ATF_REQUIRE_EQ(v1, NULL);
00158
00159 close_db();
00160 dns_test_end();
00161 }
00162
00163 ATF_TC(closeversion);
00164 ATF_TC_HEAD(closeversion, tc) {
00165 atf_tc_set_md_var(tc, "descr", "check dns_db_closeversion passes with matching db/verison");
00166 }
00167 ATF_TC_BODY(closeversion, tc) {
00168
00169 UNUSED(tc);
00170
00171 closeversion(NULL);
00172 }
00173
00174 ATF_TC(closeversion_bad);
00175 ATF_TC_HEAD(closeversion_bad, tc) {
00176 atf_tc_set_md_var(tc, "descr", "check dns_db_closeversion asserts with mis-matching db/verison");
00177 }
00178 ATF_TC_BODY(closeversion_bad, tc) {
00179
00180 UNUSED(tc);
00181
00182 closeversion(local_callback);
00183 }
00184
00185 static void
00186 find(isc_assertioncallback_t callback) {
00187 isc_result_t result;
00188 dns_rdataset_t rdataset;
00189 dns_fixedname_t fixed;
00190
00191 result = dns_test_begin(NULL, ISC_FALSE);
00192 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00193
00194 setup_db();
00195
00196 dns_rdataset_init(&rdataset);
00197 dns_fixedname_init(&fixed);
00198
00199 isc_assertion_setcallback(callback);
00200 result = dns_db_find(db1, dns_rootname, VERSION(callback),
00201 dns_rdatatype_soa, 0, 0, NULL,
00202 dns_fixedname_name(&fixed), &rdataset, NULL);
00203 if (callback != NULL)
00204 atf_tc_fail("dns_db_find did not assert");
00205 ATF_REQUIRE_EQ(result, DNS_R_NXDOMAIN);
00206
00207 close_db();
00208
00209 dns_test_end();
00210 }
00211 ATF_TC(find);
00212 ATF_TC_HEAD(find, tc) {
00213 atf_tc_set_md_var(tc, "descr", "check dns_db_find passes with matching db/version");
00214 }
00215 ATF_TC_BODY(find, tc) {
00216
00217 UNUSED(tc);
00218
00219 find(NULL);
00220 }
00221
00222 ATF_TC(find_bad);
00223 ATF_TC_HEAD(find_bad, tc) {
00224 atf_tc_set_md_var(tc, "descr", "check dns_db_find asserts with mis-matching db/version");
00225 }
00226 ATF_TC_BODY(find_bad, tc) {
00227
00228 UNUSED(tc);
00229
00230 find(local_callback);
00231 }
00232
00233 static void
00234 allrdatasets(isc_assertioncallback_t callback) {
00235 isc_result_t result;
00236 dns_dbnode_t *node = NULL;
00237 dns_rdatasetiter_t *iterator = NULL;
00238
00239 result = dns_test_begin(NULL, ISC_FALSE);
00240 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00241
00242 setup_db();
00243
00244 result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node);
00245 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00246
00247 isc_assertion_setcallback(callback);
00248 result = dns_db_allrdatasets(db1, node, VERSION(callback), 0,
00249 &iterator);
00250 if (callback != NULL)
00251 atf_tc_fail("dns_db_allrdatasets did not assert");
00252 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00253
00254 dns_rdatasetiter_destroy(&iterator);
00255 ATF_REQUIRE_EQ(iterator, NULL);
00256
00257 dns_db_detachnode(db1, &node);
00258 ATF_REQUIRE_EQ(node, NULL);
00259
00260 close_db();
00261
00262 dns_test_end();
00263 }
00264
00265 ATF_TC(allrdatasets);
00266 ATF_TC_HEAD(allrdatasets, tc) {
00267 atf_tc_set_md_var(tc, "descr", "check dns_db_allrdatasets passes with matching db/version");
00268 }
00269 ATF_TC_BODY(allrdatasets, tc) {
00270
00271 UNUSED(tc);
00272
00273 allrdatasets(NULL);
00274 }
00275
00276 ATF_TC(allrdatasets_bad);
00277 ATF_TC_HEAD(allrdatasets_bad, tc) {
00278 atf_tc_set_md_var(tc, "descr", "check dns_db_allrdatasets aborts with mis-matching db/version");
00279 }
00280 ATF_TC_BODY(allrdatasets_bad, tc) {
00281
00282 UNUSED(tc);
00283
00284 allrdatasets(local_callback);
00285 }
00286
00287 static void
00288 findrdataset(isc_assertioncallback_t callback) {
00289 isc_result_t result;
00290 dns_rdataset_t rdataset;
00291 dns_fixedname_t fixed;
00292 dns_dbnode_t *node = NULL;
00293
00294 result = dns_test_begin(NULL, ISC_FALSE);
00295 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00296
00297 setup_db();
00298
00299 dns_rdataset_init(&rdataset);
00300 dns_fixedname_init(&fixed);
00301
00302 result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node);
00303 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00304
00305 isc_assertion_setcallback(callback);
00306 result = dns_db_findrdataset(db1, node, VERSION(callback),
00307 dns_rdatatype_soa, 0, 0, &rdataset, NULL);
00308 if (callback != NULL)
00309 atf_tc_fail("dns_db_findrdataset did not assert");
00310 ATF_REQUIRE_EQ(result, ISC_R_NOTFOUND);
00311
00312 dns_db_detachnode(db1, &node);
00313 ATF_REQUIRE_EQ(node, NULL);
00314
00315 close_db();
00316
00317 dns_test_end();
00318 }
00319
00320 ATF_TC(findrdataset);
00321 ATF_TC_HEAD(findrdataset, tc) {
00322 atf_tc_set_md_var(tc, "descr", "check dns_db_findrdataset passes with matching db/version");
00323 }
00324 ATF_TC_BODY(findrdataset, tc) {
00325
00326 UNUSED(tc);
00327
00328 findrdataset(NULL);
00329 }
00330
00331 ATF_TC(findrdataset_bad);
00332 ATF_TC_HEAD(findrdataset_bad, tc) {
00333 atf_tc_set_md_var(tc, "descr", "check dns_db_findrdataset aborts with mis-matching db/version");
00334 }
00335 ATF_TC_BODY(findrdataset_bad, tc) {
00336
00337 UNUSED(tc);
00338
00339 findrdataset(local_callback);
00340 }
00341
00342 static void
00343 deleterdataset(isc_assertioncallback_t callback) {
00344 isc_result_t result;
00345 dns_rdataset_t rdataset;
00346 dns_fixedname_t fixed;
00347 dns_dbnode_t *node = NULL;
00348
00349 result = dns_test_begin(NULL, ISC_FALSE);
00350 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00351
00352 setup_db();
00353
00354 dns_rdataset_init(&rdataset);
00355 dns_fixedname_init(&fixed);
00356
00357 result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node);
00358 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00359
00360 isc_assertion_setcallback(callback);
00361 result = dns_db_deleterdataset(db1, node, VERSION(callback),
00362 dns_rdatatype_soa, 0);
00363 if (callback != NULL)
00364 atf_tc_fail("dns_db_deleterdataset did not assert");
00365 ATF_REQUIRE_EQ(result, DNS_R_UNCHANGED);
00366
00367 dns_db_detachnode(db1, &node);
00368 ATF_REQUIRE_EQ(node, NULL);
00369
00370 close_db();
00371
00372 dns_test_end();
00373 }
00374
00375 ATF_TC(deleterdataset);
00376 ATF_TC_HEAD(deleterdataset, tc) {
00377 atf_tc_set_md_var(tc, "descr", "check dns_db_deleterdataset passes with matching db/version");
00378 }
00379 ATF_TC_BODY(deleterdataset, tc) {
00380
00381 UNUSED(tc);
00382
00383 deleterdataset(NULL);
00384 }
00385
00386 ATF_TC(deleterdataset_bad);
00387 ATF_TC_HEAD(deleterdataset_bad, tc) {
00388 atf_tc_set_md_var(tc, "descr", "check dns_db_deleterdataset aborts with mis-matching db/version");
00389 }
00390 ATF_TC_BODY(deleterdataset_bad, tc) {
00391
00392 UNUSED(tc);
00393
00394 deleterdataset(local_callback);
00395 }
00396
00397 static void
00398 subtract(isc_assertioncallback_t callback) {
00399 isc_result_t result;
00400 dns_rdataset_t rdataset;
00401 dns_fixedname_t fixed;
00402 dns_dbnode_t *node = NULL;
00403 dns_rdatalist_t rdatalist;
00404
00405 result = dns_test_begin(NULL, ISC_FALSE);
00406 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00407
00408 setup_db();
00409
00410 dns_rdataset_init(&rdataset);
00411 dns_rdatalist_init(&rdatalist);
00412 dns_fixedname_init(&fixed);
00413
00414 rdatalist.rdclass = dns_rdataclass_in;
00415
00416 result = dns_rdatalist_tordataset(&rdatalist, &rdataset);
00417 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00418
00419 result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node);
00420 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00421
00422 isc_assertion_setcallback(callback);
00423 result = dns_db_subtractrdataset(db1, node, VERSION(callback),
00424 &rdataset, 0, NULL);
00425 if (callback != NULL)
00426 atf_tc_fail("dns_db_dns_db_subtractrdataset did not assert");
00427 ATF_REQUIRE_EQ(result, DNS_R_UNCHANGED);
00428
00429 dns_db_detachnode(db1, &node);
00430 ATF_REQUIRE_EQ(node, NULL);
00431
00432 close_db();
00433
00434 dns_test_end();
00435 }
00436
00437 ATF_TC(subtractrdataset);
00438 ATF_TC_HEAD(subtractrdataset, tc) {
00439 atf_tc_set_md_var(tc, "descr", "check dns_db_subtractrdataset passes with matching db/version");
00440 }
00441 ATF_TC_BODY(subtractrdataset, tc) {
00442
00443 UNUSED(tc);
00444
00445 subtract(NULL);
00446 }
00447
00448 ATF_TC(subtractrdataset_bad);
00449 ATF_TC_HEAD(subtractrdataset_bad, tc) {
00450 atf_tc_set_md_var(tc, "descr", "check dns_db_subtractrdataset aborts with mis-matching db/version");
00451 }
00452 ATF_TC_BODY(subtractrdataset_bad, tc) {
00453
00454 UNUSED(tc);
00455
00456 subtract(local_callback);
00457 }
00458
00459 static void
00460 dump(isc_assertioncallback_t callback) {
00461 isc_result_t result;
00462 FILE *f = NULL;
00463
00464 result = dns_test_begin(NULL, ISC_FALSE);
00465 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00466
00467 setup_db();
00468
00469 result = isc_file_openunique(tempname, &f);
00470 fclose(f);
00471 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00472
00473 isc_assertion_setcallback(callback);
00474 result = dns_db_dump(db1, VERSION(callback), tempname);
00475 (void)unlink(tempname);
00476 if (callback != NULL)
00477 atf_tc_fail("dns_db_dump did not assert");
00478 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00479
00480 close_db();
00481
00482 dns_test_end();
00483 }
00484
00485 ATF_TC(dump);
00486 ATF_TC_HEAD(dump, tc) {
00487 atf_tc_set_md_var(tc, "descr", "check dns_db_dump passes with matching db/version");
00488 }
00489 ATF_TC_BODY(dump, tc) {
00490
00491 UNUSED(tc);
00492
00493 dump(NULL);
00494 }
00495
00496 ATF_TC(dump_bad);
00497 ATF_TC_HEAD(dump_bad, tc) {
00498 atf_tc_set_md_var(tc, "descr", "check dns_db_dump aborts with mis-matching db/version");
00499 }
00500 ATF_TC_BODY(dump_bad, tc) {
00501
00502 UNUSED(tc);
00503
00504 dump(local_callback);
00505 }
00506
00507 static void
00508 addrdataset(isc_assertioncallback_t callback) {
00509 isc_result_t result;
00510 dns_rdataset_t rdataset;
00511 dns_fixedname_t fixed;
00512 dns_dbnode_t *node = NULL;
00513 dns_rdatalist_t rdatalist;
00514
00515 result = dns_test_begin(NULL, ISC_FALSE);
00516 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00517
00518 setup_db();
00519
00520 dns_rdataset_init(&rdataset);
00521 dns_rdatalist_init(&rdatalist);
00522 dns_fixedname_init(&fixed);
00523
00524 rdatalist.rdclass = dns_rdataclass_in;
00525
00526 result = dns_rdatalist_tordataset(&rdatalist, &rdataset);
00527 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00528
00529 result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node);
00530 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00531
00532 isc_assertion_setcallback(callback);
00533 result = dns_db_addrdataset(db1, node, VERSION(callback), 0, &rdataset,
00534 0, NULL);
00535 if (callback != NULL)
00536 atf_tc_fail("dns_db_adddataset did not assert");
00537 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00538
00539 dns_db_detachnode(db1, &node);
00540 ATF_REQUIRE_EQ(node, NULL);
00541
00542 close_db();
00543
00544 dns_test_end();
00545 }
00546
00547 ATF_TC(addrdataset);
00548 ATF_TC_HEAD(addrdataset, tc) {
00549 atf_tc_set_md_var(tc, "descr", "check dns_db_addrdataset passes with matching db/version");
00550 }
00551 ATF_TC_BODY(addrdataset, tc) {
00552
00553 UNUSED(tc);
00554
00555 addrdataset(NULL);
00556 }
00557
00558 ATF_TC(addrdataset_bad);
00559 ATF_TC_HEAD(addrdataset_bad, tc) {
00560 atf_tc_set_md_var(tc, "descr", "check dns_db_addrdataset aborts with mis-matching db/version");
00561 }
00562 ATF_TC_BODY(addrdataset_bad, tc) {
00563
00564 UNUSED(tc);
00565
00566 addrdataset(local_callback);
00567 }
00568
00569 static void
00570 getnsec3parameters(isc_assertioncallback_t callback) {
00571 isc_result_t result;
00572 dns_hash_t hash;
00573 isc_uint8_t flags;
00574 isc_uint16_t iterations;
00575 unsigned char salt[DNS_NSEC3_SALTSIZE];
00576 size_t salt_length = sizeof(salt);
00577
00578 result = dns_test_begin(NULL, ISC_FALSE);
00579 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00580
00581 setup_db();
00582
00583 isc_assertion_setcallback(callback);
00584 result = dns_db_getnsec3parameters(db1, VERSION(callback), &hash,
00585 &flags, &iterations, salt,
00586 &salt_length);
00587 if (callback != NULL)
00588 atf_tc_fail("dns_db_dump did not assert");
00589 ATF_REQUIRE_EQ(result, ISC_R_NOTFOUND);
00590
00591 close_db();
00592
00593 dns_test_end();
00594 }
00595
00596 ATF_TC(getnsec3parameters);
00597 ATF_TC_HEAD(getnsec3parameters, tc) {
00598 atf_tc_set_md_var(tc, "descr", "check dns_db_getnsec3parameters passes with matching db/version");
00599 }
00600 ATF_TC_BODY(getnsec3parameters, tc) {
00601
00602 UNUSED(tc);
00603
00604 getnsec3parameters(NULL);
00605 }
00606
00607 ATF_TC(getnsec3parameters_bad);
00608 ATF_TC_HEAD(getnsec3parameters_bad, tc) {
00609 atf_tc_set_md_var(tc, "descr", "check dns_db_getnsec3parameters aborts with mis-matching db/version");
00610 }
00611 ATF_TC_BODY(getnsec3parameters_bad, tc) {
00612
00613 UNUSED(tc);
00614
00615 getnsec3parameters(local_callback);
00616 }
00617
00618 static void
00619 resigned(isc_assertioncallback_t callback) {
00620 isc_result_t result;
00621 dns_rdataset_t rdataset, added;
00622 dns_dbnode_t *node = NULL;
00623 dns_rdatalist_t rdatalist;
00624 dns_rdata_rrsig_t rrsig;
00625 dns_rdata_t rdata = DNS_RDATA_INIT;
00626 isc_buffer_t b;
00627 unsigned char buf[1024];
00628
00629 result = dns_test_begin(NULL, ISC_FALSE);
00630 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00631
00632 setup_db();
00633
00634
00635
00636
00637 dns_rdataset_init(&added);
00638 dns_rdataset_init(&rdataset);
00639 dns_rdatalist_init(&rdatalist);
00640 isc_buffer_init(&b, buf, sizeof(buf));
00641
00642 DNS_RDATACOMMON_INIT(&rrsig, dns_rdatatype_rrsig, dns_rdataclass_in);
00643 rrsig.covered = dns_rdatatype_a;
00644 rrsig.algorithm = 100;
00645 rrsig.labels = 0;
00646 rrsig.originalttl = 0;
00647 rrsig.timeexpire = 3600;
00648 rrsig.timesigned = 0;
00649 rrsig.keyid = 0;
00650 dns_name_init(&rrsig.signer, NULL);
00651 dns_name_clone(dns_rootname, &rrsig.signer);
00652 rrsig.siglen = 0;
00653 rrsig.signature = NULL;
00654
00655 result = dns_rdata_fromstruct(&rdata, dns_rdataclass_in,
00656 dns_rdatatype_rrsig, &rrsig, &b);
00657 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00658
00659 rdatalist.rdclass = dns_rdataclass_in;
00660 rdatalist.type = dns_rdatatype_rrsig;
00661 ISC_LIST_APPEND(rdatalist.rdata, &rdata, link);
00662
00663 result = dns_rdatalist_tordataset(&rdatalist, &rdataset);
00664 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00665
00666 rdataset.attributes |= DNS_RDATASETATTR_RESIGN;
00667 rdataset.resign = 7200;
00668
00669 result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node);
00670 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00671
00672 result = dns_db_addrdataset(db1, node, v1, 0, &rdataset, 0, &added);
00673 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00674
00675 dns_db_detachnode(db1, &node);
00676 ATF_REQUIRE_EQ(node, NULL);
00677
00678 isc_assertion_setcallback(callback);
00679 dns_db_resigned(db1, &added, VERSION(callback));
00680 if (callback != NULL)
00681 atf_tc_fail("dns_db_resigned did not assert");
00682
00683 dns_rdataset_disassociate(&added);
00684
00685 close_db();
00686
00687 dns_test_end();
00688 }
00689
00690 ATF_TC(resigned);
00691 ATF_TC_HEAD(resigned, tc) {
00692 atf_tc_set_md_var(tc, "descr", "check dns_rdataset_resigned passes with matching db/version");
00693 }
00694 ATF_TC_BODY(resigned, tc) {
00695
00696 UNUSED(tc);
00697
00698 resigned(NULL);
00699 }
00700
00701 ATF_TC(resigned_bad);
00702 ATF_TC_HEAD(resigned_bad, tc) {
00703 atf_tc_set_md_var(tc, "descr", "check dns_rdataset_resigned aborts with mis-matching db/version");
00704 }
00705 ATF_TC_BODY(resigned_bad, tc) {
00706
00707 UNUSED(tc);
00708
00709 resigned(local_callback);
00710 }
00711
00712
00713
00714
00715 ATF_TP_ADD_TCS(tp) {
00716 ATF_TP_ADD_TC(tp, dump);
00717 ATF_TP_ADD_TC(tp, dump_bad);
00718 ATF_TP_ADD_TC(tp, find);
00719 ATF_TP_ADD_TC(tp, find_bad);
00720 ATF_TP_ADD_TC(tp, allrdatasets);
00721 ATF_TP_ADD_TC(tp, allrdatasets_bad);
00722 ATF_TP_ADD_TC(tp, findrdataset);
00723 ATF_TP_ADD_TC(tp, findrdataset_bad);
00724 ATF_TP_ADD_TC(tp, addrdataset);
00725 ATF_TP_ADD_TC(tp, addrdataset_bad);
00726 ATF_TP_ADD_TC(tp, deleterdataset);
00727 ATF_TP_ADD_TC(tp, deleterdataset_bad);
00728 ATF_TP_ADD_TC(tp, subtractrdataset);
00729 ATF_TP_ADD_TC(tp, subtractrdataset_bad);
00730 ATF_TP_ADD_TC(tp, attachversion);
00731 ATF_TP_ADD_TC(tp, attachversion_bad);
00732 ATF_TP_ADD_TC(tp, closeversion);
00733 ATF_TP_ADD_TC(tp, closeversion_bad);
00734 ATF_TP_ADD_TC(tp, getnsec3parameters);
00735 ATF_TP_ADD_TC(tp, getnsec3parameters_bad);
00736 ATF_TP_ADD_TC(tp, resigned);
00737 ATF_TP_ADD_TC(tp, resigned_bad);
00738
00739 return (atf_no_error());
00740 }