summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-03 00:28:22 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:47:20 +0100
commitbbdfbf8d9d486aee51117976b8f825759a4c4a37 (patch)
treec0f97e145aae09c3e7e5387471fb3fb0ab839596 /source4
parent291ddf433685ee5c25e172885045a4b60d7bb1ee (diff)
downloadsamba-bbdfbf8d9d486aee51117976b8f825759a4c4a37.tar.gz
samba-bbdfbf8d9d486aee51117976b8f825759a4c4a37.tar.bz2
samba-bbdfbf8d9d486aee51117976b8f825759a4c4a37.zip
r26238: Add a loadparm context parameter to torture_context, remove more uses of global_loadparm.
(This used to be commit a33a5530545086b81a3b205aa109dff11c546926)
Diffstat (limited to 'source4')
-rw-r--r--source4/ldap_server/ldap_server.c2
-rw-r--r--source4/lib/tls/tls.c28
-rw-r--r--source4/lib/tls/tls.h7
-rw-r--r--source4/libcli/ldap/ldap_client.c13
-rw-r--r--source4/smb_server/smb_server.c11
-rw-r--r--source4/smb_server/smb_server.h2
-rw-r--r--source4/torture/auth/pac.c4
-rw-r--r--source4/torture/basic/base.c12
-rw-r--r--source4/torture/basic/misc.c2
-rw-r--r--source4/torture/basic/secleak.c8
-rw-r--r--source4/torture/ldap/cldap.c27
-rw-r--r--source4/torture/ldap/schema.c2
-rw-r--r--source4/torture/ldap/uptodatevector.c2
-rw-r--r--source4/torture/libnet/domain.c2
-rw-r--r--source4/torture/libnet/groupinfo.c2
-rw-r--r--source4/torture/libnet/groupman.c2
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c4
-rw-r--r--source4/torture/libnet/libnet_domain.c8
-rw-r--r--source4/torture/libnet/libnet_group.c2
-rw-r--r--source4/torture/libnet/libnet_lookup.c4
-rw-r--r--source4/torture/libnet/libnet_rpc.c6
-rw-r--r--source4/torture/libnet/libnet_user.c18
-rw-r--r--source4/torture/libnet/userinfo.c2
-rw-r--r--source4/torture/libnet/userman.c6
-rw-r--r--source4/torture/local/dbspeed.c2
-rw-r--r--source4/torture/nbt/dgram.c14
-rw-r--r--source4/torture/nbt/winsreplication.c6
-rw-r--r--source4/torture/raw/composite.c74
-rw-r--r--source4/torture/raw/context.c98
-rw-r--r--source4/torture/raw/eas.c22
-rw-r--r--source4/torture/raw/lock.c6
-rw-r--r--source4/torture/raw/lockbench.c2
-rw-r--r--source4/torture/raw/mkdir.c16
-rw-r--r--source4/torture/raw/notify.c22
-rw-r--r--source4/torture/raw/open.c180
-rwxr-xr-xsource4/torture/raw/pingpong.c10
-rw-r--r--source4/torture/raw/read.c6
-rw-r--r--source4/torture/raw/samba3misc.c8
-rw-r--r--source4/torture/raw/unlink.c10
-rw-r--r--source4/torture/rpc/bench.c8
-rw-r--r--source4/torture/rpc/countcalls.c2
-rw-r--r--source4/torture/rpc/drsuapi.c36
-rw-r--r--source4/torture/rpc/dssync.c2
-rw-r--r--source4/torture/rpc/frsapi.c2
-rw-r--r--source4/torture/rpc/mgmt.c2
-rw-r--r--source4/torture/rpc/netlogon.c26
-rw-r--r--source4/torture/rpc/samba3rpc.c6
-rw-r--r--source4/torture/rpc/samlogon.c4
-rw-r--r--source4/torture/rpc/samr_accessmask.c10
-rw-r--r--source4/torture/rpc/samsync.c12
-rw-r--r--source4/torture/rpc/scanner.c2
-rw-r--r--source4/torture/rpc/schannel.c8
-rw-r--r--source4/torture/rpc/session_key.c6
-rw-r--r--source4/torture/rpc/spoolss_notify.c4
-rw-r--r--source4/torture/rpc/testjoin.c4
-rw-r--r--source4/torture/rpc/wkssvc.c20
-rw-r--r--source4/torture/smb2/connect.c2
-rw-r--r--source4/torture/smb2/dir.c2
-rw-r--r--source4/torture/smb2/find.c2
-rw-r--r--source4/torture/smb2/getinfo.c2
-rw-r--r--source4/torture/smb2/maxwrite.c13
-rw-r--r--source4/torture/smb2/notify.c7
-rw-r--r--source4/torture/smb2/scan.c23
-rw-r--r--source4/torture/smb2/setinfo.c16
-rw-r--r--source4/torture/smb2/util.c10
-rw-r--r--source4/torture/smbtorture.c71
-rw-r--r--source4/torture/ui.c8
-rw-r--r--source4/torture/ui.h2
-rw-r--r--source4/torture/unix/whoami.c40
-rw-r--r--source4/torture/util_smb.c2
-rw-r--r--source4/torture/winbind/struct_based.c8
-rw-r--r--source4/web_server/http.c2
72 files changed, 504 insertions, 512 deletions
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index 51dba26dca..a15b81707c 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -535,7 +535,7 @@ static void ldapsrv_task_init(struct task_server *task)
ldap_service = talloc_zero(task, struct ldapsrv_service);
if (ldap_service == NULL) goto failed;
- ldap_service->tls_params = tls_initialise(ldap_service);
+ ldap_service->tls_params = tls_initialise(ldap_service, task->lp_ctx);
if (ldap_service->tls_params == NULL) goto failed;
if (lp_interfaces(task->lp_ctx) && lp_bind_interfaces_only(task->lp_ctx)) {
diff --git a/source4/lib/tls/tls.c b/source4/lib/tls/tls.c
index 4a8357d93b..b298fb10cf 100644
--- a/source4/lib/tls/tls.c
+++ b/source4/lib/tls/tls.c
@@ -352,16 +352,16 @@ static NTSTATUS tls_socket_send(struct socket_context *sock,
/*
initialise global tls state
*/
-struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx)
+struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
{
struct tls_params *params;
int ret;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
- const char *keyfile = private_path(tmp_ctx, global_loadparm, lp_tls_keyfile(global_loadparm));
- const char *certfile = private_path(tmp_ctx, global_loadparm, lp_tls_certfile(global_loadparm));
- const char *cafile = private_path(tmp_ctx, global_loadparm, lp_tls_cafile(global_loadparm));
- const char *crlfile = private_path(tmp_ctx, global_loadparm, lp_tls_crlfile(global_loadparm));
- const char *dhpfile = private_path(tmp_ctx, global_loadparm, lp_tls_dhpfile(global_loadparm));
+ const char *keyfile = private_path(tmp_ctx, lp_ctx, lp_tls_keyfile(lp_ctx));
+ const char *certfile = private_path(tmp_ctx, lp_ctx, lp_tls_certfile(lp_ctx));
+ const char *cafile = private_path(tmp_ctx, lp_ctx, lp_tls_cafile(lp_ctx));
+ const char *crlfile = private_path(tmp_ctx, lp_ctx, lp_tls_crlfile(lp_ctx));
+ const char *dhpfile = private_path(tmp_ctx, lp_ctx, lp_tls_dhpfile(lp_ctx));
void tls_cert_generate(TALLOC_CTX *, const char *, const char *, const char *);
params = talloc(mem_ctx, struct tls_params);
@@ -370,7 +370,7 @@ struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx)
return NULL;
}
- if (!lp_tls_enabled(global_loadparm) || keyfile == NULL || *keyfile == 0) {
+ if (!lp_tls_enabled(lp_ctx) || keyfile == NULL || *keyfile == 0) {
params->tls_enabled = false;
talloc_free(tmp_ctx);
return params;
@@ -536,7 +536,8 @@ failed:
setup for a new client connection
*/
struct socket_context *tls_init_client(struct socket_context *socket,
- struct fd_event *fde)
+ struct fd_event *fde,
+ const char *ca_path)
{
struct tls_context *tls;
int ret = 0;
@@ -565,16 +566,10 @@ struct socket_context *tls_init_client(struct socket_context *socket,
}
new_sock->private_data = tls;
- cafile = private_path(tls, global_loadparm, lp_tls_cafile(global_loadparm));
- if (!cafile || !*cafile) {
- goto failed;
- }
-
gnutls_global_init();
gnutls_certificate_allocate_credentials(&tls->xcred);
gnutls_certificate_set_x509_trust_file(tls->xcred, cafile, GNUTLS_X509_FMT_PEM);
- talloc_free(cafile);
TLSCHECK(gnutls_init(&tls->session, GNUTLS_CLIENT));
TLSCHECK(gnutls_set_default_priority(tls->session));
gnutls_certificate_type_set_priority(tls->session, cert_type_priority);
@@ -659,7 +654,7 @@ bool tls_support(struct tls_params *params)
/* for systems without tls we just fail the operations, and the caller
* will retain the original socket */
-struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx)
+struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
{
return talloc_new(mem_ctx);
}
@@ -680,7 +675,8 @@ struct socket_context *tls_init_server(struct tls_params *params,
setup for a new client connection
*/
struct socket_context *tls_init_client(struct socket_context *socket,
- struct fd_event *fde)
+ struct fd_event *fde,
+ const char *ca_path)
{
return NULL;
}
diff --git a/source4/lib/tls/tls.h b/source4/lib/tls/tls.h
index 6f1e3d2424..e6aa8f0e1a 100644
--- a/source4/lib/tls/tls.h
+++ b/source4/lib/tls/tls.h
@@ -24,10 +24,12 @@
#include "lib/socket/socket.h"
+struct loadparm_context;
+
/*
call tls_initialise() once per task to startup the tls subsystem
*/
-struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx);
+struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx);
/*
call tls_init_server() on each new server connection
@@ -47,7 +49,8 @@ struct socket_context *tls_init_server(struct tls_params *parms,
call tls_init_client() on each new client connection
*/
struct socket_context *tls_init_client(struct socket_context *sock,
- struct fd_event *fde);
+ struct fd_event *fde,
+ const char *cafile);
/*
return True if a connection used tls
diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c
index 41e9c37196..f1cfaad18b 100644
--- a/source4/libcli/ldap/ldap_client.c
+++ b/source4/libcli/ldap/ldap_client.c
@@ -34,6 +34,7 @@
#include "lib/tls/tls.h"
#include "auth/gensec/gensec.h"
#include "system/time.h"
+#include "param/param.h"
/*
@@ -391,7 +392,17 @@ static void ldap_connect_got_sock(struct composite_context *ctx, struct ldap_con
talloc_steal(conn, conn->sock);
if (conn->ldaps) {
- struct socket_context *tls_socket = tls_init_client(conn->sock, conn->event.fde);
+ struct socket_context *tls_socket;
+ char *cafile = private_path(conn->sock, global_loadparm, lp_tls_cafile(global_loadparm));
+
+ if (!cafile || !*cafile) {
+ talloc_free(conn->sock);
+ return;
+ }
+
+ tls_socket = tls_init_client(conn->sock, conn->event.fde, cafile);
+ talloc_free(cafile);
+
if (tls_socket == NULL) {
talloc_free(conn->sock);
return;
diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c
index ac5c589932..57a6e8ea11 100644
--- a/source4/smb_server/smb_server.c
+++ b/source4/smb_server/smb_server.c
@@ -175,10 +175,11 @@ static const struct stream_server_ops smb_stream_ops = {
setup a listening socket on all the SMB ports for a particular address
*/
_PUBLIC_ NTSTATUS smbsrv_add_socket(struct event_context *event_context,
+ struct loadparm_context *lp_ctx,
const struct model_ops *model_ops,
const char *address)
{
- const char **ports = lp_smb_ports(global_loadparm);
+ const char **ports = lp_smb_ports(lp_ctx);
int i;
NTSTATUS status;
@@ -215,7 +216,7 @@ static void smbsrv_task_init(struct task_server *task)
task_server_set_title(task, "task[smbsrv]");
- if (lp_interfaces(global_loadparm) && lp_bind_interfaces_only(global_loadparm)) {
+ if (lp_interfaces(task->lp_ctx) && lp_bind_interfaces_only(task->lp_ctx)) {
int num_interfaces = iface_count();
int i;
@@ -225,13 +226,13 @@ static void smbsrv_task_init(struct task_server *task)
*/
for(i = 0; i < num_interfaces; i++) {
const char *address = iface_n_ip(i);
- status = smbsrv_add_socket(task->event_ctx, task->model_ops, address);
+ status = smbsrv_add_socket(task->event_ctx, task->lp_ctx, task->model_ops, address);
if (!NT_STATUS_IS_OK(status)) goto failed;
}
} else {
/* Just bind to lp_socket_address() (usually 0.0.0.0) */
- status = smbsrv_add_socket(task->event_ctx, task->model_ops,
- lp_socket_address(global_loadparm));
+ status = smbsrv_add_socket(task->event_ctx, task->lp_ctx, task->model_ops,
+ lp_socket_address(task->lp_ctx));
if (!NT_STATUS_IS_OK(status)) goto failed;
}
diff --git a/source4/smb_server/smb_server.h b/source4/smb_server/smb_server.h
index 4af6ef1362..5aa2e0b6ce 100644
--- a/source4/smb_server/smb_server.h
+++ b/source4/smb_server/smb_server.h
@@ -377,8 +377,10 @@ struct smbsrv_connection {
};
struct model_ops;
+struct loadparm_context;
NTSTATUS smbsrv_add_socket(struct event_context *event_context,
+ struct loadparm_context *lp_ctx,
const struct model_ops *model_ops,
const char *address);
diff --git a/source4/torture/auth/pac.c b/source4/torture/auth/pac.c
index 262cc70480..5342e5ec39 100644
--- a/source4/torture/auth/pac.c
+++ b/source4/torture/auth/pac.c
@@ -57,7 +57,7 @@ static bool torture_pac_self_check(struct torture_context *tctx)
torture_assert(tctx, 0 == smb_krb5_init_context(mem_ctx,
NULL,
- global_loadparm,
+ tctx->lp_ctx,
&smb_krb5_context),
"smb_krb5_init_context");
@@ -286,7 +286,7 @@ static bool torture_pac_saved_check(struct torture_context *tctx)
TALLOC_CTX *mem_ctx = tctx;
torture_assert(tctx, 0 == smb_krb5_init_context(mem_ctx, NULL,
- global_loadparm,
+ tctx->lp_ctx,
&smb_krb5_context),
"smb_krb5_init_context");
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c
index 5c5428d61f..9a5616e274 100644
--- a/source4/torture/basic/base.c
+++ b/source4/torture/basic/base.c
@@ -41,7 +41,7 @@ static struct smbcli_state *open_nbt_connection(struct torture_context *tctx)
struct smbcli_state *cli;
const char *host = torture_setting_string(tctx, "host", NULL);
- make_nbt_name_client(&calling, lp_netbios_name(global_loadparm));
+ make_nbt_name_client(&calling, lp_netbios_name(tctx->lp_ctx));
nbt_choose_called_name(NULL, &called, host, NBT_NAME_SERVER);
@@ -355,7 +355,7 @@ static bool run_negprot_nowait(struct torture_context *tctx)
for (i=0;i<100;i++) {
struct smbcli_request *req;
- req = smb_raw_negotiate_send(cli->transport, lp_unicode(global_loadparm), PROTOCOL_NT1);
+ req = smb_raw_negotiate_send(cli->transport, lp_unicode(tctx->lp_ctx), PROTOCOL_NT1);
event_loop_once(cli->transport->socket->event.ctx);
if (req->state == SMBCLI_REQUEST_ERROR) {
if (i > 0) {
@@ -1443,9 +1443,9 @@ static bool torture_samba3_errorpaths(struct torture_context *tctx)
return false;
}
- nt_status_support = lp_nt_status_support(global_loadparm);
+ nt_status_support = lp_nt_status_support(tctx->lp_ctx);
- if (!lp_set_cmdline(global_loadparm, "nt status support", "yes")) {
+ if (!lp_set_cmdline(tctx->lp_ctx, "nt status support", "yes")) {
torture_comment(tctx, "Could not set 'nt status support = yes'\n");
goto fail;
}
@@ -1454,7 +1454,7 @@ static bool torture_samba3_errorpaths(struct torture_context *tctx)
goto fail;
}
- if (!lp_set_cmdline(global_loadparm, "nt status support", "no")) {
+ if (!lp_set_cmdline(tctx->lp_ctx, "nt status support", "no")) {
torture_comment(tctx, "Could not set 'nt status support = yes'\n");
goto fail;
}
@@ -1463,7 +1463,7 @@ static bool torture_samba3_errorpaths(struct torture_context *tctx)
goto fail;
}
- if (!lp_set_cmdline(global_loadparm, "nt status support",
+ if (!lp_set_cmdline(tctx->lp_ctx, "nt status support",
nt_status_support ? "yes":"no")) {
torture_comment(tctx, "Could not reset 'nt status support = yes'");
goto fail;
diff --git a/source4/torture/basic/misc.c b/source4/torture/basic/misc.c
index f0d5ef5536..46f74ee1b1 100644
--- a/source4/torture/basic/misc.c
+++ b/source4/torture/basic/misc.c
@@ -442,7 +442,7 @@ static int init_benchrw_params(struct torture_context *tctx,
lpar->writeratio = torture_setting_int(tctx, "writeratio",5);
lpar->num_parallel_requests = torture_setting_int(
tctx, "parallel_requests", 5);
- lpar->workgroup = lp_workgroup(global_loadparm);
+ lpar->workgroup = lp_workgroup(tctx->lp_ctx);
p = torture_setting_string(tctx, "unclist", NULL);
if (p) {
diff --git a/source4/torture/basic/secleak.c b/source4/torture/basic/secleak.c
index 3d4aeea956..d0c048425d 100644
--- a/source4/torture/basic/secleak.c
+++ b/source4/torture/basic/secleak.c
@@ -29,7 +29,7 @@
#include "auth/credentials/credentials.h"
#include "param/param.h"
-static bool try_failed_login(struct smbcli_state *cli)
+static bool try_failed_login(struct torture_context *tctx, struct smbcli_state *cli)
{
NTSTATUS status;
struct smb_composite_sesssetup setup;
@@ -38,10 +38,10 @@ static bool try_failed_login(struct smbcli_state *cli)
session = smbcli_session_init(cli->transport, cli, false);
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities = cli->transport->negotiate.capabilities;
- setup.in.workgroup = lp_workgroup(global_loadparm);
+ setup.in.workgroup = lp_workgroup(tctx->lp_ctx);
setup.in.credentials = cli_credentials_init(session);
- cli_credentials_set_conf(setup.in.credentials, global_loadparm);
+ cli_credentials_set_conf(setup.in.credentials, tctx->lp_ctx);
cli_credentials_set_domain(setup.in.credentials, "INVALID-DOMAIN", CRED_SPECIFIED);
cli_credentials_set_username(setup.in.credentials, "INVALID-USERNAME", CRED_SPECIFIED);
cli_credentials_set_password(setup.in.credentials, "INVALID-PASSWORD", CRED_SPECIFIED);
@@ -62,7 +62,7 @@ bool torture_sec_leak(struct torture_context *tctx, struct smbcli_state *cli)
int timelimit = torture_setting_int(tctx, "timelimit", 20);
while (time(NULL) < t1+timelimit) {
- if (!try_failed_login(cli)) {
+ if (!try_failed_login(tctx, cli)) {
return false;
}
talloc_report(NULL, stdout);
diff --git a/source4/torture/ldap/cldap.c b/source4/torture/ldap/cldap.c
index a254a0ec09..ddb966683f 100644
--- a/source4/torture/ldap/cldap.c
+++ b/source4/torture/ldap/cldap.c
@@ -204,9 +204,9 @@ static void cldap_dump_results(struct cldap_search *search)
/*
test generic cldap operations
*/
-static bool test_cldap_generic(TALLOC_CTX *mem_ctx, const char *dest)
+static bool test_cldap_generic(struct torture_context *tctx, const char *dest)
{
- struct cldap_socket *cldap = cldap_socket_init(mem_ctx, NULL);
+ struct cldap_socket *cldap = cldap_socket_init(tctx, NULL);
NTSTATUS status;
struct cldap_search search;
bool ret = true;
@@ -216,18 +216,18 @@ static bool test_cldap_generic(TALLOC_CTX *mem_ctx, const char *dest)
ZERO_STRUCT(search);
search.in.dest_address = dest;
- search.in.dest_port = lp_cldap_port(global_loadparm);
+ search.in.dest_port = lp_cldap_port(tctx->lp_ctx);
search.in.timeout = 10;
search.in.retries = 3;
- status = cldap_search(cldap, mem_ctx, &search);
+ status = cldap_search(cldap, tctx, &search);
CHECK_STATUS(status, NT_STATUS_OK);
printf("fetching whole rootDSE\n");
search.in.filter = "(objectclass=*)";
search.in.attributes = NULL;
- status = cldap_search(cldap, mem_ctx, &search);
+ status = cldap_search(cldap, tctx, &search);
CHECK_STATUS(status, NT_STATUS_OK);
if (DEBUGLVL(3)) cldap_dump_results(&search);
@@ -236,7 +236,7 @@ static bool test_cldap_generic(TALLOC_CTX *mem_ctx, const char *dest)
search.in.filter = "(objectclass=*)";
search.in.attributes = attrs1;
- status = cldap_search(cldap, mem_ctx, &search);
+ status = cldap_search(cldap, tctx, &search);
CHECK_STATUS(status, NT_STATUS_OK);
if (DEBUGLVL(3)) cldap_dump_results(&search);
@@ -245,7 +245,7 @@ static bool test_cldap_generic(TALLOC_CTX *mem_ctx, const char *dest)
search.in.filter = "(objectclass=*)";
search.in.attributes = attrs2;
- status = cldap_search(cldap, mem_ctx, &search);
+ status = cldap_search(cldap, tctx, &search);
CHECK_STATUS(status, NT_STATUS_OK);
if (DEBUGLVL(3)) cldap_dump_results(&search);
@@ -254,7 +254,7 @@ static bool test_cldap_generic(TALLOC_CTX *mem_ctx, const char *dest)
search.in.filter = "(objectclass2=*)";
search.in.attributes = attrs3;
- status = cldap_search(cldap, mem_ctx, &search);
+ status = cldap_search(cldap, tctx, &search);
CHECK_STATUS(status, NT_STATUS_OK);
if (DEBUGLVL(3)) cldap_dump_results(&search);
@@ -263,7 +263,7 @@ static bool test_cldap_generic(TALLOC_CTX *mem_ctx, const char *dest)
search.in.filter = "(&(objectclass=*)(highestCommittedUSN=2))";
search.in.attributes = attrs1;
- status = cldap_search(cldap, mem_ctx, &search);
+ status = cldap_search(cldap, tctx, &search);
CHECK_STATUS(status, NT_STATUS_OK);
if (DEBUGLVL(3)) cldap_dump_results(&search);
@@ -274,16 +274,11 @@ done:
bool torture_cldap(struct torture_context *torture)
{
- TALLOC_CTX *mem_ctx;
bool ret = true;
const char *host = torture_setting_string(torture, "host", NULL);
- mem_ctx = talloc_init("torture_cldap");
-
- ret &= test_cldap_netlogon(mem_ctx, host);
- ret &= test_cldap_generic(mem_ctx, host);
-
- talloc_free(mem_ctx);
+ ret &= test_cldap_netlogon(torture, host);
+ ret &= test_cldap_generic(torture, host);
return ret;
}
diff --git a/source4/torture/ldap/schema.c b/source4/torture/ldap/schema.c
index 9d9195bb9d..4cfce11eb5 100644
--- a/source4/torture/ldap/schema.c
+++ b/source4/torture/ldap/schema.c
@@ -376,7 +376,7 @@ bool torture_ldap_schema(struct torture_context *torture)
url = talloc_asprintf(torture, "ldap://%s/", host);
- ldb = ldb_wrap_connect(torture, global_loadparm, url,
+ ldb = ldb_wrap_connect(torture, torture->lp_ctx, url,
NULL,
cmdline_credentials,
0, NULL);
diff --git a/source4/torture/ldap/uptodatevector.c b/source4/torture/ldap/uptodatevector.c
index aa473ff5cf..7bac04caf3 100644
--- a/source4/torture/ldap/uptodatevector.c
+++ b/source4/torture/ldap/uptodatevector.c
@@ -160,7 +160,7 @@ bool torture_ldap_uptodatevector(struct torture_context *torture)
url = talloc_asprintf(torture, "ldap://%s/", host);
if (!url) goto failed;
- ldb = ldb_wrap_connect(torture, global_loadparm, url,
+ ldb = ldb_wrap_connect(torture, torture->lp_ctx, url,
NULL,
cmdline_credentials,
0, NULL);
diff --git a/source4/torture/libnet/domain.c b/source4/torture/libnet/domain.c
index daf9012e0c..c75050eb55 100644
--- a/source4/torture/libnet/domain.c
+++ b/source4/torture/libnet/domain.c
@@ -93,7 +93,7 @@ bool torture_domainopen(struct torture_context *torture)
return false;
}
- name.string = lp_workgroup(global_loadparm);
+ name.string = lp_workgroup(torture->lp_ctx);
/*
* Testing synchronous version
diff --git a/source4/torture/libnet/groupinfo.c b/source4/torture/libnet/groupinfo.c
index bff2f405cd..55edb9d40d 100644
--- a/source4/torture/libnet/groupinfo.c
+++ b/source4/torture/libnet/groupinfo.c
@@ -91,7 +91,7 @@ bool torture_groupinfo(struct torture_context *torture)
return false;
}
- name.string = lp_workgroup(global_loadparm);
+ name.string = lp_workgroup(torture->lp_ctx);
/*
* Testing synchronous version
diff --git a/source4/torture/libnet/groupman.c b/source4/torture/libnet/groupman.c
index 552e02c420..adb055c750 100644
--- a/source4/torture/libnet/groupman.c
+++ b/source4/torture/libnet/groupman.c
@@ -71,7 +71,7 @@ bool torture_groupadd(struct torture_context *torture)
return false;
}
- domain_name.string = lp_workgroup(global_loadparm);
+ domain_name.string = lp_workgroup(torture->lp_ctx);
if (!test_opendomain(p, mem_ctx, &h, &domain_name, &sid)) {
ret = false;
goto done;
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index ef8e4d03c0..cf07c9c611 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -817,7 +817,7 @@ bool torture_net_become_dc(struct torture_context *torture)
s->schema = NULL;
DEBUG(0,("Reopen the SAM LDB with system credentials and all replicated data: %s\n", s->path.samdb_ldb));
- s->ldb = ldb_wrap_connect(s, global_loadparm, s->path.samdb_ldb,
+ s->ldb = ldb_wrap_connect(s, torture->lp_ctx, s->path.samdb_ldb,
system_session(s),
NULL, 0, NULL);
if (!s->ldb) {
@@ -834,7 +834,7 @@ bool torture_net_become_dc(struct torture_context *torture)
goto cleanup;
}
- if (lp_parm_bool(global_loadparm, NULL, "become dc", "do not unjoin", false)) {
+ if (lp_parm_bool(torture->lp_ctx, NULL, "become dc", "do not unjoin", false)) {
talloc_free(s);
return ret;
}
diff --git a/source4/torture/libnet/libnet_domain.c b/source4/torture/libnet/libnet_domain.c
index 379cca19be..6ec5302d91 100644
--- a/source4/torture/libnet/libnet_domain.c
+++ b/source4/torture/libnet/libnet_domain.c
@@ -134,7 +134,7 @@ bool torture_domain_open_lsa(struct torture_context *torture)
/* we're accessing domain controller so the domain name should be
passed (it's going to be resolved to dc name and address) instead
of specific server name. */
- domain_name = lp_workgroup(global_loadparm);
+ domain_name = lp_workgroup(torture->lp_ctx);
ctx = libnet_context_init(NULL);
if (ctx == NULL) {
@@ -208,7 +208,7 @@ bool torture_domain_close_lsa(struct torture_context *torture)
goto done;
}
- domain_name.string = lp_workgroup(global_loadparm);
+ domain_name.string = lp_workgroup(torture->lp_ctx);
if (!test_opendomain_lsa(p, torture, &h, &domain_name, &access_mask)) {
d_printf("failed to open domain on lsa service\n");
@@ -261,7 +261,7 @@ bool torture_domain_open_samr(struct torture_context *torture)
/* we're accessing domain controller so the domain name should be
passed (it's going to be resolved to dc name and address) instead
of specific server name. */
- domain_name = lp_workgroup(global_loadparm);
+ domain_name = lp_workgroup(torture->lp_ctx);
/*
* Testing synchronous version
@@ -338,7 +338,7 @@ bool torture_domain_close_samr(struct torture_context *torture)
goto done;
}
- domain_name.string = talloc_strdup(mem_ctx, lp_workgroup(global_loadparm));
+ domain_name.string = talloc_strdup(mem_ctx, lp_workgroup(torture->lp_ctx));
if (!test_opendomain_samr(p, torture, &h, &domain_name, &access_mask, &sid)) {
d_printf("failed to open domain on samr service\n");
diff --git a/source4/torture/libnet/libnet_group.c b/source4/torture/libnet/libnet_group.c
index a4489d376d..5029d77dd6 100644
--- a/source4/torture/libnet/libnet_group.c
+++ b/source4/torture/libnet/libnet_group.c
@@ -226,7 +226,7 @@ bool torture_groupinfo_api(struct torture_context *torture)
return false;
}
- domain_name.string = lp_workgroup(global_loadparm);
+ domain_name.string = lp_workgroup(torture->lp_ctx);
if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) {
ret = false;
goto done;
diff --git a/source4/torture/libnet/libnet_lookup.c b/source4/torture/libnet/libnet_lookup.c
index 4734ec5088..6b4c03beb7 100644
--- a/source4/torture/libnet/libnet_lookup.c
+++ b/source4/torture/libnet/libnet_lookup.c
@@ -138,7 +138,7 @@ bool torture_lookup_pdc(struct torture_context *torture)
goto done;
}
- lookup->in.domain_name = lp_workgroup(global_loadparm);
+ lookup->in.domain_name = lp_workgroup(torture->lp_ctx);
lookup->in.name_type = NBT_NAME_PDC;
status = libnet_LookupDCs(ctx, mem_ctx, lookup);
@@ -178,7 +178,7 @@ bool torture_lookup_sam_name(struct torture_context *torture)
if (mem_ctx == NULL) return false;
r.in.name = "Administrator";
- r.in.domain_name = lp_workgroup(global_loadparm);
+ r.in.domain_name = lp_workgroup(torture->lp_ctx);
status = libnet_LookupName(ctx, mem_ctx, &r);
diff --git a/source4/torture/libnet/libnet_rpc.c b/source4/torture/libnet/libnet_rpc.c
index 5ca927a1e3..1e042c77a6 100644
--- a/source4/torture/libnet/libnet_rpc.c
+++ b/source4/torture/libnet/libnet_rpc.c
@@ -163,7 +163,7 @@ bool torture_rpc_connect_pdc(struct torture_context *torture)
/* we're accessing domain controller so the domain name should be
passed (it's going to be resolved to dc name and address) instead
of specific server name. */
- domain_name = lp_workgroup(global_loadparm);
+ domain_name = lp_workgroup(torture->lp_ctx);
return torture_rpc_connect(torture, level, NULL, domain_name);
}
@@ -183,7 +183,7 @@ bool torture_rpc_connect_dc(struct torture_context *torture)
/* we're accessing domain controller so the domain name should be
passed (it's going to be resolved to dc name and address) instead
of specific server name. */
- domain_name = lp_workgroup(global_loadparm);
+ domain_name = lp_workgroup(torture->lp_ctx);
return torture_rpc_connect(torture, level, NULL, domain_name);
}
@@ -203,7 +203,7 @@ bool torture_rpc_connect_dc_info(struct torture_context *torture)
/* we're accessing domain controller so the domain name should be
passed (it's going to be resolved to dc name and address) instead
of specific server name. */
- domain_name = lp_workgroup(global_loadparm);
+ domain_name = lp_workgroup(torture->lp_ctx);
return torture_rpc_connect(torture, level, NULL, domain_name);
}
diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c
index b3aadc776e..514e42c0a5 100644
--- a/source4/torture/libnet/libnet_user.c
+++ b/source4/torture/libnet/libnet_user.c
@@ -245,7 +245,7 @@ bool torture_createuser(struct torture_context *torture)
ctx->cred = cmdline_credentials;
req.in.user_name = TEST_USERNAME;
- req.in.domain_name = lp_workgroup(global_loadparm);
+ req.in.domain_name = lp_workgroup(torture->lp_ctx);
req.out.error_string = NULL;
status = libnet_CreateUser(ctx, mem_ctx, &req);
@@ -291,7 +291,7 @@ bool torture_deleteuser(struct torture_context *torture)
ctx->cred = cmdline_credentials;
req.in.user_name = TEST_USERNAME;
- req.in.domain_name = lp_workgroup(global_loadparm);
+ req.in.domain_name = lp_workgroup(torture->lp_ctx);
status = torture_rpc_connection(torture,
&p,
@@ -301,7 +301,7 @@ bool torture_deleteuser(struct torture_context *torture)
goto done;
}
- domain_name.string = lp_workgroup(global_loadparm);
+ domain_name.string = lp_workgroup(torture->lp_ctx);
if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) {
ret = false;
goto done;
@@ -488,7 +488,7 @@ bool torture_modifyuser(struct torture_context *torture)
name = talloc_strdup(prep_mem_ctx, TEST_USERNAME);
- domain_name.string = lp_workgroup(global_loadparm);
+ domain_name.string = lp_workgroup(torture->lp_ctx);
if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) {
ret = false;
goto done;
@@ -511,7 +511,7 @@ bool torture_modifyuser(struct torture_context *torture)
for (fld = 1; fld < FIELDS_NUM - 1; fld++) {
ZERO_STRUCT(req);
- req.in.domain_name = lp_workgroup(global_loadparm);
+ req.in.domain_name = lp_workgroup(torture->lp_ctx);
req.in.user_name = name;
set_test_changes(mem_ctx, &req, 1, &name, fld);
@@ -524,7 +524,7 @@ bool torture_modifyuser(struct torture_context *torture)
}
ZERO_STRUCT(user_req);
- user_req.in.domain_name = lp_workgroup(global_loadparm);
+ user_req.in.domain_name = lp_workgroup(torture->lp_ctx);
user_req.in.user_name = name;
status = libnet_UserInfo(ctx, mem_ctx, &user_req);
@@ -563,7 +563,7 @@ bool torture_modifyuser(struct torture_context *torture)
/* restore original testing username - it's useful when test fails
because it prevents from problems with recreating account */
ZERO_STRUCT(req);
- req.in.domain_name = lp_workgroup(global_loadparm);
+ req.in.domain_name = lp_workgroup(torture->lp_ctx);
req.in.user_name = name;
req.in.account_name = TEST_USERNAME;
@@ -624,7 +624,7 @@ bool torture_userinfo_api(struct torture_context *torture)
return false;
}
- domain_name.string = lp_workgroup(global_loadparm);
+ domain_name.string = lp_workgroup(torture->lp_ctx);
if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) {
ret = false;
goto done;
@@ -682,7 +682,7 @@ bool torture_userlist(struct torture_context *torture)
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
- domain_name.string = lp_workgroup(global_loadparm);
+ domain_name.string = lp_workgroup(torture->lp_ctx);
mem_ctx = talloc_init("torture user list");
ZERO_STRUCT(req);
diff --git a/source4/torture/libnet/userinfo.c b/source4/torture/libnet/userinfo.c
index 46a9a6a015..e862435d20 100644
--- a/source4/torture/libnet/userinfo.c
+++ b/source4/torture/libnet/userinfo.c
@@ -147,7 +147,7 @@ bool torture_userinfo(struct torture_context *torture)
return false;
}
- name.string = lp_workgroup(global_loadparm);
+ name.string = lp_workgroup(torture->lp_ctx);
/*
* Testing synchronous version
diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c
index e834938bc5..0d08284a9f 100644
--- a/source4/torture/libnet/userman.c
+++ b/source4/torture/libnet/userman.c
@@ -325,7 +325,7 @@ bool torture_useradd(struct torture_context *torture)
return false;
}
- domain_name.string = lp_workgroup(global_loadparm);
+ domain_name.string = lp_workgroup(torture->lp_ctx);
if (!test_opendomain(p, mem_ctx, &h, &domain_name, &sid)) {
ret = false;
goto done;
@@ -384,7 +384,7 @@ bool torture_userdel(struct torture_context *torture)
return false;
}
- domain_name.string = lp_workgroup(global_loadparm);
+ domain_name.string = lp_workgroup(torture->lp_ctx);
if (!test_opendomain(p, mem_ctx, &h, &domain_name, &sid)) {
ret = false;
goto done;
@@ -430,7 +430,7 @@ bool torture_usermod(struct torture_context *torture)
goto done;
}
- domain_name.string = lp_workgroup(global_loadparm);
+ domain_name.string = lp_workgroup(torture->lp_ctx);
name = talloc_strdup(mem_ctx, TEST_USERNAME);
if (!test_opendomain(p, mem_ctx, &h, &domain_name, &sid)) {
diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c
index 8bef01c20a..47af7935fb 100644
--- a/source4/torture/local/dbspeed.c
+++ b/source4/torture/local/dbspeed.c
@@ -176,7 +176,7 @@ static bool test_ldb_speed(struct torture_context *torture, const void *_data)
torture_comment(torture, "Testing ldb speed for sidmap\n");
- ldb = ldb_wrap_connect(tmp_ctx, global_loadparm, "tdb://test.ldb",
+ ldb = ldb_wrap_connect(tmp_ctx, torture->lp_ctx, "tdb://test.ldb",
NULL, NULL, LDB_FLG_NOSYNC, NULL);
if (!ldb) {
unlink("./test.ldb");
diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c
index e9cfda4b17..e0d7abdc35 100644
--- a/source4/torture/nbt/dgram.c
+++ b/source4/torture/nbt/dgram.c
@@ -78,7 +78,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
const char *address;
struct nbt_name name;
- name.name = lp_workgroup(global_loadparm);
+ name.name = lp_workgroup(tctx->lp_ctx);
name.type = NBT_NAME_LOGON;
name.scope = NULL;
@@ -91,7 +91,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
- myaddress, lp_dgram_port(global_loadparm));
+ myaddress, lp_dgram_port(tctx->lp_ctx));
torture_assert(tctx, socket_address != NULL, "Error getting address");
/* try receiving replies on port 138 first, which will only
@@ -157,7 +157,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
const char *address;
struct nbt_name name;
- name.name = lp_workgroup(global_loadparm);
+ name.name = lp_workgroup(tctx->lp_ctx);
name.type = NBT_NAME_LOGON;
name.scope = NULL;
@@ -169,7 +169,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
myaddress = talloc_strdup(dgmsock, iface_best_ip(address));
socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
- myaddress, lp_dgram_port(global_loadparm));
+ myaddress, lp_dgram_port(tctx->lp_ctx));
torture_assert(tctx, socket_address != NULL, "Error getting address");
/* try receiving replies on port 138 first, which will only
@@ -266,7 +266,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
const char *address;
struct nbt_name name;
- name.name = lp_workgroup(global_loadparm);
+ name.name = lp_workgroup(tctx->lp_ctx);
name.type = NBT_NAME_LOGON;
name.scope = NULL;
@@ -278,7 +278,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
myaddress = talloc_strdup(dgmsock, iface_best_ip(address));
socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
- myaddress, lp_dgram_port(global_loadparm));
+ myaddress, lp_dgram_port(tctx->lp_ctx));
torture_assert(tctx, socket_address != NULL, "Error getting address");
/* try receiving replies on port 138 first, which will only
@@ -299,7 +299,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
ACB_WSTRUST, &machine_credentials);
torture_assert(tctx, join_ctx != NULL,
talloc_asprintf(tctx, "Failed to join domain %s as %s\n",
- lp_workgroup(global_loadparm), TEST_NAME));
+ lp_workgroup(tctx->lp_ctx), TEST_NAME));
dom_sid = torture_join_sid(join_ctx);
diff --git a/source4/torture/nbt/winsreplication.c b/source4/torture/nbt/winsreplication.c
index f0b17b9778..2164ebf8b2 100644
--- a/source4/torture/nbt/winsreplication.c
+++ b/source4/torture/nbt/winsreplication.c
@@ -629,7 +629,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
if (!ctx->nbtsock_srv) return NULL;
/* Make a port 137 version of ctx->myaddr */
- nbt_srv_addr = socket_address_from_strings(tctx, ctx->nbtsock_srv->sock->backend_name, ctx->myaddr->addr, lp_nbt_port(global_loadparm));
+ nbt_srv_addr = socket_address_from_strings(tctx, ctx->nbtsock_srv->sock->backend_name, ctx->myaddr->addr, lp_nbt_port(tctx->lp_ctx));
if (!nbt_srv_addr) return NULL;
/* And if possible, bind to it. This won't work unless we are root or in sockewrapper */
@@ -655,7 +655,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
nbt_srv_addr = socket_address_from_strings(tctx,
ctx->nbtsock_srv->sock->backend_name,
ctx->myaddr2->addr,
- lp_nbt_port(global_loadparm));
+ lp_nbt_port(tctx->lp_ctx));
if (!nbt_srv_addr) return NULL;
/* And if possible, bind to it. This won't work unless we are root or in sockewrapper */
@@ -9156,7 +9156,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
if (!ctx->nbtsock_srv) {
torture_comment(tctx, "SKIP: Test Replica records vs. owned active records: not bound to port[%d]\n",
- lp_nbt_port(global_loadparm));
+ lp_nbt_port(tctx->lp_ctx));
return true;
}
diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c
index c6969574a8..5a663fb565 100644
--- a/source4/torture/raw/composite.c
+++ b/source4/torture/raw/composite.c
@@ -43,7 +43,7 @@ static void loadfile_complete(struct composite_context *c)
/*
test a simple savefile/loadfile combination
*/
-static bool test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_loadfile(struct smbcli_state *cli, struct torture_context *tctx)
{
const char *fname = BASEDIR "\\test.txt";
NTSTATUS status;
@@ -54,9 +54,9 @@ static bool test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
size_t len = random() % 100000;
const int num_ops = 50;
int i;
- int *count = talloc_zero(mem_ctx, int);
+ int *count = talloc_zero(tctx, int);
- data = talloc_array(mem_ctx, uint8_t, len);
+ data = talloc_array(tctx, uint8_t, len);
generate_random_buffer(data, len);
@@ -76,7 +76,7 @@ static bool test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing parallel loadfile with %d ops\n", num_ops);
- c = talloc_array(mem_ctx, struct composite_context *, num_ops);
+ c = talloc_array(tctx, struct composite_context *, num_ops);
for (i=0;i<num_ops;i++) {
c[i] = smb_composite_loadfile_send(cli->tree, &io2);
@@ -87,7 +87,7 @@ static bool test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("waiting for completion\n");
while (*count != num_ops) {
event_loop_once(cli->transport->socket->event.ctx);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "progress", true)) {
+ if (torture_setting_bool(tctx, "progress", true)) {
printf("(%s) count=%d\r", __location__, *count);
fflush(stdout);
}
@@ -95,7 +95,7 @@ static bool test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("count=%d\n", *count);
for (i=0;i<num_ops;i++) {
- status = smb_composite_loadfile_recv(c[i], mem_ctx);
+ status = smb_composite_loadfile_recv(c[i], tctx);
if (!NT_STATUS_IS_OK(status)) {
printf("(%s) loadfile[%d] failed - %s\n", __location__, i, nt_errstr(status));
return false;
@@ -121,7 +121,7 @@ static bool test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/*
test a simple savefile/loadfile combination
*/
-static bool test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_fetchfile(struct smbcli_state *cli, struct torture_context *tctx)
{
const char *fname = BASEDIR "\\test.txt";
NTSTATUS status;
@@ -133,10 +133,10 @@ static bool test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
size_t len = random() % 10000;
extern int torture_numops;
struct event_context *event_ctx;
- int *count = talloc_zero(mem_ctx, int);
+ int *count = talloc_zero(tctx, int);
bool ret = true;
- data = talloc_array(mem_ctx, uint8_t, len);
+ data = talloc_array(tctx, uint8_t, len);
generate_random_buffer(data, len);
@@ -152,20 +152,20 @@ static bool test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
return false;
}
- io2.in.dest_host = lp_parm_string(global_loadparm, NULL, "torture", "host");
+ io2.in.dest_host = torture_setting_string(tctx, "host", NULL);
io2.in.port = 0;
- io2.in.called_name = lp_parm_string(global_loadparm, NULL, "torture", "host");
- io2.in.service = lp_parm_string(global_loadparm, NULL, "torture", "share");
+ io2.in.called_name = torture_setting_string(tctx, "host", NULL);
+ io2.in.service = torture_setting_string(tctx, "share", NULL);
io2.in.service_type = "A:";
io2.in.credentials = cmdline_credentials;
- io2.in.workgroup = lp_workgroup(global_loadparm);
+ io2.in.workgroup = lp_workgroup(tctx->lp_ctx);
io2.in.filename = fname;
printf("testing parallel fetchfile with %d ops\n", torture_numops);
event_ctx = cli->transport->socket->event.ctx;
- c = talloc_array(mem_ctx, struct composite_context *, torture_numops);
+ c = talloc_array(tctx, struct composite_context *, torture_numops);
for (i=0; i<torture_numops; i++) {
c[i] = smb_composite_fetchfile_send(&io2, event_ctx);
@@ -177,7 +177,7 @@ static bool test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
while (*count != torture_numops) {
event_loop_once(event_ctx);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "progress", true)) {
+ if (torture_setting_bool(tctx, "progress", true)) {
printf("(%s) count=%d\r", __location__, *count);
fflush(stdout);
}
@@ -185,7 +185,7 @@ static bool test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("count=%d\n", *count);
for (i=0;i<torture_numops;i++) {
- status = smb_composite_fetchfile_recv(c[i], mem_ctx);
+ status = smb_composite_fetchfile_recv(c[i], tctx);
if (!NT_STATUS_IS_OK(status)) {
printf("(%s) loadfile[%d] failed - %s\n", __location__, i,
nt_errstr(status));
@@ -214,7 +214,7 @@ static bool test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/*
test setfileacl
*/
-static bool test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_appendacl(struct smbcli_state *cli, struct torture_context *tctx)
{
struct smb_composite_appendacl **io;
struct smb_composite_appendacl **io_orig;
@@ -226,13 +226,13 @@ static bool test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
struct dom_sid *test_sid;
const int num_ops = 50;
- int *count = talloc_zero(mem_ctx, int);
+ int *count = talloc_zero(tctx, int);
struct smb_composite_savefile io1;
NTSTATUS status;
int i;
- io_orig = talloc_array(mem_ctx, struct smb_composite_appendacl *, num_ops);
+ io_orig = talloc_array(tctx, struct smb_composite_appendacl *, num_ops);
printf ("creating %d empty files and getting their acls with appendacl\n", num_ops);
@@ -260,10 +260,10 @@ static bool test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* fill Security Descriptor with aces to be added */
- test_sd = security_descriptor_initialise(mem_ctx);
- test_sid = dom_sid_parse_talloc (mem_ctx, "S-1-5-32-1234-5432");
+ test_sd = security_descriptor_initialise(tctx);
+ test_sid = dom_sid_parse_talloc (tctx, "S-1-5-32-1234-5432");
- ace = talloc_zero(mem_ctx, struct security_ace);
+ ace = talloc_zero(tctx, struct security_ace);
ace->type = SEC_ACE_TYPE_ACCESS_ALLOWED;
ace->flags = 0;
@@ -280,8 +280,8 @@ static bool test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing parallel appendacl with %d ops\n", num_ops);
- c = talloc_array(mem_ctx, struct composite_context *, num_ops);
- io = talloc_array(mem_ctx, struct smb_composite_appendacl *, num_ops);
+ c = talloc_array(tctx, struct composite_context *, num_ops);
+ io = talloc_array(tctx, struct smb_composite_appendacl *, num_ops);
for (i=0; i < num_ops; i++) {
io[i] = talloc (io, struct smb_composite_appendacl);
@@ -293,11 +293,11 @@ static bool test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
c[i]->async.private_data = count;
}
- event_ctx = talloc_reference(mem_ctx, cli->tree->session->transport->socket->event.ctx);
+ event_ctx = talloc_reference(tctx, cli->tree->session->transport->socket->event.ctx);
printf("waiting for completion\n");
while (*count != num_ops) {
event_loop_once(event_ctx);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "progress", true)) {
+ if (torture_setting_bool(tctx, "progress", true)) {
printf("(%s) count=%d\r", __location__, *count);
fflush(stdout);
}
@@ -327,7 +327,7 @@ static bool test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
}
/* test a query FS info by asking for share's GUID */
-static bool test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_fsinfo(struct smbcli_state *cli, struct torture_context *tctx)
{
char *guid = NULL;
NTSTATUS status;
@@ -337,22 +337,22 @@ static bool test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
int i;
extern int torture_numops;
struct event_context *event_ctx;
- int *count = talloc_zero(mem_ctx, int);
+ int *count = talloc_zero(tctx, int);
bool ret = true;
- io1.in.dest_host = lp_parm_string(global_loadparm, NULL, "torture", "host");
+ io1.in.dest_host = torture_setting_string(tctx, "host", NULL);
io1.in.port = 0;
- io1.in.called_name = lp_parm_string(global_loadparm, NULL, "torture", "host");
- io1.in.service = lp_parm_string(global_loadparm, NULL, "torture", "share");
+ io1.in.called_name = torture_setting_string(tctx, "host", NULL);
+ io1.in.service = torture_setting_string(tctx, "share", NULL);
io1.in.service_type = "A:";
io1.in.credentials = cmdline_credentials;
- io1.in.workgroup = lp_workgroup(global_loadparm);
+ io1.in.workgroup = lp_workgroup(tctx->lp_ctx);
io1.in.level = RAW_QFS_OBJECTID_INFORMATION;
printf("testing parallel queryfsinfo [Object ID] with %d ops\n", torture_numops);
- event_ctx = talloc_reference(mem_ctx, cli->tree->session->transport->socket->event.ctx);
- c = talloc_array(mem_ctx, struct composite_context *, torture_numops);
+ event_ctx = talloc_reference(tctx, cli->tree->session->transport->socket->event.ctx);
+ c = talloc_array(tctx, struct composite_context *, torture_numops);
for (i=0; i<torture_numops; i++) {
c[i] = smb_composite_fsinfo_send(cli->tree,&io1);
@@ -364,7 +364,7 @@ static bool test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
while (*count < torture_numops) {
event_loop_once(event_ctx);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "progress", true)) {
+ if (torture_setting_bool(tctx, "progress", true)) {
printf("(%s) count=%d\r", __location__, *count);
fflush(stdout);
}
@@ -372,7 +372,7 @@ static bool test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("count=%d\n", *count);
for (i=0;i<torture_numops;i++) {
- status = smb_composite_fsinfo_recv(c[i], mem_ctx);
+ status = smb_composite_fsinfo_recv(c[i], tctx);
if (!NT_STATUS_IS_OK(status)) {
printf("(%s) fsinfo[%d] failed - %s\n", __location__, i, nt_errstr(status));
ret = false;
@@ -387,7 +387,7 @@ static bool test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
continue;
}
- guid=GUID_string(mem_ctx, &io1.out.fsinfo->objectid_information.out.guid);
+ guid=GUID_string(tctx, &io1.out.fsinfo->objectid_information.out.guid);
printf("[%d] GUID: %s\n", i, guid);
diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c
index 11ad11ab3f..20135d2fa9 100644
--- a/source4/torture/raw/context.c
+++ b/source4/torture/raw/context.c
@@ -59,7 +59,7 @@
/*
test session ops
*/
-static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_session(struct smbcli_state *cli, struct torture_context *tctx)
{
NTSTATUS status;
bool ret = true;
@@ -88,11 +88,11 @@ static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
}
printf("create a second security context on the same transport\n");
- session = smbcli_session_init(cli->transport, mem_ctx, false);
+ session = smbcli_session_init(cli->transport, tctx, false);
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */
- setup.in.workgroup = lp_workgroup(global_loadparm);
+ setup.in.workgroup = lp_workgroup(tctx->lp_ctx);
setup.in.credentials = cmdline_credentials;
@@ -102,12 +102,12 @@ static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
session->vuid = setup.out.vuid;
printf("create a third security context on the same transport, with vuid set\n");
- session2 = smbcli_session_init(cli->transport, mem_ctx, false);
+ session2 = smbcli_session_init(cli->transport, tctx, false);
session2->vuid = session->vuid;
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */
- setup.in.workgroup = lp_workgroup(global_loadparm);
+ setup.in.workgroup = lp_workgroup(tctx->lp_ctx);
setup.in.credentials = cmdline_credentials;
@@ -129,12 +129,12 @@ static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
if (cli->transport->negotiate.capabilities & CAP_EXTENDED_SECURITY) {
printf("create a fourth security context on the same transport, without extended security\n");
- session3 = smbcli_session_init(cli->transport, mem_ctx, false);
+ session3 = smbcli_session_init(cli->transport, tctx, false);
session3->vuid = session->vuid;
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities &= ~CAP_EXTENDED_SECURITY; /* force a non extended security login (should fail) */
- setup.in.workgroup = lp_workgroup(global_loadparm);
+ setup.in.workgroup = lp_workgroup(tctx->lp_ctx);
setup.in.credentials = cmdline_credentials;
@@ -143,15 +143,15 @@ static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_LOGON_FAILURE);
printf("create a fouth anonymous security context on the same transport, without extended security\n");
- session4 = smbcli_session_init(cli->transport, mem_ctx, false);
+ session4 = smbcli_session_init(cli->transport, tctx, false);
session4->vuid = session->vuid;
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities &= ~CAP_EXTENDED_SECURITY; /* force a non extended security login (should fail) */
- setup.in.workgroup = lp_workgroup(global_loadparm);
+ setup.in.workgroup = lp_workgroup(tctx->lp_ctx);
- anon_creds = cli_credentials_init(mem_ctx);
- cli_credentials_set_conf(anon_creds, global_loadparm);
+ anon_creds = cli_credentials_init(tctx);
+ cli_credentials_set_conf(anon_creds, tctx->lp_ctx);
cli_credentials_set_anonymous(anon_creds);
setup.in.credentials = anon_creds;
@@ -163,7 +163,7 @@ static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
}
printf("use the same tree as the existing connection\n");
- tree = smbcli_tree_init(session, mem_ctx, false);
+ tree = smbcli_tree_init(session, tctx, false);
tree->tid = cli->tree->tid;
printf("create a file using the new vuid\n");
@@ -179,7 +179,7 @@ static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.fname = fname;
- status = smb_raw_open(tree, mem_ctx, &io);
+ status = smb_raw_open(tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
@@ -225,11 +225,11 @@ static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
for (i=0; i <ARRAY_SIZE(sessions); i++) {
setups[i].in.sesskey = cli->transport->negotiate.sesskey;
setups[i].in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */
- setups[i].in.workgroup = lp_workgroup(global_loadparm);
+ setups[i].in.workgroup = lp_workgroup(tctx->lp_ctx);
setups[i].in.credentials = cmdline_credentials;
- sessions[i] = smbcli_session_init(cli->transport, mem_ctx, false);
+ sessions[i] = smbcli_session_init(cli->transport, tctx, false);
composite_contexts[i] = smb_composite_sesssetup_send(sessions[i], &setups[i]);
}
@@ -257,7 +257,7 @@ done:
/*
test tree ops
*/
-static bool test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_tree(struct smbcli_state *cli, struct torture_context *tctx)
{
NTSTATUS status;
bool ret = true;
@@ -277,18 +277,18 @@ static bool test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
return false;
}
- share = lp_parm_string(global_loadparm, NULL, "torture", "share");
- host = lp_parm_string(global_loadparm, NULL, "torture", "host");
+ share = torture_setting_string(tctx, "share", NULL);
+ host = torture_setting_string(tctx, "host", NULL);
printf("create a second tree context on the same session\n");
- tree = smbcli_tree_init(cli->session, mem_ctx, false);
+ tree = smbcli_tree_init(cli->session, tctx, false);
tcon.generic.level = RAW_TCON_TCONX;
tcon.tconx.in.flags = 0;
tcon.tconx.in.password = data_blob(NULL, 0);
- tcon.tconx.in.path = talloc_asprintf(mem_ctx, "\\\\%s\\%s", host, share);
+ tcon.tconx.in.path = talloc_asprintf(tctx, "\\\\%s\\%s", host, share);
tcon.tconx.in.device = "A:";
- status = smb_raw_tcon(tree, mem_ctx, &tcon);
+ status = smb_raw_tcon(tree, tctx, &tcon);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -297,7 +297,7 @@ static bool test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("try a tconx with a bad device type\n");
tcon.tconx.in.device = "FOO";
- status = smb_raw_tcon(tree, mem_ctx, &tcon);
+ status = smb_raw_tcon(tree, tctx, &tcon);
CHECK_STATUS(status, NT_STATUS_BAD_DEVICE_TYPE);
@@ -314,7 +314,7 @@ static bool test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.fname = fname;
- status = smb_raw_open(tree, mem_ctx, &io);
+ status = smb_raw_open(tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
@@ -362,7 +362,7 @@ done:
this demonstrates that a tcon isn't autoclosed by a ulogoff
the tcon can be reused using any other valid session later
*/
-static bool test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_tree_ulogoff(struct smbcli_state *cli, struct torture_context *tctx)
{
NTSTATUS status;
bool ret = true;
@@ -385,14 +385,14 @@ static bool test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
return false;
}
- share = lp_parm_string(global_loadparm, NULL, "torture", "share");
- host = lp_parm_string(global_loadparm, NULL, "torture", "host");
+ share = torture_setting_string(tctx, "share", NULL);
+ host = torture_setting_string(tctx, "host", NULL);
printf("create the first new sessions\n");
- session1 = smbcli_session_init(cli->transport, mem_ctx, false);
+ session1 = smbcli_session_init(cli->transport, tctx, false);
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities = cli->transport->negotiate.capabilities;
- setup.in.workgroup = lp_workgroup(global_loadparm);
+ setup.in.workgroup = lp_workgroup(tctx->lp_ctx);
setup.in.credentials = cmdline_credentials;
status = smb_composite_sesssetup(session1, &setup);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -400,13 +400,13 @@ static bool test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("vuid1=%d\n", session1->vuid);
printf("create a tree context on the with vuid1\n");
- tree = smbcli_tree_init(session1, mem_ctx, false);
+ tree = smbcli_tree_init(session1, tctx, false);
tcon.generic.level = RAW_TCON_TCONX;
tcon.tconx.in.flags = 0;
tcon.tconx.in.password = data_blob(NULL, 0);
- tcon.tconx.in.path = talloc_asprintf(mem_ctx, "\\\\%s\\%s", host, share);
+ tcon.tconx.in.path = talloc_asprintf(tctx, "\\\\%s\\%s", host, share);
tcon.tconx.in.device = "A:";
- status = smb_raw_tcon(tree, mem_ctx, &tcon);
+ status = smb_raw_tcon(tree, tctx, &tcon);
CHECK_STATUS(status, NT_STATUS_OK);
tree->tid = tcon.tconx.out.tid;
printf("tid=%d\n", tree->tid);
@@ -424,7 +424,7 @@ static bool test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.fname = fname1;
- status = smb_raw_open(tree, mem_ctx, &io);
+ status = smb_raw_open(tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum1 = io.ntcreatex.out.file.fnum;
@@ -445,10 +445,10 @@ static bool test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
printf("create the second new sessions\n");
- session2 = smbcli_session_init(cli->transport, mem_ctx, false);
+ session2 = smbcli_session_init(cli->transport, tctx, false);
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities = cli->transport->negotiate.capabilities;
- setup.in.workgroup = lp_workgroup(global_loadparm);
+ setup.in.workgroup = lp_workgroup(tctx->lp_ctx);
setup.in.credentials = cmdline_credentials;
status = smb_composite_sesssetup(session2, &setup);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -471,7 +471,7 @@ static bool test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.fname = fname2;
- status = smb_raw_open(tree, mem_ctx, &io);
+ status = smb_raw_open(tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum2 = io.ntcreatex.out.file.fnum;
@@ -620,7 +620,7 @@ done:
/*
test pid ops with 2 sessions
*/
-static bool test_pid_2sess(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_pid_2sess(struct smbcli_state *cli, struct torture_context *tctx)
{
NTSTATUS status;
bool ret = true;
@@ -641,11 +641,11 @@ static bool test_pid_2sess(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
}
printf("create a second security context on the same transport\n");
- session = smbcli_session_init(cli->transport, mem_ctx, false);
+ session = smbcli_session_init(cli->transport, tctx, false);
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */
- setup.in.workgroup = lp_workgroup(global_loadparm);
+ setup.in.workgroup = lp_workgroup(tctx->lp_ctx);
setup.in.credentials = cmdline_credentials;
@@ -672,7 +672,7 @@ static bool test_pid_2sess(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.fname = fname;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
@@ -724,7 +724,7 @@ done:
/*
test pid ops with 2 tcons
*/
-static bool test_pid_2tcon(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_pid_2tcon(struct smbcli_state *cli, struct torture_context *tctx)
{
NTSTATUS status;
bool ret = true;
@@ -746,18 +746,18 @@ static bool test_pid_2tcon(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
return false;
}
- share = lp_parm_string(global_loadparm, NULL, "torture", "share");
- host = lp_parm_string(global_loadparm, NULL, "torture", "host");
+ share = torture_setting_string(tctx, "share", NULL);
+ host = torture_setting_string(tctx, "host", NULL);
printf("create a second tree context on the same session\n");
- tree = smbcli_tree_init(cli->session, mem_ctx, false);
+ tree = smbcli_tree_init(cli->session, tctx, false);
tcon.generic.level = RAW_TCON_TCONX;
tcon.tconx.in.flags = 0;
tcon.tconx.in.password = data_blob(NULL, 0);
- tcon.tconx.in.path = talloc_asprintf(mem_ctx, "\\\\%s\\%s", host, share);
+ tcon.tconx.in.path = talloc_asprintf(tctx, "\\\\%s\\%s", host, share);
tcon.tconx.in.device = "A:";
- status = smb_raw_tcon(tree, mem_ctx, &tcon);
+ status = smb_raw_tcon(tree, tctx, &tcon);
CHECK_STATUS(status, NT_STATUS_OK);
tree->tid = tcon.tconx.out.tid;
@@ -780,7 +780,7 @@ static bool test_pid_2tcon(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.fname = fname1;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum1 = io.ntcreatex.out.file.fnum;
@@ -811,7 +811,7 @@ static bool test_pid_2tcon(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.fname = fname2;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum2 = io.ntcreatex.out.file.fnum;
@@ -890,9 +890,9 @@ bool torture_raw_context(struct torture_context *torture,
struct smbcli_state *cli)
{
bool ret = true;
- if (lp_use_spnego(global_loadparm)) {
+ if (lp_use_spnego(torture->lp_ctx)) {
ret &= torture_raw_context_int(torture, cli);
- lp_set_cmdline(global_loadparm, "use spnego", "False");
+ lp_set_cmdline(torture->lp_ctx, "use spnego", "False");
}
ret &= torture_raw_context_int(torture, cli);
diff --git a/source4/torture/raw/eas.c b/source4/torture/raw/eas.c
index b24b98796f..53449a1505 100644
--- a/source4/torture/raw/eas.c
+++ b/source4/torture/raw/eas.c
@@ -229,7 +229,7 @@ static int test_one_eamax(struct smbcli_state *cli, const int fnum,
* --option torture:maxeasize=1024 --option torture:maxeadebug=1 ...
*
*/
-static bool test_max_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_max_eas(struct smbcli_state *cli, struct torture_context *tctx)
{
NTSTATUS status;
union smb_open io;
@@ -247,10 +247,10 @@ static bool test_max_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("TESTING SETFILEINFO MAX. EA_SET\n");
- maxeasize = lp_parm_int(global_loadparm, NULL, "torture", "maxeasize", 65536);
- maxeanames = lp_parm_int(global_loadparm, NULL, "torture", "maxeanames", 101);
- maxeastart = lp_parm_int(global_loadparm, NULL, "torture", "maxeastart", 1);
- maxeadebug = lp_parm_int(global_loadparm, NULL, "torture", "maxeadebug", 0);
+ maxeasize = torture_setting_int(tctx, "maxeasize", 65536);
+ maxeanames = torture_setting_int(tctx, "maxeanames", 101);
+ maxeastart = torture_setting_int(tctx, "maxeastart", 1);
+ maxeadebug = torture_setting_int(tctx, "maxeadebug", 0);
/* Do some sanity check on possibly passed parms */
if (maxeasize <= 0) {
@@ -296,11 +296,11 @@ static bool test_max_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.fname = fname;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
- eablob = data_blob_talloc(mem_ctx, NULL, maxeasize);
+ eablob = data_blob_talloc(tctx, NULL, maxeasize);
if (eablob.data == NULL) {
goto done;
}
@@ -336,7 +336,7 @@ static bool test_max_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
if (eaname != NULL) {
talloc_free(eaname);
}
- eaname = talloc_asprintf(mem_ctx, "MAX%d", i);
+ eaname = talloc_asprintf(tctx, "MAX%d", i);
if(eaname == NULL) {
goto done;
}
@@ -468,19 +468,16 @@ bool torture_max_eas(struct torture_context *torture)
{
struct smbcli_state *cli;
bool ret = true;
- TALLOC_CTX *mem_ctx;
if (!torture_open_connection(&cli, 0)) {
return false;
}
- mem_ctx = talloc_init("torture_raw_eas");
-
if (!torture_setup_dir(cli, BASEDIR)) {
return false;
}
- ret &= test_max_eas(cli, mem_ctx);
+ ret &= test_max_eas(cli, torture);
smb_raw_exit(cli->session);
if (!maxeadebug) {
@@ -489,6 +486,5 @@ bool torture_max_eas(struct torture_context *torture)
}
torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c
index c2d5a778fb..6eb43bd538 100644
--- a/source4/torture/raw/lock.c
+++ b/source4/torture/raw/lock.c
@@ -592,15 +592,15 @@ static bool test_async(struct torture_context *tctx,
session = smbcli_session_init(cli->transport, tctx, false);
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities = cli->transport->negotiate.capabilities;
- setup.in.workgroup = lp_workgroup(global_loadparm);
+ setup.in.workgroup = lp_workgroup(tctx->lp_ctx);
setup.in.credentials = cmdline_credentials;
status = smb_composite_sesssetup(session, &setup);
CHECK_STATUS(status, NT_STATUS_OK);
session->vuid = setup.out.vuid;
printf("create new tree context\n");
- share = lp_parm_string(global_loadparm, NULL, "torture", "share");
- host = lp_parm_string(global_loadparm, NULL, "torture", "host");
+ share = torture_setting_string(tctx, "share", NULL);
+ host = torture_setting_string(tctx, "host", NULL);
tree = smbcli_tree_init(session, tctx, false);
tcon.generic.level = RAW_TCON_TCONX;
tcon.tconx.in.flags = 0;
diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c
index 855364b169..633264ce0a 100644
--- a/source4/torture/raw/lockbench.c
+++ b/source4/torture/raw/lockbench.c
@@ -318,7 +318,7 @@ bool torture_bench_lock(struct torture_context *torture)
progress = torture_setting_bool(torture, "progress", true);
- nprocs = lp_parm_int(global_loadparm, NULL, "torture", "nprocs", 4);
+ nprocs = torture_setting_int(torture, "nprocs", 4);
state = talloc_zero_array(mem_ctx, struct benchlock_state, nprocs);
diff --git a/source4/torture/raw/mkdir.c b/source4/torture/raw/mkdir.c
index f502b10a69..93e94150d7 100644
--- a/source4/torture/raw/mkdir.c
+++ b/source4/torture/raw/mkdir.c
@@ -37,7 +37,7 @@
/*
test mkdir ops
*/
-static bool test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_mkdir(struct smbcli_state *cli, struct torture_context *tctx)
{
union smb_mkdir md;
struct smb_rmdir rd;
@@ -75,7 +75,7 @@ static bool test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing mkdir collision with file\n");
/* name collision with a file */
- smbcli_close(cli->tree, create_complex_file(cli, mem_ctx, path));
+ smbcli_close(cli->tree, create_complex_file(cli, tctx, path));
status = smb_raw_mkdir(cli->tree, &md);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
@@ -107,7 +107,7 @@ static bool test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
printf("testing t2mkdir bad path\n");
- md.t2mkdir.in.path = talloc_asprintf(mem_ctx, "%s\\bad_path\\bad_path",
+ md.t2mkdir.in.path = talloc_asprintf(tctx, "%s\\bad_path\\bad_path",
BASEDIR);
status = smb_raw_mkdir(cli->tree, &md);
CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND);
@@ -118,19 +118,19 @@ static bool test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
md.t2mkdir.level = RAW_MKDIR_T2MKDIR;
md.t2mkdir.in.path = path;
md.t2mkdir.in.num_eas = 3;
- md.t2mkdir.in.eas = talloc_array(mem_ctx, struct ea_struct, md.t2mkdir.in.num_eas);
+ md.t2mkdir.in.eas = talloc_array(tctx, struct ea_struct, md.t2mkdir.in.num_eas);
md.t2mkdir.in.eas[0].flags = 0;
md.t2mkdir.in.eas[0].name.s = "EAONE";
- md.t2mkdir.in.eas[0].value = data_blob_talloc(mem_ctx, "blah", 4);
+ md.t2mkdir.in.eas[0].value = data_blob_talloc(tctx, "blah", 4);
md.t2mkdir.in.eas[1].flags = 0;
md.t2mkdir.in.eas[1].name.s = "EA TWO";
- md.t2mkdir.in.eas[1].value = data_blob_talloc(mem_ctx, "foo bar", 7);
+ md.t2mkdir.in.eas[1].value = data_blob_talloc(tctx, "foo bar", 7);
md.t2mkdir.in.eas[2].flags = 0;
md.t2mkdir.in.eas[2].name.s = "EATHREE";
- md.t2mkdir.in.eas[2].value = data_blob_talloc(mem_ctx, "xx1", 3);
+ md.t2mkdir.in.eas[2].value = data_blob_talloc(tctx, "xx1", 3);
status = smb_raw_mkdir(cli->tree, &md);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)
+ if (torture_setting_bool(tctx, "samba3", false)
&& NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED)) {
d_printf("EAS not supported -- not treating as fatal\n");
}
diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c
index 96c7e4f947..8687e8e952 100644
--- a/source4/torture/raw/notify.c
+++ b/source4/torture/raw/notify.c
@@ -544,7 +544,7 @@ done:
/*
testing of mask bits for change notify
*/
-static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_notify_mask(struct smbcli_state *cli, struct torture_context *tctx)
{
bool ret = true;
NTSTATUS status;
@@ -585,7 +585,7 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
#define NOTIFY_MASK_TEST(setup, op, cleanup, Action, expected, nchanges) \
do { for (mask=i=0;i<32;i++) { \
struct smbcli_request *req; \
- status = smb_raw_open(cli->tree, mem_ctx, &io); \
+ status = smb_raw_open(cli->tree, tctx, &io); \
CHECK_STATUS(status, NT_STATUS_OK); \
fnum = io.ntcreatex.out.file.fnum; \
setup \
@@ -594,7 +594,7 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
req = smb_raw_changenotify_send(cli->tree, &notify); \
op \
msleep(200); smb_raw_ntcancel(req); \
- status = smb_raw_changenotify_recv(req, mem_ctx, &notify); \
+ status = smb_raw_changenotify_recv(req, tctx, &notify); \
cleanup \
smbcli_close(cli->tree, fnum); \
if (NT_STATUS_EQUAL(status, NT_STATUS_CANCELLED)) continue; \
@@ -705,20 +705,20 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing set file attribute\n");
NOTIFY_MASK_TEST(
- fnum2 = create_complex_file(cli, mem_ctx, BASEDIR "\\tname1");,
+ fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");,
smbcli_fsetatr(cli->tree, fnum2, FILE_ATTRIBUTE_HIDDEN, 0, 0, 0, 0);,
(smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));,
NOTIFY_ACTION_MODIFIED,
FILE_NOTIFY_CHANGE_ATTRIBUTES, 1);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) {
+ if (torture_setting_bool(tctx, "samba3", false)) {
printf("Samba3 does not yet support create times "
"everywhere\n");
}
else {
printf("testing set file create time\n");
NOTIFY_MASK_TEST(
- fnum2 = create_complex_file(cli, mem_ctx,
+ fnum2 = create_complex_file(cli, tctx,
BASEDIR "\\tname1");,
smbcli_fsetatr(cli->tree, fnum2, 0, t, 0, 0, 0);,
(smbcli_close(cli->tree, fnum2),
@@ -729,7 +729,7 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing set file access time\n");
NOTIFY_MASK_TEST(
- fnum2 = create_complex_file(cli, mem_ctx, BASEDIR "\\tname1");,
+ fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");,
smbcli_fsetatr(cli->tree, fnum2, 0, 0, t, 0, 0);,
(smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));,
NOTIFY_ACTION_MODIFIED,
@@ -737,7 +737,7 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing set file write time\n");
NOTIFY_MASK_TEST(
- fnum2 = create_complex_file(cli, mem_ctx, BASEDIR "\\tname1");,
+ fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");,
smbcli_fsetatr(cli->tree, fnum2, 0, 0, 0, t, 0);,
(smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));,
NOTIFY_ACTION_MODIFIED,
@@ -745,7 +745,7 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing set file change time\n");
NOTIFY_MASK_TEST(
- fnum2 = create_complex_file(cli, mem_ctx, BASEDIR "\\tname1");,
+ fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");,
smbcli_fsetatr(cli->tree, fnum2, 0, 0, 0, 0, t);,
(smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));,
NOTIFY_ACTION_MODIFIED,
@@ -754,7 +754,7 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing write\n");
NOTIFY_MASK_TEST(
- fnum2 = create_complex_file(cli, mem_ctx, BASEDIR "\\tname1");,
+ fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");,
smbcli_write(cli->tree, fnum2, 1, &c, 10000, 1);,
(smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));,
NOTIFY_ACTION_MODIFIED,
@@ -762,7 +762,7 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing truncate\n");
NOTIFY_MASK_TEST(
- fnum2 = create_complex_file(cli, mem_ctx, BASEDIR "\\tname1");,
+ fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");,
smbcli_ftruncate(cli->tree, fnum2, 10000);,
(smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));,
NOTIFY_ACTION_MODIFIED,
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index c4ccc0eb17..fb81f7d55c 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -72,7 +72,7 @@ static const char *rdwr_string(enum rdwr_mode m)
}} while (0)
#define CREATE_FILE do { \
- fnum = create_complex_file(cli, mem_ctx, fname); \
+ fnum = create_complex_file(cli, tctx, fname); \
if (fnum == -1) { \
printf("(%s) Failed to create %s - %s\n", __location__, fname, smbcli_errstr(cli->tree)); \
ret = false; \
@@ -91,16 +91,16 @@ static const char *rdwr_string(enum rdwr_mode m)
time_t t1, t2; \
finfo.all_info.level = RAW_FILEINFO_ALL_INFO; \
finfo.all_info.in.file.path = fname; \
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); \
+ status = smb_raw_pathinfo(cli->tree, tctx, &finfo); \
CHECK_STATUS(status, NT_STATUS_OK); \
t1 = t & ~1; \
t2 = nt_time_to_unix(finfo.all_info.out.field) & ~1; \
if (abs(t1-t2) > 2) { \
printf("(%s) wrong time for field %s %s - %s\n", \
__location__, #field, \
- timestring(mem_ctx, t1), \
- timestring(mem_ctx, t2)); \
- dump_all_info(mem_ctx, &finfo); \
+ timestring(tctx, t1), \
+ timestring(tctx, t2)); \
+ dump_all_info(tctx, &finfo); \
ret = false; \
}} while (0)
@@ -108,27 +108,27 @@ static const char *rdwr_string(enum rdwr_mode m)
NTTIME t2; \
finfo.all_info.level = RAW_FILEINFO_ALL_INFO; \
finfo.all_info.in.file.path = fname; \
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); \
+ status = smb_raw_pathinfo(cli->tree, tctx, &finfo); \
CHECK_STATUS(status, NT_STATUS_OK); \
t2 = finfo.all_info.out.field; \
if (t != t2) { \
printf("(%s) wrong time for field %s %s - %s\n", \
__location__, #field, \
- nt_time_string(mem_ctx, t), \
- nt_time_string(mem_ctx, t2)); \
- dump_all_info(mem_ctx, &finfo); \
+ nt_time_string(tctx, t), \
+ nt_time_string(tctx, t2)); \
+ dump_all_info(tctx, &finfo); \
ret = false; \
}} while (0)
#define CHECK_ALL_INFO(v, field) do { \
finfo.all_info.level = RAW_FILEINFO_ALL_INFO; \
finfo.all_info.in.file.path = fname; \
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); \
+ status = smb_raw_pathinfo(cli->tree, tctx, &finfo); \
CHECK_STATUS(status, NT_STATUS_OK); \
if ((v) != (finfo.all_info.out.field)) { \
printf("(%s) wrong value for field %s 0x%x - 0x%x\n", \
__location__, #field, (int)v, (int)(finfo.all_info.out.field)); \
- dump_all_info(mem_ctx, &finfo); \
+ dump_all_info(tctx, &finfo); \
ret = false; \
}} while (0)
@@ -154,7 +154,7 @@ static const char *rdwr_string(enum rdwr_mode m)
/*
test RAW_OPEN_OPEN
*/
-static bool test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_open(struct smbcli_state *cli, struct torture_context *tctx)
{
union smb_open io;
union smb_fileinfo finfo;
@@ -169,7 +169,7 @@ static bool test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.openold.in.fname = fname;
io.openold.in.open_mode = OPEN_FLAGS_FCB;
io.openold.in.search_attrs = 0;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
fnum = io.openold.out.file.fnum;
@@ -177,12 +177,12 @@ static bool test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CREATE_FILE;
smbcli_close(cli->tree, fnum);
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openold.out.file.fnum;
CHECK_RDWR(fnum, RDWR_RDWR);
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum2 = io.openold.out.file.fnum;
CHECK_RDWR(fnum2, RDWR_RDWR);
@@ -195,21 +195,21 @@ static bool test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.openold.in.search_attrs = 0;
io.openold.in.open_mode = OPEN_FLAGS_OPEN_READ;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openold.out.file.fnum;
CHECK_RDWR(fnum, RDWR_RDONLY);
smbcli_close(cli->tree, fnum);
io.openold.in.open_mode = OPEN_FLAGS_OPEN_WRITE;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openold.out.file.fnum;
CHECK_RDWR(fnum, RDWR_WRONLY);
smbcli_close(cli->tree, fnum);
io.openold.in.open_mode = OPEN_FLAGS_OPEN_RDWR;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openold.out.file.fnum;
CHECK_RDWR(fnum, RDWR_RDWR);
@@ -217,7 +217,7 @@ static bool test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* check the share modes roughly - not a complete matrix */
io.openold.in.open_mode = OPEN_FLAGS_OPEN_RDWR | OPEN_FLAGS_DENY_WRITE;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openold.out.file.fnum;
CHECK_RDWR(fnum, RDWR_RDWR);
@@ -228,11 +228,11 @@ static bool test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
}
io.openold.in.open_mode = OPEN_FLAGS_OPEN_RDWR | OPEN_FLAGS_DENY_NONE;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
io.openold.in.open_mode = OPEN_FLAGS_OPEN_READ | OPEN_FLAGS_DENY_NONE;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum2 = io.openold.out.file.fnum;
CHECK_RDWR(fnum2, RDWR_RDONLY);
@@ -245,7 +245,7 @@ static bool test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.openold.in.fname = fname;
io.openold.in.search_attrs = 0;
io.openold.in.open_mode = OPEN_FLAGS_OPEN_READ;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openold.out.file.fnum;
@@ -265,7 +265,7 @@ done:
/*
test RAW_OPEN_OPENX
*/
-static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_openx(struct smbcli_state *cli, struct torture_context *tctx)
{
union smb_open io;
union smb_fileinfo finfo;
@@ -311,7 +311,7 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* check all combinations of open_func */
for (i=0; i<ARRAY_SIZE(open_funcs); i++) {
if (open_funcs[i].with_file) {
- fnum = create_complex_file(cli, mem_ctx, fname);
+ fnum = create_complex_file(cli, tctx, fname);
if (fnum == -1) {
d_printf("Failed to create file %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = false;
@@ -320,7 +320,7 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
smbcli_close(cli->tree, fnum);
}
io.openx.in.open_func = open_funcs[i].open_func;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
if (!NT_STATUS_EQUAL(status, open_funcs[i].correct_status)) {
printf("(%s) incorrect status %s should be %s (i=%d with_file=%d open_func=0x%x)\n",
__location__, nt_errstr(status), nt_errstr(open_funcs[i].correct_status),
@@ -339,7 +339,7 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* check the basic return fields */
io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openx.out.file.fnum;
@@ -356,7 +356,7 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
smbcli_unlink(cli->tree, fname);
/* check the fields when the file already existed */
- fnum2 = create_complex_file(cli, mem_ctx, fname);
+ fnum2 = create_complex_file(cli, tctx, fname);
if (fnum2 == -1) {
ret = false;
goto done;
@@ -364,7 +364,7 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
smbcli_close(cli->tree, fnum2);
io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openx.out.file.fnum;
@@ -380,12 +380,12 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN, attrib);
io.openx.in.search_attrs = FILE_ATTRIBUTE_HIDDEN;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
smbcli_close(cli->tree, io.openx.out.file.fnum);
io.openx.in.search_attrs = 0;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
smbcli_close(cli->tree, io.openx.out.file.fnum);
@@ -396,9 +396,9 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.openx.in.open_func = OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE;
io.openx.in.search_attrs = 0;
io.openx.in.file_attrs = FILE_ATTRIBUTE_SYSTEM;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) {
+ if (torture_setting_bool(tctx, "samba3", false)) {
CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE,
attrib & ~(FILE_ATTRIBUTE_NONINDEXED|
FILE_ATTRIBUTE_SPARSE));
@@ -414,14 +414,14 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
io.openx.in.file_attrs = 0;
io.openx.in.open_mode = OPENX_MODE_ACCESS_RDWR | OPENX_MODE_DENY_ALL;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openx.out.file.fnum;
io.openx.in.timeout = 20000;
tv = timeval_current();
io.openx.in.open_mode = OPENX_MODE_ACCESS_RDWR | OPENX_MODE_DENY_NONE;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
if (timeval_elapsed(&tv) > 3.0) {
printf("(%s) Incorrect timing in openx with timeout - waited %.2f seconds\n",
@@ -441,27 +441,27 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.openx.in.write_time = 0;
io.openx.in.size = 0;
io.openx.in.timeout = 0;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
smbcli_close(cli->tree, io.openx.out.file.fnum);
/* check the extended return flag */
io.openx.in.flags = OPENX_FLAGS_ADDITIONAL_INFO | OPENX_FLAGS_EXTENDED_RETURN;
io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VAL(io.openx.out.access_mask, SEC_STD_ALL);
smbcli_close(cli->tree, io.openx.out.file.fnum);
io.openx.in.fname = "\\A.+,;=[].B";
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
/* Check the mapping for open exec. */
/* First create an .exe file. */
smbcli_unlink(cli->tree, fname_exe);
- fnum = create_complex_file(cli, mem_ctx, fname_exe);
+ fnum = create_complex_file(cli, tctx, fname_exe);
smbcli_close(cli->tree, fnum);
io.openx.level = RAW_OPEN_OPENX;
@@ -473,7 +473,7 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.openx.in.write_time = 0;
io.openx.in.size = 0;
io.openx.in.timeout = 0;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
/* Can we read and write ? */
@@ -495,7 +495,7 @@ done:
many thanks to kukks for a sniff showing how this works with os2->w2k
*/
-static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_t2open(struct smbcli_state *cli, struct torture_context *tctx)
{
union smb_open io;
union smb_fileinfo finfo;
@@ -525,7 +525,7 @@ static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{ OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, false, NT_STATUS_OK },
};
- fnum = create_complex_file(cli, mem_ctx, fname1);
+ fnum = create_complex_file(cli, tctx, fname1);
if (fnum == -1) {
d_printf("Failed to create file %s - %s\n", fname1, smbcli_errstr(cli->tree));
ret = false;
@@ -546,16 +546,16 @@ static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.t2open.in.timeout = 0;
io.t2open.in.num_eas = 3;
- io.t2open.in.eas = talloc_array(mem_ctx, struct ea_struct, io.t2open.in.num_eas);
+ io.t2open.in.eas = talloc_array(tctx, struct ea_struct, io.t2open.in.num_eas);
io.t2open.in.eas[0].flags = 0;
io.t2open.in.eas[0].name.s = ".CLASSINFO";
- io.t2open.in.eas[0].value = data_blob_talloc(mem_ctx, "first value", 11);
+ io.t2open.in.eas[0].value = data_blob_talloc(tctx, "first value", 11);
io.t2open.in.eas[1].flags = 0;
io.t2open.in.eas[1].name.s = "EA TWO";
- io.t2open.in.eas[1].value = data_blob_talloc(mem_ctx, "foo", 3);
+ io.t2open.in.eas[1].value = data_blob_talloc(tctx, "foo", 3);
io.t2open.in.eas[2].flags = 0;
io.t2open.in.eas[2].name.s = "X THIRD";
- io.t2open.in.eas[2].value = data_blob_talloc(mem_ctx, "xy", 2);
+ io.t2open.in.eas[2].value = data_blob_talloc(tctx, "xy", 2);
/* check all combinations of open_func */
for (i=0; i<ARRAY_SIZE(open_funcs); i++) {
@@ -566,10 +566,10 @@ static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.t2open.in.fname = fname2;
}
io.t2open.in.open_func = open_funcs[i].open_func;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
if ((io.t2open.in.num_eas != 0)
&& NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED)
- && lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) {
+ && torture_setting_bool(tctx, "samba3", false)) {
printf("(%s) EAs not supported, not treating as fatal "
"in Samba3 test\n", __location__);
io.t2open.in.num_eas = 0;
@@ -594,7 +594,7 @@ static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.t2open.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
io.t2open.in.write_time = 0;
io.t2open.in.fname = fname;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.t2open.out.file.fnum;
@@ -624,11 +624,11 @@ static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
SET_ATTRIB(FILE_ATTRIBUTE_HIDDEN);
CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN, attrib);
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
smbcli_close(cli->tree, io.t2open.out.file.fnum);
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
smbcli_close(cli->tree, io.t2open.out.file.fnum);
@@ -638,7 +638,7 @@ static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* and check attrib on create */
io.t2open.in.open_func = OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE;
io.t2open.in.file_attrs = FILE_ATTRIBUTE_SYSTEM;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
/* check timeout on create - win2003 ignores the timeout! */
@@ -646,7 +646,7 @@ static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.t2open.in.file_attrs = 0;
io.t2open.in.timeout = 20000;
io.t2open.in.open_mode = OPENX_MODE_ACCESS_RDWR | OPENX_MODE_DENY_ALL;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
done:
@@ -660,7 +660,7 @@ done:
/*
test RAW_OPEN_NTCREATEX
*/
-static bool test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_ntcreatex(struct smbcli_state *cli, struct torture_context *tctx)
{
union smb_open io;
union smb_fileinfo finfo;
@@ -719,7 +719,7 @@ static bool test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
smbcli_close(cli->tree, fnum);
}
io.ntcreatex.in.open_disposition = open_funcs[i].open_disp;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
if (!NT_STATUS_EQUAL(status, open_funcs[i].correct_status)) {
printf("(%s) incorrect status %s should be %s (i=%d with_file=%d open_disp=%d)\n",
__location__, nt_errstr(status), nt_errstr(open_funcs[i].correct_status),
@@ -735,7 +735,7 @@ static bool test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* basic field testing */
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
@@ -754,7 +754,7 @@ static bool test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* check fields when the file already existed */
smbcli_close(cli->tree, fnum);
smbcli_unlink(cli->tree, fname);
- fnum = create_complex_file(cli, mem_ctx, fname);
+ fnum = create_complex_file(cli, tctx, fname);
if (fnum == -1) {
ret = false;
goto done;
@@ -762,7 +762,7 @@ static bool test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
smbcli_close(cli->tree, fnum);
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
@@ -799,7 +799,7 @@ static bool test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
@@ -833,7 +833,7 @@ done:
/*
test RAW_OPEN_NTTRANS_CREATE
*/
-static bool test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_nttrans_create(struct smbcli_state *cli, struct torture_context *tctx)
{
union smb_open io;
union smb_fileinfo finfo;
@@ -894,7 +894,7 @@ static bool test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
smbcli_close(cli->tree, fnum);
}
io.ntcreatex.in.open_disposition = open_funcs[i].open_disp;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
if (!NT_STATUS_EQUAL(status, open_funcs[i].correct_status)) {
printf("(%s) incorrect status %s should be %s (i=%d with_file=%d open_disp=%d)\n",
__location__, nt_errstr(status), nt_errstr(open_funcs[i].correct_status),
@@ -910,7 +910,7 @@ static bool test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* basic field testing */
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
@@ -929,7 +929,7 @@ static bool test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* check fields when the file already existed */
smbcli_close(cli->tree, fnum);
smbcli_unlink(cli->tree, fname);
- fnum = create_complex_file(cli, mem_ctx, fname);
+ fnum = create_complex_file(cli, tctx, fname);
if (fnum == -1) {
ret = false;
goto done;
@@ -937,7 +937,7 @@ static bool test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
smbcli_close(cli->tree, fnum);
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
@@ -974,7 +974,7 @@ static bool test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
@@ -1012,7 +1012,7 @@ done:
open_disposition==NTCREATEX_DISP_OVERWRITE_IF. Windows 2003 allows the
second open.
*/
-static bool test_ntcreatex_brlocked(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_ntcreatex_brlocked(struct smbcli_state *cli, struct torture_context *tctx)
{
union smb_open io, io1;
union smb_lock io2;
@@ -1038,7 +1038,7 @@ static bool test_ntcreatex_brlocked(struct smbcli_state *cli, TALLOC_CTX *mem_ct
NTCREATEX_SECURITY_ALL;
io.ntcreatex.in.fname = fname;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
io2.lockx.level = RAW_LOCK_LOCKX;
@@ -1069,7 +1069,7 @@ static bool test_ntcreatex_brlocked(struct smbcli_state *cli, TALLOC_CTX *mem_ct
NTCREATEX_SECURITY_ALL;
io1.ntcreatex.in.fname = fname;
- status = smb_raw_open(cli->tree, mem_ctx, &io1);
+ status = smb_raw_open(cli->tree, tctx, &io1);
CHECK_STATUS(status, NT_STATUS_OK);
done:
@@ -1082,7 +1082,7 @@ static bool test_ntcreatex_brlocked(struct smbcli_state *cli, TALLOC_CTX *mem_ct
/*
test RAW_OPEN_MKNEW
*/
-static bool test_mknew(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_mknew(struct smbcli_state *cli, struct torture_context *tctx)
{
union smb_open io;
const char *fname = BASEDIR "\\torture_mknew.txt";
@@ -1098,11 +1098,11 @@ static bool test_mknew(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.mknew.in.attrib = 0;
io.mknew.in.write_time = 0;
io.mknew.in.fname = fname;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.mknew.out.file.fnum;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
smbcli_close(cli->tree, fnum);
@@ -1110,7 +1110,7 @@ static bool test_mknew(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* make sure write_time works */
io.mknew.in.write_time = basetime;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.mknew.out.file.fnum;
CHECK_TIME(basetime, write_time);
@@ -1120,7 +1120,7 @@ static bool test_mknew(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* make sure file_attrs works */
io.mknew.in.attrib = FILE_ATTRIBUTE_HIDDEN;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.mknew.out.file.fnum;
CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE,
@@ -1137,7 +1137,7 @@ done:
/*
test RAW_OPEN_CREATE
*/
-static bool test_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_create(struct smbcli_state *cli, struct torture_context *tctx)
{
union smb_open io;
const char *fname = BASEDIR "\\torture_create.txt";
@@ -1153,11 +1153,11 @@ static bool test_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.create.in.attrib = 0;
io.create.in.write_time = 0;
io.create.in.fname = fname;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.create.out.file.fnum;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
smbcli_close(cli->tree, io.create.out.file.fnum);
@@ -1166,7 +1166,7 @@ static bool test_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* make sure write_time works */
io.create.in.write_time = basetime;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.create.out.file.fnum;
CHECK_TIME(basetime, write_time);
@@ -1176,7 +1176,7 @@ static bool test_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* make sure file_attrs works */
io.create.in.attrib = FILE_ATTRIBUTE_HIDDEN;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.create.out.file.fnum;
CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE,
@@ -1193,7 +1193,7 @@ done:
/*
test RAW_OPEN_CTEMP
*/
-static bool test_ctemp(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_ctemp(struct smbcli_state *cli, TALLOC_CTX *tctx)
{
union smb_open io;
NTSTATUS status;
@@ -1209,7 +1209,7 @@ static bool test_ctemp(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.ctemp.in.attrib = FILE_ATTRIBUTE_HIDDEN;
io.ctemp.in.write_time = basetime;
io.ctemp.in.directory = BASEDIR;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ctemp.out.file.fnum;
@@ -1217,7 +1217,7 @@ static bool test_ctemp(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
finfo.generic.level = RAW_FILEINFO_NAME_INFO;
finfo.generic.in.file.fnum = fnum;
- status = smb_raw_fileinfo(cli->tree, mem_ctx, &finfo);
+ status = smb_raw_fileinfo(cli->tree, tctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
fname = finfo.name_info.out.fname.s;
@@ -1236,7 +1236,7 @@ done:
/*
test chained RAW_OPEN_OPENX_READX
*/
-static bool test_chained(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_chained(struct smbcli_state *cli, TALLOC_CTX *tctx)
{
union smb_open io;
const char *fname = BASEDIR "\\torture_chained.txt";
@@ -1249,7 +1249,7 @@ static bool test_chained(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("Checking RAW_OPEN_OPENX chained with READX\n");
smbcli_unlink(cli->tree, fname);
- fnum = create_complex_file(cli, mem_ctx, fname);
+ fnum = create_complex_file(cli, tctx, fname);
smbcli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
@@ -1272,7 +1272,7 @@ static bool test_chained(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.openxreadx.in.remaining = 0;
io.openxreadx.out.data = (uint8_t *)buf2;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openxreadx.out.file.fnum;
@@ -1293,7 +1293,7 @@ done:
NetApp filers are known to fail on this.
*/
-static bool test_no_leading_slash(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_no_leading_slash(struct smbcli_state *cli, TALLOC_CTX *tctx)
{
union smb_open io;
const char *fname = BASEDIR "\\torture_no_leading_slash.txt";
@@ -1306,7 +1306,7 @@ static bool test_no_leading_slash(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
smbcli_unlink(cli->tree, fname);
/* Create the file */
- fnum = create_complex_file(cli, mem_ctx, fname);
+ fnum = create_complex_file(cli, tctx, fname);
smbcli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
smbcli_close(cli->tree, fnum);
@@ -1322,7 +1322,7 @@ static bool test_no_leading_slash(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.openx.in.size = 1024*1024;
io.openx.in.timeout = 0;
- status = smb_raw_open(cli->tree, mem_ctx, &io);
+ status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openx.out.file.fnum;
@@ -1335,7 +1335,7 @@ done:
/* A little torture test to expose a race condition in Samba 3.0.20 ... :-) */
-static bool test_raw_open_multi(void)
+static bool test_raw_open_multi(struct torture_context *tctx)
{
struct smbcli_state *cli;
TALLOC_CTX *mem_ctx = talloc_init("torture_test_oplock_multi");
@@ -1346,8 +1346,8 @@ static bool test_raw_open_multi(void)
struct smbcli_state **clients;
struct smbcli_request **requests;
union smb_open *ios;
- const char *host = lp_parm_string(global_loadparm, NULL, "torture", "host");
- const char *share = lp_parm_string(global_loadparm, NULL, "torture", "share");
+ const char *host = torture_setting_string(tctx, "host", NULL);
+ const char *share = torture_setting_string(tctx, "share", NULL);
int i, num_files = 3;
struct event_context *ev;
int num_ok = 0;
@@ -1470,7 +1470,7 @@ bool torture_raw_open(struct torture_context *torture, struct smbcli_state *cli)
ret &= test_ntcreatex_brlocked(cli, torture);
ret &= test_open(cli, torture);
- ret &= test_raw_open_multi();
+ ret &= test_raw_open_multi(torture);
ret &= test_openx(cli, torture);
ret &= test_ntcreatex(cli, torture);
ret &= test_nttrans_create(cli, torture);
diff --git a/source4/torture/raw/pingpong.c b/source4/torture/raw/pingpong.c
index 2e9de28d67..3174021f7b 100755
--- a/source4/torture/raw/pingpong.c
+++ b/source4/torture/raw/pingpong.c
@@ -191,21 +191,21 @@ bool torture_ping_pong(struct torture_context *torture)
uint8_t *val;
int count, loops;
- fn = lp_parm_string(global_loadparm, NULL, "torture", "filename");
+ fn = torture_setting_string(torture, "filename", NULL);
if (fn == NULL) {
DEBUG(0,("You must specify the filename using --option=torture:filename=...\n"));
return false;
}
- num_locks = lp_parm_int(global_loadparm, NULL, "torture", "num_locks", -1);
+ num_locks = torture_setting_int(torture, "num_locks", -1);
if (num_locks == -1) {
DEBUG(0,("You must specify num_locks using --option=torture:num_locks=...\n"));
return false;
}
- do_reads = lp_parm_bool(global_loadparm, NULL, "torture", "read", false);
- do_writes = lp_parm_bool(global_loadparm, NULL, "torture", "write", false);
- lock_timeout = lp_parm_int(global_loadparm, NULL, "torture", "lock_timeout", 100000);
+ do_reads = torture_setting_bool(torture, "read", false);
+ do_writes = torture_setting_bool(torture, "write", false);
+ lock_timeout = torture_setting_int(torture, "lock_timeout", 100000);
if (!torture_open_connection(&cli, 0)) {
DEBUG(0,("Could not open connection\n"));
diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c
index 90f6a3d4a8..b052da2d69 100644
--- a/source4/torture/raw/read.c
+++ b/source4/torture/raw/read.c
@@ -482,7 +482,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli)
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
CHECK_VALUE(io.readx.out.compaction_mode, 0);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) {
+ if (torture_setting_bool(tctx, "samba3", false)) {
printf("SAMBA3: large read extension\n");
CHECK_VALUE(io.readx.out.nread, 80000);
} else {
@@ -526,7 +526,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli)
io.readx.in.maxcnt = 0x10000;
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) {
+ if (torture_setting_bool(tctx, "samba3", false)) {
printf("SAMBA3: large read extension\n");
CHECK_VALUE(io.readx.out.nread, 0x10000);
} else {
@@ -536,7 +536,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli)
io.readx.in.maxcnt = 0x10001;
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) {
+ if (torture_setting_bool(tctx, "samba3", false)) {
printf("SAMBA3: large read extension\n");
CHECK_VALUE(io.readx.out.nread, 0x10001);
} else {
diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c
index 8e41469963..a075277efb 100644
--- a/source4/torture/raw/samba3misc.c
+++ b/source4/torture/raw/samba3misc.c
@@ -344,9 +344,9 @@ bool torture_samba3_badpath(struct torture_context *torture)
return false;
}
- nt_status_support = lp_nt_status_support(global_loadparm);
+ nt_status_support = lp_nt_status_support(torture->lp_ctx);
- if (!lp_set_cmdline(global_loadparm, "nt status support", "yes")) {
+ if (!lp_set_cmdline(torture->lp_ctx, "nt status support", "yes")) {
printf("Could not set 'nt status support = yes'\n");
goto fail;
}
@@ -355,7 +355,7 @@ bool torture_samba3_badpath(struct torture_context *torture)
goto fail;
}
- if (!lp_set_cmdline(global_loadparm, "nt status support", "no")) {
+ if (!lp_set_cmdline(torture->lp_ctx, "nt status support", "no")) {
printf("Could not set 'nt status support = yes'\n");
goto fail;
}
@@ -364,7 +364,7 @@ bool torture_samba3_badpath(struct torture_context *torture)
goto fail;
}
- if (!lp_set_cmdline(global_loadparm, "nt status support",
+ if (!lp_set_cmdline(torture->lp_ctx, "nt status support",
nt_status_support ? "yes":"no")) {
printf("Could not reset 'nt status support = yes'");
goto fail;
diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c
index b9043a5899..d34bbeb9a5 100644
--- a/source4/torture/raw/unlink.c
+++ b/source4/torture/raw/unlink.c
@@ -129,7 +129,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli)
io.unlink.in.attrib = FILE_ATTRIBUTE_DIRECTORY;
status = smb_raw_unlink(cli->tree, &io);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) {
+ if (torture_setting_bool(tctx, "samba3", false)) {
/*
* In Samba3 we gave up upon getting the error codes in
* wildcard unlink correct. Trying gentest showed that this is
@@ -157,7 +157,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli)
io.unlink.in.pattern = BASEDIR "\\t*";
io.unlink.in.attrib = FILE_ATTRIBUTE_DIRECTORY;
status = smb_raw_unlink(cli->tree, &io);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) {
+ if (torture_setting_bool(tctx, "samba3", false)) {
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID);
}
else {
@@ -169,7 +169,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli)
io.unlink.in.pattern = BASEDIR "\\*.dat";
io.unlink.in.attrib = FILE_ATTRIBUTE_DIRECTORY;
status = smb_raw_unlink(cli->tree, &io);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) {
+ if (torture_setting_bool(tctx, "samba3", false)) {
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID);
}
else {
@@ -179,7 +179,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli)
io.unlink.in.pattern = BASEDIR "\\*.tx?";
io.unlink.in.attrib = 0;
status = smb_raw_unlink(cli->tree, &io);
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) {
+ if (torture_setting_bool(tctx, "samba3", false)) {
CHECK_STATUS(status, NT_STATUS_NO_SUCH_FILE);
}
else {
@@ -282,7 +282,7 @@ static bool test_delete_on_close(struct torture_context *tctx,
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
- if (!lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) {
+ if (!torture_setting_bool(tctx, "samba3", false)) {
/*
* Known deficiency, also skipped in base-delete.
diff --git a/source4/torture/rpc/bench.c b/source4/torture/rpc/bench.c
index 2619ac2d25..2ae92332f8 100644
--- a/source4/torture/rpc/bench.c
+++ b/source4/torture/rpc/bench.c
@@ -68,11 +68,11 @@ static bool test_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
/*
benchmark srvsvc netshareenumall queries
*/
-static bool bench_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+static bool bench_NetShareEnumAll(struct torture_context *tctx, struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
{
struct timeval tv = timeval_current();
bool ret = true;
- int timelimit = lp_parm_int(global_loadparm, NULL, "torture", "timelimit", 10);
+ int timelimit = torture_setting_int(tctx, "timelimit", 10);
int count=0;
printf("Running for %d seconds\n", timelimit);
@@ -82,7 +82,7 @@ static bool bench_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
talloc_free(tmp_ctx);
count++;
if (count % 50 == 0) {
- if (lp_parm_bool(global_loadparm, NULL, "torture", "progress", true)) {
+ if (torture_setting_bool(tctx, "progress", true)) {
printf("%.1f queries per second \r",
count / timeval_elapsed(&tv));
}
@@ -112,7 +112,7 @@ bool torture_bench_rpc(struct torture_context *torture)
return false;
}
- if (!bench_NetShareEnumAll(p, mem_ctx)) {
+ if (!bench_NetShareEnumAll(torture, p, mem_ctx)) {
ret = false;
}
diff --git a/source4/torture/rpc/countcalls.c b/source4/torture/rpc/countcalls.c
index f9a31feaaf..ba00b0f467 100644
--- a/source4/torture/rpc/countcalls.c
+++ b/source4/torture/rpc/countcalls.c
@@ -111,7 +111,7 @@ bool torture_rpc_countcalls(struct torture_context *torture)
if (!mem_ctx) {
return false;
}
- iface_name = lp_parm_string(global_loadparm, NULL, "countcalls", "interface");
+ iface_name = lp_parm_string(torture->lp_ctx, NULL, "countcalls", "interface");
if (iface_name != NULL) {
iface = ndr_table_by_name(iface_name);
if (!iface) {
diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c
index 3407e49565..ee752c6568 100644
--- a/source4/torture/rpc/drsuapi.c
+++ b/source4/torture/rpc/drsuapi.c
@@ -232,7 +232,7 @@ static bool test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
-static bool test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_DsReplicaGetInfo(struct dcerpc_pipe *p, struct torture_context *tctx,
struct DsPrivate *priv)
{
NTSTATUS status;
@@ -307,7 +307,7 @@ static bool test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
};
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
printf("skipping DsReplicaGetInfo test against Samba4\n");
return true;
}
@@ -340,11 +340,11 @@ static bool test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
break;
}
- status = dcerpc_drsuapi_DsReplicaGetInfo(p, mem_ctx, &r);
+ status = dcerpc_drsuapi_DsReplicaGetInfo(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
const char *errstr = nt_errstr(status);
if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
- errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
+ errstr = dcerpc_errstr(tctx, p->last_fault_code);
}
if (p->last_fault_code != DCERPC_FAULT_INVALID_TAG) {
printf("dcerpc_drsuapi_DsReplicaGetInfo failed - %s\n", errstr);
@@ -362,7 +362,7 @@ static bool test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
-static bool test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_DsReplicaSync(struct dcerpc_pipe *p, struct torture_context *tctx,
struct DsPrivate *priv)
{
NTSTATUS status;
@@ -380,12 +380,12 @@ static bool test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
};
- if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) {
+ if (!torture_setting_bool(tctx, "dangerous", false)) {
printf("DsReplicaSync disabled - enable dangerous tests to use\n");
return true;
}
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
printf("skipping DsReplicaSync test against Samba4\n");
return true;
}
@@ -413,11 +413,11 @@ static bool test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
break;
}
- status = dcerpc_drsuapi_DsReplicaSync(p, mem_ctx, &r);
+ status = dcerpc_drsuapi_DsReplicaSync(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
const char *errstr = nt_errstr(status);
if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
- errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
+ errstr = dcerpc_errstr(tctx, p->last_fault_code);
}
printf("dcerpc_drsuapi_DsReplicaSync failed - %s\n", errstr);
ret = false;
@@ -430,7 +430,7 @@ static bool test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
-static bool test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, struct torture_context *tctx,
struct DsPrivate *priv)
{
NTSTATUS status;
@@ -448,7 +448,7 @@ static bool test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
};
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
printf("skipping DsReplicaUpdateRefs test against Samba4\n");
return true;
}
@@ -470,18 +470,18 @@ static bool test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
r.in.req.req1.naming_context = &nc;
- r.in.req.req1.dest_dsa_dns_name = talloc_asprintf(mem_ctx, "__some_dest_dsa_guid_string._msdn.%s",
+ r.in.req.req1.dest_dsa_dns_name = talloc_asprintf(tctx, "__some_dest_dsa_guid_string._msdn.%s",
priv->domain_dns_name);
r.in.req.req1.dest_dsa_guid = null_guid;
r.in.req.req1.options = 0;
break;
}
- status = dcerpc_drsuapi_DsReplicaUpdateRefs(p, mem_ctx, &r);
+ status = dcerpc_drsuapi_DsReplicaUpdateRefs(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
const char *errstr = nt_errstr(status);
if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
- errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
+ errstr = dcerpc_errstr(tctx, p->last_fault_code);
}
printf("dcerpc_drsuapi_DsReplicaUpdateRefs failed - %s\n", errstr);
ret = false;
@@ -494,7 +494,7 @@ static bool test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
-static bool test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_DsGetNCChanges(struct dcerpc_pipe *p, struct torture_context *tctx,
struct DsPrivate *priv)
{
NTSTATUS status;
@@ -515,7 +515,7 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
};
- if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+ if (torture_setting_bool(tctx, "samba4", false)) {
printf("skipping DsGetNCChanges test against Samba4\n");
return true;
}
@@ -589,11 +589,11 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
break;
}
- status = dcerpc_drsuapi_DsGetNCChanges(p, mem_ctx, &r);
+ status = dcerpc_drsuapi_DsGetNCChanges(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
const char *errstr = nt_errstr(status);
if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
- errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
+ errstr = dcerpc_errstr(tctx, p->last_fault_code);
}
printf("dcerpc_drsuapi_DsGetNCChanges failed - %s\n", errstr);
ret = false;
diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c
index 4403a64a36..7c56a52203 100644
--- a/source4/torture/rpc/dssync.c
+++ b/source4/torture/rpc/dssync.c
@@ -420,7 +420,7 @@ static void test_analyse_objects(struct DsSyncTest *ctx,
static uint32_t object_id;
const char *save_values_dir;
- if (!lp_parm_bool(global_loadparm, NULL,"dssync","print_pwd_blobs", false)) {
+ if (!lp_parm_bool(global_loadparm, NULL, "dssync", "print_pwd_blobs", false)) {
return;
}
diff --git a/source4/torture/rpc/frsapi.c b/source4/torture/rpc/frsapi.c
index 72aae3c196..a39c91f853 100644
--- a/source4/torture/rpc/frsapi.c
+++ b/source4/torture/rpc/frsapi.c
@@ -194,7 +194,7 @@ static bool test_ForceReplication(struct torture_context *tctx,
r.in.guid1 = NULL;
r.in.guid2 = NULL;
r.in.replica_set = talloc_asprintf(tctx, "%s",
- lp_realm(global_loadparm));
+ lp_realm(tctx->lp_ctx));
r.in.partner_name = dcerpc_server_name(p);
torture_assert_ntstatus_ok(tctx,
diff --git a/source4/torture/rpc/mgmt.c b/source4/torture/rpc/mgmt.c
index 258450ada1..4ae4ac3b34 100644
--- a/source4/torture/rpc/mgmt.c
+++ b/source4/torture/rpc/mgmt.c
@@ -228,7 +228,7 @@ bool torture_rpc_mgmt(struct torture_context *torture)
continue;
}
- lp_set_cmdline(global_loadparm, "torture:binding", dcerpc_binding_string(loop_ctx, b));
+ lp_set_cmdline(torture->lp_ctx, "torture:binding", dcerpc_binding_string(loop_ctx, b));
status = torture_rpc_connection(torture, &p, &ndr_table_mgmt);
if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index 745744a25d..a8f408c0f6 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -452,11 +452,11 @@ bool test_netlogon_ops(struct dcerpc_pipe *p, struct torture_context *tctx,
DATA_BLOB names_blob, chal, lm_resp, nt_resp;
int i;
int flags = CLI_CRED_NTLM_AUTH;
- if (lp_client_lanman_auth(global_loadparm)) {
+ if (lp_client_lanman_auth(tctx->lp_ctx)) {
flags |= CLI_CRED_LANMAN_AUTH;
}
- if (lp_client_ntlmv2_auth(global_loadparm)) {
+ if (lp_client_ntlmv2_auth(tctx->lp_ctx)) {
flags |= CLI_CRED_NTLMv2_AUTH;
}
@@ -740,7 +740,7 @@ static bool test_GetDcName(struct torture_context *tctx,
struct netr_GetDcName r;
r.in.logon_server = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
- r.in.domainname = lp_workgroup(global_loadparm);
+ r.in.domainname = lp_workgroup(tctx->lp_ctx);
status = dcerpc_netr_GetDcName(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "GetDcName");
@@ -787,7 +787,7 @@ static bool test_GetAnyDCName(struct torture_context *tctx,
struct netr_GetAnyDCName r;
r.in.logon_server = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
- r.in.domainname = lp_workgroup(global_loadparm);
+ r.in.domainname = lp_workgroup(tctx->lp_ctx);
status = dcerpc_netr_GetAnyDCName(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "GetAnyDCName");
@@ -813,7 +813,7 @@ static bool test_LogonControl2(struct torture_context *tctx,
r.in.logon_server = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
r.in.function_code = NETLOGON_CONTROL_REDISCOVER;
- r.in.data.domain = lp_workgroup(global_loadparm);
+ r.in.data.domain = lp_workgroup(tctx->lp_ctx);
for (i=1;i<4;i++) {
r.in.level = i;
@@ -826,7 +826,7 @@ static bool test_LogonControl2(struct torture_context *tctx,
}
r.in.function_code = NETLOGON_CONTROL_TC_QUERY;
- r.in.data.domain = lp_workgroup(global_loadparm);
+ r.in.data.domain = lp_workgroup(tctx->lp_ctx);
for (i=1;i<4;i++) {
r.in.level = i;
@@ -839,7 +839,7 @@ static bool test_LogonControl2(struct torture_context *tctx,
}
r.in.function_code = NETLOGON_CONTROL_TRANSPORT_NOTIFY;
- r.in.data.domain = lp_workgroup(global_loadparm);
+ r.in.data.domain = lp_workgroup(tctx->lp_ctx);
for (i=1;i<4;i++) {
r.in.level = i;
@@ -932,7 +932,7 @@ static bool test_LogonControl2Ex(struct torture_context *tctx,
r.in.logon_server = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
r.in.function_code = NETLOGON_CONTROL_REDISCOVER;
- r.in.data.domain = lp_workgroup(global_loadparm);
+ r.in.data.domain = lp_workgroup(tctx->lp_ctx);
for (i=1;i<4;i++) {
r.in.level = i;
@@ -945,7 +945,7 @@ static bool test_LogonControl2Ex(struct torture_context *tctx,
}
r.in.function_code = NETLOGON_CONTROL_TC_QUERY;
- r.in.data.domain = lp_workgroup(global_loadparm);
+ r.in.data.domain = lp_workgroup(tctx->lp_ctx);
for (i=1;i<4;i++) {
r.in.level = i;
@@ -958,7 +958,7 @@ static bool test_LogonControl2Ex(struct torture_context *tctx,
}
r.in.function_code = NETLOGON_CONTROL_TRANSPORT_NOTIFY;
- r.in.data.domain = lp_workgroup(global_loadparm);
+ r.in.data.domain = lp_workgroup(tctx->lp_ctx);
for (i=1;i<4;i++) {
r.in.level = i;
@@ -1090,7 +1090,7 @@ static bool test_netr_DsRGetDCName(struct torture_context *tctx,
struct netr_DsRGetDCName r;
r.in.server_unc = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
- r.in.domain_name = talloc_asprintf(tctx, "%s", lp_realm(global_loadparm));
+ r.in.domain_name = talloc_asprintf(tctx, "%s", lp_realm(tctx->lp_ctx));
r.in.domain_guid = NULL;
r.in.site_guid = NULL;
r.in.flags = DS_RETURN_DNS_NAME;
@@ -1113,7 +1113,7 @@ static bool test_netr_DsRGetDCNameEx(struct torture_context *tctx,
struct netr_DsRGetDCNameEx r;
r.in.server_unc = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
- r.in.domain_name = talloc_asprintf(tctx, "%s", lp_realm(global_loadparm));
+ r.in.domain_name = talloc_asprintf(tctx, "%s", lp_realm(tctx->lp_ctx));
r.in.domain_guid = NULL;
r.in.site_name = NULL;
r.in.flags = DS_RETURN_DNS_NAME;
@@ -1138,7 +1138,7 @@ static bool test_netr_DsRGetDCNameEx2(struct torture_context *tctx,
r.in.server_unc = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
r.in.client_account = NULL;
r.in.mask = 0x00000000;
- r.in.domain_name = talloc_asprintf(tctx, "%s", lp_realm(global_loadparm));
+ r.in.domain_name = talloc_asprintf(tctx, "%s", lp_realm(tctx->lp_ctx));
r.in.domain_guid = NULL;
r.in.site_name = NULL;
r.in.flags = DS_RETURN_DNS_NAME;
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 3a315ff08f..941c7b4f74 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -1164,7 +1164,7 @@ bool torture_netlogon_samba3(struct torture_context *torture)
goto done;
}
- cli_credentials_set_conf(wks_creds, global_loadparm);
+ cli_credentials_set_conf(wks_creds, torture->lp_ctx);
cli_credentials_set_secure_channel_type(wks_creds, SEC_CHAN_WKSTA);
cli_credentials_set_username(wks_creds, wks_name, CRED_SPECIFIED);
cli_credentials_set_workstation(wks_creds, wks_name, CRED_SPECIFIED);
@@ -1656,7 +1656,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
goto done;
}
- cli_credentials_set_conf(user_creds, global_loadparm);
+ cli_credentials_set_conf(user_creds, torture->lp_ctx);
cli_credentials_set_username(user_creds, "torture_username",
CRED_SPECIFIED);
cli_credentials_set_password(user_creds,
@@ -2557,7 +2557,7 @@ bool torture_samba3_rpc_spoolss(struct torture_context *torture)
ZERO_STRUCT(userlevel1);
userlevel1.client = talloc_asprintf(
- mem_ctx, "\\\\%s", lp_netbios_name(global_loadparm));
+ mem_ctx, "\\\\%s", lp_netbios_name(torture->lp_ctx));
userlevel1.user = cli_credentials_get_username(cmdline_credentials);
userlevel1.build = 2600;
userlevel1.major = 3;
diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c
index aa0f6de788..de13b84392 100644
--- a/source4/torture/rpc/samlogon.c
+++ b/source4/torture/rpc/samlogon.c
@@ -1512,7 +1512,7 @@ bool torture_rpc_samlogon(struct torture_context *torture)
return false;
}
- userdomain = torture_setting_string(torture, "userdomain", lp_workgroup(global_loadparm));
+ userdomain = torture_setting_string(torture, "userdomain", lp_workgroup(torture->lp_ctx));
user_ctx = torture_create_testuser(torture,
TEST_USER_NAME,
@@ -1735,7 +1735,7 @@ bool torture_rpc_samlogon(struct torture_context *torture)
.username = talloc_asprintf(mem_ctx,
"%s@%s",
TEST_USER_NAME,
- lp_realm(global_loadparm)),
+ lp_realm(torture->lp_ctx)),
.password = user_password,
.network_login = true,
.expected_interactive_error = NT_STATUS_OK,
diff --git a/source4/torture/rpc/samr_accessmask.c b/source4/torture/rpc/samr_accessmask.c
index c444187cfc..e64d6a6bce 100644
--- a/source4/torture/rpc/samr_accessmask.c
+++ b/source4/torture/rpc/samr_accessmask.c
@@ -412,7 +412,7 @@ static bool test_samr_accessmask_LookupDomain(struct torture_context *tctx,
ld.in.connect_handle = &ch;
ld.in.domain_name = &dn;
- dn.string = lp_workgroup(global_loadparm);
+ dn.string = lp_workgroup(tctx->lp_ctx);
status = dcerpc_samr_LookupDomain(p, tctx, &ld);
if (!NT_STATUS_IS_OK(status)) {
@@ -436,7 +436,7 @@ static bool test_samr_accessmask_LookupDomain(struct torture_context *tctx,
ld.in.connect_handle = &ch;
ld.in.domain_name = &dn;
- dn.string = lp_workgroup(global_loadparm);
+ dn.string = lp_workgroup(tctx->lp_ctx);
status = dcerpc_samr_LookupDomain(p, tctx, &ld);
if(!NT_STATUS_EQUAL(NT_STATUS_ACCESS_DENIED, status)) {
@@ -488,7 +488,7 @@ static bool test_samr_accessmask_OpenDomain(struct torture_context *tctx,
ld.in.connect_handle = &ch;
ld.in.domain_name = &dn;
- dn.string = lp_workgroup(global_loadparm);
+ dn.string = lp_workgroup(tctx->lp_ctx);
status = dcerpc_samr_LookupDomain(p, tctx, &ld);
if (!NT_STATUS_IS_OK(status)) {
printf("LookupDomain failed - %s\n", nt_errstr(status));
@@ -569,7 +569,7 @@ static bool test_samr_connect(struct torture_context *tctx,
const struct dom_sid *test_sid;
/* create a test user */
- testuser = torture_create_testuser(tctx, TEST_USER_NAME, lp_workgroup(global_loadparm),
+ testuser = torture_create_testuser(tctx, TEST_USER_NAME, lp_workgroup(tctx->lp_ctx),
ACB_NORMAL, &testuser_passwd);
if (!testuser) {
printf("Failed to create test user\n");
@@ -577,7 +577,7 @@ static bool test_samr_connect(struct torture_context *tctx,
}
test_credentials = cli_credentials_init(tctx);
cli_credentials_set_workstation(test_credentials, "localhost", CRED_SPECIFIED);
- cli_credentials_set_domain(test_credentials, lp_workgroup(global_loadparm),
+ cli_credentials_set_domain(test_credentials, lp_workgroup(tctx->lp_ctx),
CRED_SPECIFIED);
cli_credentials_set_username(test_credentials, TEST_USER_NAME, CRED_SPECIFIED);
cli_credentials_set_password(test_credentials, testuser_passwd, CRED_SPECIFIED);
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index a7cde8af4f..d1d95ce8fd 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -1433,7 +1433,7 @@ bool torture_rpc_samsync(struct torture_context *torture)
test_machine_account = talloc_asprintf(mem_ctx, "%s$", TEST_MACHINE_NAME);
join_ctx = torture_create_testuser(torture, test_machine_account,
- lp_workgroup(global_loadparm), ACB_SVRTRUST,
+ lp_workgroup(torture->lp_ctx), ACB_SVRTRUST,
&machine_password);
if (!join_ctx) {
talloc_free(mem_ctx);
@@ -1442,7 +1442,7 @@ bool torture_rpc_samsync(struct torture_context *torture)
}
test_wksta_machine_account = talloc_asprintf(mem_ctx, "%s$", TEST_WKSTA_MACHINE_NAME);
- join_ctx2 = torture_create_testuser(torture, test_wksta_machine_account, lp_workgroup(global_loadparm), ACB_WSTRUST, &wksta_machine_password);
+ join_ctx2 = torture_create_testuser(torture, test_wksta_machine_account, lp_workgroup(torture->lp_ctx), ACB_WSTRUST, &wksta_machine_password);
if (!join_ctx2) {
talloc_free(mem_ctx);
printf("Failed to join as member\n");
@@ -1450,7 +1450,7 @@ bool torture_rpc_samsync(struct torture_context *torture)
}
user_ctx = torture_create_testuser(torture, TEST_USER_NAME,
- lp_workgroup(global_loadparm),
+ lp_workgroup(torture->lp_ctx),
ACB_NORMAL, NULL);
if (!user_ctx) {
talloc_free(mem_ctx);
@@ -1474,7 +1474,7 @@ bool torture_rpc_samsync(struct torture_context *torture)
goto failed;
}
- domain_policy = samsync_open_domain(mem_ctx, samsync_state, lp_workgroup(global_loadparm), NULL);
+ domain_policy = samsync_open_domain(mem_ctx, samsync_state, lp_workgroup(torture->lp_ctx), NULL);
if (!domain_policy) {
printf("samrsync_open_domain failed\n");
ret = false;
@@ -1549,7 +1549,7 @@ bool torture_rpc_samsync(struct torture_context *torture)
credentials = cli_credentials_init(mem_ctx);
cli_credentials_set_workstation(credentials, TEST_MACHINE_NAME, CRED_SPECIFIED);
- cli_credentials_set_domain(credentials, lp_workgroup(global_loadparm), CRED_SPECIFIED);
+ cli_credentials_set_domain(credentials, lp_workgroup(torture->lp_ctx), CRED_SPECIFIED);
cli_credentials_set_username(credentials, test_machine_account, CRED_SPECIFIED);
cli_credentials_set_password(credentials, machine_password, CRED_SPECIFIED);
cli_credentials_set_secure_channel_type(credentials,
@@ -1586,7 +1586,7 @@ bool torture_rpc_samsync(struct torture_context *torture)
credentials_wksta = cli_credentials_init(mem_ctx);
cli_credentials_set_workstation(credentials_wksta, TEST_WKSTA_MACHINE_NAME, CRED_SPECIFIED);
- cli_credentials_set_domain(credentials_wksta, lp_workgroup(global_loadparm), CRED_SPECIFIED);
+ cli_credentials_set_domain(credentials_wksta, lp_workgroup(torture->lp_ctx), CRED_SPECIFIED);
cli_credentials_set_username(credentials_wksta, test_wksta_machine_account, CRED_SPECIFIED);
cli_credentials_set_password(credentials_wksta, wksta_machine_password, CRED_SPECIFIED);
cli_credentials_set_secure_channel_type(credentials_wksta,
diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c
index 630e9cf1e4..a47fbdd667 100644
--- a/source4/torture/rpc/scanner.c
+++ b/source4/torture/rpc/scanner.c
@@ -131,7 +131,7 @@ bool torture_rpc_scanner(struct torture_context *torture)
b->endpoint = talloc_strdup(b, l->table->name);
}
- lp_set_cmdline(global_loadparm, "torture:binding", dcerpc_binding_string(torture, b));
+ lp_set_cmdline(torture->lp_ctx, "torture:binding", dcerpc_binding_string(torture, b));
status = torture_rpc_connection(torture, &p, &ndr_table_mgmt);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c
index a1a83c69d7..f7c9806faa 100644
--- a/source4/torture/rpc/schannel.c
+++ b/source4/torture/rpc/schannel.c
@@ -47,11 +47,11 @@ bool test_netlogon_ex_ops(struct dcerpc_pipe *p, struct torture_context *tctx,
DATA_BLOB names_blob, chal, lm_resp, nt_resp;
int i;
int flags = CLI_CRED_NTLM_AUTH;
- if (lp_client_lanman_auth(global_loadparm)) {
+ if (lp_client_lanman_auth(tctx->lp_ctx)) {
flags |= CLI_CRED_LANMAN_AUTH;
}
- if (lp_client_ntlmv2_auth(global_loadparm)) {
+ if (lp_client_ntlmv2_auth(tctx->lp_ctx)) {
flags |= CLI_CRED_NTLMv2_AUTH;
}
@@ -122,7 +122,7 @@ static bool test_samr_ops(struct torture_context *tctx,
struct policy_handle handle;
struct policy_handle domain_handle;
- name.string = lp_workgroup(global_loadparm);
+ name.string = lp_workgroup(tctx->lp_ctx);
r.in.domain_name = &name;
connect.in.system_name = 0;
@@ -233,7 +233,7 @@ static bool test_schannel(struct torture_context *tctx,
{
struct test_join *join_ctx;
NTSTATUS status;
- const char *binding = lp_parm_string(global_loadparm, NULL, "torture", "binding");
+ const char *binding = torture_setting_string(tctx, "binding", NULL);
struct dcerpc_binding *b;
struct dcerpc_pipe *p = NULL;
struct dcerpc_pipe *p_netlogon = NULL;
diff --git a/source4/torture/rpc/session_key.c b/source4/torture/rpc/session_key.c
index 69dc8da6c1..765458c62a 100644
--- a/source4/torture/rpc/session_key.c
+++ b/source4/torture/rpc/session_key.c
@@ -148,9 +148,9 @@ static bool test_secrets(struct torture_context *torture, const void *_data)
const struct secret_settings *settings =
(const struct secret_settings *)_data;
- lp_set_cmdline(global_loadparm, "ntlmssp client:keyexchange", settings->keyexchange?"True":"False");
- lp_set_cmdline(global_loadparm, "ntlmssp_client:ntlm2", settings->ntlm2?"True":"False");
- lp_set_cmdline(global_loadparm, "ntlmssp_client:lm_key", settings->lm_key?"True":"False");
+ lp_set_cmdline(torture->lp_ctx, "ntlmssp client:keyexchange", settings->keyexchange?"True":"False");
+ lp_set_cmdline(torture->lp_ctx, "ntlmssp_client:ntlm2", settings->ntlm2?"True":"False");
+ lp_set_cmdline(torture->lp_ctx, "ntlmssp_client:lm_key", settings->lm_key?"True":"False");
torture_assert_ntstatus_ok(torture, torture_rpc_binding(torture, &binding),
"Getting bindoptions");
diff --git a/source4/torture/rpc/spoolss_notify.c b/source4/torture/rpc/spoolss_notify.c
index 2547f8ce00..c39294e431 100644
--- a/source4/torture/rpc/spoolss_notify.c
+++ b/source4/torture/rpc/spoolss_notify.c
@@ -224,11 +224,11 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, dcerpc_register_ep_server(&ep_server),
"unable to register spoolss server");
- lp_set_cmdline(global_loadparm, "dcerpc endpoint servers", "spoolss");
+ lp_set_cmdline(tctx->lp_ctx, "dcerpc endpoint servers", "spoolss");
address = iface_n_ip(0);
torture_comment(tctx, "Listening for callbacks on %s\n", address);
- status = smbsrv_add_socket(p->conn->event_ctx, &single_ops, address);
+ status = smbsrv_add_socket(p->conn->event_ctx, tctx->lp_ctx, &single_ops, address);
torture_assert_ntstatus_ok(tctx, status, "starting smb server");
status = dcesrv_init_context(tctx, endpoints, &dce_ctx);
diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c
index 725799f2dd..edffe539d7 100644
--- a/source4/torture/rpc/testjoin.c
+++ b/source4/torture/rpc/testjoin.c
@@ -126,7 +126,7 @@ struct test_join *torture_create_testuser(struct torture_context *torture,
int policy_min_pw_len = 0;
struct test_join *join;
char *random_pw;
- const char *dc_binding = lp_parm_string(global_loadparm, NULL, "torture", "dc_binding");
+ const char *dc_binding = torture_setting_string(torture, "dc_binding", NULL);
join = talloc(NULL, struct test_join);
if (join == NULL) {
@@ -276,7 +276,7 @@ again:
u.info21.description.string = talloc_asprintf(join,
"Samba4 torture account created by host %s: %s",
- lp_netbios_name(global_loadparm),
+ lp_netbios_name(torture->lp_ctx),
timestring(join, time(NULL)));
printf("Resetting ACB flags, force pw change time\n");
diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c
index 9a2f518535..dba2fa16e3 100644
--- a/source4/torture/rpc/wkssvc.c
+++ b/source4/torture/rpc/wkssvc.c
@@ -212,7 +212,7 @@ static bool test_NetrWkstaUserGetInfo(struct torture_context *tctx,
NTSTATUS status;
struct wkssvc_NetrWkstaUserGetInfo r;
union wkssvc_NetrWkstaUserInfo info;
- const char *dom = lp_workgroup(global_loadparm);
+ const char *dom = lp_workgroup(tctx->lp_ctx);
struct cli_credentials *creds = cmdline_credentials;
const char *user = cli_credentials_get_username(creds);
int i;
@@ -483,7 +483,7 @@ static bool test_NetrLogonDomainNameAdd(struct torture_context *tctx,
NTSTATUS status;
struct wkssvc_NetrLogonDomainNameAdd r;
- r.in.domain_name = lp_workgroup(global_loadparm);
+ r.in.domain_name = lp_workgroup(tctx->lp_ctx);
torture_comment(tctx, "testing NetrLogonDomainNameAdd\n");
@@ -501,7 +501,7 @@ static bool test_NetrLogonDomainNameDel(struct torture_context *tctx,
NTSTATUS status;
struct wkssvc_NetrLogonDomainNameDel r;
- r.in.domain_name = lp_workgroup(global_loadparm);
+ r.in.domain_name = lp_workgroup(tctx->lp_ctx);
torture_comment(tctx, "testing NetrLogonDomainNameDel\n");
@@ -595,7 +595,7 @@ static bool test_NetrValidateName(struct torture_context *tctx,
for (i=0; i<ARRAY_SIZE(levels); i++) {
r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
- r.in.name = lp_workgroup(global_loadparm);
+ r.in.name = lp_workgroup(tctx->lp_ctx);
r.in.Account = NULL;
r.in.Password = NULL;
r.in.name_type = levels[i];
@@ -625,7 +625,7 @@ static bool test_NetrValidateName2(struct torture_context *tctx,
for (i=0; i<ARRAY_SIZE(levels); i++) {
r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
- r.in.name = lp_workgroup(global_loadparm);
+ r.in.name = lp_workgroup(tctx->lp_ctx);
r.in.Account = NULL;
r.in.EncryptedPassword = NULL;
r.in.name_type = levels[i];
@@ -1047,7 +1047,7 @@ static bool test_NetrGetJoinableOus(struct torture_context *tctx,
const char **ous = NULL;
r.in.server_name = dcerpc_server_name(p);
- r.in.domain_name = lp_workgroup(global_loadparm);
+ r.in.domain_name = lp_workgroup(tctx->lp_ctx);
r.in.Account = NULL;
r.in.unknown = NULL;
r.in.num_ous = r.out.num_ous = &num_ous;
@@ -1073,7 +1073,7 @@ static bool test_NetrGetJoinableOus2(struct torture_context *tctx,
const char **ous = NULL;
r.in.server_name = dcerpc_server_name(p);
- r.in.domain_name = lp_workgroup(global_loadparm);
+ r.in.domain_name = lp_workgroup(tctx->lp_ctx);
r.in.Account = NULL;
r.in.EncryptedPassword = NULL;
r.in.num_ous = r.out.num_ous = &num_ous;
@@ -1100,7 +1100,7 @@ static bool test_NetrUnjoinDomain(struct torture_context *tctx,
const char *admin_account = NULL;
admin_account = talloc_asprintf(tctx, "%s\\%s",
- lp_workgroup(global_loadparm),
+ lp_workgroup(tctx->lp_ctx),
user);
r.in.server_name = dcerpc_server_name(p);
@@ -1128,11 +1128,11 @@ static bool test_NetrJoinDomain(struct torture_context *tctx,
const char *admin_account = NULL;
admin_account = talloc_asprintf(tctx, "%s\\%s",
- lp_workgroup(global_loadparm),
+ lp_workgroup(tctx->lp_ctx),
user);
r.in.server_name = dcerpc_server_name(p);
- r.in.domain_name = lp_realm(global_loadparm);
+ r.in.domain_name = lp_realm(tctx->lp_ctx);
r.in.account_ou = NULL;
r.in.Account = admin_account;
r.in.password = NULL;
diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c
index d01c138ef8..f1bc63dbbb 100644
--- a/source4/torture/smb2/connect.c
+++ b/source4/torture/smb2/connect.c
@@ -196,7 +196,7 @@ bool torture_smb2_connect(struct torture_context *torture)
struct smb2_handle h1, h2;
NTSTATUS status;
- if (!torture_smb2_connection(mem_ctx, &tree)) {
+ if (!torture_smb2_connection(torture, &tree)) {
return false;
}
diff --git a/source4/torture/smb2/dir.c b/source4/torture/smb2/dir.c
index eb24dd0884..58cf2229bc 100644
--- a/source4/torture/smb2/dir.c
+++ b/source4/torture/smb2/dir.c
@@ -81,7 +81,7 @@ bool torture_smb2_dir(struct torture_context *torture)
struct smb2_tree *tree;
bool ret = true;
- if (!torture_smb2_connection(mem_ctx, &tree)) {
+ if (!torture_smb2_connection(torture, &tree)) {
return false;
}
diff --git a/source4/torture/smb2/find.c b/source4/torture/smb2/find.c
index 654866dfb5..06222e8e9e 100644
--- a/source4/torture/smb2/find.c
+++ b/source4/torture/smb2/find.c
@@ -202,7 +202,7 @@ bool torture_smb2_find(struct torture_context *torture)
bool ret = true;
NTSTATUS status;
- if (!torture_smb2_connection(mem_ctx, &tree)) {
+ if (!torture_smb2_connection(torture, &tree)) {
return false;
}
diff --git a/source4/torture/smb2/getinfo.c b/source4/torture/smb2/getinfo.c
index 9ed0b9ddb5..73107a5217 100644
--- a/source4/torture/smb2/getinfo.c
+++ b/source4/torture/smb2/getinfo.c
@@ -177,7 +177,7 @@ bool torture_smb2_getinfo(struct torture_context *torture)
bool ret = true;
NTSTATUS status;
- if (!torture_smb2_connection(mem_ctx, &tree)) {
+ if (!torture_smb2_connection(torture, &tree)) {
return false;
}
diff --git a/source4/torture/smb2/maxwrite.c b/source4/torture/smb2/maxwrite.c
index 588a49221e..892bbd73ac 100644
--- a/source4/torture/smb2/maxwrite.c
+++ b/source4/torture/smb2/maxwrite.c
@@ -31,7 +31,7 @@
/*
test writing
*/
-static NTSTATUS torture_smb2_write(TALLOC_CTX *mem_ctx,
+static NTSTATUS torture_smb2_write(struct torture_context *tctx,
struct smb2_tree *tree,
struct smb2_handle handle)
{
@@ -43,7 +43,7 @@ static NTSTATUS torture_smb2_write(TALLOC_CTX *mem_ctx,
int min = 1;
while (max > min) {
- TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
+ TALLOC_CTX *tmp_ctx = talloc_new(tctx);
len = 1+(min+max)/2;
@@ -69,7 +69,7 @@ static NTSTATUS torture_smb2_write(TALLOC_CTX *mem_ctx,
/* vista bug */
printf("coping with server disconnect\n");
talloc_free(tree);
- if (!torture_smb2_connection(mem_ctx, &tree)) {
+ if (!torture_smb2_connection(torture, &tree)) {
printf("failed to reconnect\n");
return NT_STATUS_NET_WRITE_FAULT;
}
@@ -113,23 +113,20 @@ static NTSTATUS torture_smb2_write(TALLOC_CTX *mem_ctx,
*/
bool torture_smb2_maxwrite(struct torture_context *torture)
{
- TALLOC_CTX *mem_ctx = talloc_new(NULL);
struct smb2_tree *tree;
struct smb2_handle h1;
NTSTATUS status;
- if (!torture_smb2_connection(mem_ctx, &tree)) {
+ if (!torture_smb2_connection(torture, &tree)) {
return false;
}
h1 = torture_smb2_create(tree, FNAME);
- status = torture_smb2_write(mem_ctx, tree, h1);
+ status = torture_smb2_write(torture, tree, h1);
if (!NT_STATUS_IS_OK(status)) {
printf("Write failed - %s\n", nt_errstr(status));
return false;
}
- talloc_free(mem_ctx);
-
return true;
}
diff --git a/source4/torture/smb2/notify.c b/source4/torture/smb2/notify.c
index cabe81ca71..574136ab3f 100644
--- a/source4/torture/smb2/notify.c
+++ b/source4/torture/smb2/notify.c
@@ -190,17 +190,14 @@ done:
*/
bool torture_smb2_notify(struct torture_context *torture)
{
- TALLOC_CTX *mem_ctx = talloc_new(NULL);
struct smb2_tree *tree;
bool ret = true;
- if (!torture_smb2_connection(mem_ctx, &tree)) {
+ if (!torture_smb2_connection(torture, &tree)) {
return false;
}
- ret &= test_valid_request(mem_ctx, tree);
-
- talloc_free(mem_ctx);
+ ret &= test_valid_request(torture, tree);
return ret;
}
diff --git a/source4/torture/smb2/scan.c b/source4/torture/smb2/scan.c
index f3e4d5cd36..eda753b1ee 100644
--- a/source4/torture/smb2/scan.c
+++ b/source4/torture/smb2/scan.c
@@ -37,14 +37,13 @@
*/
bool torture_smb2_getinfo_scan(struct torture_context *torture)
{
- TALLOC_CTX *mem_ctx = talloc_new(NULL);
struct smb2_tree *tree;
NTSTATUS status;
struct smb2_getinfo io;
struct smb2_handle fhandle, dhandle;
int c, i;
- if (!torture_smb2_connection(mem_ctx, &tree)) {
+ if (!torture_smb2_connection(torture, &tree)) {
return false;
}
@@ -74,7 +73,7 @@ bool torture_smb2_getinfo_scan(struct torture_context *torture)
io.in.level = (i<<8) | c;
io.in.file.handle = fhandle;
- status = smb2_getinfo(tree, mem_ctx, &io);
+ status = smb2_getinfo(tree, torture, &io);
if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS) &&
!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER) &&
!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
@@ -84,7 +83,7 @@ bool torture_smb2_getinfo_scan(struct torture_context *torture)
}
io.in.file.handle = dhandle;
- status = smb2_getinfo(tree, mem_ctx, &io);
+ status = smb2_getinfo(tree, torture, &io);
if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS) &&
!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER) &&
!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
@@ -95,8 +94,6 @@ bool torture_smb2_getinfo_scan(struct torture_context *torture)
}
}
- talloc_free(mem_ctx);
-
return true;
}
@@ -105,14 +102,13 @@ bool torture_smb2_getinfo_scan(struct torture_context *torture)
*/
bool torture_smb2_setinfo_scan(struct torture_context *torture)
{
- TALLOC_CTX *mem_ctx = talloc_new(NULL);
struct smb2_tree *tree;
NTSTATUS status;
struct smb2_setinfo io;
struct smb2_handle handle;
int c, i;
- if (!torture_smb2_connection(mem_ctx, &tree)) {
+ if (!torture_smb2_connection(torture, &tree)) {
return false;
}
@@ -126,7 +122,7 @@ bool torture_smb2_setinfo_scan(struct torture_context *torture)
torture_smb2_testfile(tree, FNAME, &handle);
ZERO_STRUCT(io);
- io.in.blob = data_blob_talloc_zero(mem_ctx, 1024);
+ io.in.blob = data_blob_talloc_zero(torture, 1024);
for (c=1;c<5;c++) {
for (i=0;i<0x100;i++) {
@@ -141,8 +137,6 @@ bool torture_smb2_setinfo_scan(struct torture_context *torture)
}
}
- talloc_free(mem_ctx);
-
return true;
}
@@ -152,14 +146,13 @@ bool torture_smb2_setinfo_scan(struct torture_context *torture)
*/
bool torture_smb2_find_scan(struct torture_context *torture)
{
- TALLOC_CTX *mem_ctx = talloc_new(NULL);
struct smb2_tree *tree;
NTSTATUS status;
struct smb2_find io;
struct smb2_handle handle;
int i;
- if (!torture_smb2_connection(mem_ctx, &tree)) {
+ if (!torture_smb2_connection(torture, &tree)) {
return false;
}
@@ -179,7 +172,7 @@ bool torture_smb2_find_scan(struct torture_context *torture)
io.in.level = i;
io.in.file.handle = handle;
- status = smb2_find(tree, mem_ctx, &io);
+ status = smb2_find(tree, torture, &io);
if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS) &&
!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER) &&
!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
@@ -189,8 +182,6 @@ bool torture_smb2_find_scan(struct torture_context *torture)
}
}
- talloc_free(mem_ctx);
-
return true;
}
diff --git a/source4/torture/smb2/setinfo.c b/source4/torture/smb2/setinfo.c
index 6a81f13f67..685bb5a47b 100644
--- a/source4/torture/smb2/setinfo.c
+++ b/source4/torture/smb2/setinfo.c
@@ -40,7 +40,6 @@ bool torture_smb2_setinfo(struct torture_context *torture)
{
struct smb2_tree *tree;
bool ret = true;
- TALLOC_CTX *mem_ctx = talloc_new(NULL);
struct smb2_handle handle;
char *fname;
char *fname_new;
@@ -56,10 +55,10 @@ bool torture_smb2_setinfo(struct torture_context *torture)
ZERO_STRUCT(handle);
- fname = talloc_asprintf(mem_ctx, BASEDIR "fnum_test_%d.txt", n);
- fname_new = talloc_asprintf(mem_ctx, BASEDIR "fnum_test_new_%d.txt", n);
+ fname = talloc_asprintf(torture, BASEDIR "fnum_test_%d.txt", n);
+ fname_new = talloc_asprintf(torture, BASEDIR "fnum_test_new_%d.txt", n);
- if (!torture_smb2_connection(mem_ctx, &tree)) {
+ if (!torture_smb2_connection(torture, &tree)) {
return false;
}
@@ -96,7 +95,7 @@ bool torture_smb2_setinfo(struct torture_context *torture)
do { if (NT_STATUS_IS_OK(status)) { \
finfo2.generic.level = RAW_FILEINFO_ ## call; \
finfo2.generic.in.file.handle = handle; \
- status2 = smb2_getinfo_file(tree, mem_ctx, &finfo2); \
+ status2 = smb2_getinfo_file(tree, torture, &finfo2); \
if (!NT_STATUS_IS_OK(status2)) { \
printf("(%s) %s - %s\n", __location__, #call, nt_errstr(status2)); \
ret = false; \
@@ -122,8 +121,8 @@ bool torture_smb2_setinfo(struct torture_context *torture)
call_name, #stype, #field, \
(uint_t)value, \
(uint_t)nt_time_to_unix(finfo2.stype.out.field)); \
- printf("\t%s", timestring(mem_ctx, value)); \
- printf("\t%s\n", nt_time_string(mem_ctx, finfo2.stype.out.field)); \
+ printf("\t%s", timestring(torture, value)); \
+ printf("\t%s\n", nt_time_string(torture, finfo2.stype.out.field)); \
torture_smb2_all_info(tree, handle); \
ret = false; \
goto done; \
@@ -240,7 +239,7 @@ bool torture_smb2_setinfo(struct torture_context *torture)
CHECK1(SEC_DESC);
sd = finfo2.query_secdesc.out.sd;
- test_sid = dom_sid_parse_talloc(mem_ctx, "S-1-5-32-1234-5432");
+ test_sid = dom_sid_parse_talloc(torture, "S-1-5-32-1234-5432");
ZERO_STRUCT(ace);
ace.type = SEC_ACE_TYPE_ACCESS_ALLOWED;
ace.flags = 0;
@@ -291,7 +290,6 @@ done:
}
smb2_util_unlink(tree, fname);
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c
index 705f10a841..ab3d299c5a 100644
--- a/source4/torture/smb2/util.c
+++ b/source4/torture/smb2/util.c
@@ -302,15 +302,15 @@ void torture_smb2_all_info(struct smb2_tree *tree, struct smb2_handle handle)
/*
open a smb2 connection
*/
-bool torture_smb2_connection(TALLOC_CTX *mem_ctx, struct smb2_tree **tree)
+bool torture_smb2_connection(struct torture_context *tctx, struct smb2_tree **tree)
{
NTSTATUS status;
- const char *host = lp_parm_string(global_loadparm, NULL, "torture", "host");
- const char *share = lp_parm_string(global_loadparm, NULL, "torture", "share");
+ const char *host = torture_setting_string(tctx, "host", NULL);
+ const char *share = torture_setting_string(tctx, "share", NULL);
struct cli_credentials *credentials = cmdline_credentials;
- status = smb2_connect(mem_ctx, host, share, credentials, tree,
- event_context_find(mem_ctx));
+ status = smb2_connect(tctx, host, share, credentials, tree,
+ event_context_find(tctx));
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to SMB2 share \\\\%s\\%s - %s\n",
host, share, nt_errstr(status));
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index e85a91def7..b0972e86fc 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -123,7 +123,33 @@ static bool run_test(struct torture_context *torture, const char *name)
return ret;
}
-static void parse_dns(const char *dns)
+static bool parse_target(struct loadparm_context *lp_ctx, const char *target)
+{
+ char *host = NULL, *share = NULL;
+ struct dcerpc_binding *binding_struct;
+ NTSTATUS status;
+
+ /* see if its a RPC transport specifier */
+ if (!smbcli_parse_unc(target, NULL, &host, &share)) {
+ status = dcerpc_parse_binding(talloc_autofree_context(), target, &binding_struct);
+ if (NT_STATUS_IS_ERR(status)) {
+ d_printf("Invalid option: %s is not a valid torture target (share or binding string)\n\n", target);
+ return false;
+ }
+ lp_set_cmdline(lp_ctx, "torture:host", binding_struct->host);
+ if (lp_parm_string(lp_ctx, NULL, "torture", "share") == NULL)
+ lp_set_cmdline(lp_ctx, "torture:share", "IPC$");
+ lp_set_cmdline(lp_ctx, "torture:binding", target);
+ } else {
+ lp_set_cmdline(lp_ctx, "torture:host", host);
+ lp_set_cmdline(lp_ctx, "torture:share", share);
+ lp_set_cmdline(lp_ctx, "torture:binding", host);
+ }
+
+ return true;
+}
+
+static void parse_dns(struct loadparm_context *lp_ctx, const char *dns)
{
char *userdn, *basedn, *secret;
char *p, *d;
@@ -131,33 +157,33 @@ static void parse_dns(const char *dns)
/* retrievieng the userdn */
p = strchr_m(dns, '#');
if (!p) {
- lp_set_cmdline(global_loadparm, "torture:ldap_userdn", "");
- lp_set_cmdline(global_loadparm, "torture:ldap_basedn", "");
- lp_set_cmdline(global_loadparm, "torture:ldap_secret", "");
+ lp_set_cmdline(lp_ctx, "torture:ldap_userdn", "");
+ lp_set_cmdline(lp_ctx, "torture:ldap_basedn", "");
+ lp_set_cmdline(lp_ctx, "torture:ldap_secret", "");
return;
}
userdn = strndup(dns, p - dns);
- lp_set_cmdline(global_loadparm, "torture:ldap_userdn", userdn);
+ lp_set_cmdline(lp_ctx, "torture:ldap_userdn", userdn);
/* retrieve the basedn */
d = p + 1;
p = strchr_m(d, '#');
if (!p) {
- lp_set_cmdline(global_loadparm, "torture:ldap_basedn", "");
- lp_set_cmdline(global_loadparm, "torture:ldap_secret", "");
+ lp_set_cmdline(lp_ctx, "torture:ldap_basedn", "");
+ lp_set_cmdline(lp_ctx, "torture:ldap_secret", "");
return;
}
basedn = strndup(d, p - d);
- lp_set_cmdline(global_loadparm, "torture:ldap_basedn", basedn);
+ lp_set_cmdline(lp_ctx, "torture:ldap_basedn", basedn);
/* retrieve the secret */
p = p + 1;
if (!p) {
- lp_set_cmdline(global_loadparm, "torture:ldap_secret", "");
+ lp_set_cmdline(lp_ctx, "torture:ldap_secret", "");
return;
}
secret = strdup(p);
- lp_set_cmdline(global_loadparm, "torture:ldap_secret", secret);
+ lp_set_cmdline(lp_ctx, "torture:ldap_secret", secret);
printf ("%s - %s - %s\n", userdn, basedn, secret);
@@ -491,14 +517,12 @@ int main(int argc,char *argv[])
char **argv_new;
poptContext pc;
static const char *target = "other";
- struct dcerpc_binding *binding_struct;
NTSTATUS status;
int shell = false;
static const char *ui_ops_name = "simple";
const char *basedir = NULL;
const char *extra_module = NULL;
static int list_tests = 0;
- char *host = NULL, *share = NULL;
enum {OPT_LOADFILE=1000,OPT_UNCLIST,OPT_TIMELIMIT,OPT_DNS, OPT_LIST,
OPT_DANGEROUS,OPT_SMB_PORTS,OPT_ASYNC,OPT_NUMPROGS};
@@ -560,7 +584,7 @@ int main(int argc,char *argv[])
lp_set_cmdline(global_loadparm, "torture:nprocs", poptGetOptArg(pc));
break;
case OPT_DNS:
- parse_dns(poptGetOptArg(pc));
+ parse_dns(global_loadparm, poptGetOptArg(pc));
break;
case OPT_DANGEROUS:
lp_set_cmdline(global_loadparm, "torture:dangerous", "Yes");
@@ -634,22 +658,9 @@ int main(int argc,char *argv[])
exit(1);
}
- /* see if its a RPC transport specifier */
- if (!smbcli_parse_unc(argv_new[1], NULL, &host, &share)) {
- status = dcerpc_parse_binding(talloc_autofree_context(), argv_new[1], &binding_struct);
- if (NT_STATUS_IS_ERR(status)) {
- d_printf("Invalid option: %s is not a valid torture target (share or binding string)\n\n", argv_new[1]);
- usage(pc);
- return false;
- }
- lp_set_cmdline(global_loadparm, "torture:host", binding_struct->host);
- if (lp_parm_string(global_loadparm, NULL, "torture", "share") == NULL)
- lp_set_cmdline(global_loadparm, "torture:share", "IPC$");
- lp_set_cmdline(global_loadparm, "torture:binding", argv_new[1]);
- } else {
- lp_set_cmdline(global_loadparm, "torture:host", host);
- lp_set_cmdline(global_loadparm, "torture:share", share);
- lp_set_cmdline(global_loadparm, "torture:binding", host);
+ if (!parse_target(global_loadparm, argv_new[1])) {
+ usage(pc);
+ exit(1);
}
if (!strcmp(ui_ops_name, "simple")) {
@@ -679,6 +690,8 @@ int main(int argc,char *argv[])
torture->outputdir = pwd;
}
+ torture->lp_ctx = global_loadparm;
+
if (argc_new == 0) {
printf("You must specify a test to run, or 'ALL'\n");
} else if (shell) {
diff --git a/source4/torture/ui.c b/source4/torture/ui.c
index 6abd394f76..67442f1df1 100644
--- a/source4/torture/ui.c
+++ b/source4/torture/ui.c
@@ -368,26 +368,26 @@ bool torture_run_test(struct torture_context *context,
int torture_setting_int(struct torture_context *test, const char *name,
int default_value)
{
- return lp_parm_int(global_loadparm, NULL, "torture", name, default_value);
+ return lp_parm_int(test->lp_ctx, NULL, "torture", name, default_value);
}
double torture_setting_double(struct torture_context *test, const char *name,
double default_value)
{
- return lp_parm_double(global_loadparm, NULL, "torture", name, default_value);
+ return lp_parm_double(test->lp_ctx, NULL, "torture", name, default_value);
}
bool torture_setting_bool(struct torture_context *test, const char *name,
bool default_value)
{
- return lp_parm_bool(global_loadparm, NULL, "torture", name, default_value);
+ return lp_parm_bool(test->lp_ctx, NULL, "torture", name, default_value);
}
const char *torture_setting_string(struct torture_context *test,
const char *name,
const char *default_value)
{
- const char *ret = lp_parm_string(global_loadparm, NULL, "torture", name);
+ const char *ret = lp_parm_string(test->lp_ctx, NULL, "torture", name);
if (ret == NULL)
return default_value;
diff --git a/source4/torture/ui.h b/source4/torture/ui.h
index ebf7844ae2..5f0ec3dbff 100644
--- a/source4/torture/ui.h
+++ b/source4/torture/ui.h
@@ -90,6 +90,8 @@ struct torture_context
const char *outputdir;
int level;
struct event_context *ev;
+
+ struct loadparm_context *lp_ctx;
};
/*
diff --git a/source4/torture/unix/whoami.c b/source4/torture/unix/whoami.c
index f45d2345db..422e2abcbf 100644
--- a/source4/torture/unix/whoami.c
+++ b/source4/torture/unix/whoami.c
@@ -66,16 +66,16 @@ struct smb_whoami
struct dom_sid ** sid_list;
};
-static struct smbcli_state *connect_to_server(void *mem_ctx,
+static struct smbcli_state *connect_to_server(struct torture_context *tctx,
struct cli_credentials *creds)
{
NTSTATUS status;
struct smbcli_state *cli;
- const char *host = lp_parm_string(global_loadparm, NULL, "torture", "host");
- const char *share = lp_parm_string(global_loadparm, NULL, "torture", "share");
+ const char *host = torture_setting_string(tctx, "host", NULL);
+ const char *share = torture_setting_string(tctx, "share", NULL);
- status = smbcli_full_connection(mem_ctx, &cli,
+ status = smbcli_full_connection(tctx, &cli,
host, share, NULL,
creds, NULL);
@@ -270,29 +270,25 @@ bool torture_unix_whoami(struct torture_context *torture)
struct smbcli_state *cli;
struct cli_credentials *anon_credentials;
struct smb_whoami whoami;
- void *mem_ctx;
- mem_ctx = talloc_init("smb_query_posix_whoami");
- torture_assert(torture, mem_ctx != NULL, "malloc failed");
-
- if (!(cli = connect_to_server(mem_ctx, cmdline_credentials))) {
- goto fail;
+ if (!(cli = connect_to_server(torture, cmdline_credentials))) {
+ return false;
}
/* Test basic authenticated mapping. */
printf("calling SMB_QFS_POSIX_WHOAMI on an authenticated connection\n");
- if (!smb_raw_query_posix_whoami(mem_ctx, torture,
+ if (!smb_raw_query_posix_whoami(torture, torture,
cli, &whoami, 0xFFFF)) {
smbcli_tdis(cli);
- goto fail;
+ return false;
}
/* Test that the server drops the UID and GID list. */
printf("calling SMB_QFS_POSIX_WHOAMI with a small buffer\n");
- if (!smb_raw_query_posix_whoami(mem_ctx, torture,
+ if (!smb_raw_query_posix_whoami(torture, torture,
cli, &whoami, 0x40)) {
smbcli_tdis(cli);
- goto fail;
+ return false;
}
torture_assert_int_equal(torture, whoami.num_gids, 0,
@@ -305,16 +301,16 @@ bool torture_unix_whoami(struct torture_context *torture)
smbcli_tdis(cli);
printf("calling SMB_QFS_POSIX_WHOAMI on an anonymous connection\n");
- anon_credentials = cli_credentials_init_anon(mem_ctx);
+ anon_credentials = cli_credentials_init_anon(torture);
- if (!(cli = connect_to_server(mem_ctx, anon_credentials))) {
- goto fail;
+ if (!(cli = connect_to_server(torture, anon_credentials))) {
+ return false;
}
- if (!smb_raw_query_posix_whoami(mem_ctx, torture,
+ if (!smb_raw_query_posix_whoami(torture, torture,
cli, &whoami, 0xFFFF)) {
smbcli_tdis(cli);
- goto fail;
+ return false;
}
smbcli_tdis(cli);
@@ -331,13 +327,7 @@ bool torture_unix_whoami(struct torture_context *torture)
printf("server does not support SMB_WHOAMI_GUEST flag\n");
}
- talloc_free(mem_ctx);
return true;
-
-fail:
- talloc_free(mem_ctx);
- return false;
-
}
/* vim: set sts=8 sw=8 : */
diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c
index 21cdba89eb..965b5543b0 100644
--- a/source4/torture/util_smb.c
+++ b/source4/torture/util_smb.c
@@ -643,7 +643,7 @@ double torture_create_procs(struct torture_context *tctx,
srandom(((int)mypid) ^ ((int)time(NULL)));
asprintf(&myname, "CLIENT%d", i);
- lp_set_cmdline(global_loadparm, "netbios name", myname);
+ lp_set_cmdline(tctx->lp_ctx, "netbios name", myname);
free(myname);
diff --git a/source4/torture/winbind/struct_based.c b/source4/torture/winbind/struct_based.c
index 3a3629fe5d..0fe2148b75 100644
--- a/source4/torture/winbind/struct_based.c
+++ b/source4/torture/winbind/struct_based.c
@@ -125,7 +125,7 @@ static bool torture_winbind_struct_info(struct torture_context *torture)
separator = torture_setting_string(torture,
"winbindd separator",
- lp_winbind_separator(global_loadparm));
+ lp_winbind_separator(torture->lp_ctx));
torture_assert_int_equal(torture,
rep.data.info.winbind_separator,
*separator,
@@ -154,7 +154,7 @@ static bool torture_winbind_struct_priv_pipe_dir(struct torture_context *torture
torture_assert(torture, got_dir, "NULL WINBINDD_PRIV_PIPE_DIR\n");
- default_dir = lock_path(torture, global_loadparm,
+ default_dir = lock_path(torture, torture->lp_ctx,
WINBINDD_PRIV_SOCKET_SUBDIR);
expected_dir = torture_setting_string(torture,
"winbindd private pipe dir",
@@ -180,7 +180,7 @@ static bool torture_winbind_struct_netbios_name(struct torture_context *torture)
expected = torture_setting_string(torture,
"winbindd netbios name",
- lp_netbios_name(global_loadparm));
+ lp_netbios_name(torture->lp_ctx));
torture_assert_str_equal(torture,
rep.data.netbios_name, expected,
@@ -212,7 +212,7 @@ static bool torture_winbind_struct_domain_name(struct torture_context *torture)
expected = torture_setting_string(torture,
"winbindd netbios domain",
- lp_workgroup(global_loadparm));
+ lp_workgroup(torture->lp_ctx));
get_winbind_domain(torture, &domain);
diff --git a/source4/web_server/http.c b/source4/web_server/http.c
index db2021a16c..558cc79eb9 100644
--- a/source4/web_server/http.c
+++ b/source4/web_server/http.c
@@ -1023,7 +1023,7 @@ NTSTATUS http_setup_esp(struct task_server *task)
task->private = edata;
- edata->tls_params = tls_initialise(edata);
+ edata->tls_params = tls_initialise(edata, task->lp_ctx);
NT_STATUS_HAVE_NO_MEMORY(edata->tls_params);
return NT_STATUS_OK;