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

Rename mctx in dnstest.c to dt_mctx to prevent any global/local name clashes

The common construct seen in the BIND 9 source is func(isc_mem_t *mctx, ...).
Unfortunately, the dnstest.{h,c} has been using mctx as a global symbol, which
in turn generated a lot of errors when update.c got included in update_test.c.

As a rule of thumb, we should avoid naming global symbols with generic names
(like mctx) and we should prefix them with "namespace" (like dt_mctx).
This commit is contained in:
Ondřej Surý 2019-06-18 15:01:43 +02:00
parent 6a1f24a863
commit 52f98c5734
26 changed files with 173 additions and 170 deletions

View File

@ -72,16 +72,16 @@ dns_acl_isinsecure_test(void **state) {
UNUSED(state);
result = dns_acl_any(mctx, &any);
result = dns_acl_any(dt_mctx, &any);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_acl_none(mctx, &none);
result = dns_acl_none(dt_mctx, &none);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_acl_create(mctx, 1, &notnone);
result = dns_acl_create(dt_mctx, 1, &notnone);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_acl_create(mctx, 1, &notany);
result = dns_acl_create(dt_mctx, 1, &notany);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_acl_merge(notnone, none, false);
@ -91,7 +91,7 @@ dns_acl_isinsecure_test(void **state) {
assert_int_equal(result, ISC_R_SUCCESS);
#ifdef HAVE_GEOIP
result = dns_acl_create(mctx, 1, &geoip);
result = dns_acl_create(dt_mctx, 1, &geoip);
assert_int_equal(result, ISC_R_SUCCESS);
de = geoip->elements;
@ -106,7 +106,7 @@ dns_acl_isinsecure_test(void **state) {
de->node_num = geoip->node_count;
geoip->length++;
result = dns_acl_create(mctx, 1, &notgeoip);
result = dns_acl_create(dt_mctx, 1, &notgeoip);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_acl_merge(notgeoip, geoip, false);

View File

@ -63,15 +63,15 @@ static void
getoriginnode_test(void **state) {
dns_db_t *db = NULL;
dns_dbnode_t *node = NULL;
isc_mem_t *mymctx = NULL;
isc_mem_t *mctx = NULL;
isc_result_t result;
UNUSED(state);
result = isc_mem_create(0, 0, &mymctx);
result = isc_mem_create(0, 0, &mctx);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_zone,
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &db);
assert_int_equal(result, ISC_R_SUCCESS);
@ -84,23 +84,23 @@ getoriginnode_test(void **state) {
dns_db_detachnode(db, &node);
dns_db_detach(&db);
isc_mem_detach(&mymctx);
isc_mem_detach(&mctx);
}
/* test getservestalettl and setservestalettl */
static void
getsetservestalettl_test(void **state) {
dns_db_t *db = NULL;
isc_mem_t *mymctx = NULL;
isc_mem_t *mctx = NULL;
isc_result_t result;
dns_ttl_t ttl;
UNUSED(state);
result = isc_mem_create(0, 0, &mymctx);
result = isc_mem_create(0, 0, &mctx);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_cache,
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_cache,
dns_rdataclass_in, 0, NULL, &db);
assert_int_equal(result, ISC_R_SUCCESS);
@ -119,7 +119,7 @@ getsetservestalettl_test(void **state) {
assert_int_equal(ttl, 6 * 3600);
dns_db_detach(&db);
isc_mem_detach(&mymctx);
isc_mem_detach(&mctx);
}
/* check DNS_DBFIND_STALEOK works */
@ -135,16 +135,16 @@ dns_dbfind_staleok_test(void **state) {
dns_rdataset_t rdataset;
int count;
int pass;
isc_mem_t *mymctx = NULL;
isc_mem_t *mctx = NULL;
isc_result_t result;
unsigned char data[] = { 0x0a, 0x00, 0x00, 0x01 };
UNUSED(state);
result = isc_mem_create(0, 0, &mymctx);
result = isc_mem_create(0, 0, &mctx);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_cache,
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_cache,
dns_rdataclass_in, 0, NULL, &db);
assert_int_equal(result, ISC_R_SUCCESS);
@ -275,7 +275,7 @@ dns_dbfind_staleok_test(void **state) {
}
dns_db_detach(&db);
isc_mem_detach(&mymctx);
isc_mem_detach(&mctx);
}
/* database class */
@ -286,7 +286,7 @@ class_test(void **state) {
UNUSED(state);
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
result = dns_db_create(dt_mctx, "rbt", dns_rootname, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &db);
assert_int_equal(result, ISC_R_SUCCESS);
@ -308,7 +308,7 @@ dbtype_test(void **state) {
UNUSED(state);
/* DB has zone semantics */
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
result = dns_db_create(dt_mctx, "rbt", dns_rootname, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &db);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_db_load(db, "testdata/db/data.db",
@ -319,7 +319,7 @@ dbtype_test(void **state) {
dns_db_detach(&db);
/* DB has cache semantics */
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_cache,
result = dns_db_create(dt_mctx, "rbt", dns_rootname, dns_dbtype_cache,
dns_rdataclass_in, 0, NULL, &db);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_db_load(db, "testdata/db/data.db",

View File

@ -81,7 +81,7 @@ diffx_same(void **state) {
test_create("testdata/diff/zone1.data", &olddb,
"testdata/diff/zone1.data", &newdb);
dns_diff_init(mctx, &diff);
dns_diff_init(dt_mctx, &diff);
result = dns_db_diffx(&diff, newdb, NULL, olddb, NULL, NULL);
assert_int_equal(result, ISC_R_SUCCESS);
@ -107,7 +107,7 @@ diffx_add(void **state) {
test_create("testdata/diff/zone1.data", &olddb,
"testdata/diff/zone2.data", &newdb);
dns_diff_init(mctx, &diff);
dns_diff_init(dt_mctx, &diff);
result = dns_db_diffx(&diff, newdb, NULL, olddb, NULL, NULL);
assert_int_equal(result, ISC_R_SUCCESS);
@ -139,7 +139,7 @@ diffx_remove(void **state) {
test_create("testdata/diff/zone1.data", &olddb,
"testdata/diff/zone3.data", &newdb);
dns_diff_init(mctx, &diff);
dns_diff_init(dt_mctx, &diff);
result = dns_db_diffx(&diff, newdb, NULL, olddb, NULL, NULL);
assert_int_equal(result, ISC_R_SUCCESS);

View File

@ -81,13 +81,13 @@ _setup(void **state) {
res = dns_test_begin(NULL, false);
assert_int_equal(res, ISC_R_SUCCESS);
res = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
res = dns_db_create(dt_mctx, "rbt", dns_rootname, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &db1);
assert_int_equal(res, ISC_R_SUCCESS);
dns_db_newversion(db1, &v1);
assert_non_null(v1);
res = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
res = dns_db_create(dt_mctx, "rbt", dns_rootname, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &db2);
assert_int_equal(res, ISC_R_SUCCESS);
dns_db_newversion(db2, &v2);

View File

@ -76,7 +76,7 @@ dh_computesecret(void **state) {
result = dst_key_fromfile(name, 18602, DST_ALG_DH,
DST_TYPE_PUBLIC | DST_TYPE_KEY,
"./", mctx, &key);
"./", dt_mctx, &key);
assert_int_equal(result, ISC_R_SUCCESS);
isc_buffer_init(&buf, array, sizeof(array));

View File

@ -68,7 +68,7 @@ make_dispatchset(unsigned int ndisps) {
unsigned int attrs;
dns_dispatch_t *disp = NULL;
result = dns_dispatchmgr_create(mctx, &dispatchmgr);
result = dns_dispatchmgr_create(dt_mctx, &dispatchmgr);
if (result != ISC_R_SUCCESS)
return (result);
@ -80,7 +80,7 @@ make_dispatchset(unsigned int ndisps) {
if (result != ISC_R_SUCCESS)
return (result);
result = dns_dispatchset_create(mctx, socketmgr, taskmgr, disp,
result = dns_dispatchset_create(dt_mctx, socketmgr, taskmgr, disp,
&dset, ndisps);
dns_dispatch_detach(&disp);
@ -271,7 +271,7 @@ dispatch_getnext(void **state) {
result = isc_task_create(taskmgr, 0, &task);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_dispatchmgr_create(mctx, &dispatchmgr);
result = dns_dispatchmgr_create(dt_mctx, &dispatchmgr);
assert_int_equal(result, ISC_R_SUCCESS);
ina.s_addr = htonl(INADDR_LOOPBACK);
@ -313,7 +313,7 @@ dispatch_getnext(void **state) {
region.base = message;
region.length = sizeof(message);
result = isc_app_onrun(mctx, task, startit, &region);
result = isc_app_onrun(dt_mctx, task, startit, &region);
assert_int_equal(result, ISC_R_SUCCESS);
result = isc_app_run();

View File

@ -87,7 +87,7 @@ create_test(void **state) {
assert_non_null(fopt);
fstrm_iothr_options_set_num_input_queues(fopt, 1);
result = dns_dt_create(mctx, dns_dtmode_file, TAPFILE,
result = dns_dt_create(dt_mctx, dns_dtmode_file, TAPFILE,
&fopt, NULL, &dtenv);
assert_int_equal(result, ISC_R_SUCCESS);
if (dtenv != NULL) {
@ -103,7 +103,7 @@ create_test(void **state) {
assert_non_null(fopt);
fstrm_iothr_options_set_num_input_queues(fopt, 1);
result = dns_dt_create(mctx, dns_dtmode_unix, TAPSOCK,
result = dns_dt_create(dt_mctx, dns_dtmode_unix, TAPSOCK,
&fopt, NULL, &dtenv);
assert_int_equal(result, ISC_R_SUCCESS);
if (dtenv != NULL) {
@ -120,7 +120,7 @@ create_test(void **state) {
assert_non_null(fopt);
fstrm_iothr_options_set_num_input_queues(fopt, 1);
result = dns_dt_create(mctx, 33, TAPSOCK, &fopt, NULL, &dtenv);
result = dns_dt_create(dt_mctx, 33, TAPSOCK, &fopt, NULL, &dtenv);
assert_int_equal(result, ISC_R_FAILURE);
assert_null(dtenv);
if (dtenv != NULL) {
@ -171,7 +171,7 @@ send_test(void **state) {
assert_non_null(fopt);
fstrm_iothr_options_set_num_input_queues(fopt, 1);
result = dns_dt_create(mctx, dns_dtmode_file, TAPFILE,
result = dns_dt_create(dt_mctx, dns_dtmode_file, TAPFILE,
&fopt, NULL, &dtenv);
assert_int_equal(result, ISC_R_SUCCESS);
@ -189,7 +189,7 @@ send_test(void **state) {
memset(&zr, 0, sizeof(zr));
isc_buffer_init(&zb, zone, sizeof(zone));
result = dns_compress_init(&cctx, -1, mctx);
result = dns_compress_init(&cctx, -1, dt_mctx);
dns_compress_setmethods(&cctx, DNS_COMPRESS_NONE);
result = dns_name_towire(zname, &cctx, &zb);
assert_int_equal(result, ISC_R_SUCCESS);
@ -263,7 +263,7 @@ send_test(void **state) {
dns_dt_shutdown();
dns_view_detach(&view);
result = dns_dt_open(TAPFILE, dns_dtmode_file, mctx, &handle);
result = dns_dt_open(TAPFILE, dns_dtmode_file, dt_mctx, &handle);
assert_int_equal(result, ISC_R_SUCCESS);
while (dns_dt_getframe(handle, &data, &dsize) == ISC_R_SUCCESS) {
@ -275,7 +275,7 @@ send_test(void **state) {
r.base = data;
r.length = dsize;
result = dns_dt_parse(mctx, &r, &dtdata);
result = dns_dt_parse(dt_mctx, &r, &dtdata);
assert_int_equal(result, ISC_R_SUCCESS);
if (result != ISC_R_SUCCESS) {
n++;
@ -310,7 +310,7 @@ totext_test(void **state) {
UNUSED(state);
result = dns_dt_open(TAPSAVED, dns_dtmode_file, mctx, &handle);
result = dns_dt_open(TAPSAVED, dns_dtmode_file, dt_mctx, &handle);
assert_int_equal(result, ISC_R_SUCCESS);
result = isc_stdio_open(TAPTEXT, "r", &fp);
@ -338,13 +338,13 @@ totext_test(void **state) {
}
/* parse dnstap frame */
result = dns_dt_parse(mctx, &r, &dtdata);
result = dns_dt_parse(dt_mctx, &r, &dtdata);
assert_int_equal(result, ISC_R_SUCCESS);
if (result != ISC_R_SUCCESS) {
continue;
}
isc_buffer_allocate(mctx, &b, 2048);
isc_buffer_allocate(dt_mctx, &b, 2048);
assert_non_null(b);
if (b == NULL) {
break;

View File

@ -61,7 +61,7 @@
} \
} while (0)
isc_mem_t *mctx = NULL;
isc_mem_t *dt_mctx = NULL;
isc_log_t *lctx = NULL;
isc_taskmgr_t *taskmgr = NULL;
isc_task_t *maintask = NULL;
@ -115,9 +115,9 @@ create_managers(void) {
isc_result_t result;
ncpus = isc_os_ncpus();
CHECK(isc_taskmgr_create(mctx, ncpus, 0, &taskmgr));
CHECK(isc_timermgr_create(mctx, &timermgr));
CHECK(isc_socketmgr_create(mctx, &socketmgr));
CHECK(isc_taskmgr_create(dt_mctx, ncpus, 0, &taskmgr));
CHECK(isc_timermgr_create(dt_mctx, &timermgr));
CHECK(isc_socketmgr_create(dt_mctx, &socketmgr));
CHECK(isc_task_create(taskmgr, 0, &maintask));
return (ISC_R_SUCCESS);
@ -140,14 +140,14 @@ dns_test_begin(FILE *logfile, bool start_managers) {
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
}
INSIST(mctx == NULL);
CHECK(isc_mem_create(0, 0, &mctx));
INSIST(dt_mctx == NULL);
CHECK(isc_mem_create(0, 0, &dt_mctx));
/* Don't check the memory leaks as they hide the assertions */
isc_mem_setdestroycheck(mctx, false);
isc_mem_setdestroycheck(dt_mctx, false);
INSIST(!dst_active);
CHECK(dst_lib_init(mctx, NULL));
CHECK(dst_lib_init(dt_mctx, NULL));
dst_active = true;
if (logfile != NULL) {
@ -155,7 +155,7 @@ dns_test_begin(FILE *logfile, bool start_managers) {
isc_logconfig_t *logconfig = NULL;
INSIST(lctx == NULL);
CHECK(isc_log_create(mctx, &lctx, &logconfig));
CHECK(isc_log_create(dt_mctx, &lctx, &logconfig));
isc_log_registercategories(lctx, categories);
isc_log_setcontext(lctx);
@ -206,8 +206,8 @@ dns_test_end(void) {
isc_log_destroy(&lctx);
}
if (mctx != NULL) {
isc_mem_destroy(&mctx);
if (dt_mctx != NULL) {
isc_mem_destroy(&dt_mctx);
}
test_running = false;
@ -221,7 +221,7 @@ dns_test_makeview(const char *name, dns_view_t **viewp) {
isc_result_t result;
dns_view_t *view = NULL;
CHECK(dns_view_create(mctx, dns_rdataclass_in, name, &view));
CHECK(dns_view_create(dt_mctx, dns_rdataclass_in, name, &view));
*viewp = view;
return (ISC_R_SUCCESS);
@ -246,7 +246,7 @@ dns_test_makezone(const char *name, dns_zone_t **zonep, dns_view_t *view,
/*
* Create the zone structure.
*/
result = dns_zone_create(&zone, mctx);
result = dns_zone_create(&zone, dt_mctx);
if (result != ISC_R_SUCCESS) {
return (result);
}
@ -302,7 +302,7 @@ dns_test_setupzonemgr(void) {
isc_result_t result;
REQUIRE(zonemgr == NULL);
result = dns_zonemgr_create(mctx, taskmgr, timermgr, socketmgr,
result = dns_zonemgr_create(dt_mctx, taskmgr, timermgr, socketmgr,
&zonemgr);
return (result);
}
@ -370,7 +370,7 @@ dns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin,
if (result != ISC_R_SUCCESS)
return(result);
result = dns_db_create(mctx, "rbt", name, dbtype, dns_rdataclass_in,
result = dns_db_create(dt_mctx, "rbt", name, dbtype, dns_rdataclass_in,
0, NULL, db);
if (result != ISC_R_SUCCESS)
return (result);
@ -508,7 +508,7 @@ dns_test_rdatafromstring(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
/*
* Create a lexer as one is required by dns_rdata_fromtext().
*/
result = isc_lex_create(mctx, 64, &lex);
result = isc_lex_create(dt_mctx, 64, &lex);
if (result != ISC_R_SUCCESS) {
return (result);
}
@ -554,7 +554,7 @@ dns_test_rdatafromstring(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
* Parse input string, determining result.
*/
result = dns_rdata_fromtext(rdata, rdclass, rdtype, lex, dns_rootname,
0, mctx, &target, &callbacks);
0, dt_mctx, &target, &callbacks);
destroy_lexer:
isc_lex_destroy(&lex);
@ -573,7 +573,7 @@ dns_test_namefromstring(const char *namestr, dns_fixedname_t *fname) {
name = dns_fixedname_initname(fname);
result = isc_buffer_allocate(mctx, &b, length);
result = isc_buffer_allocate(dt_mctx, &b, length);
assert_int_equal(result, ISC_R_SUCCESS);
isc_buffer_putmem(b, (const unsigned char *) namestr, length);
@ -600,14 +600,14 @@ dns_test_difffromchanges(dns_diff_t *diff, const zonechange_t *changes,
REQUIRE(diff != NULL);
REQUIRE(changes != NULL);
dns_diff_init(mctx, diff);
dns_diff_init(dt_mctx, diff);
for (i = 0; changes[i].owner != NULL; i++) {
/*
* Parse owner name.
*/
name = dns_fixedname_initname(&fixedname);
result = dns_name_fromstring(name, changes[i].owner, 0, mctx);
result = dns_name_fromstring(name, changes[i].owner, 0, dt_mctx);
if (result != ISC_R_SUCCESS) {
break;
}
@ -640,7 +640,7 @@ dns_test_difffromchanges(dns_diff_t *diff, const zonechange_t *changes,
* Create a diff tuple for the parsed change and append it to
* the diff.
*/
result = dns_difftuple_create(mctx, changes[i].op, name,
result = dns_difftuple_create(dt_mctx, changes[i].op, name,
changes[i].ttl, &rdata, &tuple);
if (result != ISC_R_SUCCESS) {
break;

View File

@ -37,7 +37,7 @@ typedef struct {
#define ZONECHANGE_SENTINEL { 0, NULL, 0, NULL, NULL }
extern isc_mem_t *mctx;
extern isc_mem_t *dt_mctx;
extern isc_log_t *lctx;
extern isc_taskmgr_t *taskmgr;
extern isc_task_t *maintask;

View File

@ -74,7 +74,7 @@ sig_fromfile(const char *path, isc_buffer_t *buf) {
result = isc_file_getsizefd(fileno(fp), &size);
assert_int_equal(result, ISC_R_SUCCESS);
data = isc_mem_get(mctx, (size + 1));
data = isc_mem_get(dt_mctx, (size + 1));
assert_non_null(data);
len = (size_t)size;
@ -124,7 +124,7 @@ sig_fromfile(const char *path, isc_buffer_t *buf) {
result = ISC_R_SUCCESS;
err:
isc_mem_put(mctx, data, size + 1);
isc_mem_put(dt_mctx, data, size + 1);
return (result);
}
@ -156,7 +156,7 @@ check_sig(const char *datapath, const char *sigpath, const char *keyname,
result = isc_file_getsizefd(fileno(fp), &size);
assert_int_equal(result, ISC_R_SUCCESS);
data = isc_mem_get(mctx, (size + 1));
data = isc_mem_get(dt_mctx, (size + 1));
assert_non_null(data);
p = data;
@ -178,7 +178,7 @@ check_sig(const char *datapath, const char *sigpath, const char *keyname,
result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
assert_int_equal(result, ISC_R_SUCCESS);
result = dst_key_fromfile(name, id, alg, type, "testdata/dst",
mctx, &key);
dt_mctx, &key);
assert_int_equal(result, ISC_R_SUCCESS);
isc_buffer_init(&databuf, data, (unsigned int)size);
@ -199,7 +199,7 @@ check_sig(const char *datapath, const char *sigpath, const char *keyname,
*/
isc_buffer_remainingregion(&sigbuf, &sigreg);
result = dst_context_create(key, mctx, DNS_LOGCATEGORY_GENERAL,
result = dst_context_create(key, dt_mctx, DNS_LOGCATEGORY_GENERAL,
false, 0, &ctx);
assert_int_equal(result, ISC_R_SUCCESS);
@ -209,7 +209,7 @@ check_sig(const char *datapath, const char *sigpath, const char *keyname,
if (expect && result != ISC_R_SUCCESS) {
isc_result_t result2;
result2 = dst_context_create(key, mctx, DNS_LOGCATEGORY_GENERAL,
result2 = dst_context_create(key, dt_mctx, DNS_LOGCATEGORY_GENERAL,
false, 0, &ctx);
assert_int_equal(result2, ISC_R_SUCCESS);
@ -240,7 +240,7 @@ check_sig(const char *datapath, const char *sigpath, const char *keyname,
assert_true((expect && (result == ISC_R_SUCCESS)) ||
(!expect && (result != ISC_R_SUCCESS)));
isc_mem_put(mctx, data, size + 1);
isc_mem_put(dt_mctx, data, size + 1);
dst_context_destroy(&ctx);
dst_key_free(&key);

View File

@ -134,7 +134,7 @@ create_key(uint16_t flags, uint8_t proto, uint8_t alg,
ISC_R_SUCCESS);
assert_int_equal(dst_key_fromdns(str2name(keynamestr), rdclass,
&rrdatabuf, mctx, target),
&rrdatabuf, dt_mctx, target),
ISC_R_SUCCESS);
}
@ -148,7 +148,7 @@ create_tables() {
result = dns_test_makeview("view", &view);
assert_int_equal(result, ISC_R_SUCCESS);
assert_int_equal(dns_keytable_create(mctx, &keytable), ISC_R_SUCCESS);
assert_int_equal(dns_keytable_create(dt_mctx, &keytable), ISC_R_SUCCESS);
assert_int_equal(dns_ntatable_create(view, taskmgr, timermgr,
&ntatable), ISC_R_SUCCESS);
@ -651,7 +651,7 @@ nta_test(void **state) {
result = isc_task_create(taskmgr, 0, &myview->task);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_view_initsecroots(myview, mctx);
result = dns_view_initsecroots(myview, dt_mctx);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_view_getsecroots(myview, &keytable);
assert_int_equal(result, ISC_R_SUCCESS);

View File

@ -171,14 +171,14 @@ test_master(const char *testfile, dns_masterformat_t format,
result = dns_master_loadfile(testfile, &dns_origin, &dns_origin,
dns_rdataclass_in, true, 0,
&callbacks, NULL, NULL, mctx, format, 0);
&callbacks, NULL, NULL, dt_mctx, format, 0);
return (result);
}
static void
include_callback(const char *filename, void *arg) {
char **argp = (char **) arg;
*argp = isc_mem_strdup(mctx, filename);
*argp = isc_mem_strdup(dt_mctx, filename);
}
/*
@ -356,12 +356,12 @@ master_includelist_test(void **state) {
&dns_origin, &dns_origin,
dns_rdataclass_in, 0, true,
&callbacks, include_callback,
&filename, mctx, dns_masterformat_text, 0);
&filename, dt_mctx, dns_masterformat_text, 0);
assert_int_equal(result, DNS_R_SEENINCLUDE);
assert_non_null(filename);
if (filename != NULL) {
assert_string_equal(filename, "testdata/master/master6.data");
isc_mem_free(mctx, filename);
isc_mem_free(dt_mctx, filename);
}
}
@ -507,7 +507,7 @@ dumpraw_test(void **state) {
0, &target);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_db_create(mctx, "rbt", &dnsorigin, dns_dbtype_zone,
result = dns_db_create(dt_mctx, "rbt", &dnsorigin, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &db);
assert_int_equal(result, ISC_R_SUCCESS);
@ -517,7 +517,7 @@ dumpraw_test(void **state) {
dns_db_currentversion(db, &version);
result = dns_master_dump(mctx, db, version,
result = dns_master_dump(dt_mctx, db, version,
&dns_master_style_default, "test.dump",
dns_masterformat_raw, NULL);
assert_int_equal(result, ISC_R_SUCCESS);
@ -533,7 +533,7 @@ dumpraw_test(void **state) {
header.flags |= DNS_MASTERRAW_SOURCESERIALSET;
unlink("test.dump");
result = dns_master_dump(mctx, db, version,
result = dns_master_dump(dt_mctx, db, version,
&dns_master_style_default, "test.dump",
dns_masterformat_raw, &header);
assert_int_equal(result, ISC_R_SUCCESS);

View File

@ -215,7 +215,7 @@ compression_test(void **state) {
/* Test 1: NONE */
allowed = DNS_COMPRESS_NONE;
assert_int_equal(dns_compress_init(&cctx, -1, mctx), ISC_R_SUCCESS);
assert_int_equal(dns_compress_init(&cctx, -1, dt_mctx), ISC_R_SUCCESS);
dns_compress_setmethods(&cctx, allowed);
dns_decompress_init(&dctx, -1, DNS_DECOMPRESS_STRICT);
dns_decompress_setmethods(&dctx, allowed);
@ -228,7 +228,7 @@ compression_test(void **state) {
/* Test2: GLOBAL14 */
allowed = DNS_COMPRESS_GLOBAL14;
assert_int_equal(dns_compress_init(&cctx, -1, mctx), ISC_R_SUCCESS);
assert_int_equal(dns_compress_init(&cctx, -1, dt_mctx), ISC_R_SUCCESS);
dns_compress_setmethods(&cctx, allowed);
dns_decompress_init(&dctx, -1, DNS_DECOMPRESS_STRICT);
dns_decompress_setmethods(&dctx, allowed);
@ -241,7 +241,7 @@ compression_test(void **state) {
/* Test3: ALL */
allowed = DNS_COMPRESS_ALL;
assert_int_equal(dns_compress_init(&cctx, -1, mctx), ISC_R_SUCCESS);
assert_int_equal(dns_compress_init(&cctx, -1, dt_mctx), ISC_R_SUCCESS);
dns_compress_setmethods(&cctx, allowed);
dns_decompress_init(&dctx, -1, DNS_DECOMPRESS_STRICT);
dns_decompress_setmethods(&dctx, allowed);
@ -254,7 +254,7 @@ compression_test(void **state) {
/* Test4: NONE disabled */
allowed = DNS_COMPRESS_NONE;
assert_int_equal(dns_compress_init(&cctx, -1, mctx), ISC_R_SUCCESS);
assert_int_equal(dns_compress_init(&cctx, -1, dt_mctx), ISC_R_SUCCESS);
dns_compress_setmethods(&cctx, allowed);
dns_compress_disable(&cctx);
dns_decompress_init(&dctx, -1, DNS_DECOMPRESS_STRICT);
@ -268,7 +268,7 @@ compression_test(void **state) {
/* Test5: GLOBAL14 disabled */
allowed = DNS_COMPRESS_GLOBAL14;
assert_int_equal(dns_compress_init(&cctx, -1, mctx), ISC_R_SUCCESS);
assert_int_equal(dns_compress_init(&cctx, -1, dt_mctx), ISC_R_SUCCESS);
dns_compress_setmethods(&cctx, allowed);
dns_compress_disable(&cctx);
dns_decompress_init(&dctx, -1, DNS_DECOMPRESS_STRICT);
@ -282,7 +282,7 @@ compression_test(void **state) {
/* Test6: ALL disabled */
allowed = DNS_COMPRESS_ALL;
assert_int_equal(dns_compress_init(&cctx, -1, mctx), ISC_R_SUCCESS);
assert_int_equal(dns_compress_init(&cctx, -1, dt_mctx), ISC_R_SUCCESS);
dns_compress_setmethods(&cctx, allowed);
dns_compress_disable(&cctx);
dns_decompress_init(&dctx, -1, DNS_DECOMPRESS_STRICT);

View File

@ -60,7 +60,7 @@ iteration_test(const char *file, unsigned int expected) {
result = dns_test_loaddb(&db, dns_dbtype_zone, "test", file);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_nsec3_maxiterations(db, NULL, mctx, &iterations);
result = dns_nsec3_maxiterations(db, NULL, dt_mctx, &iterations);
assert_int_equal(result, ISC_R_SUCCESS);
assert_int_equal(iterations, expected);

View File

@ -65,7 +65,7 @@ dscp(void **state) {
*/
ina.s_addr = INADDR_LOOPBACK;
isc_netaddr_fromin(&netaddr, &ina);
result = dns_peer_new(mctx, &netaddr, &peer);
result = dns_peer_new(dt_mctx, &netaddr, &peer);
assert_int_equal(result, ISC_R_SUCCESS);
/*

View File

@ -211,7 +211,7 @@ fix_data(dns_rbtnode_t *p, void *base, size_t max, void *arg, uint64_t *crc) {
* Load test data into the RBT.
*/
static void
add_test_data(isc_mem_t *mymctx, dns_rbt_t *rbt) {
add_test_data(isc_mem_t *mctx, dns_rbt_t *rbt) {
char buffer[1024];
isc_buffer_t b;
isc_result_t result;
@ -220,7 +220,7 @@ add_test_data(isc_mem_t *mymctx, dns_rbt_t *rbt) {
dns_compress_t cctx;
rbt_testdata_t *testdatap = testdata;
dns_compress_init(&cctx, -1, mymctx);
dns_compress_init(&cctx, -1, mctx);
while (testdatap->name != NULL && testdatap->data.data != NULL) {
memmove(buffer, testdatap->name, testdatap->name_len);
@ -307,10 +307,10 @@ serialize_test(void **state) {
isc_mem_debugging = ISC_MEM_DEBUGRECORD;
result = dns_rbt_create(mctx, delete_data, NULL, &rbt);
result = dns_rbt_create(dt_mctx, delete_data, NULL, &rbt);
assert_int_equal(result, ISC_R_SUCCESS);
add_test_data(mctx, rbt);
add_test_data(dt_mctx, rbt);
if (verbose) {
dns_rbt_printtext(rbt, data_printer, stdout);
@ -337,7 +337,7 @@ serialize_test(void **state) {
assert_true(base != NULL && base != MAP_FAILED);
close(fd);
result = dns_rbt_deserialize_tree(base, filesize, 0, mctx,
result = dns_rbt_deserialize_tree(base, filesize, 0, dt_mctx,
delete_data, NULL, fix_data, NULL,
NULL, &rbt_deserialized);
@ -375,10 +375,10 @@ deserialize_corrupt_test(void **state) {
isc_mem_debugging = ISC_MEM_DEBUGRECORD;
/* Set up map file */
result = dns_rbt_create(mctx, delete_data, NULL, &rbt);
result = dns_rbt_create(dt_mctx, delete_data, NULL, &rbt);
assert_int_equal(result, ISC_R_SUCCESS);
add_test_data(mctx, rbt);
add_test_data(dt_mctx, rbt);
rbtfile = fopen("./zone.bin", "w+b");
assert_non_null(rbtfile);
result = dns_rbt_serialize_tree(rbtfile, rbt, write_data, NULL,
@ -405,7 +405,7 @@ deserialize_corrupt_test(void **state) {
*p = isc_random8();
}
result = dns_rbt_deserialize_tree(base, filesize, 0, mctx,
result = dns_rbt_deserialize_tree(base, filesize, 0, dt_mctx,
delete_data, NULL,
fix_data, NULL,
NULL, &rbt_deserialized);

View File

@ -154,7 +154,7 @@ static void
delete_data(void *data, void *arg) {
UNUSED(arg);
isc_mem_put(mctx, data, sizeof(size_t));
isc_mem_put(dt_mctx, data, sizeof(size_t));
}
static test_context_t *
@ -163,15 +163,15 @@ test_context_setup(void) {
isc_result_t result;
size_t i;
ctx = isc_mem_get(mctx, sizeof(*ctx));
ctx = isc_mem_get(dt_mctx, sizeof(*ctx));
assert_non_null(ctx);
ctx->rbt = NULL;
result = dns_rbt_create(mctx, delete_data, NULL, &ctx->rbt);
result = dns_rbt_create(dt_mctx, delete_data, NULL, &ctx->rbt);
assert_int_equal(result, ISC_R_SUCCESS);
ctx->rbt_distances = NULL;
result = dns_rbt_create(mctx, delete_data, NULL, &ctx->rbt_distances);
result = dns_rbt_create(dt_mctx, delete_data, NULL, &ctx->rbt_distances);
assert_int_equal(result, ISC_R_SUCCESS);
for (i = 0; i < domain_names_count; i++) {
@ -183,13 +183,13 @@ test_context_setup(void) {
name = dns_fixedname_name(&fname);
n = isc_mem_get(mctx, sizeof(size_t));
n = isc_mem_get(dt_mctx, sizeof(size_t));
assert_non_null(n);
*n = i + 1;
result = dns_rbt_addname(ctx->rbt, name, n);
assert_int_equal(result, ISC_R_SUCCESS);
n = isc_mem_get(mctx, sizeof(size_t));
n = isc_mem_get(dt_mctx, sizeof(size_t));
assert_non_null(n);
*n = node_distances[i];
result = dns_rbt_addname(ctx->rbt_distances, name, n);
@ -204,7 +204,7 @@ test_context_teardown(test_context_t *ctx) {
dns_rbt_destroy(&ctx->rbt);
dns_rbt_destroy(&ctx->rbt_distances);
isc_mem_put(mctx, ctx, sizeof(*ctx));
isc_mem_put(dt_mctx, ctx, sizeof(*ctx));
}
/*
@ -291,7 +291,7 @@ rbtnode_get_distance(void **state) {
dns_test_namefromstring(name_str, &fname);
name = dns_fixedname_name(&fname);
dns_rbtnodechain_init(&chain, mctx);
dns_rbtnodechain_init(&chain, dt_mctx);
result = dns_rbt_findnode(ctx->rbt_distances, name, NULL,
&node, &chain, 0, NULL, NULL);
@ -335,7 +335,7 @@ rbt_check_distance_random(void **state) {
isc_mem_debugging = ISC_MEM_DEBUGRECORD;
result = dns_rbt_create(mctx, delete_data, NULL, &mytree);
result = dns_rbt_create(dt_mctx, delete_data, NULL, &mytree);
assert_int_equal(result, ISC_R_SUCCESS);
/* Names are inserted in random order. */
@ -352,7 +352,7 @@ rbt_check_distance_random(void **state) {
size_t *n;
char namebuf[34];
n = isc_mem_get(mctx, sizeof(size_t));
n = isc_mem_get(dt_mctx, sizeof(size_t));
assert_non_null(n);
*n = i + 1;
@ -413,7 +413,7 @@ rbt_check_distance_ordered(void **state) {
isc_mem_debugging = ISC_MEM_DEBUGRECORD;
result = dns_rbt_create(mctx, delete_data, NULL, &mytree);
result = dns_rbt_create(dt_mctx, delete_data, NULL, &mytree);
assert_int_equal(result, ISC_R_SUCCESS);
/* Names are inserted in sorted order. */
@ -432,7 +432,7 @@ rbt_check_distance_ordered(void **state) {
dns_fixedname_t fname;
dns_name_t *name;
n = isc_mem_get(mctx, sizeof(size_t));
n = isc_mem_get(dt_mctx, sizeof(size_t));
assert_non_null(n);
*n = i + 1;
@ -481,12 +481,12 @@ compare_labelsequences(dns_rbtnode_t *node, const char *labelstr) {
dns_name_init(&name, NULL);
dns_rbt_namefromnode(node, &name);
result = dns_name_tostring(&name, &nodestr, mctx);
result = dns_name_tostring(&name, &nodestr, dt_mctx);
assert_int_equal(result, ISC_R_SUCCESS);
is_equal = strcmp(labelstr, nodestr) == 0 ? true : false;
isc_mem_free(mctx, nodestr);
isc_mem_free(dt_mctx, nodestr);
return (is_equal);
}
@ -676,7 +676,7 @@ rbt_remove(void **state) {
size_t start_node;
/* Create a tree. */
result = dns_rbt_create(mctx, delete_data, NULL, &mytree);
result = dns_rbt_create(dt_mctx, delete_data, NULL, &mytree);
assert_int_equal(result, ISC_R_SUCCESS);
/* Insert test data into the tree. */
@ -705,7 +705,7 @@ rbt_remove(void **state) {
assert_non_null(node);
assert_null(node->data);
n = isc_mem_get(mctx, sizeof(size_t));
n = isc_mem_get(dt_mctx, sizeof(size_t));
assert_non_null(n);
*n = i;
@ -729,7 +729,7 @@ rbt_remove(void **state) {
tree_ok = dns__rbt_checkproperties(mytree);
assert_true(tree_ok);
dns_rbtnodechain_init(&chain, mctx);
dns_rbtnodechain_init(&chain, dt_mctx);
/* Now, walk through nodes in order. */
if (j == 0) {
@ -854,7 +854,7 @@ insert_nodes(dns_rbt_t *mytree, char **names,
size_t *n;
char namebuf[34];
n = isc_mem_get(mctx, sizeof(size_t));
n = isc_mem_get(dt_mctx, sizeof(size_t));
assert_non_null(n);
*n = i; /* Unused value */
@ -879,7 +879,7 @@ insert_nodes(dns_rbt_t *mytree, char **names,
result = dns_rbt_addnode(mytree, name, &node);
if (result == ISC_R_SUCCESS) {
node->data = n;
names[*names_count] = isc_mem_strdup(mctx,
names[*names_count] = isc_mem_strdup(dt_mctx,
namebuf);
assert_non_null(names[*names_count]);
*names_count += 1;
@ -911,7 +911,7 @@ remove_nodes(dns_rbt_t *mytree, char **names,
result = dns_rbt_deletename(mytree, name, false);
assert_int_equal(result, ISC_R_SUCCESS);
isc_mem_free(mctx, names[node]);
isc_mem_free(dt_mctx, names[node]);
if (*names_count > 0) {
names[node] = names[*names_count - 1];
names[*names_count - 1] = NULL;
@ -969,10 +969,10 @@ rbt_insert_and_remove(void **state) {
isc_mem_debugging = ISC_MEM_DEBUGRECORD;
result = dns_rbt_create(mctx, delete_data, NULL, &mytree);
result = dns_rbt_create(dt_mctx, delete_data, NULL, &mytree);
assert_int_equal(result, ISC_R_SUCCESS);
n = isc_mem_get(mctx, sizeof(size_t));
n = isc_mem_get(dt_mctx, sizeof(size_t));
assert_non_null(n);
result = dns_rbt_addname(mytree, dns_rootname, n);
assert_int_equal(result, ISC_R_SUCCESS);
@ -1011,7 +1011,7 @@ rbt_insert_and_remove(void **state) {
for (i = 0; i < 1024; i++) {
if (names[i] != NULL) {
isc_mem_free(mctx, names[i]);
isc_mem_free(dt_mctx, names[i]);
}
}
@ -1089,7 +1089,7 @@ rbt_addname(void **state) {
ctx = test_context_setup();
n = isc_mem_get(mctx, sizeof(size_t));
n = isc_mem_get(dt_mctx, sizeof(size_t));
assert_non_null(n);
*n = 1;
@ -1101,12 +1101,12 @@ rbt_addname(void **state) {
assert_int_equal(result, ISC_R_SUCCESS);
/* Now add again, should get ISC_R_EXISTS */
n = isc_mem_get(mctx, sizeof(size_t));
n = isc_mem_get(dt_mctx, sizeof(size_t));
assert_non_null(n);
*n = 2;
result = dns_rbt_addname(ctx->rbt, name, n);
assert_int_equal(result, ISC_R_EXISTS);
isc_mem_put(mctx, n, sizeof(size_t));
isc_mem_put(dt_mctx, n, sizeof(size_t));
test_context_teardown(ctx);
}
@ -1156,7 +1156,7 @@ rbt_nodechain(void **state) {
ctx = test_context_setup();
dns_rbtnodechain_init(&chain, mctx);
dns_rbtnodechain_init(&chain, dt_mctx);
dns_test_namefromstring("a", &fname);
name = dns_fixedname_name(&fname);
@ -1276,7 +1276,7 @@ benchmark(void **state) {
/* Create a tree. */
mytree = NULL;
result = dns_rbt_create(mctx, NULL, NULL, &mytree);
result = dns_rbt_create(dt_mctx, NULL, NULL, &mytree);
assert_int_equal(result, ISC_R_SUCCESS);
/* Insert test data into the tree. */

View File

@ -169,7 +169,7 @@ check_struct_conversions(dns_rdata_t *rdata, size_t structsize) {
void *rdata_struct;
char buf[1024];
rdata_struct = isc_mem_allocate(mctx, structsize);
rdata_struct = isc_mem_allocate(dt_mctx, structsize);
assert_non_null(rdata_struct);
/*
@ -193,7 +193,7 @@ check_struct_conversions(dns_rdata_t *rdata, size_t structsize) {
assert_memory_equal(buf, rdata->data, rdata->length);
isc_mem_free(mctx, rdata_struct);
isc_mem_free(dt_mctx, rdata_struct);
}
/*

View File

@ -154,7 +154,7 @@ rdatasetstats(void **state) {
UNUSED(state);
result = dns_rdatasetstats_create(mctx, &stats);
result = dns_rdatasetstats_create(dt_mctx, &stats);
assert_int_equal(result, ISC_R_SUCCESS);
/* First 256 types. */

View File

@ -51,7 +51,7 @@ _setup(void **state) {
result = dns_test_begin(NULL, true);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_dispatchmgr_create(mctx, &dispatchmgr);
result = dns_dispatchmgr_create(dt_mctx, &dispatchmgr);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_test_makeview("view", &view);

View File

@ -182,12 +182,12 @@ isc_rsa_verify_test(void **state) {
assert_int_equal(ret, ISC_R_SUCCESS);
ret = dst_key_fromfile(name, 29235, DST_ALG_RSASHA1,
DST_TYPE_PUBLIC, "./", mctx, &key);
DST_TYPE_PUBLIC, "./", dt_mctx, &key);
assert_int_equal(ret, ISC_R_SUCCESS);
/* RSASHA1 */
ret = dst_context_create(key, mctx, DNS_LOGCATEGORY_DNSSEC,
ret = dst_context_create(key, dt_mctx, DNS_LOGCATEGORY_DNSSEC,
false, 0, &ctx);
assert_int_equal(ret, ISC_R_SUCCESS);
@ -207,7 +207,7 @@ isc_rsa_verify_test(void **state) {
key->key_alg = DST_ALG_RSASHA256;
ret = dst_context_create(key, mctx, DNS_LOGCATEGORY_DNSSEC,
ret = dst_context_create(key, dt_mctx, DNS_LOGCATEGORY_DNSSEC,
false, 0, &ctx);
assert_int_equal(ret, ISC_R_SUCCESS);
@ -227,7 +227,7 @@ isc_rsa_verify_test(void **state) {
key->key_alg = DST_ALG_RSASHA512;
ret = dst_context_create(key, mctx, DNS_LOGCATEGORY_DNSSEC,
ret = dst_context_create(key, dt_mctx, DNS_LOGCATEGORY_DNSSEC,
false, 0, &ctx);
assert_int_equal(ret, ISC_R_SUCCESS);

View File

@ -124,7 +124,7 @@ compare_tuples(const zonediff_t *expected, dns_difftuple_t *found,
* Check owner name.
*/
expected_name = dns_fixedname_initname(&expected_fname);
result = dns_name_fromstring(expected_name, expected->owner, 0, mctx);
result = dns_name_fromstring(expected_name, expected->owner, 0, dt_mctx);
assert_int_equal(result, ISC_R_SUCCESS);
dns_name_format(&found->name, found_name, sizeof(found_name));
assert_true(dns_name_equal(expected_name, &found->name));
@ -233,7 +233,7 @@ updatesigs_test(const updatesigs_test_params_t *test, dns_zone_t *zone,
/*
* Initialize the structure dns__zone_updatesigs() will modify.
*/
dns_diff_init(mctx, &zone_diff);
dns_diff_init(dt_mctx, &zone_diff);
/*
* Check whether dns__zone_updatesigs() behaves as expected.
@ -314,7 +314,8 @@ updatesigs_next_test(void **state) {
assert_int_equal(result, ISC_R_SUCCESS);
isc_stdtime_get(&now);
result = dns__zone_findkeys(zone, db, NULL, now, mctx, DNS_MAXZONEKEYS,
result = dns__zone_findkeys(zone, db, NULL, now, dt_mctx,
DNS_MAXZONEKEYS,
zone_keys, &nkeys);
assert_int_equal(result, ISC_R_SUCCESS);
assert_int_equal(nkeys, 2);

View File

@ -30,7 +30,7 @@ static isc_mem_t mock_mctx = {
};
static void *
__wrap_isc__mem_get(isc_mem_t *mctx __attribute__ ((unused)),
__wrap_isc__mem_get(isc_mem_t *dt_mctx __attribute__ ((unused)),
size_t size)
{
bool has_enough_memory = mock_type(bool);
@ -84,11 +84,13 @@ dns_tkeyctx_create_test(void **state) {
tctx = NULL;
will_return(__wrap_isc__mem_get, false);
assert_int_equal(dns_tkeyctx_create(&mock_mctx, &tctx), ISC_R_NOMEMORY);
assert_int_equal(dns_tkeyctx_create(&mock_mctx, &tctx),
ISC_R_NOMEMORY);
tctx = NULL;
will_return(__wrap_isc__mem_get, true);
assert_int_equal(dns_tkeyctx_create(&mock_mctx, &tctx), ISC_R_SUCCESS);
assert_int_equal(dns_tkeyctx_create(&mock_mctx, &tctx),
ISC_R_SUCCESS);
*state = tctx;
}

View File

@ -111,7 +111,7 @@ add_tsig(dst_context_t *tsigctx, dns_tsigkey_t *key, isc_buffer_t *target) {
memset(&tsig, 0, sizeof(tsig));
CHECK(dns_compress_init(&cctx, -1, mctx));
CHECK(dns_compress_init(&cctx, -1, dt_mctx));
invalidate_ctx = true;
tsig.common.rdclass = dns_rdataclass_any;
@ -135,7 +135,7 @@ add_tsig(dst_context_t *tsigctx, dns_tsigkey_t *key, isc_buffer_t *target) {
CHECK(dst_context_adddata(tsigctx, &r));
CHECK(dst_key_sigsize(key->key, &sigsize));
tsig.signature = (unsigned char *) isc_mem_get(mctx, sigsize);
tsig.signature = (unsigned char *) isc_mem_get(dt_mctx, sigsize);
if (tsig.signature == NULL) {
CHECK(ISC_R_NOMEMORY);
}
@ -144,7 +144,7 @@ add_tsig(dst_context_t *tsigctx, dns_tsigkey_t *key, isc_buffer_t *target) {
tsig.siglen = isc_buffer_usedlength(&sigbuf);
assert_int_equal(sigsize, tsig.siglen);
CHECK(isc_buffer_allocate(mctx, &dynbuf, 512));
CHECK(isc_buffer_allocate(dt_mctx, &dynbuf, 512));
CHECK(dns_rdata_fromstruct(&rdata, dns_rdataclass_any,
dns_rdatatype_tsig, &tsig, dynbuf));
dns_rdatalist_init(&rdatalist);
@ -165,7 +165,7 @@ add_tsig(dst_context_t *tsigctx, dns_tsigkey_t *key, isc_buffer_t *target) {
}
cleanup:
if (tsig.signature != NULL) {
isc_mem_put(mctx, tsig.signature, sigsize);
isc_mem_put(dt_mctx, tsig.signature, sigsize);
}
if (dynbuf != NULL) {
isc_buffer_free(&dynbuf);
@ -189,13 +189,13 @@ printmessage(dns_message_t *msg) {
}
do {
buf = isc_mem_get(mctx, len);
buf = isc_mem_get(dt_mctx, len);
isc_buffer_init(&b, buf, len);
result = dns_message_totext(msg, &dns_master_style_debug,
0, &b);
if (result == ISC_R_NOSPACE) {
isc_mem_put(mctx, buf, len);
isc_mem_put(dt_mctx, buf, len);
len *= 2;
} else if (result == ISC_R_SUCCESS) {
printf("%.*s\n", (int) isc_buffer_usedlength(&b), buf);
@ -203,7 +203,7 @@ printmessage(dns_message_t *msg) {
} while (result == ISC_R_NOSPACE);
if (buf != NULL) {
isc_mem_put(mctx, buf, len);
isc_mem_put(dt_mctx, buf, len);
}
}
@ -216,7 +216,7 @@ render(isc_buffer_t *buf, unsigned flags, dns_tsigkey_t *key,
dns_compress_t cctx;
isc_result_t result;
result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, &msg);
result = dns_message_create(dt_mctx, DNS_MESSAGE_INTENTRENDER, &msg);
assert_int_equal(result, ISC_R_SUCCESS);
assert_non_null(msg);
@ -244,7 +244,7 @@ render(isc_buffer_t *buf, unsigned flags, dns_tsigkey_t *key,
assert_int_equal(result, ISC_R_SUCCESS);
}
result = dns_compress_init(&cctx, -1, mctx);
result = dns_compress_init(&cctx, -1, dt_mctx);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_message_renderbegin(msg, &cctx, buf);
@ -264,7 +264,7 @@ render(isc_buffer_t *buf, unsigned flags, dns_tsigkey_t *key,
isc_buffer_free(tsigin);
}
result = dns_message_getquerytsig(msg, mctx, tsigout);
result = dns_message_getquerytsig(msg, dt_mctx, tsigout);
assert_int_equal(result, ISC_R_SUCCESS);
}
@ -303,19 +303,19 @@ tsig_tcp_test(void **state) {
result = dns_name_fromstring(keyname, "test", 0, NULL);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_tsigkeyring_create(mctx, &ring);
result = dns_tsigkeyring_create(dt_mctx, &ring);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_tsigkey_create(keyname, dns_tsig_hmacsha256_name,
secret, sizeof(secret), false,
NULL, 0, 0, mctx, ring, &key);
NULL, 0, 0, dt_mctx, ring, &key);
assert_int_equal(result, ISC_R_SUCCESS);
assert_non_null(key);
/*
* Create request.
*/
result = isc_buffer_allocate(mctx, &buf, 65535);
result = isc_buffer_allocate(dt_mctx, &buf, 65535);
assert_int_equal(result, ISC_R_SUCCESS);
render(buf, 0, key, &tsigout, &querytsig, NULL);
isc_buffer_free(&buf);
@ -323,14 +323,14 @@ tsig_tcp_test(void **state) {
/*
* Create response message 1.
*/
result = isc_buffer_allocate(mctx, &buf, 65535);
result = isc_buffer_allocate(dt_mctx, &buf, 65535);
assert_int_equal(result, ISC_R_SUCCESS);
render(buf, DNS_MESSAGEFLAG_QR, key, &querytsig, &tsigout, NULL);
/*
* Process response message 1.
*/
result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &msg);
result = dns_message_create(dt_mctx, DNS_MESSAGE_INTENTPARSE, &msg);
assert_int_equal(result, ISC_R_SUCCESS);
assert_non_null(msg);
@ -355,7 +355,7 @@ tsig_tcp_test(void **state) {
*/
assert_non_null(dns_message_gettsig(msg, &tsigowner));
result = dns_message_getquerytsig(msg, mctx, &tsigin);
result = dns_message_getquerytsig(msg, dt_mctx, &tsigin);
assert_int_equal(result, ISC_R_SUCCESS);
tsigctx = msg->tsigctx;
@ -363,7 +363,7 @@ tsig_tcp_test(void **state) {
isc_buffer_free(&buf);
dns_message_destroy(&msg);
result = dst_context_create(key->key, mctx, DNS_LOGCATEGORY_DNSSEC,
result = dst_context_create(key->key, dt_mctx, DNS_LOGCATEGORY_DNSSEC,
false, 0, &outctx);
assert_int_equal(result, ISC_R_SUCCESS);
assert_non_null(outctx);
@ -377,7 +377,7 @@ tsig_tcp_test(void **state) {
/*
* Create response message 2.
*/
result = isc_buffer_allocate(mctx, &buf, 65535);
result = isc_buffer_allocate(dt_mctx, &buf, 65535);
assert_int_equal(result, ISC_R_SUCCESS);
assert_int_equal(result, ISC_R_SUCCESS);
@ -386,7 +386,7 @@ tsig_tcp_test(void **state) {
/*
* Process response message 2.
*/
result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &msg);
result = dns_message_create(dt_mctx, DNS_MESSAGE_INTENTPARSE, &msg);
assert_int_equal(result, ISC_R_SUCCESS);
assert_non_null(msg);
@ -424,7 +424,7 @@ tsig_tcp_test(void **state) {
/*
* Create response message 3.
*/
result = isc_buffer_allocate(mctx, &buf, 65535);
result = isc_buffer_allocate(dt_mctx, &buf, 65535);
assert_int_equal(result, ISC_R_SUCCESS);
render(buf, DNS_MESSAGEFLAG_QR, key, &tsigout, &tsigout, outctx);
@ -434,7 +434,7 @@ tsig_tcp_test(void **state) {
/*
* Process response message 3.
*/
result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &msg);
result = dns_message_create(dt_mctx, DNS_MESSAGE_INTENTPARSE, &msg);
assert_int_equal(result, ISC_R_SUCCESS);
assert_non_null(msg);
@ -467,7 +467,7 @@ tsig_tcp_test(void **state) {
isc_buffer_free(&tsigin);
}
result = dns_message_getquerytsig(msg, mctx, &tsigin);
result = dns_message_getquerytsig(msg, dt_mctx, &tsigin);
assert_int_equal(result, ISC_R_SUCCESS);
isc_buffer_free(&buf);
@ -543,10 +543,10 @@ algfromname_test(void **state) {
static void test_name(const char *name_string, const dns_name_t *expected) {
dns_name_t name;
dns_name_init(&name, NULL);
assert_int_equal(dns_name_fromstring(&name, name_string, 0, mctx),
assert_int_equal(dns_name_fromstring(&name, name_string, 0, dt_mctx),
ISC_R_SUCCESS);
assert_int_equal(dns__tsig_algnamefromname(&name), expected);
dns_name_free(&name, mctx);
dns_name_free(&name, dt_mctx);
}
static void

View File

@ -62,7 +62,7 @@ zonemgr_create(void **state) {
UNUSED(state);
result = dns_zonemgr_create(mctx, taskmgr, timermgr, socketmgr,
result = dns_zonemgr_create(dt_mctx, taskmgr, timermgr, socketmgr,
&myzonemgr);
assert_int_equal(result, ISC_R_SUCCESS);
@ -80,7 +80,7 @@ zonemgr_managezone(void **state) {
UNUSED(state);
result = dns_zonemgr_create(mctx, taskmgr, timermgr, socketmgr,
result = dns_zonemgr_create(dt_mctx, taskmgr, timermgr, socketmgr,
&myzonemgr);
assert_int_equal(result, ISC_R_SUCCESS);
@ -121,7 +121,7 @@ zonemgr_createzone(void **state) {
UNUSED(state);
result = dns_zonemgr_create(mctx, taskmgr, timermgr, socketmgr,
result = dns_zonemgr_create(dt_mctx, taskmgr, timermgr, socketmgr,
&myzonemgr);
assert_int_equal(result, ISC_R_SUCCESS);
@ -159,7 +159,7 @@ zonemgr_unreachable(void **state) {
TIME_NOW(&now);
result = dns_zonemgr_create(mctx, taskmgr, timermgr, socketmgr,
result = dns_zonemgr_create(dt_mctx, taskmgr, timermgr, socketmgr,
&myzonemgr);
assert_int_equal(result, ISC_R_SUCCESS);

View File

@ -197,7 +197,7 @@ asyncload_zone(void **state) {
args.arg1 = zone;
args.arg2 = &done;
args.arg3 = false;
isc_app_onrun(mctx, maintask, start_zone_asyncload, &args);
isc_app_onrun(dt_mctx, maintask, start_zone_asyncload, &args);
isc_app_run();
while (dns__zone_loadpending(zone) && i++ < 5000)
@ -218,7 +218,7 @@ asyncload_zone(void **state) {
args.arg1 = zone;
args.arg2 = &done;
args.arg3 = true;
isc_app_onrun(mctx, maintask, start_zone_asyncload, &args);
isc_app_onrun(dt_mctx, maintask, start_zone_asyncload, &args);
isc_app_run();
@ -234,7 +234,7 @@ asyncload_zone(void **state) {
args.arg1 = zone;
args.arg2 = &done;
args.arg3 = false;
isc_app_onrun(mctx, maintask, start_zone_asyncload, &args);
isc_app_onrun(dt_mctx, maintask, start_zone_asyncload, &args);
isc_app_run();
@ -305,7 +305,7 @@ asyncload_zt(void **state) {
args.arg1 = zt;
args.arg2 = &done;
isc_app_onrun(mctx, maintask, start_zt_asyncload, &args);
isc_app_onrun(dt_mctx, maintask, start_zt_asyncload, &args);
isc_app_run();
while (!done && i++ < 5000)