* 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();
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));
}
}
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);
}
extern char *optarg;
extern int optind;
char *p;
+ struct loadparm_context *lp_ctx;
DEBUGLEVEL = 1;
}
if (getenv("PASSWD")) {
- pstrcpy(password,getenv("PASSWD"));
+ pstrcpy(password, getenv("PASSWD"));
got_pass = true;
}
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());
}
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)) {
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
{
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 */
case 's':
if (arg) {
- lp_load(arg);
+ lp_load(arg, NULL);
}
break;
_PUBLIC_ _DEPRECATED_ bool lp_load_default(void)
{
- return lp_load(dyn_CONFIGFILE);
+ return lp_load(dyn_CONFIGFILE, NULL);
}
/***************************************************************************
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;
close_iconv();
+ if (ret_lp != NULL)
+ *ret_lp = lp_ctx;
+
return bRetval;
}
*/
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();
}
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);
int opt;
int i, username_count=0;
bool ret;
+ struct loadparm_context *lp_ctx;
setlinebuf(stdout);
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;
}
}
- gensec_init(global_loadparm);
+ gensec_init(lp_ctx);
if (username_count == 0) {
usage();
int opt;
int seed, server;
int username_count=0;
+ struct loadparm_context *lp_ctx;
setlinebuf(stdout);
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);
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();
servers[1] = servers[0];
}
- gensec_init(global_loadparm);
+ gensec_init(lp_ctx);
argc -= optind;
argv += optind;
int opt;
char *p;
int seed;
+ struct loadparm_context *lp_ctx;
setlinebuf(stdout);
argc -= 4;
argv += 4;
- lp_load(dyn_CONFIGFILE);
+ lp_load(dyn_CONFIGFILE, &lp_ctx);
if (getenv("USER")) {
fstrcpy(username,getenv("USER"));
struct smbcli_state *cli;
int opt;
int seed;
+ struct loadparm_context *lp_ctx;
setlinebuf(stdout);
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);
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);
}
}
- gensec_init(global_loadparm);
+ gensec_init(lp_ctx);
argc -= optind;
argv += optind;
static const char *cname;
static const char *caddr;
static bool show_defaults = false;
+ struct loadparm_context *lp_ctx;
struct poptOption long_options[] = {
POPT_AUTOHELP
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);
}