summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/basic/base.c2
-rw-r--r--source4/torture/basic/misc.c2
-rw-r--r--source4/torture/gentest.c25
-rw-r--r--source4/torture/locktest.c1
-rw-r--r--source4/torture/locktest2.c17
-rw-r--r--source4/torture/masktest.c5
-rw-r--r--source4/torture/nbt/wins.c1
-rw-r--r--source4/torture/raw/composite.c4
-rw-r--r--source4/torture/raw/lockbench.c2
-rw-r--r--source4/torture/raw/openbench.c2
-rw-r--r--source4/torture/rpc/join.c4
-rw-r--r--source4/torture/rpc/samba3rpc.c6
-rw-r--r--source4/torture/rpc/schannel.c3
-rw-r--r--source4/torture/unix/unix_info2.c6
-rw-r--r--source4/torture/unix/whoami.c5
-rw-r--r--source4/torture/util_smb.c1
16 files changed, 53 insertions, 33 deletions
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c
index 6f02fc4fe5..cba57ac413 100644
--- a/source4/torture/basic/base.c
+++ b/source4/torture/basic/base.c
@@ -51,7 +51,7 @@ static struct smbcli_state *open_nbt_connection(struct torture_context *tctx)
goto failed;
}
- if (!smbcli_socket_connect(cli, host, lp_resolve_context(tctx->lp_ctx), lp_max_xmit(tctx->lp_ctx), lp_maxmux(tctx->lp_ctx))) {
+ 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))) {
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 e9a41e8299..0832556b53 100644
--- a/source4/torture/basic/misc.c
+++ b/source4/torture/basic/misc.c
@@ -815,7 +815,7 @@ static struct composite_context *torture_connect_async(
torture_comment(tctx, "Open Connection to %s/%s\n",host,share);
smb->in.dest_host=talloc_strdup(mem_ctx,host);
smb->in.service=talloc_strdup(mem_ctx,share);
- smb->in.port=0;
+ smb->in.dest_ports=lp_smb_ports(tctx->lp_ctx);
smb->in.called_name = strupper_talloc(mem_ctx, host);
smb->in.service_type=NULL;
smb->in.credentials=cmdline_credentials;
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 25512b9567..b257f1dc35 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -152,7 +152,7 @@ static bool connect_servers_fast(void)
/*****************************************************
connect to the servers
*******************************************************/
-static bool connect_servers(void)
+static bool connect_servers(struct loadparm_context *lp_ctx)
{
int i, j;
@@ -185,6 +185,7 @@ static bool connect_servers(void)
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, NULL);
if (!NT_STATUS_IS_OK(status)) {
@@ -1927,11 +1928,11 @@ static struct {
run the test with the current set of op_parms parameters
return the number of operations that completed successfully
*/
-static int run_test(void)
+static int run_test(struct loadparm_context *lp_ctx)
{
int op, i;
- if (!connect_servers()) {
+ if (!connect_servers(lp_ctx)) {
printf("Failed to connect to servers\n");
exit(1);
}
@@ -2008,7 +2009,7 @@ static int run_test(void)
perform a backtracking analysis of the minimal set of operations
to generate an error
*/
-static void backtrack_analyze(void)
+static void backtrack_analyze(struct loadparm_context *lp_ctx)
{
int chunk, ret;
@@ -2029,7 +2030,7 @@ static void backtrack_analyze(void)
}
printf("Testing %d ops with %d-%d disabled\n",
options.numops, base, max-1);
- ret = run_test();
+ ret = run_test(lp_ctx);
printf("Completed %d of %d ops\n", ret, options.numops);
for (i=base;i<max; i++) {
op_parms[i].disabled = false;
@@ -2061,7 +2062,7 @@ static void backtrack_analyze(void)
} while (chunk > 0);
printf("Reduced to %d ops\n", options.numops);
- ret = run_test();
+ ret = run_test(lp_ctx);
if (ret != options.numops - 1) {
printf("Inconsistent result? ret=%d numops=%d\n", ret, options.numops);
}
@@ -2070,7 +2071,7 @@ static void backtrack_analyze(void)
/*
start the main gentest process
*/
-static bool start_gentest(void)
+static bool start_gentest(struct loadparm_context *lp_ctx)
{
int op;
int ret;
@@ -2106,15 +2107,15 @@ static bool start_gentest(void)
}
}
- ret = run_test();
+ ret = run_test(lp_ctx);
if (ret != options.numops && options.analyze) {
options.numops = ret+1;
- backtrack_analyze();
+ backtrack_analyze(lp_ctx);
} else if (options.analyze_always) {
- backtrack_analyze();
+ backtrack_analyze(lp_ctx);
} else if (options.analyze_continuous) {
- while (run_test() == options.numops) ;
+ while (run_test(lp_ctx) == options.numops) ;
}
return ret == options.numops;
@@ -2279,7 +2280,7 @@ static bool split_unc_name(const char *unc, char **server, char **share)
printf("seed=%u\n", options.seed);
- ret = start_gentest();
+ ret = start_gentest(lp_ctx);
if (ret) {
printf("gentest completed - no errors\n");
diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c
index 82e9b416b3..9758cd2cf6 100644
--- a/source4/torture/locktest.c
+++ b/source4/torture/locktest.c
@@ -153,6 +153,7 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
printf("\\\\%s\\%s\n", server, share);
status = smbcli_full_connection(NULL, &c,
server,
+ lp_smb_ports(lp_ctx),
share, NULL,
servers[snum], NULL);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/locktest2.c b/source4/torture/locktest2.c
index 1dfefc15ed..db323e1391 100644
--- a/source4/torture/locktest2.c
+++ b/source4/torture/locktest2.c
@@ -136,7 +136,7 @@ static bool try_unlock(struct smbcli_state *c, int fstype,
/*****************************************************
return a connection to a server
*******************************************************/
-static struct smbcli_state *connect_one(char *share)
+static struct smbcli_state *connect_one(char *share, const char **ports)
{
struct smbcli_state *c;
char *server_n;
@@ -163,7 +163,7 @@ static struct smbcli_state *connect_one(char *share)
slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++);
nt_status = smbcli_full_connection(NULL,
- &c, myname, server_n, 0, share, NULL,
+ &c, myname, server_n, ports, share, NULL,
username, lp_workgroup(), password, NULL);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status)));
@@ -179,6 +179,7 @@ static struct smbcli_state *connect_one(char *share)
static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
char *nfs[NSERVERS],
int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
+ const char **ports,
char *share1, char *share2)
{
int server, conn, f, fstype;
@@ -197,7 +198,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]);
+ cli[server][conn] = connect_one(share[server], ports);
if (!cli[server][conn]) {
DEBUG(0,("Failed to connect to %s\n", share[server]));
exit(1);
@@ -343,7 +344,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)
+static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath2, const char **ports)
{
struct smbcli_state *cli[NSERVERS][NCONNECTIONS];
char *nfs[NSERVERS];
@@ -372,7 +373,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
recorded[n].needed = true;
}
- reconnect(cli, nfs, fnum, share1, share2);
+ reconnect(cli, nfs, fnum, share1, share2, ports);
open_files(cli, nfs, fnum);
n = retest(cli, nfs, fnum, numops);
@@ -383,7 +384,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);
+ reconnect(cli, nfs, fnum, share1, share2, ports);
open_files(cli, nfs, fnum);
for (i=0;i<n-1;i++) {
@@ -410,7 +411,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
}
close_files(cli, nfs, fnum);
- reconnect(cli, nfs, fnum, share1, share2);
+ reconnect(cli, nfs, fnum, share1, share2, ports);
open_files(cli, nfs, fnum);
showall = true;
n1 = retest(cli, nfs, fnum, n);
@@ -538,7 +539,7 @@ static void usage(void)
srandom(seed);
locking_init(1);
- test_locks(share1, share2, nfspath1, nfspath2);
+ test_locks(share1, share2, nfspath1, nfspath2, lp_smb_ports(lp_ctx));
return(0);
}
diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index 63ad6027a1..4603fd05e4 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -69,7 +69,7 @@ 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(char *share)
+static struct smbcli_state *connect_one(char *share, const char **ports)
{
struct smbcli_state *c;
fstring server;
@@ -85,6 +85,7 @@ static struct smbcli_state *connect_one(char *share)
status = smbcli_full_connection(NULL, &c,
server,
+ ports,
share, NULL,
credentials, NULL);
@@ -363,7 +364,7 @@ static void usage(void)
argc -= optind;
argv += optind;
- cli = connect_one(share);
+ cli = connect_one(share, lp_smb_ports(lp_ctx));
if (!cli) {
DEBUG(0,("Failed to connect to %s\n", share));
exit(1);
diff --git a/source4/torture/nbt/wins.c b/source4/torture/nbt/wins.c
index 3107b19075..cf115fcd75 100644
--- a/source4/torture/nbt/wins.c
+++ b/source4/torture/nbt/wins.c
@@ -94,6 +94,7 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address
torture_comment(tctx, "register the name\n");
io.in.name = *name;
+ io.in.wins_port = lp_nbt_port(tctx->lp_ctx);
io.in.wins_servers = str_list_make(tctx, address, NULL);
io.in.addresses = str_list_make(tctx, myaddress, NULL);
io.in.nb_flags = nb_flags;
diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c
index 5a663fb565..0367110ddc 100644
--- a/source4/torture/raw/composite.c
+++ b/source4/torture/raw/composite.c
@@ -153,7 +153,7 @@ static bool test_fetchfile(struct smbcli_state *cli, struct torture_context *tct
}
io2.in.dest_host = torture_setting_string(tctx, "host", NULL);
- io2.in.port = 0;
+ io2.in.ports = lp_smb_ports(tctx->lp_ctx);
io2.in.called_name = torture_setting_string(tctx, "host", NULL);
io2.in.service = torture_setting_string(tctx, "share", NULL);
io2.in.service_type = "A:";
@@ -341,7 +341,7 @@ static bool test_fsinfo(struct smbcli_state *cli, struct torture_context *tctx)
bool ret = true;
io1.in.dest_host = torture_setting_string(tctx, "host", NULL);
- io1.in.port = 0;
+ io1.in.dest_ports = lp_smb_ports(tctx->lp_ctx);
io1.in.called_name = torture_setting_string(tctx, "host", NULL);
io1.in.service = torture_setting_string(tctx, "share", NULL);
io1.in.service_type = "A:";
diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c
index 113634f264..744aab66b1 100644
--- a/source4/torture/raw/lockbench.c
+++ b/source4/torture/raw/lockbench.c
@@ -185,7 +185,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
}
io->in.dest_host = state->dest_host;
- io->in.port = state->dest_port;
+ io->in.dest_ports = state->dest_port;
io->in.called_name = state->called_name;
io->in.service = share;
io->in.service_type = state->service_type;
diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c
index 8f9803fa4d..ceb52cdfcf 100644
--- a/source4/torture/raw/openbench.c
+++ b/source4/torture/raw/openbench.c
@@ -123,7 +123,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
}
io->in.dest_host = state->dest_host;
- io->in.port = state->dest_port;
+ io->in.dest_ports = state->dest_port;
io->in.called_name = state->called_name;
io->in.service = share;
io->in.service_type = state->service_type;
diff --git a/source4/torture/rpc/join.c b/source4/torture/rpc/join.c
index d973d2d083..8ab6ae03ea 100644
--- a/source4/torture/rpc/join.c
+++ b/source4/torture/rpc/join.c
@@ -5,6 +5,8 @@
#include "auth/credentials/credentials.h"
#include "torture/rpc/rpc.h"
+#include "param/param.h"
+
#define TORTURE_NETBIOS_NAME "smbtorturejoin"
@@ -29,6 +31,7 @@ bool torture_rpc_join(struct torture_context *torture)
}
status = smbcli_full_connection(tj, &cli, host,
+ lp_smb_ports(torture->lp_ctx),
"IPC$", NULL,
machine_account,
NULL);
@@ -53,6 +56,7 @@ bool torture_rpc_join(struct torture_context *torture)
}
status = smbcli_full_connection(tj, &cli, host,
+ lp_smb_ports(torture->lp_ctx),
"IPC$", NULL,
machine_account,
NULL);
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 96ed03fc6f..496453e181 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -80,6 +80,7 @@ bool torture_bind_authcontext(struct torture_context *torture)
status = smbcli_full_connection(mem_ctx, &cli,
torture_setting_string(torture, "host", NULL),
+ lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, cmdline_credentials,
NULL);
if (!NT_STATUS_IS_OK(status)) {
@@ -287,6 +288,7 @@ bool torture_bind_samba3(struct torture_context *torture)
status = smbcli_full_connection(mem_ctx, &cli,
torture_setting_string(torture, "host", NULL),
+ lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, cmdline_credentials,
NULL);
if (!NT_STATUS_IS_OK(status)) {
@@ -1144,6 +1146,7 @@ bool torture_netlogon_samba3(struct torture_context *torture)
status = smbcli_full_connection(mem_ctx, &cli,
torture_setting_string(torture, "host", NULL),
+ lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, anon_creds, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
@@ -1225,6 +1228,7 @@ static bool test_join3(struct torture_context *tctx,
status = smbcli_full_connection(tctx, &cli,
torture_setting_string(tctx, "host", NULL),
+ lp_smb_ports(tctx->lp_ctx),
"IPC$", NULL, smb_creds, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
@@ -1588,6 +1592,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
status = smbcli_full_connection(
mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
+ lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, cmdline_credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) smbcli_full_connection failed: %s\n",
@@ -1612,6 +1617,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
status = smbcli_full_connection(
mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
+ lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, anon_creds, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) anon smbcli_full_connection failed: %s\n",
diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c
index 6b0cbbf525..cb9b8be2c9 100644
--- a/source4/torture/rpc/schannel.c
+++ b/source4/torture/rpc/schannel.c
@@ -244,7 +244,8 @@ static bool test_schannel(struct torture_context *tctx,
struct creds_CredentialState *creds;
struct cli_credentials *credentials;
- join_ctx = torture_join_domain(tctx, talloc_asprintf(tctx, "%s%d", TEST_MACHINE_NAME, i),
+ join_ctx = torture_join_domain(tctx,
+ talloc_asprintf(tctx, "%s%d", TEST_MACHINE_NAME, i),
acct_flags, &credentials);
torture_assert(tctx, join_ctx != NULL, "Failed to join domain");
diff --git a/source4/torture/unix/unix_info2.c b/source4/torture/unix/unix_info2.c
index 882dc7a084..d5fe8bc260 100644
--- a/source4/torture/unix/unix_info2.c
+++ b/source4/torture/unix/unix_info2.c
@@ -26,6 +26,7 @@
#include "torture/basic/proto.h"
#include "lib/cmdline/popt_common.h"
#include "auth/credentials/credentials.h"
+#include "param/param.h"
struct unix_info2 {
uint64_t end_of_file;
@@ -54,8 +55,9 @@ 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);
- status = smbcli_full_connection(tctx, &cli,
- host, share, NULL,
+ status = smbcli_full_connection(tctx, &cli, host,
+ lp_smb_ports(tctx->lp_ctx),
+ share, NULL,
cmdline_credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/unix/whoami.c b/source4/torture/unix/whoami.c
index 422e2abcbf..412a256da7 100644
--- a/source4/torture/unix/whoami.c
+++ b/source4/torture/unix/whoami.c
@@ -75,8 +75,9 @@ 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);
- status = smbcli_full_connection(tctx, &cli,
- host, share, NULL,
+ status = smbcli_full_connection(tctx, &cli, host,
+ lp_smb_ports(tctx->lp_ctx),
+ share, NULL,
creds, NULL);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c
index 65dfaec1cc..1168f31679 100644
--- a/source4/torture/util_smb.c
+++ b/source4/torture/util_smb.c
@@ -474,6 +474,7 @@ _PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx,
NTSTATUS status;
status = smbcli_full_connection(mem_ctx, c, hostname,
+ lp_smb_ports(tctx->lp_ctx),
sharename, NULL,
cmdline_credentials, ev);
if (!NT_STATUS_IS_OK(status)) {