#include "lib/cmdline/popt_common.h"
#include "lib/socket/socket.h"
#include "param/param.h"
+#include "param/loadparm.h"
/***********************************************
for (s=0;s<lp_numservices(lp_ctx);s++) {
struct loadparm_service *service = lp_servicebynum(lp_ctx, s);
if (service != NULL) {
- const char **deny_list = lp_hostsdeny(service);
- const char **allow_list = lp_hostsallow(service);
+ const char **deny_list = lp_hostsdeny(service, lp_default_service(lp_ctx));
+ const char **allow_list = lp_hostsallow(service, lp_default_service(lp_ctx));
int i;
if(deny_list) {
for (i=0; deny_list[i]; i++) {
fflush(stdout);
getc(stdin);
}
- if (section_name || parameter_name) {
+ if (section_name != NULL || parameter_name != NULL) {
struct loadparm_service *service = NULL;
if (!section_name) {
section_name = GLOBAL_NAME;
return(1);
}
if (!parameter_name) {
- lp_dump_one(stdout, show_defaults, service);
+ lp_dump_one(stdout, show_defaults, service, lp_default_service(lp_ctx));
} else {
- ret = !lp_dump_a_parameter(lp_ctx, s, parameter_name, stdout, (service == NULL));
+ ret = !lp_dump_a_parameter(lp_ctx, service, parameter_name, stdout);
}
} else {
lp_dump(lp_ctx, stdout, show_defaults, lp_numservices(lp_ctx));
for (s=0;s<lp_numservices(lp_ctx);s++) {
struct loadparm_service *service = lp_servicebynum(lp_ctx, s);
if (service != NULL) {
- if (allow_access(NULL, lp_hostsdeny(NULL), lp_hostsallow(NULL), cname, caddr)
- && allow_access(NULL, lp_hostsdeny(service), lp_hostsallow(service), cname, caddr)) {
+ if (allow_access(NULL, lp_hostsdeny(NULL, lp_default_service(lp_ctx)), lp_hostsallow(NULL, lp_default_service(lp_ctx)), cname, caddr)
+ && allow_access(NULL, lp_hostsdeny(service, lp_default_service(lp_ctx)), lp_hostsallow(service, lp_default_service(lp_ctx)), cname, caddr)) {
fprintf(stderr,"Allow connection from %s (%s) to %s\n",
cname,caddr,lp_servicename(service));
} else {
static const char *cname;
static const char *caddr;
static bool show_defaults = false;
+ struct loadparm_context *lp_ctx;
struct poptOption long_options[] = {
POPT_AUTOHELP
set_local_machine_name(new_local_machine, True);
}
*/
+
+ lp_ctx = cmdline_lp_ctx;
/* We need this to force the output */
- lp_set_cmdline(global_loadparm, "log level", "2");
+ lp_set_cmdline(lp_ctx, "log level", "2");
- fprintf(stderr, "Loaded smb config files from %s\n", lp_configfile(global_loadparm));
+ fprintf(stderr, "Loaded smb config files from %s\n", lp_configfile(lp_ctx));
- if (!lp_load(lp_configfile(global_loadparm))) {
+ if (!lp_load(lp_ctx, lp_configfile(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);
}