summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source4/client/smbmount.c12
-rw-r--r--source4/client/smbspool.c5
-rw-r--r--source4/lib/cmdline/popt_common.c6
-rw-r--r--source4/param/loadparm.c10
-rw-r--r--source4/scripting/ejs/smbcalls_config.c4
-rw-r--r--source4/scripting/ejs/smbscript.c7
-rw-r--r--source4/torture/gentest.c9
-rw-r--r--source4/torture/locktest.c13
-rw-r--r--source4/torture/locktest2.c3
-rw-r--r--source4/torture/masktest.c9
-rw-r--r--source4/utils/testparm.c7
11 files changed, 51 insertions, 34 deletions
diff --git a/source4/client/smbmount.c b/source4/client/smbmount.c
index db16c6cf1f..907405535e 100644
--- a/source4/client/smbmount.c
+++ b/source4/client/smbmount.c
@@ -323,7 +323,8 @@ static void smb_umount(const char *mount_point)
* not exit after open_sockets() or send_login() errors,
* as the smbfs mount would then have no way to recover.
*/
-static void send_fs_socket(const char *the_service, const char *mount_point, struct smbcli_state *c)
+static void send_fs_socket(struct loadparm_context *lp_ctx,
+ const char *the_service, const char *mount_point, struct smbcli_state *c)
{
int fd, closed = 0, res = 1;
pid_t parentpid = getppid();
@@ -407,7 +408,7 @@ static void send_fs_socket(const char *the_service, const char *mount_point, str
pause();
DEBUG(2,("mount.smbfs[%d]: got signal, getting new socket\n", sys_getpid()));
c = do_connection(the_service,
- lp_unicode(global_loadparm),
+ lp_unicode(lp_ctx),
lp_cli_maxprotocol(global_loadparm));
}
}
@@ -529,7 +530,7 @@ static void init_mount(void)
for any reason, we will have to unmount the mount point. There
is no exit from the next call...
*/
- send_fs_socket(service, mount_point, c);
+ send_fs_socket(global_loadparm, service, mount_point, c);
}
@@ -852,6 +853,7 @@ static void parse_mount_smb(int argc, char **argv)
extern char *optarg;
extern int optind;
char *p;
+ struct loadparm_context *lp_ctx;
DEBUGLEVEL = 1;
@@ -882,7 +884,7 @@ static void parse_mount_smb(int argc, char **argv)
}
if (getenv("PASSWD")) {
- pstrcpy(password,getenv("PASSWD"));
+ pstrcpy(password, getenv("PASSWD"));
got_pass = true;
}
@@ -895,7 +897,7 @@ static void parse_mount_smb(int argc, char **argv)
pstrcpy(username,getenv("LOGNAME"));
}
- if (!lp_load(dyn_CONFIGFILE)) {
+ if (!lp_load(dyn_CONFIGFILE, &lp_ctx)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n",
lp_config_file());
}
diff --git a/source4/client/smbspool.c b/source4/client/smbspool.c
index 7270942037..6a7454b6b2 100644
--- a/source4/client/smbspool.c
+++ b/source4/client/smbspool.c
@@ -50,6 +50,7 @@ static int smb_print(struct smbcli_state *, char *, FILE *);
FILE *fp; /* File to print */
int status=0; /* Status of LPD job */
struct smbcli_state *cli; /* SMB interface */
+ struct loadparm_context *lp_ctx;
/* we expect the URI in argv[0]. Detect the case where it is in argv[1] and cope */
if (argc > 2 && strncmp(argv[0],"smb://", 6) && !strncmp(argv[1],"smb://", 6)) {
@@ -176,13 +177,13 @@ static int smb_print(struct smbcli_state *, char *, FILE *);
setup_logging(argv[0], DEBUG_STDOUT);
- if (!lp_load(dyn_CONFIGFILE)) {
+ if (!lp_load(dyn_CONFIGFILE, &lp_ctx)) {
fprintf(stderr, "ERROR: Can't load %s - run testparm to debug it\n", lp_config_file());
return (1);
}
if (workgroup == NULL)
- workgroup = lp_workgroup();
+ workgroup = lp_workgroup(lp_ctx);
do
{
diff --git a/source4/lib/cmdline/popt_common.c b/source4/lib/cmdline/popt_common.c
index 1c96bf64cf..1eeb611256 100644
--- a/source4/lib/cmdline/popt_common.c
+++ b/source4/lib/cmdline/popt_common.c
@@ -52,9 +52,9 @@ static void popt_common_callback(poptContext con,
if (reason == POPT_CALLBACK_REASON_POST) {
if (!lp_loaded()) {
if (getenv("SMB_CONF_PATH"))
- lp_load(getenv("SMB_CONF_PATH"));
+ lp_load(getenv("SMB_CONF_PATH"), NULL);
else
- lp_load(dyn_CONFIGFILE);
+ lp_load(dyn_CONFIGFILE, NULL);
}
/* Hook any 'every Samba program must do this, after
* the smb.conf is setup' functions here */
@@ -101,7 +101,7 @@ static void popt_common_callback(poptContext con,
case 's':
if (arg) {
- lp_load(arg);
+ lp_load(arg, NULL);
}
break;
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index be5464c8e6..9065a48113 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -2407,7 +2407,7 @@ bool loadparm_init(struct loadparm_context *lp_ctx)
_PUBLIC_ _DEPRECATED_ bool lp_load_default(void)
{
- return lp_load(dyn_CONFIGFILE);
+ return lp_load(dyn_CONFIGFILE, NULL);
}
/***************************************************************************
@@ -2415,13 +2415,16 @@ _PUBLIC_ _DEPRECATED_ bool lp_load_default(void)
False on failure.
***************************************************************************/
-bool lp_load(const char *filename)
+bool lp_load(const char *filename, struct loadparm_context **ret_lp)
{
char *n2;
bool bRetval;
struct param_opt *data;
struct loadparm_context *lp_ctx = &loadparm;
+ if (ret_lp != NULL)
+ *ret_lp = NULL;
+
filename = talloc_strdup(talloc_autofree_context(), filename);
global_loadparm = lp_ctx;
@@ -2470,6 +2473,9 @@ bool lp_load(const char *filename)
close_iconv();
+ if (ret_lp != NULL)
+ *ret_lp = lp_ctx;
+
return bRetval;
}
diff --git a/source4/scripting/ejs/smbcalls_config.c b/source4/scripting/ejs/smbcalls_config.c
index 1c76757659..122d78ac20 100644
--- a/source4/scripting/ejs/smbcalls_config.c
+++ b/source4/scripting/ejs/smbcalls_config.c
@@ -187,7 +187,9 @@ static int ejs_lpSet(MprVarHandle eid, int argc, char **argv)
*/
static int ejs_lpReload(MprVarHandle eid, int argc, char **argv)
{
- bool ret = lp_load(lp_configfile(global_loadparm));
+ bool ret;
+
+ ret = lp_load(lp_configfile(global_loadparm), NULL);
if (ret) {
unload_interfaces();
}
diff --git a/source4/scripting/ejs/smbscript.c b/source4/scripting/ejs/smbscript.c
index db6e0eeb10..2bb67135ea 100644
--- a/source4/scripting/ejs/smbscript.c
+++ b/source4/scripting/ejs/smbscript.c
@@ -49,18 +49,19 @@ int main(int argc, const char **argv)
const char *fname;
struct MprVar *return_var;
int exit_status, i;
+ struct loadparm_context *lp_ctx;
fault_setup(argv[0]);
if (getenv("SMB_CONF_PATH")) {
- lp_load(getenv("SMB_CONF_PATH"));
+ lp_load(getenv("SMB_CONF_PATH"), &lp_ctx);
} else {
- lp_load(dyn_CONFIGFILE);
+ lp_load(dyn_CONFIGFILE, &lp_ctx);
}
ldb_global_init();
- gensec_init(global_loadparm);
+ gensec_init(lp_ctx);
mprSetCtx(mem_ctx);
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index fa352a3e9e..edc1b0754a 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -2172,6 +2172,7 @@ static bool split_unc_name(const char *unc, char **server, char **share)
int opt;
int i, username_count=0;
bool ret;
+ struct loadparm_context *lp_ctx;
setlinebuf(stdout);
@@ -2196,12 +2197,12 @@ static bool split_unc_name(const char *unc, char **server, char **share)
argc -= NSERVERS;
argv += NSERVERS;
- lp_load(dyn_CONFIGFILE);
+ lp_load(dyn_CONFIGFILE, &lp_ctx);
servers[0].credentials = cli_credentials_init(talloc_autofree_context());
servers[1].credentials = cli_credentials_init(talloc_autofree_context());
- cli_credentials_guess(servers[0].credentials, global_loadparm);
- cli_credentials_guess(servers[1].credentials, global_loadparm);
+ cli_credentials_guess(servers[0].credentials, lp_ctx);
+ cli_credentials_guess(servers[1].credentials, lp_ctx);
options.seed = time(NULL);
options.numops = 1000;
@@ -2265,7 +2266,7 @@ static bool split_unc_name(const char *unc, char **server, char **share)
}
}
- gensec_init(global_loadparm);
+ gensec_init(lp_ctx);
if (username_count == 0) {
usage();
diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c
index 381abaebc6..2aa074c6c3 100644
--- a/source4/torture/locktest.c
+++ b/source4/torture/locktest.c
@@ -543,6 +543,7 @@ static void usage(void)
int opt;
int seed, server;
int username_count=0;
+ struct loadparm_context *lp_ctx;
setlinebuf(stdout);
@@ -563,12 +564,12 @@ static void usage(void)
argc -= NSERVERS;
argv += NSERVERS;
- lp_load(dyn_CONFIGFILE);
+ lp_load(dyn_CONFIGFILE, &lp_ctx);
servers[0] = cli_credentials_init(talloc_autofree_context());
servers[1] = cli_credentials_init(talloc_autofree_context());
- cli_credentials_guess(servers[0], global_loadparm);
- cli_credentials_guess(servers[1], global_loadparm);
+ cli_credentials_guess(servers[0], lp_ctx);
+ cli_credentials_guess(servers[1], lp_ctx);
seed = time(NULL);
@@ -617,10 +618,10 @@ static void usage(void)
exact_error_codes = true;
break;
case 'l':
- lp_set_cmdline(global_loadparm, "torture:unclist", optarg);
+ lp_set_cmdline(lp_ctx, "torture:unclist", optarg);
break;
case 'W':
- lp_set_cmdline(global_loadparm, "workgroup", optarg);
+ lp_set_cmdline(lp_ctx, "workgroup", optarg);
break;
case 'h':
usage();
@@ -639,7 +640,7 @@ static void usage(void)
servers[1] = servers[0];
}
- gensec_init(global_loadparm);
+ gensec_init(lp_ctx);
argc -= optind;
argv += optind;
diff --git a/source4/torture/locktest2.c b/source4/torture/locktest2.c
index 55edd4aa17..1798e485ea 100644
--- a/source4/torture/locktest2.c
+++ b/source4/torture/locktest2.c
@@ -460,6 +460,7 @@ static void usage(void)
int opt;
char *p;
int seed;
+ struct loadparm_context *lp_ctx;
setlinebuf(stdout);
@@ -483,7 +484,7 @@ static void usage(void)
argc -= 4;
argv += 4;
- lp_load(dyn_CONFIGFILE);
+ lp_load(dyn_CONFIGFILE, &lp_ctx);
if (getenv("USER")) {
fstrcpy(username,getenv("USER"));
diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index 2b3c92db0c..2455361e10 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -281,6 +281,7 @@ static void usage(void)
struct smbcli_state *cli;
int opt;
int seed;
+ struct loadparm_context *lp_ctx;
setlinebuf(stdout);
@@ -302,10 +303,10 @@ static void usage(void)
argc -= 1;
argv += 1;
- lp_load(dyn_CONFIGFILE);
+ lp_load(dyn_CONFIGFILE, &lp_ctx);
credentials = cli_credentials_init(talloc_autofree_context());
- cli_credentials_guess(credentials, global_loadparm);
+ cli_credentials_guess(credentials, lp_ctx);
seed = time(NULL);
@@ -326,7 +327,7 @@ static void usage(void)
verbose++;
break;
case 'M':
- lp_set_cmdline(global_loadparm, "max protocol", optarg);
+ lp_set_cmdline(lp_ctx, "max protocol", optarg);
break;
case 'U':
cli_credentials_parse_string(credentials, optarg, CRED_SPECIFIED);
@@ -358,7 +359,7 @@ static void usage(void)
}
}
- gensec_init(global_loadparm);
+ gensec_init(lp_ctx);
argc -= optind;
argv += optind;
diff --git a/source4/utils/testparm.c b/source4/utils/testparm.c
index 665c649e73..b9e6bc0595 100644
--- a/source4/utils/testparm.c
+++ b/source4/utils/testparm.c
@@ -184,6 +184,7 @@ static int do_share_checks(struct loadparm_context *lp_ctx, const char *cname, c
static const char *cname;
static const char *caddr;
static bool show_defaults = false;
+ struct loadparm_context *lp_ctx;
struct poptOption long_options[] = {
POPT_AUTOHELP
@@ -238,15 +239,15 @@ static int do_share_checks(struct loadparm_context *lp_ctx, const char *cname, c
fprintf(stderr, "Loaded smb config files from %s\n", lp_configfile(global_loadparm));
- if (!lp_load(lp_configfile(global_loadparm))) {
+ if (!lp_load(lp_configfile(global_loadparm), &lp_ctx)) {
fprintf(stderr,"Error loading services.\n");
return(1);
}
fprintf(stderr,"Loaded services file OK.\n");
- ret = do_global_checks(global_loadparm);
- ret |= do_share_checks(global_loadparm, cname, caddr, silent_mode, show_defaults, section_name, parameter_name);
+ ret = do_global_checks(lp_ctx);
+ ret |= do_share_checks(lp_ctx, cname, caddr, silent_mode, show_defaults, section_name, parameter_name);
return(ret);
}