Commit 702c0220 authored by Witold Krecicki's avatar Witold Krecicki
Browse files

libdns refactoring: get rid of multiple versions of dns_xfrin_create,...

libdns refactoring: get rid of multiple versions of dns_xfrin_create, dst_key_generate, dst_lib_init and dst_context_create
parent ef0e68bf
......@@ -170,12 +170,12 @@ generate_key(isc_mem_t *mctx, const char *randomfile, dns_secalg_t alg,
entropy_flags = ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY;
DO("initialize dst library", dst_lib_init(mctx, ectx, entropy_flags));
DO("initialize dst library", dst_lib_init(mctx, ectx, NULL, entropy_flags));
DO("generate key", dst_key_generate(dns_rootname, alg,
keysize, 0, 0,
DNS_KEYPROTO_ANY,
dns_rdataclass_in, mctx, &key));
keysize, 0, 0, DNS_KEYPROTO_ANY,
dns_rdataclass_in, mctx, &key,
NULL));
isc_buffer_init(&key_rawbuffer, &key_rawsecret, sizeof(key_rawsecret));
......
......@@ -1400,7 +1400,7 @@ setup_libs(void) {
result = isc_entropy_create(mctx, &entp);
check_result(result, "isc_entropy_create");
result = dst_lib_init(mctx, entp, 0);
result = dst_lib_init(mctx, entp, NULL, 0);
check_result(result, "dst_lib_init");
is_dst_up = ISC_TRUE;
......
......@@ -1237,7 +1237,7 @@ main(int argc, char *argv[]) {
if (ectx == NULL) {
setup_entropy(mctx, NULL, &ectx);
}
result = dst_lib_init(mctx, ectx,
result = dst_lib_init(mctx, ectx, NULL,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
if (result != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s",
......
......@@ -479,7 +479,7 @@ main(int argc, char **argv) {
if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
result = dst_lib_init(mctx, ectx,
result = dst_lib_init(mctx, ectx, NULL,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
if (result != ISC_R_SUCCESS)
fatal("could not initialize dst: %s",
......
......@@ -408,7 +408,7 @@ main(int argc, char **argv) {
if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
result = dst_lib_init(mctx, ectx,
result = dst_lib_init(mctx, ectx, NULL,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
if (result != ISC_R_SUCCESS)
fatal("could not initialize dst: %s",
......
......@@ -349,8 +349,8 @@ main(int argc, char **argv) {
if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
ret = dst_lib_init2(mctx, ectx, engine,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
ret = dst_lib_init(mctx, ectx, engine,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
if (ret != ISC_R_SUCCESS)
fatal("could not initialize dst: %s",
isc_result_totext(ret));
......
......@@ -496,8 +496,8 @@ main(int argc, char **argv) {
if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
ret = dst_lib_init2(mctx, ectx, engine,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
ret = dst_lib_init(mctx, ectx, engine,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
if (ret != ISC_R_SUCCESS)
fatal("could not initialize dst: %s",
isc_result_totext(ret));
......@@ -862,15 +862,15 @@ main(int argc, char **argv) {
if (!quiet && show_progress) {
fprintf(stderr, "Generating key pair.");
ret = dst_key_generate2(name, alg, size, param, flags,
protocol, rdclass, mctx, &key,
&progress);
ret = dst_key_generate(name, alg, size, param, flags,
protocol, rdclass, mctx, &key,
&progress);
putc('\n', stderr);
fflush(stderr);
} else {
ret = dst_key_generate2(name, alg, size, param, flags,
protocol, rdclass, mctx, &key,
NULL);
ret = dst_key_generate(name, alg, size, param, flags,
protocol, rdclass, mctx, &key,
NULL);
}
isc_entropy_stopcallbacksources(ectx);
......
......@@ -182,8 +182,8 @@ main(int argc, char **argv) {
if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
result = dst_lib_init2(mctx, ectx, engine,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
result = dst_lib_init(mctx, ectx, engine,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
if (result != ISC_R_SUCCESS)
fatal("Could not initialize dst: %s",
isc_result_totext(result));
......
......@@ -380,8 +380,8 @@ main(int argc, char **argv) {
if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
result = dst_lib_init2(mctx, ectx, engine,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
result = dst_lib_init(mctx, ectx, engine,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
if (result != ISC_R_SUCCESS)
fatal("Could not initialize dst: %s",
isc_result_totext(result));
......
......@@ -3505,7 +3505,7 @@ main(int argc, char *argv[]) {
if (!pseudorandom)
eflags |= ISC_ENTROPY_GOODONLY;
result = dst_lib_init2(mctx, ectx, engine, eflags);
result = dst_lib_init(mctx, ectx, engine, eflags);
if (result != ISC_R_SUCCESS)
fatal("could not initialize dst: %s",
isc_result_totext(result));
......
......@@ -281,7 +281,7 @@ main(int argc, char *argv[]) {
if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
result = dst_lib_init2(mctx, ectx, engine, ISC_ENTROPY_BLOCKING);
result = dst_lib_init(mctx, ectx, engine, ISC_ENTROPY_BLOCKING);
if (result != ISC_R_SUCCESS)
fatal("could not initialize dst: %s",
isc_result_totext(result));
......
......@@ -6820,7 +6820,7 @@ generate_session_key(const char *filename, const char *keynamestr,
/* generate key */
result = dst_key_generate(keyname, algtype, bits, 1, 0,
DNS_KEYPROTO_ANY, dns_rdataclass_in,
mctx, &key);
mctx, &key, NULL);
if (result != ISC_R_SUCCESS)
return (result);
......@@ -9424,8 +9424,8 @@ named_server_create(isc_mem_t *mctx, named_server_t **serverp) {
server->in_roothints = NULL;
/* Must be first. */
CHECKFATAL(dst_lib_init2(named_g_mctx, named_g_entropy,
named_g_engine, ISC_ENTROPY_GOODONLY),
CHECKFATAL(dst_lib_init(named_g_mctx, named_g_entropy,
named_g_engine, ISC_ENTROPY_GOODONLY),
"initializing DST");
CHECKFATAL(dns_rootns_create(mctx, dns_rdataclass_in, NULL,
......
......@@ -989,7 +989,7 @@ setup_system(void) {
result = isc_task_onshutdown(global_task, shutdown_program, NULL);
check_result(result, "isc_task_onshutdown");
result = dst_lib_init(gmctx, entropy, 0);
result = dst_lib_init(gmctx, entropy, NULL, 0);
check_result(result, "dst_lib_init");
is_dst_up = ISC_TRUE;
......
......@@ -101,7 +101,7 @@ main(int argc, char **argv) {
CHECK(isc_mem_create(0, 0, &mctx));
CHECK(isc_entropy_create(mctx, &ectx));
CHECK(dst_lib_init(mctx, ectx, ISC_ENTROPY_BLOCKING));
CHECK(dst_lib_init(mctx, ectx, NULL, ISC_ENTROPY_BLOCKING));
dst_active = ISC_TRUE;
CHECK(isc_log_create(mctx, &lctx, &logconfig));
......
......@@ -52,8 +52,8 @@ use(dst_key_t *key, isc_mem_t *mctx) {
isc_buffer_add(&databuf, strlen(data));
isc_buffer_usedregion(&databuf, &datareg);
ret = dst_context_create3(key, mctx,
DNS_LOGCATEGORY_GENERAL, ISC_TRUE, &ctx);
ret = dst_context_create(key, mctx,
DNS_LOGCATEGORY_GENERAL, ISC_TRUE, 0, &ctx);
if (ret != ISC_R_SUCCESS) {
printf("contextcreate(%u) returned: %s\n", dst_key_alg(key),
isc_result_totext(ret));
......@@ -73,8 +73,8 @@ use(dst_key_t *key, isc_mem_t *mctx) {
isc_buffer_forward(&sigbuf, 1);
isc_buffer_remainingregion(&sigbuf, &sigreg);
ret = dst_context_create3(key, mctx,
DNS_LOGCATEGORY_GENERAL, ISC_FALSE, &ctx);
ret = dst_context_create(key, mctx,
DNS_LOGCATEGORY_GENERAL, ISC_FALSE, 0, &ctx);
if (ret != ISC_R_SUCCESS) {
printf("contextcreate(%u) returned: %s\n", dst_key_alg(key),
isc_result_totext(ret));
......@@ -214,7 +214,7 @@ generate(int alg, isc_mem_t *mctx) {
dst_key_t *key = NULL;
ret = dst_key_generate(dns_rootname, alg, 512, 0, 0, 0,
dns_rdataclass_in, mctx, &key);
dns_rdataclass_in, mctx, &key, NULL);
printf("generate(%d) returned: %s\n", alg, isc_result_totext(ret));
if (ret != ISC_R_SUCCESS)
return;
......@@ -254,7 +254,8 @@ main(void) {
result = isc_entropy_createfilesource(ectx, "randomfile");
if (result != ISC_R_SUCCESS)
return (1);
dst_lib_init(mctx, ectx, ISC_ENTROPY_BLOCKING|ISC_ENTROPY_GOODONLY);
dst_lib_init(mctx, ectx, NULL,
ISC_ENTROPY_BLOCKING|ISC_ENTROPY_GOODONLY);
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
......
......@@ -475,7 +475,7 @@ main(int argc, char *argv[]) {
RUNCHECK(isc_entropy_create(mctx, &ectx));
RUNCHECK(isc_entropy_createfilesource(ectx, "/dev/urandom"));
RUNCHECK(dst_lib_init(mctx, ectx, ISC_ENTROPY_GOODONLY));
RUNCHECK(dst_lib_init(mctx, ectx, NULL, ISC_ENTROPY_GOODONLY));
taskmgr = NULL;
RUNCHECK(isc_taskmgr_create(mctx, 1, 0, &taskmgr));
......
......@@ -225,7 +225,7 @@ main(int argc, char *argv[]) {
}
RUNTIME_CHECK(isc_entropy_create(mctx, &ent) == ISC_R_SUCCESS);
RUNTIME_CHECK(dst_lib_init(mctx, ent, 0) == ISC_R_SUCCESS);
RUNTIME_CHECK(dst_lib_init(mctx, ent, NULL, 0) == ISC_R_SUCCESS);
dns_result_register();
dst_result_register();
......
......@@ -286,7 +286,7 @@ main(int argc, char *argv[]) {
if (randomfile != NULL)
RUNCHECK(isc_entropy_createfilesource(ectx, randomfile));
RUNCHECK(dst_lib_init(mctx, ectx, ISC_ENTROPY_GOODONLY));
RUNCHECK(dst_lib_init(mctx, ectx, NULL, ISC_ENTROPY_GOODONLY));
taskmgr = NULL;
RUNCHECK(isc_taskmgr_create(mctx, 1, 0, &taskmgr));
......
......@@ -192,7 +192,7 @@ main(int argc, char **argv) {
"../random.data",
ISC_ENTROPY_KEYBOARDNO),
"isc_entropy_usebestsource(\"../random.data\")");
CHECK(dst_lib_init2(mctx, ectx, NULL, 0), "dst_lib_init2()");
CHECK(dst_lib_init(mctx, ectx, NULL, 0), "dst_lib_init()");
CHECK(isc_log_create(mctx, &log_, &logconfig), "isc_log_create()");
isc_log_setcontext(log_);
dns_log_init(log_);
......
......@@ -264,7 +264,7 @@ main(int argc, char *argv[]) {
logconfig = NULL;
RUNCHECK(isc_log_create(mctx, &log, &logconfig));
RUNCHECK(dst_lib_init(mctx, ectx, ISC_ENTROPY_GOODONLY));
RUNCHECK(dst_lib_init(mctx, ectx, NULL, ISC_ENTROPY_GOODONLY));
taskmgr = NULL;
RUNCHECK(isc_taskmgr_create(mctx, 1, 0, &taskmgr));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment