summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-07 02:37:04 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:48:41 +0100
commit4c4323009fa83f00ed319de59a3aad48fcd65994 (patch)
tree4eb290c8e7881e1b9b9f77f8401531443aa81bf4 /source4/torture
parent485b24fc113fe64507e20b9079948832d63194a3 (diff)
downloadsamba-4c4323009fa83f00ed319de59a3aad48fcd65994.tar.gz
samba-4c4323009fa83f00ed319de59a3aad48fcd65994.tar.bz2
samba-4c4323009fa83f00ed319de59a3aad48fcd65994.zip
r26327: Explicit loadparm_context for RPC client functions.
(This used to be commit eeb2251d22b3d6e0379444a73af69d1014692b07)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/libnet/domain.c2
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c6
-rw-r--r--source4/torture/libnet/libnet_domain.c14
-rw-r--r--source4/torture/libnet/libnet_group.c2
-rw-r--r--source4/torture/libnet/libnet_lookup.c8
-rw-r--r--source4/torture/libnet/libnet_rpc.c2
-rw-r--r--source4/torture/libnet/libnet_share.c4
-rw-r--r--source4/torture/libnet/libnet_user.c10
-rw-r--r--source4/torture/rpc/async_bind.c2
-rw-r--r--source4/torture/rpc/bind.c3
-rw-r--r--source4/torture/rpc/dfs.c12
-rw-r--r--source4/torture/rpc/dssync.c2
-rw-r--r--source4/torture/rpc/mgmt.c2
-rw-r--r--source4/torture/rpc/rpc.c8
-rw-r--r--source4/torture/rpc/samba3rpc.c66
-rw-r--r--source4/torture/rpc/samlogon.c2
-rw-r--r--source4/torture/rpc/samr_accessmask.c4
-rw-r--r--source4/torture/rpc/samsync.c4
-rw-r--r--source4/torture/rpc/scanner.c2
-rw-r--r--source4/torture/rpc/schannel.c27
-rw-r--r--source4/torture/rpc/session_key.c2
-rw-r--r--source4/torture/rpc/testjoin.c4
22 files changed, 94 insertions, 94 deletions
diff --git a/source4/torture/libnet/domain.c b/source4/torture/libnet/domain.c
index c75050eb55..ff1fbcab78 100644
--- a/source4/torture/libnet/domain.c
+++ b/source4/torture/libnet/domain.c
@@ -83,7 +83,7 @@ bool torture_domainopen(struct torture_context *torture)
mem_ctx = talloc_init("test_domain_open");
evt_ctx = event_context_find(torture);
- net_ctx = libnet_context_init(evt_ctx);
+ net_ctx = libnet_context_init(evt_ctx, torture->lp_ctx);
status = torture_rpc_connection(torture,
&net_ctx->samr.pipe,
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index 2b8fef0178..1eaed12701 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -258,8 +258,8 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data,
DEBUG(0,("Open the SAM LDB with system credentials: %s\n",
s->path.samdb_ldb));
- s->ldb = ldb_wrap_connect(s, global_loadparm, s->path.samdb_ldb,
- system_session(s, global_loadparm),
+ s->ldb = ldb_wrap_connect(s, s->tctx->lp_ctx, s->path.samdb_ldb,
+ system_session(s, s->tctx->lp_ctx),
NULL, 0, NULL);
if (!s->ldb) {
DEBUG(0,("Failed to open '%s'\n",
@@ -758,7 +758,7 @@ bool torture_net_become_dc(struct torture_context *torture)
return false;
}
- s->ctx = libnet_context_init(torture->ev);
+ s->ctx = libnet_context_init(torture->ev, torture->lp_ctx);
s->ctx->cred = cmdline_credentials;
s->ldb = ldb_init(s);
diff --git a/source4/torture/libnet/libnet_domain.c b/source4/torture/libnet/libnet_domain.c
index 6ec5302d91..3c8d574f0e 100644
--- a/source4/torture/libnet/libnet_domain.c
+++ b/source4/torture/libnet/libnet_domain.c
@@ -136,7 +136,7 @@ bool torture_domain_open_lsa(struct torture_context *torture)
of specific server name. */
domain_name = lp_workgroup(torture->lp_ctx);
- ctx = libnet_context_init(NULL);
+ ctx = libnet_context_init(NULL, torture->lp_ctx);
if (ctx == NULL) {
d_printf("failed to create libnet context\n");
return false;
@@ -190,7 +190,7 @@ bool torture_domain_close_lsa(struct torture_context *torture)
return false;
}
- ctx = libnet_context_init(NULL);
+ ctx = libnet_context_init(NULL, torture->lp_ctx);
if (ctx == NULL) {
d_printf("failed to create libnet context\n");
ret = false;
@@ -201,7 +201,7 @@ bool torture_domain_close_lsa(struct torture_context *torture)
mem_ctx = talloc_init("torture_domain_close_lsa");
status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_lsarpc,
- cmdline_credentials, NULL);
+ cmdline_credentials, NULL, torture->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
d_printf("failed to connect to server: %s\n", nt_errstr(status));
ret = false;
@@ -255,7 +255,7 @@ bool torture_domain_open_samr(struct torture_context *torture)
mem_ctx = talloc_init("test_domainopen_lsa");
- ctx = libnet_context_init(evt_ctx);
+ ctx = libnet_context_init(evt_ctx, torture->lp_ctx);
ctx->cred = cmdline_credentials;
/* we're accessing domain controller so the domain name should be
@@ -320,7 +320,7 @@ bool torture_domain_close_samr(struct torture_context *torture)
return false;
}
- ctx = libnet_context_init(NULL);
+ ctx = libnet_context_init(NULL, torture->lp_ctx);
if (ctx == NULL) {
d_printf("failed to create libnet context\n");
ret = false;
@@ -331,7 +331,7 @@ bool torture_domain_close_samr(struct torture_context *torture)
mem_ctx = talloc_init("torture_domain_close_samr");
status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_samr,
- ctx->cred, NULL);
+ ctx->cred, NULL, torture->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
d_printf("failed to connect to server: %s\n", nt_errstr(status));
ret = false;
@@ -388,7 +388,7 @@ bool torture_domain_list(struct torture_context *torture)
return false;
}
- ctx = libnet_context_init(NULL);
+ ctx = libnet_context_init(NULL, torture->lp_ctx);
if (ctx == NULL) {
d_printf("failed to create libnet context\n");
ret = false;
diff --git a/source4/torture/libnet/libnet_group.c b/source4/torture/libnet/libnet_group.c
index 5029d77dd6..02fc0f7fd5 100644
--- a/source4/torture/libnet/libnet_group.c
+++ b/source4/torture/libnet/libnet_group.c
@@ -216,7 +216,7 @@ bool torture_groupinfo_api(struct torture_context *torture)
prep_mem_ctx = talloc_init("prepare torture group info");
- ctx = libnet_context_init(NULL);
+ ctx = libnet_context_init(NULL, torture->lp_ctx);
ctx->cred = cmdline_credentials;
status = torture_rpc_connection(torture,
diff --git a/source4/torture/libnet/libnet_lookup.c b/source4/torture/libnet/libnet_lookup.c
index 6b4c03beb7..e4473b0fdd 100644
--- a/source4/torture/libnet/libnet_lookup.c
+++ b/source4/torture/libnet/libnet_lookup.c
@@ -40,7 +40,7 @@ bool torture_lookup(struct torture_context *torture)
mem_ctx = talloc_init("test_lookup");
- ctx = libnet_context_init(NULL);
+ ctx = libnet_context_init(NULL, torture->lp_ctx);
ctx->cred = cmdline_credentials;
lookup.in.hostname = torture_setting_string(torture, "host", NULL);
@@ -84,7 +84,7 @@ bool torture_lookup_host(struct torture_context *torture)
mem_ctx = talloc_init("test_lookup_host");
- ctx = libnet_context_init(NULL);
+ ctx = libnet_context_init(NULL, torture->lp_ctx);
ctx->cred = cmdline_credentials;
lookup.in.hostname = torture_setting_string(torture, "host", NULL);
@@ -127,7 +127,7 @@ bool torture_lookup_pdc(struct torture_context *torture)
mem_ctx = talloc_init("test_lookup_pdc");
- ctx = libnet_context_init(NULL);
+ ctx = libnet_context_init(NULL, torture->lp_ctx);
ctx->cred = cmdline_credentials;
talloc_steal(ctx, mem_ctx);
@@ -171,7 +171,7 @@ bool torture_lookup_sam_name(struct torture_context *torture)
struct libnet_context *ctx;
struct libnet_LookupName r;
- ctx = libnet_context_init(NULL);
+ ctx = libnet_context_init(NULL, torture->lp_ctx);
ctx->cred = cmdline_credentials;
mem_ctx = talloc_init("torture lookup sam name");
diff --git a/source4/torture/libnet/libnet_rpc.c b/source4/torture/libnet/libnet_rpc.c
index 1e042c77a6..282837d3fe 100644
--- a/source4/torture/libnet/libnet_rpc.c
+++ b/source4/torture/libnet/libnet_rpc.c
@@ -89,7 +89,7 @@ static bool torture_rpc_connect(struct torture_context *torture,
{
struct libnet_context *ctx;
- ctx = libnet_context_init(NULL);
+ ctx = libnet_context_init(NULL, torture->lp_ctx);
ctx->cred = cmdline_credentials;
d_printf("Testing connection to LSA interface\n");
diff --git a/source4/torture/libnet/libnet_share.c b/source4/torture/libnet/libnet_share.c
index d18e6ea9db..d693430b05 100644
--- a/source4/torture/libnet/libnet_share.c
+++ b/source4/torture/libnet/libnet_share.c
@@ -131,7 +131,7 @@ bool torture_listshares(struct torture_context *torture)
goto done;
}
- libnetctx = libnet_context_init(NULL);
+ libnetctx = libnet_context_init(NULL, torture->lp_ctx);
if (!libnetctx) {
printf("Couldn't allocate libnet context\n");
ret = false;
@@ -209,7 +209,7 @@ bool torture_delshare(struct torture_context *torture)
status = torture_rpc_binding(torture, &bind);
torture_assert_ntstatus_ok(torture, status, "Failed to get binding");
- libnetctx = libnet_context_init(NULL);
+ libnetctx = libnet_context_init(NULL, torture->lp_ctx);
libnetctx->cred = cmdline_credentials;
status = torture_rpc_connection(torture,
diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c
index f4c3bd9918..8671e438b7 100644
--- a/source4/torture/libnet/libnet_user.c
+++ b/source4/torture/libnet/libnet_user.c
@@ -241,7 +241,7 @@ bool torture_createuser(struct torture_context *torture)
mem_ctx = talloc_init("test_createuser");
- ctx = libnet_context_init(NULL);
+ ctx = libnet_context_init(NULL, torture->lp_ctx);
ctx->cred = cmdline_credentials;
req.in.user_name = TEST_USERNAME;
@@ -287,7 +287,7 @@ bool torture_deleteuser(struct torture_context *torture)
prep_mem_ctx = talloc_init("prepare test_deleteuser");
- ctx = libnet_context_init(NULL);
+ ctx = libnet_context_init(NULL, torture->lp_ctx);
ctx->cred = cmdline_credentials;
req.in.user_name = TEST_USERNAME;
@@ -475,7 +475,7 @@ bool torture_modifyuser(struct torture_context *torture)
prep_mem_ctx = talloc_init("prepare test_deleteuser");
- ctx = libnet_context_init(NULL);
+ ctx = libnet_context_init(NULL, torture->lp_ctx);
ctx->cred = cmdline_credentials;
status = torture_rpc_connection(torture,
@@ -609,7 +609,7 @@ bool torture_userinfo_api(struct torture_context *torture)
prep_mem_ctx = talloc_init("prepare torture user info");
- ctx = libnet_context_init(NULL);
+ ctx = libnet_context_init(NULL, torture->lp_ctx);
ctx->cred = cmdline_credentials;
status = torture_rpc_connection(torture,
@@ -674,7 +674,7 @@ bool torture_userlist(struct torture_context *torture)
struct libnet_UserList req;
int i;
- ctx = libnet_context_init(NULL);
+ ctx = libnet_context_init(NULL, torture->lp_ctx);
ctx->cred = cmdline_credentials;
domain_name.string = lp_workgroup(torture->lp_ctx);
diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c
index 70743bd433..1ca3c62df0 100644
--- a/source4/torture/rpc/async_bind.c
+++ b/source4/torture/rpc/async_bind.c
@@ -78,7 +78,7 @@ bool torture_async_bind(struct torture_context *torture)
for (i = 0; i < torture_numasync; i++) {
table[i] = &ndr_table_lsarpc;
bind_req[i] = dcerpc_pipe_connect_send(mem_ctx, binding_string,
- table[i], creds, evt_ctx);
+ table[i], creds, evt_ctx, torture->lp_ctx);
}
/* recv bind requests */
diff --git a/source4/torture/rpc/bind.c b/source4/torture/rpc/bind.c
index 1800901873..55c9d3686d 100644
--- a/source4/torture/rpc/bind.c
+++ b/source4/torture/rpc/bind.c
@@ -64,7 +64,8 @@ bool torture_multi_bind(struct torture_context *torture)
return false;
}
- status = dcerpc_pipe_auth(mem_ctx, &p, binding, &ndr_table_lsarpc, cmdline_credentials);
+ status = dcerpc_pipe_auth(mem_ctx, &p, binding, &ndr_table_lsarpc, cmdline_credentials,
+ torture->lp_ctx);
if (NT_STATUS_IS_OK(status)) {
printf("(incorrectly) allowed re-bind to uuid %s - %s\n",
diff --git a/source4/torture/rpc/dfs.c b/source4/torture/rpc/dfs.c
index e169876b2b..dc2601d86e 100644
--- a/source4/torture/rpc/dfs.c
+++ b/source4/torture/rpc/dfs.c
@@ -44,6 +44,7 @@
}\
static bool test_NetShareAdd(TALLOC_CTX *mem_ctx,
+ struct torture_context *tctx,
const char *host,
const char *sharename,
const char *dir)
@@ -55,7 +56,7 @@ static bool test_NetShareAdd(TALLOC_CTX *mem_ctx,
printf("Creating share %s\n", sharename);
- if (!(libnetctx = libnet_context_init(NULL))) {
+ if (!(libnetctx = libnet_context_init(NULL, tctx->lp_ctx))) {
return false;
}
@@ -85,6 +86,7 @@ static bool test_NetShareAdd(TALLOC_CTX *mem_ctx,
}
static bool test_NetShareDel(TALLOC_CTX *mem_ctx,
+ struct torture_context *tctx,
const char *host,
const char *sharename)
{
@@ -94,7 +96,7 @@ static bool test_NetShareDel(TALLOC_CTX *mem_ctx,
printf("Deleting share %s\n", sharename);
- if (!(libnetctx = libnet_context_init(NULL))) {
+ if (!(libnetctx = libnet_context_init(NULL, tctx->lp_ctx))) {
return false;
}
@@ -491,7 +493,7 @@ static void test_cleanup_stdroot(struct dcerpc_pipe *p,
printf("Cleaning up StdRoot\n");
test_RemoveStdRoot(p, mem_ctx, host, sharename);
- test_NetShareDel(mem_ctx, host, sharename);
+ test_NetShareDel(mem_ctx, tctx, host, sharename);
torture_open_connection_share(mem_ctx, &cli, tctx, host, "C$", NULL);
test_DeleteDir(cli, dir);
torture_close_connection(cli);
@@ -513,11 +515,11 @@ static bool test_StdRoot(struct dcerpc_pipe *p,
test_cleanup_stdroot(p, mem_ctx, tctx, host, sharename, dir);
ret &= test_CreateDir(mem_ctx, &cli, tctx, host, "C$", dir);
- ret &= test_NetShareAdd(mem_ctx, host, sharename, path);
+ ret &= test_NetShareAdd(mem_ctx, tctx, host, sharename, path);
ret &= test_AddStdRoot(p, mem_ctx, host, sharename);
ret &= test_RemoveStdRoot(p, mem_ctx, host, sharename);
ret &= test_AddStdRootForced(p, mem_ctx, host, sharename);
- ret &= test_NetShareDel(mem_ctx, host, sharename);
+ ret &= test_NetShareDel(mem_ctx, tctx, host, sharename);
ret &= test_DeleteDir(cli, dir);
torture_close_connection(cli);
diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c
index 14164321b9..c0deb13570 100644
--- a/source4/torture/rpc/dssync.c
+++ b/source4/torture/rpc/dssync.c
@@ -182,7 +182,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);
+ credentials, event, global_loadparm);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status));
diff --git a/source4/torture/rpc/mgmt.c b/source4/torture/rpc/mgmt.c
index 4ae4ac3b34..d4b5fa9c6f 100644
--- a/source4/torture/rpc/mgmt.c
+++ b/source4/torture/rpc/mgmt.c
@@ -220,7 +220,7 @@ bool torture_rpc_mgmt(struct torture_context *torture)
printf("\nTesting pipe '%s'\n", l->table->name);
- status = dcerpc_epm_map_binding(loop_ctx, b, l->table, NULL);
+ status = dcerpc_epm_map_binding(loop_ctx, b, l->table, NULL, torture->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to map port for uuid %s\n",
GUID_string(loop_ctx, &l->table->syntax_id.uuid));
diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c
index c0c75ab21a..198c888f17 100644
--- a/source4/torture/rpc/rpc.c
+++ b/source4/torture/rpc/rpc.c
@@ -83,7 +83,7 @@ _PUBLIC_ NTSTATUS torture_rpc_connection(struct torture_context *tctx,
status = dcerpc_pipe_connect_b(tctx,
p, binding, table,
- cmdline_credentials, NULL);
+ cmdline_credentials, NULL, tctx->lp_ctx);
if (NT_STATUS_IS_ERR(status)) {
printf("Failed to connect to remote server: %s %s\n",
@@ -113,7 +113,7 @@ NTSTATUS torture_rpc_connection_transport(struct torture_context *tctx,
binding->assoc_group_id = assoc_group_id;
status = dcerpc_pipe_connect_b(tctx, p, binding, table,
- cmdline_credentials, NULL);
+ cmdline_credentials, NULL, tctx->lp_ctx);
if (NT_STATUS_IS_ERR(status)) {
*p = NULL;
@@ -147,7 +147,7 @@ static bool torture_rpc_setup_machine(struct torture_context *tctx,
&(tcase_data->pipe),
binding,
tcase->table,
- tcase_data->credentials, NULL);
+ tcase_data->credentials, NULL, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status, "Error connecting to server");
@@ -205,7 +205,7 @@ static bool torture_rpc_setup_anonymous(struct torture_context *tctx,
&(tcase_data->pipe),
binding,
tcase->table,
- tcase_data->credentials, NULL);
+ tcase_data->credentials, NULL, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status, "Error connecting to server");
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 184125b493..96ed03fc6f 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -51,20 +51,6 @@
#include "param/param.h"
#include "lib/registry/registry.h"
-static struct cli_credentials *create_anon_creds(TALLOC_CTX *mem_ctx)
-{
- struct cli_credentials *result;
-
- if (!(result = cli_credentials_init(mem_ctx))) {
- return NULL;
- }
-
- cli_credentials_set_conf(result, global_loadparm);
- cli_credentials_set_anonymous(result);
-
- return result;
-}
-
/*
* This tests a RPC call using an invalid vuid
*/
@@ -153,7 +139,7 @@ bool torture_bind_authcontext(struct torture_context *torture)
goto done;
}
- if (!(anon_creds = create_anon_creds(mem_ctx))) {
+ if (!(anon_creds = cli_credentials_init_anon(mem_ctx))) {
d_printf("create_anon_creds failed\n");
goto done;
}
@@ -199,6 +185,7 @@ bool torture_bind_authcontext(struct torture_context *torture)
static bool bindtest(struct smbcli_state *cli,
struct cli_credentials *credentials,
+ struct loadparm_context *lp_ctx,
uint8_t auth_type, uint8_t auth_level)
{
TALLOC_CTX *mem_ctx;
@@ -232,7 +219,7 @@ static bool bindtest(struct smbcli_state *cli,
}
status = dcerpc_bind_auth(lsa_pipe, &ndr_table_lsarpc,
- credentials, auth_type, auth_level,
+ credentials, lp_ctx, auth_type, auth_level,
NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("dcerpc_bind_auth failed: %s\n", nt_errstr(status));
@@ -310,13 +297,13 @@ bool torture_bind_samba3(struct torture_context *torture)
ret = true;
- ret &= bindtest(cli, cmdline_credentials, DCERPC_AUTH_TYPE_NTLMSSP,
+ ret &= bindtest(cli, cmdline_credentials, torture->lp_ctx, DCERPC_AUTH_TYPE_NTLMSSP,
DCERPC_AUTH_LEVEL_INTEGRITY);
- ret &= bindtest(cli, cmdline_credentials, DCERPC_AUTH_TYPE_NTLMSSP,
+ ret &= bindtest(cli, cmdline_credentials, torture->lp_ctx, DCERPC_AUTH_TYPE_NTLMSSP,
DCERPC_AUTH_LEVEL_PRIVACY);
- ret &= bindtest(cli, cmdline_credentials, DCERPC_AUTH_TYPE_SPNEGO,
+ ret &= bindtest(cli, cmdline_credentials, torture->lp_ctx, DCERPC_AUTH_TYPE_SPNEGO,
DCERPC_AUTH_LEVEL_INTEGRITY);
- ret &= bindtest(cli, cmdline_credentials, DCERPC_AUTH_TYPE_SPNEGO,
+ ret &= bindtest(cli, cmdline_credentials, torture->lp_ctx, DCERPC_AUTH_TYPE_SPNEGO,
DCERPC_AUTH_LEVEL_PRIVACY);
done:
@@ -330,6 +317,7 @@ bool torture_bind_samba3(struct torture_context *torture)
static NTSTATUS get_usr_handle(struct smbcli_state *cli,
TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct cli_credentials *admin_creds,
uint8_t auth_type,
uint8_t auth_level,
@@ -372,7 +360,7 @@ static NTSTATUS get_usr_handle(struct smbcli_state *cli,
if (admin_creds != NULL) {
status = dcerpc_bind_auth(samr_pipe, &ndr_table_samr,
- admin_creds, auth_type, auth_level,
+ admin_creds, lp_ctx, auth_type, auth_level,
NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("dcerpc_bind_auth failed: %s\n",
@@ -504,6 +492,7 @@ static NTSTATUS get_usr_handle(struct smbcli_state *cli,
*/
static bool create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli,
+ struct loadparm_context *lp_ctx,
struct cli_credentials *admin_creds,
const char *username, const char *password,
char **domain_name,
@@ -520,7 +509,7 @@ static bool create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli,
return false;
}
- status = get_usr_handle(cli, tmp_ctx, admin_creds,
+ status = get_usr_handle(cli, tmp_ctx, lp_ctx, admin_creds,
DCERPC_AUTH_TYPE_NTLMSSP,
DCERPC_AUTH_LEVEL_INTEGRITY,
username, domain_name, &samr_pipe, &wks_handle,
@@ -616,6 +605,7 @@ static bool create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli,
*/
static bool delete_user(struct smbcli_state *cli,
+ struct loadparm_context *lp_ctx,
struct cli_credentials *admin_creds,
const char *username)
{
@@ -631,7 +621,7 @@ static bool delete_user(struct smbcli_state *cli,
return false;
}
- status = get_usr_handle(cli, mem_ctx, admin_creds,
+ status = get_usr_handle(cli, mem_ctx, lp_ctx, admin_creds,
DCERPC_AUTH_TYPE_NTLMSSP,
DCERPC_AUTH_LEVEL_INTEGRITY,
username, &dom_name, &samr_pipe,
@@ -667,6 +657,7 @@ static bool delete_user(struct smbcli_state *cli,
*/
static bool join3(struct smbcli_state *cli,
+ struct loadparm_context *lp_ctx,
bool use_level25,
struct cli_credentials *admin_creds,
struct cli_credentials *wks_creds)
@@ -684,7 +675,7 @@ static bool join3(struct smbcli_state *cli,
}
status = get_usr_handle(
- cli, mem_ctx, admin_creds,
+ cli, mem_ctx, lp_ctx, admin_creds,
DCERPC_AUTH_TYPE_NTLMSSP,
DCERPC_AUTH_LEVEL_PRIVACY,
talloc_asprintf(mem_ctx, "%s$",
@@ -908,6 +899,7 @@ static bool auth2(struct smbcli_state *cli,
*/
static bool schan(struct smbcli_state *cli,
+ struct loadparm_context *lp_ctx,
struct cli_credentials *wks_creds,
struct cli_credentials *user_creds)
{
@@ -944,7 +936,7 @@ static bool schan(struct smbcli_state *cli,
#if 1
net_pipe->conn->flags |= (DCERPC_SIGN | DCERPC_SEAL);
status = dcerpc_bind_auth(net_pipe, &ndr_table_netlogon,
- wks_creds, DCERPC_AUTH_TYPE_SCHANNEL,
+ wks_creds, lp_ctx, DCERPC_AUTH_TYPE_SCHANNEL,
DCERPC_AUTH_LEVEL_PRIVACY,
NULL);
#else
@@ -1105,6 +1097,7 @@ static bool schan(struct smbcli_state *cli,
*/
static bool leave(struct smbcli_state *cli,
+ struct loadparm_context *lp_ctx,
struct cli_credentials *admin_creds,
struct cli_credentials *wks_creds)
{
@@ -1112,7 +1105,7 @@ static bool leave(struct smbcli_state *cli,
NULL, "%s$", cli_credentials_get_workstation(wks_creds));
bool ret;
- ret = delete_user(cli, admin_creds, wks_name);
+ ret = delete_user(cli, lp_ctx, admin_creds, wks_name);
talloc_free(wks_name);
return ret;
}
@@ -1144,7 +1137,7 @@ bool torture_netlogon_samba3(struct torture_context *torture)
return false;
}
- if (!(anon_creds = create_anon_creds(mem_ctx))) {
+ if (!(anon_creds = cli_credentials_init_anon(mem_ctx))) {
d_printf("create_anon_creds failed\n");
goto done;
}
@@ -1172,7 +1165,7 @@ bool torture_netlogon_samba3(struct torture_context *torture)
generate_random_str(wks_creds, 8),
CRED_SPECIFIED);
- if (!join3(cli, false, cmdline_credentials, wks_creds)) {
+ if (!join3(cli, torture->lp_ctx, false, cmdline_credentials, wks_creds)) {
d_printf("join failed\n");
goto done;
}
@@ -1195,14 +1188,14 @@ bool torture_netlogon_samba3(struct torture_context *torture)
}
for (j=0; j<2; j++) {
- if (!schan(cli, wks_creds, cmdline_credentials)) {
+ if (!schan(cli, torture->lp_ctx, wks_creds, cmdline_credentials)) {
d_printf("schan failed\n");
goto done;
}
}
}
- if (!leave(cli, cmdline_credentials, wks_creds)) {
+ if (!leave(cli, torture->lp_ctx, cmdline_credentials, wks_creds)) {
d_printf("leave failed\n");
goto done;
}
@@ -1253,7 +1246,7 @@ static bool test_join3(struct torture_context *tctx,
generate_random_str(wks_creds, 8),
CRED_SPECIFIED);
- if (!join3(cli, use_level25, samr_creds, wks_creds)) {
+ if (!join3(cli, tctx->lp_ctx, use_level25, samr_creds, wks_creds)) {
d_printf("join failed\n");
goto done;
}
@@ -1267,7 +1260,7 @@ static bool test_join3(struct torture_context *tctx,
goto done;
}
- if (!leave(cli, samr_creds, wks_creds)) {
+ if (!leave(cli, tctx->lp_ctx, samr_creds, wks_creds)) {
d_printf("leave failed\n");
goto done;
}
@@ -1293,7 +1286,7 @@ bool torture_samba3_sessionkey(struct torture_context *torture)
wks_name = torture_setting_string(torture, "wksname", get_myname());
- if (!(anon_creds = create_anon_creds(torture))) {
+ if (!(anon_creds = cli_credentials_init_anon(torture))) {
d_printf("create_anon_creds failed\n");
goto done;
}
@@ -1611,7 +1604,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
talloc_free(cli);
- if (!(anon_creds = create_anon_creds(mem_ctx))) {
+ if (!(anon_creds = cli_credentials_init_anon(mem_ctx))) {
d_printf("(%s) create_anon_creds failed\n", __location__);
ret = false;
goto done;
@@ -1655,7 +1648,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
generate_random_str(user_creds, 8),
CRED_SPECIFIED);
- if (!create_user(mem_ctx, cli, cmdline_credentials,
+ if (!create_user(mem_ctx, cli, torture->lp_ctx, cmdline_credentials,
cli_credentials_get_username(user_creds),
cli_credentials_get_password(user_creds),
&domain_name, &created_sid)) {
@@ -1720,7 +1713,8 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
}
delete:
- if (!delete_user(cli, cmdline_credentials,
+ if (!delete_user(cli, torture->lp_ctx,
+ cmdline_credentials,
cli_credentials_get_username(user_creds))) {
d_printf("(%s) delete_user failed\n", __location__);
ret = false;
diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c
index e7f14a89e2..b60cef7d53 100644
--- a/source4/torture/rpc/samlogon.c
+++ b/source4/torture/rpc/samlogon.c
@@ -1598,7 +1598,7 @@ bool torture_rpc_samlogon(struct torture_context *torture)
status = dcerpc_pipe_connect_b(mem_ctx, &p, b,
&ndr_table_netlogon,
- machine_credentials, NULL);
+ machine_credentials, NULL, torture->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
d_printf("RPC pipe connect as domain member failed: %s\n", nt_errstr(status));
diff --git a/source4/torture/rpc/samr_accessmask.c b/source4/torture/rpc/samr_accessmask.c
index e64d6a6bce..97fe16101d 100644
--- a/source4/torture/rpc/samr_accessmask.c
+++ b/source4/torture/rpc/samr_accessmask.c
@@ -292,7 +292,7 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx,
/* Try to connect as the test user */
status = dcerpc_pipe_connect(tctx,
&test_p, binding, &ndr_table_samr,
- test_credentials, NULL);
+ test_credentials, NULL, tctx->lp_ctx);
/* connect to SAMR as the user */
status = torture_samr_Connect5(tctx, test_p, SEC_FLAG_MAXIMUM_ALLOWED, &uch);
if (!NT_STATUS_IS_OK(status)) {
@@ -357,7 +357,7 @@ static bool test_samr_connect_user_acl_enforced(struct torture_context *tctx,
status = dcerpc_pipe_connect(tctx,
&test_p, binding, &ndr_table_samr,
- test_credentials, NULL);
+ test_credentials, NULL, tctx->lp_ctx);
/* connect to SAMR as the user */
status = torture_samr_Connect5(tctx, test_p, SAMR_ACCESS_SHUTDOWN_SERVER, &uch);
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index d1d95ce8fd..e94f228589 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -1558,7 +1558,7 @@ bool torture_rpc_samsync(struct torture_context *torture)
status = dcerpc_pipe_connect_b(samsync_state,
&samsync_state->p, b,
&ndr_table_netlogon,
- credentials, NULL);
+ credentials, NULL, torture->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status));
@@ -1596,7 +1596,7 @@ bool torture_rpc_samsync(struct torture_context *torture)
&samsync_state->p_netlogon_wksta,
b_netlogon_wksta,
&ndr_table_netlogon,
- credentials_wksta, NULL);
+ credentials_wksta, NULL, torture->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to server as a Workstation: %s\n", nt_errstr(status));
diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c
index a47fbdd667..03a2c9fd07 100644
--- a/source4/torture/rpc/scanner.c
+++ b/source4/torture/rpc/scanner.c
@@ -120,7 +120,7 @@ bool torture_rpc_scanner(struct torture_context *torture)
printf("\nTesting pipe '%s'\n", l->table->name);
if (b->transport == NCACN_IP_TCP) {
- status = dcerpc_epm_map_binding(torture, b, l->table, NULL);
+ status = dcerpc_epm_map_binding(torture, b, l->table, NULL, torture->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to map port for uuid %s\n",
GUID_string(loop_ctx, &l->table->syntax_id.uuid));
diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c
index 39cffc8e2a..6b0cbbf525 100644
--- a/source4/torture/rpc/schannel.c
+++ b/source4/torture/rpc/schannel.c
@@ -255,7 +255,7 @@ static bool test_schannel(struct torture_context *tctx,
b->flags |= dcerpc_flags;
status = dcerpc_pipe_connect_b(tctx, &p, b, &ndr_table_samr,
- credentials, NULL);
+ credentials, NULL, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status,
"Failed to connect with schannel");
@@ -267,15 +267,16 @@ static bool test_schannel(struct torture_context *tctx,
* the second */
/* Swap the binding details from SAMR to NETLOGON */
- status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL);
+ status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status, "epm map");
status = dcerpc_secondary_connection(p, &p_netlogon,
b);
torture_assert_ntstatus_ok(tctx, status, "seconday connection");
- status = dcerpc_bind_auth(p_netlogon, &ndr_table_netlogon,
- credentials, DCERPC_AUTH_TYPE_SCHANNEL,
+ status = dcerpc_bind_auth(p_netlogon, &ndr_table_netlogon,
+ credentials, tctx->lp_ctx,
+ DCERPC_AUTH_TYPE_SCHANNEL,
dcerpc_auth_level(p->conn),
NULL);
@@ -292,7 +293,7 @@ static bool test_schannel(struct torture_context *tctx,
"Failed to process schannel secured NETLOGON EX ops");
/* Swap the binding details from SAMR to LSARPC */
- status = dcerpc_epm_map_binding(tctx, b, &ndr_table_lsarpc, NULL);
+ status = dcerpc_epm_map_binding(tctx, b, &ndr_table_lsarpc, NULL, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status, "epm map");
status = dcerpc_secondary_connection(p, &p_lsa,
@@ -301,7 +302,8 @@ static bool test_schannel(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, status, "seconday connection");
status = dcerpc_bind_auth(p_lsa, &ndr_table_lsarpc,
- credentials, DCERPC_AUTH_TYPE_SCHANNEL,
+ credentials, tctx->lp_ctx,
+ DCERPC_AUTH_TYPE_SCHANNEL,
dcerpc_auth_level(p->conn),
NULL);
@@ -323,7 +325,7 @@ static bool test_schannel(struct torture_context *tctx,
b->flags |= dcerpc_flags;
status = dcerpc_pipe_connect_b(tctx, &p_samr2, b, &ndr_table_samr,
- credentials, NULL);
+ credentials, NULL, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status,
"Failed to connect with schannel");
@@ -332,7 +334,7 @@ static bool test_schannel(struct torture_context *tctx,
"Failed to process schannel secured SAMR ops (on fresh connection)");
/* Swap the binding details from SAMR to NETLOGON */
- status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL);
+ status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status, "epm");
status = dcerpc_secondary_connection(p_samr2, &p_netlogon2,
@@ -341,7 +343,8 @@ static bool test_schannel(struct torture_context *tctx,
/* and now setup an SCHANNEL bind on netlogon */
status = dcerpc_bind_auth(p_netlogon2, &ndr_table_netlogon,
- credentials, DCERPC_AUTH_TYPE_SCHANNEL,
+ credentials, tctx->lp_ctx,
+ DCERPC_AUTH_TYPE_SCHANNEL,
dcerpc_auth_level(p_samr2->conn),
NULL);
@@ -364,7 +367,7 @@ static bool test_schannel(struct torture_context *tctx,
b->flags &= ~DCERPC_AUTH_OPTIONS;
status = dcerpc_pipe_connect_b(tctx, &p_netlogon3, b, &ndr_table_netlogon,
- credentials, NULL);
+ credentials, NULL, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status, "Failed to connect without schannel");
torture_assert(tctx, !test_netlogon_ex_ops(p_netlogon3, tctx, credentials, creds),
@@ -447,12 +450,12 @@ bool torture_rpc_schannel2(struct torture_context *torture)
printf("Opening first connection\n");
status = dcerpc_pipe_connect_b(torture, &p1, b, &ndr_table_netlogon,
- credentials1, NULL);
+ credentials1, NULL, torture->lp_ctx);
torture_assert_ntstatus_ok(torture, status, "Failed to connect with schannel");
torture_comment(torture, "Opening second connection\n");
status = dcerpc_pipe_connect_b(torture, &p2, b, &ndr_table_netlogon,
- credentials2, NULL);
+ credentials2, NULL, torture->lp_ctx);
torture_assert_ntstatus_ok(torture, status, "Failed to connect with schannel");
credentials1->netlogon_creds = NULL;
diff --git a/source4/torture/rpc/session_key.c b/source4/torture/rpc/session_key.c
index 765458c62a..44c3ae2358 100644
--- a/source4/torture/rpc/session_key.c
+++ b/source4/torture/rpc/session_key.c
@@ -158,7 +158,7 @@ static bool test_secrets(struct torture_context *torture, const void *_data)
binding->flags |= settings->bindoptions;
torture_assert_ntstatus_ok(torture,
- dcerpc_pipe_connect_b(torture, &p, binding, &ndr_table_lsarpc, cmdline_credentials, NULL),
+ dcerpc_pipe_connect_b(torture, &p, binding, &ndr_table_lsarpc, cmdline_credentials, NULL, torture->lp_ctx),
"connect");
if (!test_lsa_OpenPolicy2(p, torture, &handle)) {
diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c
index 23a737c042..02f04946d6 100644
--- a/source4/torture/rpc/testjoin.c
+++ b/source4/torture/rpc/testjoin.c
@@ -142,7 +142,7 @@ struct test_join *torture_create_testuser(struct torture_context *torture,
&join->p,
dc_binding,
&ndr_table_samr,
- cmdline_credentials, NULL);
+ cmdline_credentials, NULL, torture->lp_ctx);
} else {
status = torture_rpc_connection(torture,
@@ -320,7 +320,7 @@ _PUBLIC_ struct test_join *torture_join_domain(struct torture_context *tctx,
return NULL;
}
- libnet_ctx = libnet_context_init(NULL);
+ libnet_ctx = libnet_context_init(NULL, tctx->lp_ctx);
if (!libnet_ctx) {
talloc_free(tj);
return NULL;