summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/basic/base.c5
-rw-r--r--source4/torture/basic/misc.c8
-rw-r--r--source4/torture/gentest.c4
-rw-r--r--source4/torture/locktest.c5
-rw-r--r--source4/torture/locktest2.c24
-rw-r--r--source4/torture/masktest.c12
-rw-r--r--source4/torture/raw/lockbench.c8
-rw-r--r--source4/torture/raw/openbench.c8
-rw-r--r--source4/torture/rpc/join.c7
-rw-r--r--source4/torture/rpc/samba3rpc.c27
-rw-r--r--source4/torture/unix/unix_info2.c6
-rw-r--r--source4/torture/unix/whoami.c5
-rw-r--r--source4/torture/util_smb.c6
13 files changed, 78 insertions, 47 deletions
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c
index fcd788481b..aa729ec0df 100644
--- a/source4/torture/basic/base.c
+++ b/source4/torture/basic/base.c
@@ -40,6 +40,7 @@ static struct smbcli_state *open_nbt_connection(struct torture_context *tctx)
struct nbt_name called, calling;
struct smbcli_state *cli;
const char *host = torture_setting_string(tctx, "host", NULL);
+ struct smbcli_options options;
make_nbt_name_client(&calling, lp_netbios_name(tctx->lp_ctx));
@@ -51,7 +52,9 @@ static struct smbcli_state *open_nbt_connection(struct torture_context *tctx)
goto failed;
}
- if (!smbcli_socket_connect(cli, host, lp_smb_ports(tctx->lp_ctx), lp_resolve_context(tctx->lp_ctx), lp_max_xmit(tctx->lp_ctx), lp_maxmux(tctx->lp_ctx), lp_nt_status_support(tctx->lp_ctx) && lp_use_spnego(tctx->lp_ctx), lp_client_signing(tctx->lp_ctx))) {
+ lp_smbcli_options(tctx->lp_ctx, &options);
+
+ if (!smbcli_socket_connect(cli, host, lp_smb_ports(tctx->lp_ctx), lp_resolve_context(tctx->lp_ctx), &options)) {
torture_comment(tctx, "Failed to connect with %s\n", host);
goto failed;
}
diff --git a/source4/torture/basic/misc.c b/source4/torture/basic/misc.c
index 986a4574a9..d991f117cd 100644
--- a/source4/torture/basic/misc.c
+++ b/source4/torture/basic/misc.c
@@ -821,13 +821,7 @@ static struct composite_context *torture_connect_async(
smb->in.credentials=cmdline_credentials;
smb->in.fallback_to_anonymous=false;
smb->in.workgroup=workgroup;
- smb->in.max_xmit = lp_max_xmit(tctx->lp_ctx);
- smb->in.max_mux = lp_maxmux(tctx->lp_ctx);
- smb->in.ntstatus_support = lp_nt_status_support(tctx->lp_ctx);
- smb->in.max_protocol = lp_cli_maxprotocol(tctx->lp_ctx);
- smb->in.unicode = lp_unicode(tctx->lp_ctx);
- smb->in.use_spnego = lp_use_spnego(tctx->lp_ctx) && lp_nt_status_support(tctx->lp_ctx);
- smb->in.signing = lp_client_signing(tctx->lp_ctx);
+ lp_smbcli_options(tctx->lp_ctx, &smb->in.options);
return smb_composite_connect_send(smb,mem_ctx,
lp_resolve_context(tctx->lp_ctx),ev);
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 9e5ef73ea6..c9e36b7e4e 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -176,6 +176,7 @@ static bool connect_servers(struct loadparm_context *lp_ctx)
for (i=0;i<NSERVERS;i++) {
for (j=0;j<NINSTANCES;j++) {
+ struct smbcli_options smb_options;
NTSTATUS status;
printf("Connecting to \\\\%s\\%s as %s - instance %d\n",
servers[i].server_name, servers[i].share_name,
@@ -184,13 +185,14 @@ static bool connect_servers(struct loadparm_context *lp_ctx)
cli_credentials_set_workstation(servers[i].credentials,
"gentest", CRED_SPECIFIED);
+ lp_smbcli_options(lp_ctx, &smb_options);
status = smbcli_full_connection(NULL, &servers[i].cli[j],
servers[i].server_name,
lp_smb_ports(lp_ctx),
servers[i].share_name, NULL,
servers[i].credentials,
lp_resolve_context(lp_ctx),
- NULL);
+ NULL, &smb_options);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to \\\\%s\\%s - %s\n",
servers[i].server_name, servers[i].share_name,
diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c
index 08313b6d57..90e2eec2be 100644
--- a/source4/torture/locktest.c
+++ b/source4/torture/locktest.c
@@ -113,6 +113,9 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
fstring server, myname;
NTSTATUS status;
int retries = 10;
+ struct smbcli_options options;
+
+ lp_smbcli_options(lp_ctx, &options);
printf("connect_one(%s, %d, %d)\n", share, snum, conn);
@@ -158,7 +161,7 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
share, NULL,
servers[snum],
lp_resolve_context(lp_ctx),
- NULL);
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
sleep(2);
}
diff --git a/source4/torture/locktest2.c b/source4/torture/locktest2.c
index db323e1391..0fe3725385 100644
--- a/source4/torture/locktest2.c
+++ b/source4/torture/locktest2.c
@@ -136,7 +136,8 @@ static bool try_unlock(struct smbcli_state *c, int fstype,
/*****************************************************
return a connection to a server
*******************************************************/
-static struct smbcli_state *connect_one(char *share, const char **ports)
+static struct smbcli_state *connect_one(char *share, const char **ports,
+ struct smb_options *options)
{
struct smbcli_state *c;
char *server_n;
@@ -163,8 +164,9 @@ static struct smbcli_state *connect_one(char *share, const char **ports)
slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++);
nt_status = smbcli_full_connection(NULL,
- &c, myname, server_n, ports, share, NULL,
- username, lp_workgroup(), password, NULL);
+ &c, myname, server_n, ports, share, NULL,
+ username, lp_workgroup(), password, NULL,
+ options);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status)));
return NULL;
@@ -180,6 +182,7 @@ static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
char *nfs[NSERVERS],
int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
const char **ports,
+ struct smbcli_options *options,
char *share1, char *share2)
{
int server, conn, f, fstype;
@@ -198,7 +201,7 @@ static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
smbcli_ulogoff(cli[server][conn]);
talloc_free(cli[server][conn]);
}
- cli[server][conn] = connect_one(share[server], ports);
+ cli[server][conn] = connect_one(share[server], ports, options);
if (!cli[server][conn]) {
DEBUG(0,("Failed to connect to %s\n", share[server]));
exit(1);
@@ -344,7 +347,7 @@ static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
we then do random locking ops in tamdem on the 4 fnums from each
server and ensure that the results match
*/
-static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath2, const char **ports)
+static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath2, const char **ports, struct smbcli_options *options)
{
struct smbcli_state *cli[NSERVERS][NCONNECTIONS];
char *nfs[NSERVERS];
@@ -373,7 +376,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
recorded[n].needed = true;
}
- reconnect(cli, nfs, fnum, share1, share2, ports);
+ reconnect(cli, nfs, fnum, ports, options, share1, share2);
open_files(cli, nfs, fnum);
n = retest(cli, nfs, fnum, numops);
@@ -384,7 +387,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
n1 = n;
close_files(cli, nfs, fnum);
- reconnect(cli, nfs, fnum, share1, share2, ports);
+ reconnect(cli, nfs, fnum, ports, options, share1, share2);
open_files(cli, nfs, fnum);
for (i=0;i<n-1;i++) {
@@ -411,7 +414,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
}
close_files(cli, nfs, fnum);
- reconnect(cli, nfs, fnum, share1, share2, ports);
+ reconnect(cli, nfs, fnum, ports, options, share1, share2);
open_files(cli, nfs, fnum);
showall = true;
n1 = retest(cli, nfs, fnum, n);
@@ -458,6 +461,7 @@ static void usage(void)
char *share1, *share2, *nfspath1, *nfspath2;
extern char *optarg;
extern int optind;
+ struct smbcli_options options;
int opt;
char *p;
int seed;
@@ -539,7 +543,9 @@ static void usage(void)
srandom(seed);
locking_init(1);
- test_locks(share1, share2, nfspath1, nfspath2, lp_smb_ports(lp_ctx));
+ lp_smbcli_options(lp_ctx, &options);
+ test_locks(share1, share2, nfspath1, nfspath2, lp_smb_ports(lp_ctx),
+ &options);
return(0);
}
diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index 28dfe27960..d1b853de72 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -74,7 +74,8 @@ static char *reg_test(struct smbcli_state *cli, char *pattern, char *long_name,
return a connection to a server
*******************************************************/
static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx,
- char *share, const char **ports)
+ char *share, const char **ports,
+ struct smbcli_options *options)
{
struct smbcli_state *c;
fstring server;
@@ -92,7 +93,8 @@ static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx,
server,
ports,
share, NULL,
- credentials, resolve_ctx, NULL);
+ credentials, resolve_ctx, NULL,
+ options);
if (!NT_STATUS_IS_OK(status)) {
return NULL;
@@ -303,6 +305,7 @@ static void usage(void)
int opt;
int seed;
struct loadparm_context *lp_ctx;
+ struct smbcli_options options;
setlinebuf(stdout);
@@ -382,7 +385,10 @@ static void usage(void)
argc -= optind;
argv += optind;
- cli = connect_one(lp_resolve_context(lp_ctx), share, lp_smb_ports(lp_ctx));
+ lp_smbcli_options(lp_ctx, &options);
+
+ cli = connect_one(lp_resolve_context(lp_ctx), share,
+ lp_smb_ports(lp_ctx), &options);
if (!cli) {
DEBUG(0,("Failed to connect to %s\n", share));
exit(1);
diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c
index 5093816a31..16e9f0ec75 100644
--- a/source4/torture/raw/lockbench.c
+++ b/source4/torture/raw/lockbench.c
@@ -193,13 +193,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
io->in.credentials = cmdline_credentials;
io->in.fallback_to_anonymous = false;
io->in.workgroup = lp_workgroup(state->tctx->lp_ctx);
- io->in.max_xmit = lp_max_xmit(state->tctx->lp_ctx);
- io->in.max_mux = lp_maxmux(state->tctx->lp_ctx);
- io->in.ntstatus_support = lp_nt_status_support(state->tctx->lp_ctx);
- io->in.max_protocol = lp_cli_maxprotocol(state->tctx->lp_ctx);
- io->in.unicode = lp_unicode(state->tctx->lp_ctx);
- io->in.use_spnego = lp_use_spnego(state->tctx->lp_ctx) && lp_nt_status_support(state->tctx->lp_ctx);
- io->in.signing = lp_client_signing(state->tctx->lp_ctx);
+ lp_smbcli_options(state->tctx->lp_ctx, &io->in.options);
/* kill off the remnants of the old connection */
talloc_free(state->tree);
diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c
index 7f4752cdf7..87b27d0728 100644
--- a/source4/torture/raw/openbench.c
+++ b/source4/torture/raw/openbench.c
@@ -131,13 +131,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
io->in.credentials = cmdline_credentials;
io->in.fallback_to_anonymous = false;
io->in.workgroup = lp_workgroup(state->tctx->lp_ctx);
- io->in.max_xmit = lp_max_xmit(state->tctx->lp_ctx);
- io->in.max_mux = lp_maxmux(state->tctx->lp_ctx);
- io->in.ntstatus_support = lp_nt_status_support(state->tctx->lp_ctx);
- io->in.max_protocol = lp_cli_maxprotocol(state->tctx->lp_ctx);
- io->in.unicode = lp_unicode(state->tctx->lp_ctx);
- io->in.use_spnego = lp_use_spnego(state->tctx->lp_ctx) && lp_nt_status_support(state->tctx->lp_ctx);
- io->in.signing = lp_client_signing(state->tctx->lp_ctx);
+ lp_smbcli_options(state->tctx->lp_ctx, &io->in.options);
/* kill off the remnants of the old connection */
talloc_free(state->tree);
diff --git a/source4/torture/rpc/join.c b/source4/torture/rpc/join.c
index dd2912380d..849b9fd1e9 100644
--- a/source4/torture/rpc/join.c
+++ b/source4/torture/rpc/join.c
@@ -18,6 +18,7 @@ bool torture_rpc_join(struct torture_context *torture)
struct cli_credentials *machine_account;
struct smbcli_state *cli;
const char *host = torture_setting_string(torture, "host", NULL);
+ struct smbcli_options options;
/* Join domain as a member server. */
tj = torture_join_domain(torture,
@@ -31,12 +32,14 @@ bool torture_rpc_join(struct torture_context *torture)
return false;
}
+ lp_smbcli_options(torture->lp_ctx, &options);
+
status = smbcli_full_connection(tj, &cli, host,
lp_smb_ports(torture->lp_ctx),
"IPC$", NULL,
machine_account,
lp_resolve_context(torture->lp_ctx),
- NULL);
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
TORTURE_NETBIOS_NAME));
@@ -62,7 +65,7 @@ bool torture_rpc_join(struct torture_context *torture)
"IPC$", NULL,
machine_account,
lp_resolve_context(torture->lp_ctx),
- NULL);
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
TORTURE_NETBIOS_NAME));
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index fd8236544e..3b96140fb2 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -71,6 +71,7 @@ bool torture_bind_authcontext(struct torture_context *torture)
struct dcerpc_pipe *lsa_pipe;
struct cli_credentials *anon_creds;
struct smb_composite_sesssetup setup;
+ struct smbcli_options options;
mem_ctx = talloc_init("torture_bind_authcontext");
@@ -79,12 +80,14 @@ bool torture_bind_authcontext(struct torture_context *torture)
return false;
}
+ lp_smbcli_options(torture->lp_ctx, &options);
+
status = smbcli_full_connection(mem_ctx, &cli,
torture_setting_string(torture, "host", NULL),
lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, cmdline_credentials,
lp_resolve_context(torture->lp_ctx),
- NULL);
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
nt_errstr(status));
@@ -282,6 +285,7 @@ bool torture_bind_samba3(struct torture_context *torture)
NTSTATUS status;
bool ret = false;
struct smbcli_state *cli;
+ struct smbcli_options options;
mem_ctx = talloc_init("torture_bind_authcontext");
@@ -290,12 +294,14 @@ bool torture_bind_samba3(struct torture_context *torture)
return false;
}
+ lp_smbcli_options(torture->lp_ctx, &options);
+
status = smbcli_full_connection(mem_ctx, &cli,
torture_setting_string(torture, "host", NULL),
lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, cmdline_credentials,
lp_resolve_context(torture->lp_ctx),
- NULL);
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
nt_errstr(status));
@@ -1134,6 +1140,7 @@ bool torture_netlogon_samba3(struct torture_context *torture)
struct cli_credentials *wks_creds;
const char *wks_name;
int i;
+ struct smbcli_options options;
wks_name = torture_setting_string(torture, "wksname", NULL);
if (wks_name == NULL) {
@@ -1152,12 +1159,14 @@ bool torture_netlogon_samba3(struct torture_context *torture)
goto done;
}
+ lp_smbcli_options(torture->lp_ctx, &options);
+
status = smbcli_full_connection(mem_ctx, &cli,
torture_setting_string(torture, "host", NULL),
lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, anon_creds,
lp_resolve_context(torture->lp_ctx),
- NULL);
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
nt_errstr(status));
@@ -1235,13 +1244,16 @@ static bool test_join3(struct torture_context *tctx,
bool ret = false;
struct smbcli_state *cli;
struct cli_credentials *wks_creds;
+ struct smbcli_options options;
+
+ lp_smbcli_options(tctx->lp_ctx, &options);
status = smbcli_full_connection(tctx, &cli,
torture_setting_string(tctx, "host", NULL),
lp_smb_ports(tctx->lp_ctx),
"IPC$", NULL, smb_creds,
lp_resolve_context(tctx->lp_ctx),
- NULL);
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
nt_errstr(status));
@@ -1598,17 +1610,20 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
struct cli_credentials *anon_creds;
struct cli_credentials *user_creds;
char *domain_name;
+ struct smbcli_options options;
if (!(mem_ctx = talloc_new(torture))) {
return false;
}
+ lp_smbcli_options(torture->lp_ctx, &options);
+
status = smbcli_full_connection(
mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, cmdline_credentials,
lp_resolve_context(torture->lp_ctx),
- NULL);
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) smbcli_full_connection failed: %s\n",
__location__, nt_errstr(status));
@@ -1635,7 +1650,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, anon_creds,
lp_resolve_context(torture->lp_ctx),
- NULL);
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) anon smbcli_full_connection failed: %s\n",
__location__, nt_errstr(status));
diff --git a/source4/torture/unix/unix_info2.c b/source4/torture/unix/unix_info2.c
index 9fa0d55c9e..c14be9e2d0 100644
--- a/source4/torture/unix/unix_info2.c
+++ b/source4/torture/unix/unix_info2.c
@@ -55,12 +55,16 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx)
const char *host = torture_setting_string(tctx, "host", NULL);
const char *share = torture_setting_string(tctx, "share", NULL);
+ struct smbcli_options options;
+
+ lp_smbcli_options(tctx->lp_ctx, &options);
status = smbcli_full_connection(tctx, &cli, host,
lp_smb_ports(tctx->lp_ctx),
share, NULL,
cmdline_credentials,
- lp_resolve_context(tctx->lp_ctx), NULL);
+ lp_resolve_context(tctx->lp_ctx), NULL,
+ &options);
if (!NT_STATUS_IS_OK(status)) {
printf("failed to connect to //%s/%s: %s\n",
diff --git a/source4/torture/unix/whoami.c b/source4/torture/unix/whoami.c
index 4477713bfe..3203f91bc0 100644
--- a/source4/torture/unix/whoami.c
+++ b/source4/torture/unix/whoami.c
@@ -75,12 +75,15 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx,
const char *host = torture_setting_string(tctx, "host", NULL);
const char *share = torture_setting_string(tctx, "share", NULL);
+ struct smbcli_options options;
+
+ lp_smbcli_options(tctx->lp_ctx, &options);
status = smbcli_full_connection(tctx, &cli, host,
lp_smb_ports(tctx->lp_ctx),
share, NULL,
creds, lp_resolve_context(tctx->lp_ctx),
- NULL);
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
printf("failed to connect to //%s/%s: %s\n",
diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c
index 7d35b1296e..6621b68b6e 100644
--- a/source4/torture/util_smb.c
+++ b/source4/torture/util_smb.c
@@ -474,12 +474,16 @@ _PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx,
{
NTSTATUS status;
+ struct smbcli_options options;
+
+ lp_smbcli_options(tctx->lp_ctx, &options);
+
status = smbcli_full_connection(mem_ctx, c, hostname,
lp_smb_ports(tctx->lp_ctx),
sharename, NULL,
cmdline_credentials,
lp_resolve_context(tctx->lp_ctx),
- ev);
+ ev, &options);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to open connection - %s\n", nt_errstr(status));
return false;