mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-09 03:42:06 -04:00
create and destroy entropy and hash
This commit is contained in:
parent
c9b4dafc92
commit
e6bddc301c
1 changed files with 19 additions and 6 deletions
|
|
@ -20,6 +20,8 @@
|
|||
#include <getopt.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/entropy.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/result.h>
|
||||
|
|
@ -106,7 +108,8 @@ debug = 1;
|
|||
int
|
||||
main (int *argc, char **argv)
|
||||
{
|
||||
isc_mem_t *isc_ctx = NULL;
|
||||
isc_mem_t *mctx = NULL;
|
||||
isc_entropy_t *ectx = NULL;
|
||||
isc_result_t result;
|
||||
char *basedn;
|
||||
ldap_info *tmp;
|
||||
|
|
@ -185,9 +188,15 @@ main (int *argc, char **argv)
|
|||
if (debug)
|
||||
printf ("Initializing ISC Routines, parsing zone file\n");
|
||||
|
||||
result = isc_mem_create (0, 0, &isc_ctx);
|
||||
result = isc_mem_create (0, 0, &mctx);
|
||||
isc_result_check (result, "isc_mem_create");
|
||||
|
||||
result = isc_entropy_create(mctx, &ectx);
|
||||
isc_result_check (result, "isc_entropy_create");
|
||||
|
||||
result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE);
|
||||
isc_result_check (result, "isc_hash_create");
|
||||
|
||||
isc_buffer_init (&buff, argzone, strlen (argzone));
|
||||
isc_buffer_add (&buff, strlen (argzone));
|
||||
dns_fixedname_init (&fixedzone);
|
||||
|
|
@ -195,9 +204,8 @@ main (int *argc, char **argv)
|
|||
result = dns_name_fromtext (zone, &buff, dns_rootname, ISC_FALSE, NULL);
|
||||
isc_result_check (result, "dns_name_fromtext");
|
||||
|
||||
result =
|
||||
dns_db_create (isc_ctx, "rbt", zone, dns_dbtype_zone, dns_rdataclass_in,
|
||||
0, NULL, &db);
|
||||
result = dns_db_create (mctx, "rbt", zone, dns_dbtype_zone,
|
||||
dns_rdataclass_in, 0, NULL, &db);
|
||||
isc_result_check (result, "dns_db_create");
|
||||
|
||||
result = dns_db_load (db, zonefile);
|
||||
|
|
@ -313,9 +321,14 @@ main (int *argc, char **argv)
|
|||
add_ldap_values (tmp);
|
||||
}
|
||||
|
||||
if (debug)
|
||||
if (debug)
|
||||
printf("Operation Complete.\n");
|
||||
|
||||
/* Cleanup */
|
||||
isc_hash_destroy();
|
||||
isc_entropy_detach(&ectx);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue