]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
create and destroy entropy and hash
authorMark Andrews <marka@isc.org>
Thu, 11 Aug 2005 23:32:32 +0000 (23:32 +0000)
committerMark Andrews <marka@isc.org>
Thu, 11 Aug 2005 23:32:32 +0000 (23:32 +0000)
contrib/sdb/ldap/zone2ldap.c

index badc06ce2e0eacd81828b8b1883159f34c45e0eb..90028b6d55f6da14a27da450c01b90fb1ab33c5e 100644 (file)
@@ -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;
 }