summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-10 04:33:16 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:49:01 +0100
commitb65dba2245bf382c47d65c95ac9b1efa43918fc0 (patch)
treee2a474ba5bd99368423ad11d3632c55a51ed865c /source4/torture
parent4a36b71675a5ea2a22d7cf2a79d61a3cd511e99f (diff)
downloadsamba-b65dba2245bf382c47d65c95ac9b1efa43918fc0.tar.gz
samba-b65dba2245bf382c47d65c95ac9b1efa43918fc0.tar.bz2
samba-b65dba2245bf382c47d65c95ac9b1efa43918fc0.zip
r26355: Eliminate global_loadparm in more places.
(This used to be commit 5d589a0d94bd76a9b4c9fc748854e8098ea43c4d)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/gentest.c2
-rw-r--r--source4/torture/ldap/basic.c9
-rw-r--r--source4/torture/ldap/common.c13
-rw-r--r--source4/torture/locktest.c2
-rw-r--r--source4/torture/locktest2.c2
-rw-r--r--source4/torture/masktest.c2
-rw-r--r--source4/torture/rpc/dssync.c18
-rw-r--r--source4/torture/rpc/spoolss_notify.c2
-rw-r--r--source4/torture/smbtorture.c24
-rw-r--r--source4/torture/torture.c2
10 files changed, 40 insertions, 36 deletions
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index e8e531a119..25512b9567 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -2197,7 +2197,7 @@ static bool split_unc_name(const char *unc, char **server, char **share)
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());
diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c
index 76d412a7cd..358bf53590 100644
--- a/source4/torture/ldap/basic.c
+++ b/source4/torture/ldap/basic.c
@@ -42,14 +42,15 @@ static bool test_bind_simple(struct ldap_connection *conn, const char *userdn, c
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;
}
@@ -205,7 +206,7 @@ bool torture_ldap_basic(struct torture_context *torture)
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;
}
@@ -220,7 +221,7 @@ bool torture_ldap_basic(struct torture_context *torture)
ret = false;
}
- if (!test_bind_sasl(conn, cmdline_credentials)) {
+ if (!test_bind_sasl(torture, conn, cmdline_credentials)) {
ret = false;
}
diff --git a/source4/torture/ldap/common.c b/source4/torture/ldap/common.c
index b03a6d8113..11b11dcc00 100644
--- a/source4/torture/ldap/common.c
+++ b/source4/torture/ldap/common.c
@@ -54,8 +54,9 @@ _PUBLIC_ NTSTATUS torture_ldap_bind_sasl(struct ldap_connection *conn,
}
/* 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;
@@ -64,7 +65,7 @@ _PUBLIC_ NTSTATUS torture_ldap_connection(TALLOC_CTX *mem_ctx, struct ldap_conne
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)) {
@@ -76,17 +77,17 @@ _PUBLIC_ NTSTATUS torture_ldap_connection(TALLOC_CTX *mem_ctx, struct ldap_conne
}
/* 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;
diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c
index d51c2692d7..82e9b416b3 100644
--- a/source4/torture/locktest.c
+++ b/source4/torture/locktest.c
@@ -565,7 +565,7 @@ static void usage(void)
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());
diff --git a/source4/torture/locktest2.c b/source4/torture/locktest2.c
index 19629d8770..1dfefc15ed 100644
--- a/source4/torture/locktest2.c
+++ b/source4/torture/locktest2.c
@@ -484,7 +484,7 @@ static void usage(void)
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")) {
diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index 612b96e4f7..dab8193753 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -303,7 +303,7 @@ static void usage(void)
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());
diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c
index 8f15f6f096..4417285e04 100644
--- a/source4/torture/rpc/dssync.c
+++ b/source4/torture/rpc/dssync.c
@@ -173,7 +173,8 @@ static struct DsSyncTest *test_create_context(struct torture_context *tctx)
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;
@@ -182,7 +183,7 @@ static bool _test_DsBind(struct DsSyncTest *ctx, struct cli_credentials *credent
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));
@@ -223,12 +224,13 @@ static bool _test_DsBind(struct DsSyncTest *ctx, struct cli_credentials *credent
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;
@@ -236,7 +238,7 @@ static bool test_LDAPBind(struct DsSyncTest *ctx, struct cli_credentials *creden
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;
@@ -811,16 +813,16 @@ bool torture_rpc_dssync(struct torture_context *torture)
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;
}
diff --git a/source4/torture/rpc/spoolss_notify.c b/source4/torture/rpc/spoolss_notify.c
index 5e7a4469e4..bdbdc6b0c6 100644
--- a/source4/torture/rpc/spoolss_notify.c
+++ b/source4/torture/rpc/spoolss_notify.c
@@ -289,7 +289,7 @@ struct torture_suite *torture_rpc_spoolss_notify(TALLOC_CTX *mem_ctx)
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;
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 33e80a4b97..b35e623610 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -572,36 +572,36 @@ int main(int argc,char *argv[])
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) {
@@ -658,7 +658,7 @@ int main(int argc,char *argv[])
exit(1);
}
- if (!parse_target(global_loadparm, argv_new[1])) {
+ if (!parse_target(cmdline_lp_ctx, argv_new[1])) {
usage(pc);
exit(1);
}
@@ -690,7 +690,7 @@ int main(int argc,char *argv[])
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");
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 44a0d3b4c2..f0538c0362 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -65,7 +65,7 @@ struct torture_context *torture_context_init(TALLOC_CTX *mem_ctx,
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);