summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/cmdline/popt_common.c21
-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
9 files changed, 34 insertions, 23 deletions
diff --git a/source4/lib/cmdline/popt_common.c b/source4/lib/cmdline/popt_common.c
index 41eb70094e..1c96bf64cf 100644
--- a/source4/lib/cmdline/popt_common.c
+++ b/source4/lib/cmdline/popt_common.c
@@ -47,6 +47,7 @@ static void popt_common_callback(poptContext con,
const char *arg, const void *data)
{
const char *pname;
+ struct loadparm_context *lp_ctx = global_loadparm; /* FIXME: allow overriding */
if (reason == POPT_CALLBACK_REASON_POST) {
if (!lp_loaded()) {
@@ -81,7 +82,7 @@ static void popt_common_callback(poptContext con,
switch(opt->val) {
case 'd':
- lp_set_cmdline(global_loadparm, "log level", arg);
+ lp_set_cmdline(lp_ctx, "log level", arg);
break;
case OPT_DEBUG_STDERR:
@@ -94,7 +95,7 @@ static void popt_common_callback(poptContext con,
case 'O':
if (arg) {
- lp_set_cmdline(global_loadparm, "socket options", arg);
+ lp_set_cmdline(lp_ctx, "socket options", arg);
}
break;
@@ -107,37 +108,37 @@ static void popt_common_callback(poptContext con,
case 'l':
if (arg) {
char *new_logfile = talloc_asprintf(NULL, "%s/log.%s", arg, pname);
- lp_set_cmdline(global_loadparm, "log file", new_logfile);
+ lp_set_cmdline(lp_ctx, "log file", new_logfile);
talloc_free(new_logfile);
}
break;
case 'W':
- lp_set_cmdline(global_loadparm, "workgroup", arg);
+ lp_set_cmdline(lp_ctx, "workgroup", arg);
break;
case 'r':
- lp_set_cmdline(global_loadparm, "realm", arg);
+ lp_set_cmdline(lp_ctx, "realm", arg);
break;
case 'n':
- lp_set_cmdline(global_loadparm, "netbios name", arg);
+ lp_set_cmdline(lp_ctx, "netbios name", arg);
break;
case 'i':
- lp_set_cmdline(global_loadparm, "netbios scope", arg);
+ lp_set_cmdline(lp_ctx, "netbios scope", arg);
break;
case 'm':
- lp_set_cmdline(global_loadparm, "client max protocol", arg);
+ lp_set_cmdline(lp_ctx, "client max protocol", arg);
break;
case 'R':
- lp_set_cmdline(global_loadparm, "name resolve order", arg);
+ lp_set_cmdline(lp_ctx, "name resolve order", arg);
break;
case OPT_OPTION:
- if (!lp_set_option(global_loadparm, arg)) {
+ if (!lp_set_option(lp_ctx, arg)) {
fprintf(stderr, "Error setting option '%s'\n", arg);
exit(1);
}
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)