}
}
- gensec_init(global_loadparm);
+ gensec_init(cmdline_lp_ctx);
dump_args();
if (check_arg_numeric("ibs") == 0 || check_arg_numeric("ibs") == 0) {
CatchSignal(SIGINT, dd_handle_signal);
CatchSignal(SIGUSR1, dd_handle_signal);
- return(copy_files(global_loadparm));
+ return(copy_files(cmdline_lp_ctx));
}
/* vim: set sw=8 sts=8 ts=8 tw=79 : */
}
}
- gensec_init(global_loadparm);
+ gensec_init(cmdline_lp_ctx);
if(poptPeekArg(pc)) {
char *s = strdup(poptGetArg(pc));
}
if (query_host) {
- return do_host_query(global_loadparm, query_host, lp_workgroup(global_loadparm));
+ return do_host_query(cmdline_lp_ctx, query_host, lp_workgroup(cmdline_lp_ctx));
}
if (message) {
- return do_message_op(lp_netbios_name(global_loadparm), desthost, dest_ip, name_type, lp_name_resolve_order(global_loadparm), lp_max_xmit(global_loadparm), lp_maxmux(global_loadparm));
+ return do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost, dest_ip, name_type, lp_name_resolve_order(cmdline_lp_ctx), lp_max_xmit(cmdline_lp_ctx), lp_maxmux(cmdline_lp_ctx));
}
pstrcpy(username,getenv("LOGNAME"));
}
- lp_ctx = global_loadparm = loadparm_init(talloc_autofree_context());
+ lp_ctx = loadparm_init(talloc_autofree_context());
if (!lp_load(lp_ctx, dyn_CONFIGFILE)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n",
setup_logging(argv[0], DEBUG_STDOUT);
- global_loadparm = lp_ctx = loadparm_init(talloc_autofree_context());
+ lp_ctx = loadparm_init(talloc_autofree_context());
if (!lp_load(lp_ctx, dyn_CONFIGFILE)) {
fprintf(stderr, "ERROR: Can't load %s - run testparm to debug it\n", lp_config_file());
#define POPT_COMMON_CREDENTIALS { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_credentials, 0, "Authentication options:", NULL },
extern struct cli_credentials *cmdline_credentials;
+extern struct loadparm_context *cmdline_lp_ctx;
#endif /* _POPT_COMMON_H */
}
module->private_data = ildb;
ildb->module = module;
- ildb->ldap = ldap4_new_connection(ildb, ldb_get_opaque(ldb, "EventContext"));
+ ildb->ldap = ldap4_new_connection(ildb, ldb_get_opaque(ldb, "loadparm"),
+ ldb_get_opaque(ldb, "EventContext"));
if (!ildb->ldap) {
ldb_oom(ldb);
goto failed;
goto failed;
}
} else {
- status = ldap_bind_sasl(ildb->ldap, creds, global_loadparm);
+ status = ldap_bind_sasl(ildb->ldap, creds, ldb_get_opaque(ldb, "loadparm"));
if (!NT_STATUS_IS_OK(status)) {
ldb_debug(ldb, LDB_DEBUG_ERROR, "Failed to bind - %s\n",
ldap_errstr(ildb->ldap, module, status));
#if (_SAMBA_BUILD_ >= 4)
/* Must be after we have processed command line options */
- gensec_init(global_loadparm);
+ gensec_init(cmdline_lp_ctx);
- if (ldb_set_opaque(ldb, "sessionInfo", system_session(ldb, global_loadparm))) {
+ if (ldb_set_opaque(ldb, "sessionInfo", system_session(ldb, cmdline_lp_ctx))) {
goto failed;
}
if (ldb_set_opaque(ldb, "credentials", cmdline_credentials)) {
goto failed;
}
- if (ldb_set_opaque(ldb, "loadparm", global_loadparm)) {
+ if (ldb_set_opaque(ldb, "loadparm", cmdline_lp_ctx)) {
goto failed;
}
}
- h1 = open_backend(pc, global_loadparm, backend1, remote1);
+ h1 = open_backend(pc, cmdline_lp_ctx, backend1, remote1);
if (h1 == NULL)
return 1;
- h2 = open_backend(pc, global_loadparm, backend2, remote2);
+ h2 = open_backend(pc, cmdline_lp_ctx, backend2, remote2);
if (h2 == NULL)
return 1;
}
if (remote) {
- h = reg_common_open_remote (remote, global_loadparm, cmdline_credentials);
+ h = reg_common_open_remote (remote, cmdline_lp_ctx, cmdline_credentials);
} else {
- h = reg_common_open_local (cmdline_credentials, global_loadparm);
+ h = reg_common_open_local (cmdline_credentials, cmdline_lp_ctx);
}
if (h == NULL)
ctx = talloc_zero(NULL, struct regshell_context);
if (remote != NULL) {
- ctx->registry = reg_common_open_remote(remote, global_loadparm,
+ ctx->registry = reg_common_open_remote(remote, cmdline_lp_ctx,
cmdline_credentials);
} else if (file != NULL) {
ctx->current = reg_common_open_file(file, cmdline_credentials);
ctx->registry = ctx->current->context;
ctx->path = talloc_strdup(ctx, "");
} else {
- ctx->registry = reg_common_open_local(cmdline_credentials, global_loadparm);
+ ctx->registry = reg_common_open_local(cmdline_credentials, cmdline_lp_ctx);
}
if (ctx->registry == NULL)
}
if (remote != NULL) {
- h = reg_common_open_remote(remote, global_loadparm, cmdline_credentials);
+ h = reg_common_open_remote(remote, cmdline_lp_ctx, cmdline_credentials);
} else if (file != NULL) {
start_key = reg_common_open_file(file, cmdline_credentials);
} else {
- h = reg_common_open_local(cmdline_credentials, global_loadparm);
+ h = reg_common_open_local(cmdline_credentials, cmdline_lp_ctx);
}
if (h == NULL && start_key == NULL)
switch (conn->bind.type) {
case LDAP_BIND_SASL:
status = ldap_bind_sasl(conn, (struct cli_credentials *)conn->bind.creds,
- global_loadparm);
+ conn->lp_ctx);
break;
case LDAP_BIND_SIMPLE:
#include "param/param.h"
-/*
+/**
create a new ldap_connection stucture. The event context is optional
*/
struct ldap_connection *ldap4_new_connection(TALLOC_CTX *mem_ctx,
- struct event_context *ev)
+ struct loadparm_context *lp_ctx,
+ struct event_context *ev)
{
struct ldap_connection *conn;
conn->next_messageid = 1;
conn->event.event_ctx = ev;
+ conn->lp_ctx = lp_ctx;
+
/* set a reasonable request timeout */
conn->timeout = 60;
}
ctx = socket_connect_send(conn->sock, NULL, unix_addr,
- 0, lp_name_resolve_order(global_loadparm), conn->event.event_ctx);
+ 0, lp_name_resolve_order(conn->lp_ctx), conn->event.event_ctx);
ctx->async.fn = ldap_connect_recv_unix_conn;
ctx->async.private_data = state;
return result;
}
ctx = socket_connect_multi_send(state, conn->host, 1, &conn->port,
- lp_name_resolve_order(global_loadparm), conn->event.event_ctx);
+ lp_name_resolve_order(conn->lp_ctx), conn->event.event_ctx);
if (ctx == NULL) goto failed;
ctx->async.fn = ldap_connect_recv_tcp_conn;
talloc_steal(conn, conn->sock);
if (conn->ldaps) {
struct socket_context *tls_socket;
- char *cafile = private_path(conn->sock, global_loadparm, lp_tls_cafile(global_loadparm));
+ char *cafile = private_path(conn->sock, conn->lp_ctx, lp_tls_cafile(conn->lp_ctx));
if (!cafile || !*cafile) {
talloc_free(conn->sock);
/* main context for a ldap client connection */
struct ldap_connection {
struct socket_context *sock;
+ struct loadparm_context *lp_ctx;
+
char *host;
uint16_t port;
bool ldaps;
return 0;
}
/* HACK: (this module should not call lp_ funtions) */
- return *lp_winbind_separator(global_loadparm);
+ return *lp_winbind_separator(cmdline_lp_ctx);
}
sep = response.data.info.winbind_separator;
return 0;
}
/* HACK: (this module should not call lp_ funtions) */
- sep = *lp_winbind_separator(global_loadparm);
+ sep = *lp_winbind_separator(cmdline_lp_ctx);
}
return sep;
d_fprintf(stderr, "could not obtain winbind domain name!\n");
/* HACK: (this module should not call lp_ funtions) */
- return lp_workgroup(global_loadparm);
+ return lp_workgroup(cmdline_lp_ctx);
}
fstrcpy(winbind_domain, response.data.domain_name);
got_error = true;
}
- if (!wbinfo_auth_crap(global_loadparm, string_arg)) {
+ if (!wbinfo_auth_crap(cmdline_lp_ctx, string_arg)) {
d_fprintf(stderr, "Could not authenticate user %s with "
"challenge/response\n", string_arg);
got_error = true;
need the messaging_ctx to allow for pending lock notifications.
*/
struct brl_context *brl_init(TALLOC_CTX *mem_ctx, struct server_id server,
+ struct loadparm_context *lp_ctx,
struct messaging_context *messaging_ctx)
{
if (ops == NULL) {
brl_tdb_init_ops();
}
- return ops->brl_init(mem_ctx, server, messaging_ctx);
+ return ops->brl_init(mem_ctx, server, lp_ctx, messaging_ctx);
}
struct brl_handle *brl_create_handle(TALLOC_CTX *mem_ctx, struct ntvfs_handle *ntvfs, DATA_BLOB *file_key)
struct brlock_ops {
struct brl_context *(*brl_init)(TALLOC_CTX *, struct server_id ,
+ struct loadparm_context *lp_ctx,
struct messaging_context *);
struct brl_handle *(*brl_create_handle)(TALLOC_CTX *, struct ntvfs_handle *, DATA_BLOB *);
NTSTATUS (*brl_lock)(struct brl_context *,
pending lock notifications.
*/
static struct brl_context *brl_tdb_init(TALLOC_CTX *mem_ctx, struct server_id server,
+ struct loadparm_context *lp_ctx,
struct messaging_context *messaging_ctx)
{
struct brl_context *brl;
return NULL;
}
- brl->db = db_tmp_open(brl, global_loadparm, "brlock.tdb", TDB_DEFAULT);
+ brl->db = db_tmp_open(brl, lp_ctx, "brlock.tdb", TDB_DEFAULT);
if (brl->db == NULL) {
talloc_free(brl);
return NULL;
struct ntvfs_context *ntvfs_ctx)
{
if (ops == NULL) {
- if (lp_parm_bool(global_loadparm, NULL, "ctdb", "opendb", false)) {
+ if (lp_parm_bool(ntvfs_ctx->lp_ctx, NULL, "ctdb", "opendb", false)) {
odb_ctdb_init_ops();
} else {
odb_tdb_init_ops();
return NT_STATUS_OK;
}
-NTSTATUS ntvfs_init(void)
+NTSTATUS ntvfs_init(struct loadparm_context *lp_ctx)
{
init_module_fn static_init[] = STATIC_ntvfs_MODULES;
- init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "ntvfs");
+ init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "ntvfs");
run_init_functions(static_init);
run_init_functions(shared_init);
pvfs->brl_context = brl_init(pvfs,
pvfs->ntvfs->ctx->server_id,
+ pvfs->ntvfs->ctx->lp_ctx,
pvfs->ntvfs->ctx->msg_ctx);
if (pvfs->brl_context == NULL) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
/*
initialise the SHARE subsystem
*/
-NTSTATUS share_init(struct loadparm_context *lp_ctx)
+NTSTATUS share_init(void)
{
init_module_fn static_init[] = STATIC_share_MODULES;
- init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "share");
run_init_functions(static_init);
- run_init_functions(shared_init);
-
- talloc_free(shared_init);
return NT_STATUS_OK;
}
{
struct loadparm_service *s = talloc_get_type(scfg->opaque,
struct loadparm_service);
+ struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data,
+ struct loadparm_context);
char *parm, *val;
const char *ret;
*val = '\0';
val++;
- ret = lp_parm_string(global_loadparm, s, parm, val);
+ ret = lp_parm_string(lp_ctx, s, parm, val);
if (!ret) {
ret = defval;
}
{
struct loadparm_service *s = talloc_get_type(scfg->opaque,
struct loadparm_service);
+ struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data,
+ struct loadparm_context);
char *parm, *val;
int ret;
*val = '\0';
val++;
- ret = lp_parm_int(global_loadparm, s, parm, val, defval);
+ ret = lp_parm_int(lp_ctx, s, parm, val, defval);
if (!ret) {
ret = defval;
}
{
struct loadparm_service *s = talloc_get_type(scfg->opaque,
struct loadparm_service);
+ struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data,
+ struct loadparm_context);
char *parm, *val;
bool ret;
*val = '\0';
val++;
- ret = lp_parm_bool(global_loadparm, s, parm, val, defval);
+ ret = lp_parm_bool(lp_ctx, s, parm, val, defval);
talloc_free(parm);
return ret;
}
{
struct loadparm_service *s = talloc_get_type(scfg->opaque,
struct loadparm_service);
+ struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data,
+ struct loadparm_context);
char *parm, *val;
const char **ret;
*val = '\0';
val++;
- ret = lp_parm_string_list(mem_ctx, global_loadparm, s, parm, val, ",;");
+ ret = lp_parm_string_list(mem_ctx, lp_ctx, s, parm, val, ",;");
talloc_free(parm);
return ret;
}
struct torture_suite *suite = torture_suite_create(mem_ctx, "SHARE");
struct torture_tcase *tcase;
- share_init(global_loadparm);
+ share_init();
tcase = torture_suite_add_tcase(suite, "ldb");
torture_tcase_set_fixture(tcase, setup_ldb, teardown);
req->smb_conn->negotiate.protocol,
req->smb_conn->connection->event.ctx,
req->smb_conn->connection->msg_ctx,
- global_loadparm,
+ req->smb_conn->lp_ctx,
req->smb_conn->connection->server_id,
&tcon->ntvfs);
if (!NT_STATUS_IS_OK(status)) {
req->smb_conn->negotiate.protocol,
req->smb_conn->connection->event.ctx,
req->smb_conn->connection->msg_ctx,
- global_loadparm,
+ req->smb_conn->lp_ctx,
req->smb_conn->connection->server_id,
&tcon->ntvfs);
if (!NT_STATUS_IS_OK(status)) {
become_daemon(true);
}
- cleanup_tmp_files(global_loadparm);
+ cleanup_tmp_files(cmdline_lp_ctx);
- if (!directory_exist(lp_lockdir(global_loadparm))) {
- mkdir(lp_lockdir(global_loadparm), 0755);
+ if (!directory_exist(lp_lockdir(cmdline_lp_ctx))) {
+ mkdir(lp_lockdir(cmdline_lp_ctx), 0755);
}
- pidfile_create(lp_piddir(global_loadparm), binary_name);
+ pidfile_create(lp_piddir(cmdline_lp_ctx), binary_name);
/* Do *not* remove this, until you have removed
* passdb/secrets.c, and proved that Samba still builds... */
/* Setup the SECRETS subsystem */
- if (!secrets_init(global_loadparm)) {
+ if (!secrets_init(cmdline_lp_ctx)) {
exit(1);
}
ldb_global_init(); /* FIXME: */
- share_init(global_loadparm);
+ share_init();
- gensec_init(global_loadparm); /* FIXME: */
+ gensec_init(cmdline_lp_ctx); /* FIXME: */
- ntptr_init(global_loadparm); /* FIXME: maybe run this in the initialization function
+ ntptr_init(cmdline_lp_ctx); /* FIXME: maybe run this in the initialization function
of the spoolss RPC server instead? */
- ntvfs_init(); /* FIXME: maybe run this in the initialization functions
+ ntvfs_init(cmdline_lp_ctx); /* FIXME: maybe run this in the initialization functions
of the SMB[,2] server instead? */
- process_model_init(global_loadparm);
+ process_model_init(cmdline_lp_ctx);
- shared_init = load_samba_modules(NULL, global_loadparm, "service");
+ shared_init = load_samba_modules(NULL, cmdline_lp_ctx, "service");
run_init_functions(static_init);
run_init_functions(shared_init);
}
/* initialise clustering if needed */
- cluster_ctdb_init(global_loadparm, event_ctx, model);
+ cluster_ctdb_init(cmdline_lp_ctx, event_ctx, model);
if (opt_interactive) {
/* catch EOF on stdin */
}
DEBUG(0,("%s: using '%s' process model\n", binary_name, model));
- status = server_service_startup(event_ctx, global_loadparm, model,
- lp_server_services(global_loadparm));
+ status = server_service_startup(event_ctx, cmdline_lp_ctx, model,
+ lp_server_services(cmdline_lp_ctx));
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Starting Services failed - %s\n", nt_errstr(status)));
return 1;
argc -= NSERVERS;
argv += NSERVERS;
- global_loadparm = lp_ctx = loadparm_init(talloc_autofree_context());
+ lp_ctx = loadparm_init(talloc_autofree_context());
lp_load(lp_ctx, dyn_CONFIGFILE);
servers[0].credentials = cli_credentials_init(talloc_autofree_context());
return ret;
}
-static bool test_bind_sasl(struct ldap_connection *conn, struct cli_credentials *creds)
+static bool test_bind_sasl(struct torture_context *tctx,
+ struct ldap_connection *conn, struct cli_credentials *creds)
{
NTSTATUS status;
bool ret = true;
printf("Testing sasl bind as user\n");
- status = torture_ldap_bind_sasl(conn, creds, global_loadparm);
+ status = torture_ldap_bind_sasl(conn, creds, tctx->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
ret = false;
}
url = talloc_asprintf(mem_ctx, "ldap://%s/", host);
- status = torture_ldap_connection(mem_ctx, &conn, url);
+ status = torture_ldap_connection(torture, &conn, url);
if (!NT_STATUS_IS_OK(status)) {
return false;
}
ret = false;
}
- if (!test_bind_sasl(conn, cmdline_credentials)) {
+ if (!test_bind_sasl(torture, conn, cmdline_credentials)) {
ret = false;
}
}
/* open a ldap connection to a server */
-_PUBLIC_ NTSTATUS torture_ldap_connection(TALLOC_CTX *mem_ctx, struct ldap_connection **conn,
- const char *url)
+_PUBLIC_ NTSTATUS torture_ldap_connection(struct torture_context *tctx,
+ struct ldap_connection **conn,
+ const char *url)
{
NTSTATUS status;
return NT_STATUS_INVALID_PARAMETER;
}
- *conn = ldap4_new_connection(mem_ctx, NULL);
+ *conn = ldap4_new_connection(tctx, tctx->lp_ctx, NULL);
status = ldap_connect(*conn, url);
if (!NT_STATUS_IS_OK(status)) {
}
/* open a ldap connection to a server */
-NTSTATUS torture_ldap_connection2(TALLOC_CTX *mem_ctx, struct ldap_connection **conn,
+NTSTATUS torture_ldap_connection2(struct torture_context *tctx, struct ldap_connection **conn,
const char *url, const char *userdn, const char *password)
{
NTSTATUS status;
- status = torture_ldap_connection(mem_ctx, conn, url);
+ status = torture_ldap_connection(tctx, conn, url);
NT_STATUS_NOT_OK_RETURN(status);
status = ldap_bind_simple(*conn, userdn, password);
if (!NT_STATUS_IS_OK(status)) {
- printf("Failed a simple ldap bind - %s\n", ldap_errstr(*conn, mem_ctx, status));
+ printf("Failed a simple ldap bind - %s\n", ldap_errstr(*conn, tctx, status));
}
return status;
argc -= NSERVERS;
argv += NSERVERS;
- global_loadparm = lp_ctx = loadparm_init(talloc_autofree_context());
+ lp_ctx = loadparm_init(talloc_autofree_context());
lp_load(lp_ctx, dyn_CONFIGFILE);
servers[0] = cli_credentials_init(talloc_autofree_context());
argc -= 4;
argv += 4;
- global_loadparm = lp_ctx = loadparm_init(talloc_autofree_context());
+ lp_ctx = loadparm_init(talloc_autofree_context());
lp_load(lp_ctx, dyn_CONFIGFILE);
if (getenv("USER")) {
argc -= 1;
argv += 1;
- lp_ctx = global_loadparm = loadparm_init(talloc_autofree_context());
+ lp_ctx = loadparm_init(talloc_autofree_context());
lp_load(lp_ctx, dyn_CONFIGFILE);
credentials = cli_credentials_init(talloc_autofree_context());
return ctx;
}
-static bool _test_DsBind(struct DsSyncTest *ctx, struct cli_credentials *credentials, struct DsSyncBindInfo *b)
+static bool _test_DsBind(struct torture_context *tctx,
+ struct DsSyncTest *ctx, struct cli_credentials *credentials, struct DsSyncBindInfo *b)
{
NTSTATUS status;
bool ret = true;
status = dcerpc_pipe_connect_b(ctx,
&b->pipe, ctx->drsuapi_binding,
&ndr_table_drsuapi,
- credentials, event, global_loadparm);
+ credentials, event, tctx->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status));
return ret;
}
-static bool test_LDAPBind(struct DsSyncTest *ctx, struct cli_credentials *credentials, struct DsSyncLDAPInfo *l)
+static bool test_LDAPBind(struct torture_context *tctx, struct DsSyncTest *ctx,
+ struct cli_credentials *credentials, struct DsSyncLDAPInfo *l)
{
NTSTATUS status;
bool ret = true;
- status = torture_ldap_connection(ctx, &l->conn, ctx->ldap_url);
+ status = torture_ldap_connection(tctx, &l->conn, ctx->ldap_url);
if (!NT_STATUS_IS_OK(status)) {
printf("failed to connect to LDAP: %s\n", ctx->ldap_url);
return false;
printf("connected to LDAP: %s\n", ctx->ldap_url);
- status = torture_ldap_bind_sasl(l->conn, credentials, global_loadparm);
+ status = torture_ldap_bind_sasl(l->conn, credentials, tctx->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
printf("failed to bind to LDAP:\n");
return false;
mem_ctx = talloc_init("torture_rpc_dssync");
ctx = test_create_context(torture);
- ret &= _test_DsBind(ctx, ctx->admin.credentials, &ctx->admin.drsuapi);
+ ret &= _test_DsBind(torture, ctx, ctx->admin.credentials, &ctx->admin.drsuapi);
if (!ret) {
return ret;
}
- ret &= test_LDAPBind(ctx, ctx->admin.credentials, &ctx->admin.ldap);
+ ret &= test_LDAPBind(torture, ctx, ctx->admin.credentials, &ctx->admin.ldap);
if (!ret) {
return ret;
}
ret &= test_GetInfo(torture, ctx);
- ret &= _test_DsBind(ctx, ctx->new_dc.credentials, &ctx->new_dc.drsuapi);
+ ret &= _test_DsBind(torture, ctx, ctx->new_dc.credentials, &ctx->new_dc.drsuapi);
if (!ret) {
return ret;
}
struct torture_rpc_tcase *tcase = torture_suite_add_rpc_iface_tcase(suite,
"notify", &ndr_table_spoolss);
- ntvfs_init();
+ ntvfs_init(global_loadparm);
torture_rpc_tcase_add_test(tcase, "testRFFPCNEx", test_RFFPCNEx);
return suite;
while((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
case OPT_LOADFILE:
- lp_set_cmdline(global_loadparm, "torture:loadfile", poptGetOptArg(pc));
+ lp_set_cmdline(cmdline_lp_ctx, "torture:loadfile", poptGetOptArg(pc));
break;
case OPT_UNCLIST:
- lp_set_cmdline(global_loadparm, "torture:unclist", poptGetOptArg(pc));
+ lp_set_cmdline(cmdline_lp_ctx, "torture:unclist", poptGetOptArg(pc));
break;
case OPT_TIMELIMIT:
- lp_set_cmdline(global_loadparm, "torture:timelimit", poptGetOptArg(pc));
+ lp_set_cmdline(cmdline_lp_ctx, "torture:timelimit", poptGetOptArg(pc));
break;
case OPT_NUMPROGS:
- lp_set_cmdline(global_loadparm, "torture:nprocs", poptGetOptArg(pc));
+ lp_set_cmdline(cmdline_lp_ctx, "torture:nprocs", poptGetOptArg(pc));
break;
case OPT_DNS:
- parse_dns(global_loadparm, poptGetOptArg(pc));
+ parse_dns(cmdline_lp_ctx, poptGetOptArg(pc));
break;
case OPT_DANGEROUS:
- lp_set_cmdline(global_loadparm, "torture:dangerous", "Yes");
+ lp_set_cmdline(cmdline_lp_ctx, "torture:dangerous", "Yes");
break;
case OPT_ASYNC:
- lp_set_cmdline(global_loadparm, "torture:async", "Yes");
+ lp_set_cmdline(cmdline_lp_ctx, "torture:async", "Yes");
break;
case OPT_SMB_PORTS:
- lp_set_cmdline(global_loadparm, "smb ports", poptGetOptArg(pc));
+ lp_set_cmdline(cmdline_lp_ctx, "smb ports", poptGetOptArg(pc));
break;
}
}
if (strcmp(target, "samba3") == 0) {
- lp_set_cmdline(global_loadparm, "torture:samba3", "true");
+ lp_set_cmdline(cmdline_lp_ctx, "torture:samba3", "true");
} else if (strcmp(target, "samba4") == 0) {
- lp_set_cmdline(global_loadparm, "torture:samba4", "true");
+ lp_set_cmdline(cmdline_lp_ctx, "torture:samba4", "true");
}
if (max_runtime) {
exit(1);
}
- if (!parse_target(global_loadparm, argv_new[1])) {
+ if (!parse_target(cmdline_lp_ctx, argv_new[1])) {
usage(pc);
exit(1);
}
torture->outputdir = pwd;
}
- torture->lp_ctx = global_loadparm;
+ torture->lp_ctx = cmdline_lp_ctx;
if (argc_new == 0) {
printf("You must specify a test to run, or 'ALL'\n");
int torture_init(void)
{
init_module_fn static_init[] = STATIC_torture_MODULES;
- init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "torture");
+ init_module_fn *shared_init = load_samba_modules(NULL, cmdline_lp_ctx, "torture");
run_init_functions(static_init);
run_init_functions(shared_init);
ZERO_STRUCTP(ctx);
ctx->mem_ctx = mem_ctx;
- ctx->lp_ctx = global_loadparm;
+ ctx->lp_ctx = cmdline_lp_ctx;
ctx->credentials = cmdline_credentials;
rc = net_run_function(ctx, argc_new-1, argv_new+1, net_functable, net_usage);
}
-static bool process_one(const char *name, int nbt_port)
+static bool process_one(struct loadparm_context *lp_ctx, const char *name, int nbt_port)
{
TALLOC_CTX *tmp_ctx = talloc_new(NULL);
enum nbt_name_type node_type = NBT_NAME_CLIENT;
status = do_node_query(nbtsock, options.unicast_address,
nbt_port, node_name, node_type, false);
} else {
- int i, num_interfaces = iface_count(global_loadparm);
+ int i, num_interfaces = iface_count(lp_ctx);
for (i=0;i<num_interfaces;i++) {
- const char *bcast = iface_n_bcast(global_loadparm, i);
+ const char *bcast = iface_n_bcast(lp_ctx, i);
if (bcast == NULL) continue;
status = do_node_query(nbtsock, bcast, nbt_port,
node_name, node_type, true);
while (poptPeekArg(pc)) {
const char *name = poptGetArg(pc);
- ret &= process_one(name, lp_nbt_port(global_loadparm));
+ ret &= process_one(cmdline_lp_ctx, name, lp_nbt_port(cmdline_lp_ctx));
}
poptFreeContext(pc);
char *buf, int length, void **private,
unsigned int mux_id, void **private2);
-static void manage_squid_request(enum stdio_helper_mode helper_mode,
+static void manage_squid_request(struct loadparm_context *lp_ctx,
+ enum stdio_helper_mode helper_mode,
stdio_helper_function fn, void **private2);
static const struct {
mux_printf((unsigned int)credentials->priv_data, "PW\n");
credentials->priv_data = NULL;
- manage_squid_request(NUM_HELPER_MODES /* bogus */, manage_gensec_get_pw_request, (void **)&password);
+ manage_squid_request(cmdline_lp_ctx, NUM_HELPER_MODES /* bogus */, manage_gensec_get_pw_request, (void **)&password);
return password;
}
}
}
-static void manage_squid_request(enum stdio_helper_mode helper_mode,
+static void manage_squid_request(struct loadparm_context *lp_ctx, enum stdio_helper_mode helper_mode,
stdio_helper_function fn, void **private2)
{
char *buf;
private = &normal_private;
}
- fn(helper_mode, global_loadparm, c, length, private, mux_id, private2);
+ fn(helper_mode, lp_ctx, c, length, private, mux_id, private2);
talloc_free(buf);
}
-static void squid_stream(enum stdio_helper_mode stdio_mode,
+static void squid_stream(struct loadparm_context *lp_ctx,
+ enum stdio_helper_mode stdio_mode,
stdio_helper_function fn) {
/* initialize FDescs */
x_setbuf(x_stdout, NULL);
x_setbuf(x_stderr, NULL);
while(1) {
- manage_squid_request(stdio_mode, fn, NULL);
+ manage_squid_request(lp_ctx, stdio_mode, fn, NULL);
}
}
return 1;
}
- gensec_init(global_loadparm);
+ gensec_init(cmdline_lp_ctx);
if (opt_domain == NULL) {
- opt_domain = lp_workgroup(global_loadparm);
+ opt_domain = lp_workgroup(cmdline_lp_ctx);
}
if (helper_protocol) {
int i;
for (i=0; i<NUM_HELPER_MODES; i++) {
if (strcmp(helper_protocol, stdio_helper_protocols[i].name) == 0) {
- squid_stream(stdio_helper_protocols[i].mode, stdio_helper_protocols[i].fn);
+ squid_stream(cmdline_lp_ctx, stdio_helper_protocols[i].mode, stdio_helper_protocols[i].fn);
exit(0);
}
}
}
if (opt_workstation == NULL) {
- opt_workstation = lp_netbios_name(global_loadparm);
+ opt_workstation = lp_netbios_name(cmdline_lp_ctx);
}
if (!opt_password) {
{
char *user;
- asprintf(&user, "%s%c%s", opt_domain, *lp_winbind_separator(global_loadparm), opt_username);
+ asprintf(&user, "%s%c%s", opt_domain, *lp_winbind_separator(cmdline_lp_ctx), opt_username);
if (!check_plaintext_auth(user, opt_password, true)) {
return 1;
}
}
*/
- lp_ctx = global_loadparm;
+ lp_ctx = cmdline_lp_ctx;
/* We need this to force the output */
lp_set_cmdline(lp_ctx, "log level", "2");
state->domain->libnet_ctx->samr.sid = state->domain->info->sid;
state->domain->ldap_conn =
- ldap4_new_connection(state->domain, state->ctx->event_ctx);
+ ldap4_new_connection(state->domain, state->domain->libnet_ctx->lp_ctx, state->ctx->event_ctx);
composite_nomem(state->domain->ldap_conn, state->ctx);
ldap_url = talloc_asprintf(state, "ldap://%s/",