summaryrefslogtreecommitdiff
path: root/source4/lib/registry
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-02 22:32:11 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:47:15 +0100
commit6c999cd12344f2bb8b1d2941210b4c205b3e0aad (patch)
tree0911e4ca75694e080173c2863e2c41ff5881309c /source4/lib/registry
parent934e932387ea5668ec000bcefe4ec86935297339 (diff)
downloadsamba-6c999cd12344f2bb8b1d2941210b4c205b3e0aad.tar.gz
samba-6c999cd12344f2bb8b1d2941210b4c205b3e0aad.tar.bz2
samba-6c999cd12344f2bb8b1d2941210b4c205b3e0aad.zip
r26236: Remove more uses of global_loadparm or specify loadparm_context explicitly.
(This used to be commit 5b29ef7c03d9ae76b0ca909e9f03a58e1bad3521)
Diffstat (limited to 'source4/lib/registry')
-rw-r--r--source4/lib/registry/registry.h2
-rw-r--r--source4/lib/registry/registry.i1
-rw-r--r--source4/lib/registry/samba.c12
-rw-r--r--source4/lib/registry/tools/common.c4
-rw-r--r--source4/lib/registry/tools/regdiff.c8
-rw-r--r--source4/lib/registry/tools/regpatch.c3
-rw-r--r--source4/lib/registry/tools/regshell.c3
-rw-r--r--source4/lib/registry/tools/regtree.c3
8 files changed, 23 insertions, 13 deletions
diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h
index c1159dde2e..c53e3dfbe5 100644
--- a/source4/lib/registry/registry.h
+++ b/source4/lib/registry/registry.h
@@ -164,6 +164,7 @@ struct registry_context {
struct auth_session_info;
struct event_context;
+struct loadparm_context;
/**
* Open the locally defined registry.
@@ -175,6 +176,7 @@ WERROR reg_open_local(TALLOC_CTX *mem_ctx,
WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
struct registry_context **ctx,
+ struct loadparm_context *lp_ctx,
struct auth_session_info *session_info,
struct cli_credentials *credentials);
diff --git a/source4/lib/registry/registry.i b/source4/lib/registry/registry.i
index 7e33f43a14..330f0856e1 100644
--- a/source4/lib/registry/registry.i
+++ b/source4/lib/registry/registry.i
@@ -135,6 +135,7 @@ typedef struct hive_key {
WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
struct registry_context **ctx,
+ struct loadparm_context *lp_ctx,
struct auth_session_info *session_info,
struct cli_credentials *credentials);
diff --git a/source4/lib/registry/samba.c b/source4/lib/registry/samba.c
index 2397432f0b..a5a60ba610 100644
--- a/source4/lib/registry/samba.c
+++ b/source4/lib/registry/samba.c
@@ -26,6 +26,7 @@
*/
static WERROR mount_samba_hive(struct registry_context *ctx,
+ struct loadparm_context *lp_ctx,
struct auth_session_info *auth_info,
struct cli_credentials *creds,
const char *name,
@@ -36,7 +37,7 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
const char *location;
location = talloc_asprintf(ctx, "%s/%s.ldb",
- lp_private_dir(global_loadparm),
+ lp_private_dir(lp_ctx),
name);
error = reg_open_hive(ctx, location, auth_info, creds, &hive);
@@ -54,6 +55,7 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
_PUBLIC_ WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
struct registry_context **ctx,
+ struct loadparm_context *lp_ctx,
struct auth_session_info *session_info,
struct cli_credentials *credentials)
{
@@ -64,18 +66,18 @@ _PUBLIC_ WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
return result;
}
- mount_samba_hive(*ctx, session_info, credentials,
+ mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
"hklm", HKEY_LOCAL_MACHINE);
- mount_samba_hive(*ctx, session_info, credentials,
+ mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
"hkcr", HKEY_CLASSES_ROOT);
/* FIXME: Should be mounted from NTUSER.DAT in the home directory of the
* current user */
- mount_samba_hive(*ctx, session_info, credentials,
+ mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
"hkcu", HKEY_CURRENT_USER);
- mount_samba_hive(*ctx, session_info, credentials,
+ mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
"hku", HKEY_USERS);
/* FIXME: Different hive backend for HKEY_CLASSES_ROOT: merged view of HKEY_LOCAL_MACHINE\Software\Classes
diff --git a/source4/lib/registry/tools/common.c b/source4/lib/registry/tools/common.c
index 0233f27437..6d766fd25c 100644
--- a/source4/lib/registry/tools/common.c
+++ b/source4/lib/registry/tools/common.c
@@ -65,12 +65,12 @@ struct registry_key *reg_common_open_file(const char *path,
return reg_import_hive_key(h, hive_root, -1, NULL);
}
-struct registry_context *reg_common_open_local(struct cli_credentials *creds)
+struct registry_context *reg_common_open_local(struct cli_credentials *creds, struct loadparm_context *lp_ctx)
{
WERROR error;
struct registry_context *h;
- error = reg_open_samba(NULL, &h, NULL, creds);
+ error = reg_open_samba(NULL, &h, lp_ctx, NULL, creds);
if(!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Unable to open local registry:%s \n",
diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c
index f96761cda0..1996861a2a 100644
--- a/source4/lib/registry/tools/regdiff.c
+++ b/source4/lib/registry/tools/regdiff.c
@@ -24,10 +24,12 @@
#include "lib/events/events.h"
#include "lib/cmdline/popt_common.h"
#include "lib/registry/tools/common.h"
+#include "param/param.h"
enum reg_backend { REG_UNKNOWN, REG_LOCAL, REG_REMOTE, REG_NULL };
static struct registry_context *open_backend(poptContext pc,
+ struct loadparm_context *lp_ctx,
enum reg_backend backend,
const char *remote_host)
{
@@ -39,7 +41,7 @@ static struct registry_context *open_backend(poptContext pc,
poptPrintUsage(pc, stderr, 0);
return NULL;
case REG_LOCAL:
- error = reg_open_samba(NULL, &ctx, NULL, cmdline_credentials);
+ error = reg_open_samba(NULL, &ctx, lp_ctx, NULL, cmdline_credentials);
break;
case REG_REMOTE:
error = reg_open_remote(&ctx, NULL, cmdline_credentials,
@@ -114,11 +116,11 @@ int main(int argc, const char **argv)
}
- h1 = open_backend(pc, backend1, remote1);
+ h1 = open_backend(pc, global_loadparm, backend1, remote1);
if (h1 == NULL)
return 1;
- h2 = open_backend(pc, backend2, remote2);
+ h2 = open_backend(pc, global_loadparm, backend2, remote2);
if (h2 == NULL)
return 1;
diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c
index 35f12c7e62..2f2cf789a9 100644
--- a/source4/lib/registry/tools/regpatch.c
+++ b/source4/lib/registry/tools/regpatch.c
@@ -24,6 +24,7 @@
#include "lib/cmdline/popt_common.h"
#include "lib/registry/tools/common.h"
#include "lib/registry/patchfile.h"
+#include "param/param.h"
int main(int argc, char **argv)
{
@@ -50,7 +51,7 @@ int main(int argc, char **argv)
if (remote) {
h = reg_common_open_remote (remote, cmdline_credentials);
} else {
- h = reg_common_open_local (cmdline_credentials);
+ h = reg_common_open_local (cmdline_credentials, global_loadparm);
}
if (h == NULL)
diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c
index 7dbcf2f875..9b582c3c02 100644
--- a/source4/lib/registry/tools/regshell.c
+++ b/source4/lib/registry/tools/regshell.c
@@ -26,6 +26,7 @@
#include "lib/smbreadline/smbreadline.h"
#include "librpc/gen_ndr/ndr_security.h"
#include "lib/registry/tools/common.h"
+#include "param/param.h"
struct regshell_context {
struct registry_context *registry;
@@ -505,7 +506,7 @@ int main(int argc, char **argv)
ctx->registry = ctx->current->context;
ctx->path = talloc_strdup(ctx, "");
} else {
- ctx->registry = reg_common_open_local(cmdline_credentials);
+ ctx->registry = reg_common_open_local(cmdline_credentials, global_loadparm);
}
if (ctx->registry == NULL)
diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c
index 9f8d8c012d..f95fc1968d 100644
--- a/source4/lib/registry/tools/regtree.c
+++ b/source4/lib/registry/tools/regtree.c
@@ -23,6 +23,7 @@
#include "lib/registry/tools/common.h"
#include "lib/events/events.h"
#include "lib/cmdline/popt_common.h"
+#include "param/param.h"
/**
* Print a registry key recursively
@@ -132,7 +133,7 @@ int main(int argc, char **argv)
} else if (file != NULL) {
start_key = reg_common_open_file(file, cmdline_credentials);
} else {
- h = reg_common_open_local(cmdline_credentials);
+ h = reg_common_open_local(cmdline_credentials, global_loadparm);
}
if (h == NULL && start_key == NULL)