summaryrefslogtreecommitdiff
path: root/source3/libnet
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libnet')
-rw-r--r--source3/libnet/libnet_conf.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c
index 86ef3e5517..665261723b 100644
--- a/source3/libnet/libnet_conf.c
+++ b/source3/libnet/libnet_conf.c
@@ -21,6 +21,11 @@
#include "includes.h"
#include "libnet/libnet.h"
+/*
+ * yuck - static variable to keep track of the registry initialization.
+ */
+static bool registry_initialized = false;
+
/**********************************************************************
*
* Helper functions (mostly registry related)
@@ -54,6 +59,26 @@ static WERROR libnet_conf_add_string_to_array(TALLOC_CTX *mem_ctx,
return WERR_OK;
}
+static WERROR libnet_conf_reg_initialize(void)
+{
+ WERROR werr = WERR_OK;
+
+ if (registry_initialized) {
+ goto done;
+ }
+
+ if (!registry_init_regdb()) {
+ /* proper error code? */
+ werr = WERR_GENERAL_FAILURE;
+ goto done;
+ }
+
+ registry_initialized = true;
+
+done:
+ return werr;
+}
+
/**
* Open a registry key specified by "path"
*/
@@ -78,6 +103,13 @@ static WERROR libnet_conf_reg_open_path(TALLOC_CTX *mem_ctx,
goto done;
}
+ werr = libnet_conf_reg_initialize();
+ if (!W_ERROR_IS_OK(werr)) {
+ DEBUG(1, ("Error initializing registry: %s\n",
+ dos_errstr(werr)));
+ goto done;
+ }
+
token = registry_create_admin_token(tmp_ctx);
if (token == NULL) {
DEBUG(1, ("Error creating admin token\n"));