summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-03 15:53:17 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:47:28 +0100
commitab69eb8d8901d23794c6a298718e67656ef4820e (patch)
treecd415ecd2aee4caa9e47f6c442d0d23b2f443b9c /source4/torture
parent0a2f1a46a02d2c9497d05d7e534829dc6e9430dc (diff)
downloadsamba-ab69eb8d8901d23794c6a298718e67656ef4820e.tar.gz
samba-ab69eb8d8901d23794c6a298718e67656ef4820e.tar.bz2
samba-ab69eb8d8901d23794c6a298718e67656ef4820e.zip
r26250: Avoid global_loadparm in a couple more places.
(This used to be commit 2c6b755309fdf685cd0b0564272bf83038574a43)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c4
-rw-r--r--source4/torture/raw/lockbench.c2
-rw-r--r--source4/torture/raw/openbench.c2
-rw-r--r--source4/torture/rpc/drsuapi.c10
-rw-r--r--source4/torture/rpc/lsa.c98
-rw-r--r--source4/torture/rpc/samr.c156
-rw-r--r--source4/torture/rpc/testjoin.c11
-rw-r--r--source4/torture/smb2/getinfo.c6
8 files changed, 142 insertions, 147 deletions
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index cf07c9c611..22decc474d 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -726,7 +726,7 @@ bool torture_net_become_dc(struct torture_context *torture)
s = talloc_zero(torture, struct test_become_dc_state);
if (!s) return false;
- s->netbios_name = lp_parm_string(global_loadparm, NULL, "become dc", "smbtorture dc");
+ s->netbios_name = lp_parm_string(torture->lp_ctx, NULL, "become dc", "smbtorture dc");
if (!s->netbios_name || !s->netbios_name[0]) {
s->netbios_name = "smbtorturedc";
}
@@ -745,7 +745,7 @@ bool torture_net_become_dc(struct torture_context *torture)
if (!s->path.secrets_keytab) return false;
/* Join domain as a member server. */
- s->tj = torture_join_domain(s->netbios_name,
+ s->tj = torture_join_domain(torture, s->netbios_name,
ACB_WSTRUST,
&s->machine_account);
if (!s->tj) {
diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c
index 81016fc563..113634f264 100644
--- a/source4/torture/raw/lockbench.c
+++ b/source4/torture/raw/lockbench.c
@@ -191,7 +191,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
io->in.service_type = state->service_type;
io->in.credentials = cmdline_credentials;
io->in.fallback_to_anonymous = false;
- io->in.workgroup = lp_workgroup(global_loadparm);
+ io->in.workgroup = lp_workgroup(state->tctx->lp_ctx);
/* kill off the remnants of the old connection */
talloc_free(state->tree);
diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c
index 3eec9fbb13..8f9803fa4d 100644
--- a/source4/torture/raw/openbench.c
+++ b/source4/torture/raw/openbench.c
@@ -129,7 +129,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
io->in.service_type = state->service_type;
io->in.credentials = cmdline_credentials;
io->in.fallback_to_anonymous = false;
- io->in.workgroup = lp_workgroup(global_loadparm);
+ io->in.workgroup = lp_workgroup(state->tctx->lp_ctx);
/* kill off the remnants of the old connection */
talloc_free(state->tree);
diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c
index ee752c6568..7fc2406bbf 100644
--- a/source4/torture/rpc/drsuapi.c
+++ b/source4/torture/rpc/drsuapi.c
@@ -544,7 +544,7 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, struct torture_context *t
r.in.req.req5.highwatermark.highest_usn = 0;
r.in.req.req5.uptodateness_vector = NULL;
r.in.req.req5.replica_flags = 0;
- if (lp_parm_bool(global_loadparm, NULL, "drsuapi","compression", false)) {
+ if (lp_parm_bool(tctx->lp_ctx, NULL, "drsuapi","compression", false)) {
r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
}
r.in.req.req5.max_object_count = 0;
@@ -566,10 +566,10 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, struct torture_context *t
r.in.req.req8.highwatermark.highest_usn = 0;
r.in.req.req8.uptodateness_vector = NULL;
r.in.req.req8.replica_flags = 0;
- if (lp_parm_bool(global_loadparm, NULL, "drsuapi", "compression", false)) {
+ if (lp_parm_bool(tctx->lp_ctx, NULL, "drsuapi", "compression", false)) {
r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
}
- if (lp_parm_bool(global_loadparm, NULL, "drsuapi", "neighbour_writeable", true)) {
+ if (lp_parm_bool(tctx->lp_ctx, NULL, "drsuapi", "neighbour_writeable", true)) {
r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
}
r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
@@ -699,7 +699,7 @@ bool torture_rpc_drsuapi(struct torture_context *torture)
ZERO_STRUCT(priv);
- priv.join = torture_join_domain(TEST_MACHINE_NAME, ACB_SVRTRUST,
+ priv.join = torture_join_domain(torture, TEST_MACHINE_NAME, ACB_SVRTRUST,
&machine_credentials);
if (!priv.join) {
torture_fail(torture, "Failed to join as BDC");
@@ -751,7 +751,7 @@ bool torture_rpc_drsuapi_cracknames(struct torture_context *torture)
ZERO_STRUCT(priv);
- priv.join = torture_join_domain(TEST_MACHINE_NAME, ACB_SVRTRUST,
+ priv.join = torture_join_domain(torture, TEST_MACHINE_NAME, ACB_SVRTRUST,
&machine_credentials);
if (!priv.join) {
torture_fail(torture, "Failed to join as BDC\n");
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index 1250743955..f40f034ec3 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -1305,14 +1305,14 @@ static bool test_EnumAccountRights(struct dcerpc_pipe *p,
static bool test_QuerySecurity(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
+ struct torture_context *tctx,
struct policy_handle *handle,
struct policy_handle *acct_handle)
{
NTSTATUS status;
struct lsa_QuerySecurity r;
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
printf("skipping QuerySecurity test against Samba4\n");
return true;
}
@@ -1322,7 +1322,7 @@ static bool test_QuerySecurity(struct dcerpc_pipe *p,
r.in.handle = acct_handle;
r.in.sec_info = 7;
- status = dcerpc_lsa_QuerySecurity(p, mem_ctx, &r);
+ status = dcerpc_lsa_QuerySecurity(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("QuerySecurity failed - %s\n", nt_errstr(status));
return false;
@@ -1539,7 +1539,7 @@ static bool test_EnumPrivs(struct dcerpc_pipe *p,
}
static bool test_QueryForestTrustInformation(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
+ struct torture_context *tctx,
struct policy_handle *handle,
const char *trusted_domain_name)
{
@@ -1551,7 +1551,7 @@ static bool test_QueryForestTrustInformation(struct dcerpc_pipe *p,
printf("\nTesting lsaRQueryForestTrustInformation\n");
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
printf("skipping QueryForestTrustInformation against Samba4\n");
return true;
}
@@ -1569,7 +1569,7 @@ static bool test_QueryForestTrustInformation(struct dcerpc_pipe *p,
r.in.unknown = 0;
r.out.forest_trust_info = &info_ptr;
- status = dcerpc_lsa_lsaRQueryForestTrustInformation(p, mem_ctx, &r);
+ status = dcerpc_lsa_lsaRQueryForestTrustInformation(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("lsaRQueryForestTrustInformation failed - %s\n", nt_errstr(status));
@@ -1911,14 +1911,14 @@ static bool test_CreateTrustedDomain(struct dcerpc_pipe *p,
}
static bool test_QueryDomainInfoPolicy(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
+ struct torture_context *tctx,
struct policy_handle *handle)
{
struct lsa_QueryDomainInformationPolicy r;
NTSTATUS status;
int i;
bool ret = true;
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
printf("skipping QueryDomainInformationPolicy test against Samba4\n");
return true;
}
@@ -1931,7 +1931,7 @@ static bool test_QueryDomainInfoPolicy(struct dcerpc_pipe *p,
printf("\ntrying QueryDomainInformationPolicy level %d\n", i);
- status = dcerpc_lsa_QueryDomainInformationPolicy(p, mem_ctx, &r);
+ status = dcerpc_lsa_QueryDomainInformationPolicy(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("QueryDomainInformationPolicy failed - %s\n", nt_errstr(status));
@@ -1945,7 +1945,7 @@ static bool test_QueryDomainInfoPolicy(struct dcerpc_pipe *p,
static bool test_QueryInfoPolicy(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
+ struct torture_context *tctx,
struct policy_handle *handle)
{
struct lsa_QueryInfoPolicy r;
@@ -1954,7 +1954,7 @@ static bool test_QueryInfoPolicy(struct dcerpc_pipe *p,
bool ret = true;
printf("\nTesting QueryInfoPolicy\n");
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
printf("skipping QueryInfoPolicy against Samba4\n");
return true;
}
@@ -1965,7 +1965,7 @@ static bool test_QueryInfoPolicy(struct dcerpc_pipe *p,
printf("\ntrying QueryInfoPolicy level %d\n", i);
- status = dcerpc_lsa_QueryInfoPolicy(p, mem_ctx, &r);
+ status = dcerpc_lsa_QueryInfoPolicy(p, tctx, &r);
switch (i) {
case LSA_POLICY_INFO_DB:
@@ -1985,7 +1985,7 @@ static bool test_QueryInfoPolicy(struct dcerpc_pipe *p,
}
break;
default:
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
/* Other levels not implemented yet */
if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS)) {
printf("QueryInfoPolicy failed - %s\n", nt_errstr(status));
@@ -2003,18 +2003,18 @@ static bool test_QueryInfoPolicy(struct dcerpc_pipe *p,
struct lsa_TransNameArray tnames;
tnames.count = 10;
- tnames.names = talloc_array(mem_ctx, struct lsa_TranslatedName, tnames.count);
+ tnames.names = talloc_array(tctx, struct lsa_TranslatedName, tnames.count);
tnames.names[0].name.string = r.out.info->dns.name.string;
tnames.names[1].name.string = r.out.info->dns.dns_domain.string;
- tnames.names[2].name.string = talloc_asprintf(mem_ctx, "%s\\", r.out.info->dns.name.string);
- tnames.names[3].name.string = talloc_asprintf(mem_ctx, "%s\\", r.out.info->dns.dns_domain.string);
- tnames.names[4].name.string = talloc_asprintf(mem_ctx, "%s\\guest", r.out.info->dns.name.string);
- tnames.names[5].name.string = talloc_asprintf(mem_ctx, "%s\\krbtgt", r.out.info->dns.name.string);
- tnames.names[6].name.string = talloc_asprintf(mem_ctx, "%s\\guest", r.out.info->dns.dns_domain.string);
- tnames.names[7].name.string = talloc_asprintf(mem_ctx, "%s\\krbtgt", r.out.info->dns.dns_domain.string);
- tnames.names[8].name.string = talloc_asprintf(mem_ctx, "krbtgt@%s", r.out.info->dns.name.string);
- tnames.names[9].name.string = talloc_asprintf(mem_ctx, "krbtgt@%s", r.out.info->dns.dns_domain.string);
- ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
+ tnames.names[2].name.string = talloc_asprintf(tctx, "%s\\", r.out.info->dns.name.string);
+ tnames.names[3].name.string = talloc_asprintf(tctx, "%s\\", r.out.info->dns.dns_domain.string);
+ tnames.names[4].name.string = talloc_asprintf(tctx, "%s\\guest", r.out.info->dns.name.string);
+ tnames.names[5].name.string = talloc_asprintf(tctx, "%s\\krbtgt", r.out.info->dns.name.string);
+ tnames.names[6].name.string = talloc_asprintf(tctx, "%s\\guest", r.out.info->dns.dns_domain.string);
+ tnames.names[7].name.string = talloc_asprintf(tctx, "%s\\krbtgt", r.out.info->dns.dns_domain.string);
+ tnames.names[8].name.string = talloc_asprintf(tctx, "krbtgt@%s", r.out.info->dns.name.string);
+ tnames.names[9].name.string = talloc_asprintf(tctx, "krbtgt@%s", r.out.info->dns.dns_domain.string);
+ ret &= test_LookupNames(p, tctx, handle, &tnames);
}
}
@@ -2022,7 +2022,7 @@ static bool test_QueryInfoPolicy(struct dcerpc_pipe *p,
}
static bool test_QueryInfoPolicy2(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
+ struct torture_context *tctx,
struct policy_handle *handle)
{
struct lsa_QueryInfoPolicy2 r;
@@ -2036,7 +2036,7 @@ static bool test_QueryInfoPolicy2(struct dcerpc_pipe *p,
printf("\ntrying QueryInfoPolicy2 level %d\n", i);
- status = dcerpc_lsa_QueryInfoPolicy2(p, mem_ctx, &r);
+ status = dcerpc_lsa_QueryInfoPolicy2(p, tctx, &r);
switch (i) {
case LSA_POLICY_INFO_DB:
@@ -2056,7 +2056,7 @@ static bool test_QueryInfoPolicy2(struct dcerpc_pipe *p,
}
break;
default:
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
/* Other levels not implemented yet */
if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS)) {
printf("QueryInfoPolicy2 failed - %s\n", nt_errstr(status));
@@ -2128,99 +2128,93 @@ bool test_lsa_Close(struct dcerpc_pipe *p,
return true;
}
-bool torture_rpc_lsa(struct torture_context *torture)
+bool torture_rpc_lsa(struct torture_context *tctx)
{
NTSTATUS status;
struct dcerpc_pipe *p;
- TALLOC_CTX *mem_ctx;
bool ret = true;
struct policy_handle *handle;
- mem_ctx = talloc_init("torture_rpc_lsa");
-
- status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
+ status = torture_rpc_connection(tctx, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
- talloc_free(mem_ctx);
return false;
}
- if (!test_OpenPolicy(p, mem_ctx)) {
+ if (!test_OpenPolicy(p, tctx)) {
ret = false;
}
- if (!test_lsa_OpenPolicy2(p, mem_ctx, &handle)) {
+ if (!test_lsa_OpenPolicy2(p, tctx, &handle)) {
ret = false;
}
if (handle) {
- if (!test_LookupNames_wellknown(p, mem_ctx, handle)) {
+ if (!test_LookupNames_wellknown(p, tctx, handle)) {
ret = false;
}
- if (!test_LookupNames_bogus(p, mem_ctx, handle)) {
+ if (!test_LookupNames_bogus(p, tctx, handle)) {
ret = false;
}
- if (!test_LookupSids_async(p, mem_ctx, handle)) {
+ if (!test_LookupSids_async(p, tctx, handle)) {
ret = false;
}
- if (!test_QueryDomainInfoPolicy(p, mem_ctx, handle)) {
+ if (!test_QueryDomainInfoPolicy(p, tctx, handle)) {
ret = false;
}
- if (!test_CreateAccount(p, mem_ctx, handle)) {
+ if (!test_CreateAccount(p, tctx, handle)) {
ret = false;
}
- if (!test_CreateSecret(p, mem_ctx, handle)) {
+ if (!test_CreateSecret(p, tctx, handle)) {
ret = false;
}
- if (!test_CreateTrustedDomain(p, mem_ctx, handle)) {
+ if (!test_CreateTrustedDomain(p, tctx, handle)) {
ret = false;
}
- if (!test_EnumAccounts(p, mem_ctx, handle)) {
+ if (!test_EnumAccounts(p, tctx, handle)) {
ret = false;
}
- if (!test_EnumPrivs(p, mem_ctx, handle)) {
+ if (!test_EnumPrivs(p, tctx, handle)) {
ret = false;
}
- if (!test_QueryInfoPolicy(p, mem_ctx, handle)) {
+ if (!test_QueryInfoPolicy(p, tctx, handle)) {
ret = false;
}
- if (!test_QueryInfoPolicy2(p, mem_ctx, handle)) {
+ if (!test_QueryInfoPolicy2(p, tctx, handle)) {
ret = false;
}
#if 0
- if (!test_Delete(p, mem_ctx, handle)) {
+ if (!test_Delete(p, tctx, handle)) {
ret = false;
}
#endif
- if (!test_many_LookupSids(p, mem_ctx, handle)) {
+ if (!test_many_LookupSids(p, tctx, handle)) {
ret = false;
}
- if (!test_lsa_Close(p, mem_ctx, handle)) {
+ if (!test_lsa_Close(p, tctx, handle)) {
ret = false;
}
} else {
- if (!test_many_LookupSids(p, mem_ctx, handle)) {
+ if (!test_many_LookupSids(p, tctx, handle)) {
ret = false;
}
}
- if (!test_GetUserName(p, mem_ctx)) {
+ if (!test_GetUserName(p, tctx)) {
ret = false;
}
-
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index ec70c91570..6a8ff58fb0 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -78,13 +78,13 @@ bool test_samr_handle_Close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return true;
}
-static bool test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_Shutdown(struct dcerpc_pipe *p, struct torture_context *tctx,
struct policy_handle *handle)
{
NTSTATUS status;
struct samr_Shutdown r;
- if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) {
+ if (!torture_setting_bool(tctx, "dangerous", false)) {
printf("samr_Shutdown disabled - enable dangerous tests to use\n");
return true;
}
@@ -93,7 +93,7 @@ static bool test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("testing samr_Shutdown\n");
- status = dcerpc_samr_Shutdown(p, mem_ctx, &r);
+ status = dcerpc_samr_Shutdown(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("samr_Shutdown failed - %s\n", nt_errstr(status));
return false;
@@ -102,7 +102,7 @@ static bool test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return true;
}
-static bool test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_SetDsrmPassword(struct dcerpc_pipe *p, struct torture_context *tctx,
struct policy_handle *handle)
{
NTSTATUS status;
@@ -110,7 +110,7 @@ static bool test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct lsa_String string;
struct samr_Password hash;
- if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) {
+ if (!torture_setting_bool(tctx, "dangerous", false)) {
printf("samr_SetDsrmPassword disabled - enable dangerous tests to use\n");
return true;
}
@@ -125,7 +125,7 @@ static bool test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("testing samr_SetDsrmPassword\n");
- status = dcerpc_samr_SetDsrmPassword(p, mem_ctx, &r);
+ status = dcerpc_samr_SetDsrmPassword(p, tctx, &r);
if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
printf("samr_SetDsrmPassword failed - %s\n", nt_errstr(status));
return false;
@@ -135,7 +135,7 @@ static bool test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
-static bool test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_QuerySecurity(struct dcerpc_pipe *p, struct torture_context *tctx,
struct policy_handle *handle)
{
NTSTATUS status;
@@ -145,7 +145,7 @@ static bool test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r.in.handle = handle;
r.in.sec_info = 7;
- status = dcerpc_samr_QuerySecurity(p, mem_ctx, &r);
+ status = dcerpc_samr_QuerySecurity(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("QuerySecurity failed - %s\n", nt_errstr(status));
return false;
@@ -159,18 +159,18 @@ static bool test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
s.in.sec_info = 7;
s.in.sdbuf = r.out.sdbuf;
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
printf("skipping SetSecurity test against Samba4\n");
return true;
}
- status = dcerpc_samr_SetSecurity(p, mem_ctx, &s);
+ status = dcerpc_samr_SetSecurity(p, tctx, &s);
if (!NT_STATUS_IS_OK(status)) {
printf("SetSecurity failed - %s\n", nt_errstr(status));
return false;
}
- status = dcerpc_samr_QuerySecurity(p, mem_ctx, &r);
+ status = dcerpc_samr_QuerySecurity(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("QuerySecurity failed - %s\n", nt_errstr(status));
return false;
@@ -180,7 +180,7 @@ static bool test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
-static bool test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_SetUserInfo(struct dcerpc_pipe *p, struct torture_context *tctx,
struct policy_handle *handle, uint32_t base_acct_flags,
const char *base_account_name)
{
@@ -210,7 +210,7 @@ static bool test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
q0 = q;
#define TESTCALL(call, r) \
- status = dcerpc_samr_ ##call(p, mem_ctx, &r); \
+ status = dcerpc_samr_ ##call(p, tctx, &r); \
if (!NT_STATUS_IS_OK(status)) { \
printf(#call " level %u failed - %s (%s)\n", \
r.in.level, nt_errstr(status), __location__); \
@@ -299,17 +299,17 @@ static bool test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
TEST_USERINFO_STRING(21, comment, 21, comment, "xx21-21 comment",
SAMR_FIELD_COMMENT);
- test_account_name = talloc_asprintf(mem_ctx, "%sxx7-1", base_account_name);
+ test_account_name = talloc_asprintf(tctx, "%sxx7-1", base_account_name);
TEST_USERINFO_STRING(7, account_name, 1, account_name, base_account_name, 0);
- test_account_name = talloc_asprintf(mem_ctx, "%sxx7-3", base_account_name);
+ test_account_name = talloc_asprintf(tctx, "%sxx7-3", base_account_name);
TEST_USERINFO_STRING(7, account_name, 3, account_name, base_account_name, 0);
- test_account_name = talloc_asprintf(mem_ctx, "%sxx7-5", base_account_name);
+ test_account_name = talloc_asprintf(tctx, "%sxx7-5", base_account_name);
TEST_USERINFO_STRING(7, account_name, 5, account_name, base_account_name, 0);
- test_account_name = talloc_asprintf(mem_ctx, "%sxx7-6", base_account_name);
+ test_account_name = talloc_asprintf(tctx, "%sxx7-6", base_account_name);
TEST_USERINFO_STRING(7, account_name, 6, account_name, base_account_name, 0);
- test_account_name = talloc_asprintf(mem_ctx, "%sxx7-7", base_account_name);
+ test_account_name = talloc_asprintf(tctx, "%sxx7-7", base_account_name);
TEST_USERINFO_STRING(7, account_name, 7, account_name, base_account_name, 0);
- test_account_name = talloc_asprintf(mem_ctx, "%sxx7-21", base_account_name);
+ test_account_name = talloc_asprintf(tctx, "%sxx7-21", base_account_name);
TEST_USERINFO_STRING(7, account_name, 21, account_name, base_account_name, 0);
test_account_name = base_account_name;
TEST_USERINFO_STRING(21, account_name, 21, account_name, base_account_name,
@@ -415,7 +415,7 @@ static bool test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
TEST_USERINFO_INT(21, logon_hours.bits[3], 21, logon_hours.bits[3], 4,
SAMR_FIELD_LOGON_HOURS);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
printf("skipping Set Account Flag tests against Samba4\n");
return ret;
}
@@ -2099,34 +2099,34 @@ static bool test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
-static bool test_alias_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_alias_ops(struct dcerpc_pipe *p, struct torture_context *tctx,
struct policy_handle *alias_handle,
const struct dom_sid *domain_sid)
{
bool ret = true;
- if (!test_QuerySecurity(p, mem_ctx, alias_handle)) {
+ if (!test_QuerySecurity(p, tctx, alias_handle)) {
ret = false;
}
- if (!test_QueryAliasInfo(p, mem_ctx, alias_handle)) {
+ if (!test_QueryAliasInfo(p, tctx, alias_handle)) {
ret = false;
}
- if (!test_SetAliasInfo(p, mem_ctx, alias_handle)) {
+ if (!test_SetAliasInfo(p, tctx, alias_handle)) {
ret = false;
}
- if (!test_AddMemberToAlias(p, mem_ctx, alias_handle, domain_sid)) {
+ if (!test_AddMemberToAlias(p, tctx, alias_handle, domain_sid)) {
ret = false;
}
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
printf("skipping MultipleMembers Alias tests against Samba4\n");
return ret;
}
- if (!test_AddMultipleMembersToAlias(p, mem_ctx, alias_handle)) {
+ if (!test_AddMultipleMembersToAlias(p, tctx, alias_handle)) {
ret = false;
}
@@ -2284,7 +2284,7 @@ static bool test_DeleteAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
-static bool test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_CreateAlias(struct dcerpc_pipe *p, struct torture_context *tctx,
struct policy_handle *domain_handle,
struct policy_handle *alias_handle,
const struct dom_sid *domain_sid)
@@ -2304,7 +2304,7 @@ static bool test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("Testing CreateAlias (%s)\n", r.in.alias_name->string);
- status = dcerpc_samr_CreateDomAlias(p, mem_ctx, &r);
+ status = dcerpc_samr_CreateDomAlias(p, tctx, &r);
if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
printf("Server refused create of '%s'\n", r.in.alias_name->string);
@@ -2312,10 +2312,10 @@ static bool test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
if (NT_STATUS_EQUAL(status, NT_STATUS_ALIAS_EXISTS)) {
- if (!test_DeleteAlias_byname(p, mem_ctx, domain_handle, r.in.alias_name->string)) {
+ if (!test_DeleteAlias_byname(p, tctx, domain_handle, r.in.alias_name->string)) {
return false;
}
- status = dcerpc_samr_CreateDomAlias(p, mem_ctx, &r);
+ status = dcerpc_samr_CreateDomAlias(p, tctx, &r);
}
if (!NT_STATUS_IS_OK(status)) {
@@ -2323,7 +2323,7 @@ static bool test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return false;
}
- if (!test_alias_ops(p, mem_ctx, alias_handle, domain_sid)) {
+ if (!test_alias_ops(p, tctx, alias_handle, domain_sid)) {
ret = false;
}
@@ -3170,7 +3170,7 @@ static bool test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
/*
try blasting the server with a bunch of sync requests
*/
-static bool test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *tctx,
struct policy_handle *handle)
{
NTSTATUS status;
@@ -3180,7 +3180,7 @@ static bool test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct
#define ASYNC_COUNT 100
struct rpc_request *req[ASYNC_COUNT];
- if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) {
+ if (!torture_setting_bool(tctx, "dangerous", false)) {
printf("samr async test disabled - enable dangerous tests to use\n");
return true;
}
@@ -3194,7 +3194,7 @@ static bool test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct
r.out.resume_handle = &resume_handle;
for (i=0;i<ASYNC_COUNT;i++) {
- req[i] = dcerpc_samr_EnumDomainUsers_send(p, mem_ctx, &r);
+ req[i] = dcerpc_samr_EnumDomainUsers_send(p, tctx, &r);
}
for (i=0;i<ASYNC_COUNT;i++) {
@@ -4020,7 +4020,7 @@ static bool test_GetBootKeyInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct
return ret;
}
-static bool test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_AddGroupMember(struct dcerpc_pipe *p, struct torture_context *tctx,
struct policy_handle *domain_handle,
struct policy_handle *group_handle)
{
@@ -4032,7 +4032,7 @@ static bool test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
bool ret = true;
uint32_t rid;
- status = test_LookupName(p, mem_ctx, domain_handle, TEST_ACCOUNT_NAME, &rid);
+ status = test_LookupName(p, tctx, domain_handle, TEST_ACCOUNT_NAME, &rid);
if (!NT_STATUS_IS_OK(status)) {
printf("test_AddGroupMember looking up name " TEST_ACCOUNT_NAME " failed - %s\n", nt_errstr(status));
return false;
@@ -4047,27 +4047,27 @@ static bool test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
d.in.group_handle = group_handle;
d.in.rid = rid;
- status = dcerpc_samr_DeleteGroupMember(p, mem_ctx, &d);
+ status = dcerpc_samr_DeleteGroupMember(p, tctx, &d);
if (!NT_STATUS_EQUAL(NT_STATUS_MEMBER_NOT_IN_GROUP, status)) {
printf("DeleteGroupMember gave %s - should be NT_STATUS_MEMBER_NOT_IN_GROUP\n",
nt_errstr(status));
return false;
}
- status = dcerpc_samr_AddGroupMember(p, mem_ctx, &r);
+ status = dcerpc_samr_AddGroupMember(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("AddGroupMember failed - %s\n", nt_errstr(status));
return false;
}
- status = dcerpc_samr_AddGroupMember(p, mem_ctx, &r);
+ status = dcerpc_samr_AddGroupMember(p, tctx, &r);
if (!NT_STATUS_EQUAL(NT_STATUS_MEMBER_IN_GROUP, status)) {
printf("AddGroupMember gave %s - should be NT_STATUS_MEMBER_IN_GROUP\n",
nt_errstr(status));
return false;
}
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
printf("skipping SetMemberAttributesOfGroup test against Samba4\n");
} else {
/* this one is quite strange. I am using random inputs in the
@@ -4077,7 +4077,7 @@ static bool test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
s.in.unknown1 = random();
s.in.unknown2 = random();
- status = dcerpc_samr_SetMemberAttributesOfGroup(p, mem_ctx, &s);
+ status = dcerpc_samr_SetMemberAttributesOfGroup(p, tctx, &s);
if (!NT_STATUS_IS_OK(status)) {
printf("SetMemberAttributesOfGroup failed - %s\n", nt_errstr(status));
return false;
@@ -4086,19 +4086,19 @@ static bool test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
q.in.group_handle = group_handle;
- status = dcerpc_samr_QueryGroupMember(p, mem_ctx, &q);
+ status = dcerpc_samr_QueryGroupMember(p, tctx, &q);
if (!NT_STATUS_IS_OK(status)) {
printf("QueryGroupMember failed - %s\n", nt_errstr(status));
return false;
}
- status = dcerpc_samr_DeleteGroupMember(p, mem_ctx, &d);
+ status = dcerpc_samr_DeleteGroupMember(p, tctx, &d);
if (!NT_STATUS_IS_OK(status)) {
printf("DeleteGroupMember failed - %s\n", nt_errstr(status));
return false;
}
- status = dcerpc_samr_AddGroupMember(p, mem_ctx, &r);
+ status = dcerpc_samr_AddGroupMember(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("AddGroupMember failed - %s\n", nt_errstr(status));
return false;
@@ -4198,7 +4198,7 @@ static bool test_RemoveMemberFromForeignDomain(struct dcerpc_pipe *p,
static bool test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle);
-static bool test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_OpenDomain(struct dcerpc_pipe *p, struct torture_context *tctx,
struct policy_handle *handle, struct dom_sid *sid,
enum torture_samr_choice which_ops)
{
@@ -4222,7 +4222,7 @@ static bool test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r.in.sid = sid;
r.out.domain_handle = &domain_handle;
- status = dcerpc_samr_OpenDomain(p, mem_ctx, &r);
+ status = dcerpc_samr_OpenDomain(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("OpenDomain failed - %s\n", nt_errstr(status));
return false;
@@ -4230,67 +4230,67 @@ static bool test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
/* run the domain tests with the main handle closed - this tests
the servers reference counting */
- ret &= test_samr_handle_Close(p, mem_ctx, handle);
+ ret &= test_samr_handle_Close(p, tctx, handle);
switch (which_ops) {
case TORTURE_SAMR_USER_ATTRIBUTES:
case TORTURE_SAMR_PASSWORDS:
- ret &= test_CreateUser2(p, mem_ctx, &domain_handle, which_ops);
- ret &= test_CreateUser(p, mem_ctx, &domain_handle, &user_handle, which_ops);
+ ret &= test_CreateUser2(p, tctx, &domain_handle, which_ops);
+ ret &= test_CreateUser(p, tctx, &domain_handle, &user_handle, which_ops);
/* This test needs 'complex' users to validate */
- ret &= test_QueryDisplayInfo(p, mem_ctx, &domain_handle);
+ ret &= test_QueryDisplayInfo(p, tctx, &domain_handle);
break;
case TORTURE_SAMR_OTHER:
- ret &= test_CreateUser(p, mem_ctx, &domain_handle, &user_handle, which_ops);
- ret &= test_QuerySecurity(p, mem_ctx, &domain_handle);
- ret &= test_RemoveMemberFromForeignDomain(p, mem_ctx, &domain_handle);
- ret &= test_CreateAlias(p, mem_ctx, &domain_handle, &alias_handle, sid);
- ret &= test_CreateDomainGroup(p, mem_ctx, &domain_handle, &group_handle);
- ret &= test_QueryDomainInfo(p, mem_ctx, &domain_handle);
- ret &= test_QueryDomainInfo2(p, mem_ctx, &domain_handle);
- ret &= test_EnumDomainUsers(p, mem_ctx, &domain_handle);
- ret &= test_EnumDomainUsers_async(p, mem_ctx, &domain_handle);
- ret &= test_EnumDomainGroups(p, mem_ctx, &domain_handle);
- ret &= test_EnumDomainAliases(p, mem_ctx, &domain_handle);
- ret &= test_QueryDisplayInfo2(p, mem_ctx, &domain_handle);
- ret &= test_QueryDisplayInfo3(p, mem_ctx, &domain_handle);
- ret &= test_QueryDisplayInfo_continue(p, mem_ctx, &domain_handle);
+ ret &= test_CreateUser(p, tctx, &domain_handle, &user_handle, which_ops);
+ ret &= test_QuerySecurity(p, tctx, &domain_handle);
+ ret &= test_RemoveMemberFromForeignDomain(p, tctx, &domain_handle);
+ ret &= test_CreateAlias(p, tctx, &domain_handle, &alias_handle, sid);
+ ret &= test_CreateDomainGroup(p, tctx, &domain_handle, &group_handle);
+ ret &= test_QueryDomainInfo(p, tctx, &domain_handle);
+ ret &= test_QueryDomainInfo2(p, tctx, &domain_handle);
+ ret &= test_EnumDomainUsers(p, tctx, &domain_handle);
+ ret &= test_EnumDomainUsers_async(p, tctx, &domain_handle);
+ ret &= test_EnumDomainGroups(p, tctx, &domain_handle);
+ ret &= test_EnumDomainAliases(p, tctx, &domain_handle);
+ ret &= test_QueryDisplayInfo2(p, tctx, &domain_handle);
+ ret &= test_QueryDisplayInfo3(p, tctx, &domain_handle);
+ ret &= test_QueryDisplayInfo_continue(p, tctx, &domain_handle);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
printf("skipping GetDisplayEnumerationIndex test against Samba4\n");
} else {
- ret &= test_GetDisplayEnumerationIndex(p, mem_ctx, &domain_handle);
- ret &= test_GetDisplayEnumerationIndex2(p, mem_ctx, &domain_handle);
+ ret &= test_GetDisplayEnumerationIndex(p, tctx, &domain_handle);
+ ret &= test_GetDisplayEnumerationIndex2(p, tctx, &domain_handle);
}
- ret &= test_GroupList(p, mem_ctx, &domain_handle);
- ret &= test_TestPrivateFunctionsDomain(p, mem_ctx, &domain_handle);
- ret &= test_RidToSid(p, mem_ctx, sid, &domain_handle);
- ret &= test_GetBootKeyInformation(p, mem_ctx, &domain_handle);
+ ret &= test_GroupList(p, tctx, &domain_handle);
+ ret &= test_TestPrivateFunctionsDomain(p, tctx, &domain_handle);
+ ret &= test_RidToSid(p, tctx, sid, &domain_handle);
+ ret &= test_GetBootKeyInformation(p, tctx, &domain_handle);
break;
}
if (!policy_handle_empty(&user_handle) &&
- !test_DeleteUser(p, mem_ctx, &user_handle)) {
+ !test_DeleteUser(p, tctx, &user_handle)) {
ret = false;
}
if (!policy_handle_empty(&alias_handle) &&
- !test_DeleteAlias(p, mem_ctx, &alias_handle)) {
+ !test_DeleteAlias(p, tctx, &alias_handle)) {
ret = false;
}
if (!policy_handle_empty(&group_handle) &&
- !test_DeleteDomainGroup(p, mem_ctx, &group_handle)) {
+ !test_DeleteDomainGroup(p, tctx, &group_handle)) {
ret = false;
}
- ret &= test_samr_handle_Close(p, mem_ctx, &domain_handle);
+ ret &= test_samr_handle_Close(p, tctx, &domain_handle);
/* reconnect the main handle */
- ret &= test_Connect(p, mem_ctx, handle);
+ ret &= test_Connect(p, tctx, handle);
if (!ret) {
- printf("Testing domain %s failed!\n", dom_sid_string(mem_ctx, sid));
+ printf("Testing domain %s failed!\n", dom_sid_string(tctx, sid));
}
return ret;
diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c
index edffe539d7..23a737c042 100644
--- a/source4/torture/rpc/testjoin.c
+++ b/source4/torture/rpc/testjoin.c
@@ -299,7 +299,8 @@ failed:
}
-_PUBLIC_ struct test_join *torture_join_domain(const char *machine_name,
+_PUBLIC_ struct test_join *torture_join_domain(struct torture_context *tctx,
+ const char *machine_name,
uint32_t acct_flags,
struct cli_credentials **machine_credentials)
{
@@ -328,9 +329,9 @@ _PUBLIC_ struct test_join *torture_join_domain(const char *machine_name,
tj->libnet_r = libnet_r;
libnet_ctx->cred = cmdline_credentials;
- libnet_r->in.binding = lp_parm_string(global_loadparm, NULL, "torture", "binding");
+ libnet_r->in.binding = torture_setting_string(tctx, "binding", NULL);
if (!libnet_r->in.binding) {
- libnet_r->in.binding = talloc_asprintf(libnet_r, "ncacn_np:%s", lp_parm_string(global_loadparm, NULL, "torture", "host"));
+ libnet_r->in.binding = talloc_asprintf(libnet_r, "ncacn_np:%s", torture_setting_string(tctx, "host", NULL));
}
libnet_r->in.level = LIBNET_JOINDOMAIN_SPECIFIED;
libnet_r->in.netbios_name = machine_name;
@@ -383,7 +384,7 @@ _PUBLIC_ struct test_join *torture_join_domain(const char *machine_name,
u.info21.description.string = talloc_asprintf(tj,
"Samba4 torture account created by host %s: %s",
- lp_netbios_name(global_loadparm), timestring(tj, time(NULL)));
+ lp_netbios_name(tctx->lp_ctx), timestring(tj, time(NULL)));
status = dcerpc_samr_SetUserInfo(tj->p, tj, &s);
if (!NT_STATUS_IS_OK(status)) {
@@ -391,7 +392,7 @@ _PUBLIC_ struct test_join *torture_join_domain(const char *machine_name,
}
*machine_credentials = cli_credentials_init(tj);
- cli_credentials_set_conf(*machine_credentials, global_loadparm);
+ cli_credentials_set_conf(*machine_credentials, tctx->lp_ctx);
cli_credentials_set_workstation(*machine_credentials, machine_name, CRED_SPECIFIED);
cli_credentials_set_domain(*machine_credentials, libnet_r->out.domain_name, CRED_SPECIFIED);
if (libnet_r->out.realm) {
diff --git a/source4/torture/smb2/getinfo.c b/source4/torture/smb2/getinfo.c
index 73107a5217..f561b62d47 100644
--- a/source4/torture/smb2/getinfo.c
+++ b/source4/torture/smb2/getinfo.c
@@ -77,7 +77,7 @@ static struct {
/*
test fileinfo levels
*/
-static bool torture_smb2_fileinfo(struct smb2_tree *tree)
+static bool torture_smb2_fileinfo(struct torture_context *tctx, struct smb2_tree *tree)
{
struct smb2_handle hfile, hdir;
NTSTATUS status;
@@ -105,7 +105,7 @@ static bool torture_smb2_fileinfo(struct smb2_tree *tree)
file_levels[i].dinfo.query_secdesc.in.secinfo_flags = 0x7;
}
if (file_levels[i].level == RAW_FILEINFO_SMB2_ALL_EAS) {
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
continue;
}
file_levels[i].finfo.all_eas.in.continue_flags =
@@ -192,7 +192,7 @@ bool torture_smb2_getinfo(struct torture_context *torture)
}
torture_setup_complex_file(tree, DNAME ":streamtwo");
- ret &= torture_smb2_fileinfo(tree);
+ ret &= torture_smb2_fileinfo(torture, tree);
ret &= torture_smb2_fsinfo(tree);
talloc_free(mem_ctx);