omapi_test has failed to work since the dst API change because it required

dst_lib_init to be called before any of the dst functions are used.  The
missing calls for dst_lib_init() and dst_lib_destroy() have been added to
the application here, rather than to omapi_lib_init(), to be consistent with
the rest of our applications.

Not sure that this warrants a CHANGES entry since it is just a test program.
Then again, it is probably worth mentioning that programs using OMAPI will
need to ensure they call dst_lib_init() before they call
omapi_listener_listen().  Unfortunately omapi_lib_init() can't require
dst having been initialized as part of its contract because it can't
figure out whether that's true or not.
This commit is contained in:
David Lawrence
2000-06-28 03:37:47 +00:00
parent 57584184fe
commit e0720bd847

View File

@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: omapi_test.c,v 1.23 2000/06/28 00:25:10 neild Exp $ */
/* $Id: omapi_test.c,v 1.24 2000/06/28 03:37:47 tale Exp $ */
/*
* Test code for OMAPI.
@@ -26,12 +26,14 @@
#include <isc/commandline.h>
#include <isc/condition.h>
#include <isc/entropy.h>
#include <isc/mem.h>
#include <isc/socket.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dst/dst.h>
#include <dst/result.h>
#include <omapi/omapi.h>
@@ -620,6 +622,7 @@ main(int argc, char **argv) {
isc_boolean_t show_final_mem = ISC_FALSE;
isc_socketmgr_t *socketmgr = NULL;
isc_taskmgr_t *taskmgr = NULL;
isc_entropy_t *entropy = NULL;
int ch;
progname = strrchr(*argv, '/');
@@ -676,6 +679,13 @@ main(int argc, char **argv) {
RUNTIME_CHECK(isc_mutex_init(&mutex) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_condition_init(&waiter) == ISC_R_SUCCESS);
/*
* Initialize the signature library.
*/
RUNTIME_CHECK(isc_entropy_create(mctx, &entropy) == ISC_R_SUCCESS);
RUNTIME_CHECK(dst_lib_init(mctx, entropy, ISC_ENTROPY_BLOCKING)
== ISC_R_SUCCESS);
/*
* The secret key is shared on both the client and server side.
*/
@@ -711,6 +721,9 @@ main(int argc, char **argv) {
isc_socketmgr_destroy(&socketmgr);
isc_taskmgr_destroy(&taskmgr);
dst_lib_destroy();
isc_entropy_detach(&entropy);
if (show_final_mem)
isc_mem_stats(mctx, stderr);