summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/client/cifsdd.c10
-rw-r--r--source4/client/cifsdd.h1
-rw-r--r--source4/client/cifsddio.c11
-rw-r--r--source4/client/client.c12
-rw-r--r--source4/client/smbspool.c7
-rw-r--r--source4/lib/socket/socket_ip.c4
-rw-r--r--source4/libcli/cliconnect.c8
-rw-r--r--source4/libcli/nbt/nameregister.c2
-rw-r--r--source4/libcli/raw/clisocket.c36
-rw-r--r--source4/libcli/raw/clitree.c4
-rw-r--r--source4/libcli/smb2/connect.c5
-rw-r--r--source4/libcli/smb_composite/connect.c3
-rw-r--r--source4/libcli/smb_composite/fetchfile.c2
-rw-r--r--source4/libcli/smb_composite/fsinfo.c2
-rw-r--r--source4/libcli/smb_composite/smb_composite.h6
-rw-r--r--source4/libnet/libnet_join.c2
-rw-r--r--source4/libnet/libnet_site.c5
-rw-r--r--source4/librpc/rpc/dcerpc_connect.c2
-rw-r--r--source4/nbt_server/wins/winsclient.c1
-rw-r--r--source4/nbt_server/wins/winsserver.c2
-rw-r--r--source4/nbt_server/wins/winswack.c3
-rw-r--r--source4/ntvfs/cifs/vfs_cifs.c2
-rw-r--r--source4/scripting/ejs/smbcalls_cli.c2
-rw-r--r--source4/smbd/service_stream.h1
-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
40 files changed, 121 insertions, 98 deletions
diff --git a/source4/client/cifsdd.c b/source4/client/cifsdd.c
index 2ce01a2227..08c152c3a5 100644
--- a/source4/client/cifsdd.c
+++ b/source4/client/cifsdd.c
@@ -351,7 +351,7 @@ static void print_transfer_stats(void)
}
}
-static struct dd_iohandle * open_file(const char * which)
+static struct dd_iohandle * open_file(const char * which, const char **ports)
{
int options = 0;
const char * path = NULL;
@@ -371,12 +371,12 @@ static struct dd_iohandle * open_file(const char * which)
if (strcmp(which, "if") == 0) {
path = check_arg_pathname("if");
- handle = dd_open_path(path, check_arg_numeric("ibs"),
+ handle = dd_open_path(path, ports, check_arg_numeric("ibs"),
options);
} else if (strcmp(which, "of") == 0) {
options |= DD_WRITE;
path = check_arg_pathname("of");
- handle = dd_open_path(path, check_arg_numeric("obs"),
+ handle = dd_open_path(path, ports, check_arg_numeric("obs"),
options);
} else {
SMB_ASSERT(0);
@@ -431,11 +431,11 @@ static int copy_files(struct loadparm_context *lp_ctx)
DEBUG(4, ("IO buffer size is %llu, max xmit is %d\n",
(unsigned long long)iomax, lp_max_xmit(lp_ctx)));
- if (!(ifile = open_file("if"))) {
+ if (!(ifile = open_file("if", lp_smb_ports(lp_ctx)))) {
return(FILESYS_EXIT_CODE);
}
- if (!(ofile = open_file("of"))) {
+ if (!(ofile = open_file("of", lp_smb_ports(lp_ctx)))) {
return(FILESYS_EXIT_CODE);
}
diff --git a/source4/client/cifsdd.h b/source4/client/cifsdd.h
index 2fe8de6ea3..994c209103 100644
--- a/source4/client/cifsdd.h
+++ b/source4/client/cifsdd.h
@@ -89,6 +89,7 @@ struct dd_iohandle
#define DD_OPLOCK 0x00000008
struct dd_iohandle * dd_open_path(const char * path,
+ const char **ports,
uint64_t io_size, int options);
bool dd_fill_block(struct dd_iohandle * h, uint8_t * buf,
uint64_t * buf_size, uint64_t need_size, uint64_t block_size);
diff --git a/source4/client/cifsddio.c b/source4/client/cifsddio.c
index 5cea8cf305..c30bf53196 100644
--- a/source4/client/cifsddio.c
+++ b/source4/client/cifsddio.c
@@ -221,7 +221,8 @@ static bool smb_write_func(void * handle, uint8_t * buf, uint64_t wanted,
}
static struct smbcli_state * init_smb_session(const char * host,
- const char * share)
+ const char **ports,
+ const char * share)
{
NTSTATUS ret;
struct smbcli_state * cli = NULL;
@@ -229,7 +230,7 @@ static struct smbcli_state * init_smb_session(const char * host,
/* When we support SMB URLs, we can get different user credentials for
* each connection, but for now, we just use the same one for both.
*/
- ret = smbcli_full_connection(NULL, &cli, host, share,
+ ret = smbcli_full_connection(NULL, &cli, host, ports, share,
NULL /* devtype */, cmdline_credentials, NULL /* events */);
if (!NT_STATUS_IS_OK(ret)) {
@@ -289,6 +290,7 @@ static int open_smb_file(struct smbcli_state * cli,
}
static struct dd_iohandle * open_cifs_handle(const char * host,
+ const char **ports,
const char * share,
const char * path,
uint64_t io_size,
@@ -312,7 +314,7 @@ static struct dd_iohandle * open_cifs_handle(const char * host,
smbh->h.io_write = smb_write_func;
smbh->h.io_seek = smb_seek_func;
- if ((smbh->cli = init_smb_session(host, share)) == NULL) {
+ if ((smbh->cli = init_smb_session(host, ports, share)) == NULL) {
return(NULL);
}
@@ -328,6 +330,7 @@ static struct dd_iohandle * open_cifs_handle(const char * host,
/* ------------------------------------------------------------------------- */
struct dd_iohandle * dd_open_path(const char * path,
+ const char **ports,
uint64_t io_size,
int options)
{
@@ -344,7 +347,7 @@ struct dd_iohandle * dd_open_path(const char * path,
/* Skip over leading directory separators. */
while (*remain == '/' || *remain == '\\') { remain++; }
- return(open_cifs_handle(host, share, remain,
+ return(open_cifs_handle(host, ports, share, remain,
io_size, options));
}
diff --git a/source4/client/client.c b/source4/client/client.c
index 98b13aba4c..748ee2d7cb 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -3017,7 +3017,7 @@ static int process_stdin(struct smbclient_context *ctx)
return a connection to a server
*******************************************************/
static bool do_connect(struct smbclient_context *ctx,
- const char *specified_server, const char *specified_share, struct cli_credentials *cred)
+ const char *specified_server, const char **ports, const char *specified_share, struct cli_credentials *cred)
{
NTSTATUS status;
char *server, *share;
@@ -3034,7 +3034,7 @@ static bool do_connect(struct smbclient_context *ctx,
ctx->remote_cur_dir = talloc_strdup(ctx, "\\");
- status = smbcli_full_connection(ctx, &ctx->cli, server,
+ status = smbcli_full_connection(ctx, &ctx->cli, server, ports,
share, NULL, cred,
cli_credentials_get_event_context(cred));
if (!NT_STATUS_IS_OK(status)) {
@@ -3061,7 +3061,7 @@ static int do_host_query(struct loadparm_context *lp_ctx, const char *query_host
/****************************************************************************
handle a message operation
****************************************************************************/
-static int do_message_op(const char *netbios_name, const char *desthost, const char *destip, int name_type, struct resolve_context *resolve_ctx, int max_xmit, int max_mux)
+static int do_message_op(const char *netbios_name, const char *desthost, const char **destports, const char *destip, int name_type, struct resolve_context *resolve_ctx, int max_xmit, int max_mux)
{
struct nbt_name called, calling;
const char *server_name;
@@ -3073,7 +3073,7 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
server_name = destip ? destip : desthost;
- if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, resolve_ctx, max_xmit, max_mux)) {
+ if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, destports, resolve_ctx, max_xmit, max_mux)) {
d_printf("Connection to %s failed\n", server_name);
return 1;
}
@@ -3221,10 +3221,10 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
}
if (message) {
- return do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost, dest_ip, name_type, lp_resolve_context(cmdline_lp_ctx), lp_max_xmit(cmdline_lp_ctx), lp_maxmux(cmdline_lp_ctx));
+ return do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost, lp_smb_ports(cmdline_lp_ctx), dest_ip, name_type, lp_resolve_context(cmdline_lp_ctx), lp_max_xmit(cmdline_lp_ctx), lp_maxmux(cmdline_lp_ctx));
}
- if (!do_connect(ctx, desthost, service, cmdline_credentials))
+ if (!do_connect(ctx, desthost, lp_smb_ports(cmdline_lp_ctx), service, cmdline_credentials))
return 1;
if (base_directory)
diff --git a/source4/client/smbspool.c b/source4/client/smbspool.c
index 57050acab8..614e50bb0b 100644
--- a/source4/client/smbspool.c
+++ b/source4/client/smbspool.c
@@ -26,7 +26,7 @@
*/
static void list_devices(void);
-static struct smbcli_state *smb_connect(const char *, const char *, const char *, const char *, const char *);
+static struct smbcli_state *smb_connect(const char *, const char *, const char **, const char *, const char *, const char *);
static int smb_print(struct smbcli_state *, char *, FILE *);
@@ -189,7 +189,7 @@ static int smb_print(struct smbcli_state *, char *, FILE *);
do
{
- if ((cli = smb_connect(workgroup, server, printer, username, password)) == NULL)
+ if ((cli = smb_connect(workgroup, server, lp_smb_ports(lp_ctx), printer, username, password)) == NULL)
{
if (getenv("CLASS") == NULL)
{
@@ -255,6 +255,7 @@ list_devices(void)
static struct smbcli_state * /* O - SMB connection */
smb_connect(const char *workgroup, /* I - Workgroup */
const char *server, /* I - Server */
+ const char **ports, /* I - Ports */
const char *share, /* I - Printer */
const char *username, /* I - Username */
const char *password) /* I - Password */
@@ -269,7 +270,7 @@ smb_connect(const char *workgroup, /* I - Workgroup */
myname = get_myname();
- nt_status = smbcli_full_connection(NULL, &c, myname, server, 0, share, NULL,
+ nt_status = smbcli_full_connection(NULL, &c, myname, server, ports, share, NULL,
username, workgroup, password, NULL);
free(myname);
diff --git a/source4/lib/socket/socket_ip.c b/source4/lib/socket/socket_ip.c
index e3676ad71a..e61b6d82fc 100644
--- a/source4/lib/socket/socket_ip.c
+++ b/source4/lib/socket/socket_ip.c
@@ -130,6 +130,8 @@ static NTSTATUS ipv4_connect(struct socket_context *sock,
if (!srv_ip.s_addr) {
return NT_STATUS_BAD_NETWORK_NAME;
}
+
+ SMB_ASSERT(srv_address->port != 0);
ZERO_STRUCT(srv_addr);
#ifdef HAVE_SOCK_SIN_LEN
@@ -356,6 +358,8 @@ static NTSTATUS ipv4_sendto(struct socket_context *sock,
} else {
struct sockaddr_in srv_addr;
struct in_addr addr;
+
+ SMB_ASSERT(dest_addr->port != 0);
ZERO_STRUCT(srv_addr);
#ifdef HAVE_SOCK_SIN_LEN
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index a170024def..7ec914e831 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -31,12 +31,12 @@
wrapper around smbcli_sock_connect()
*/
bool smbcli_socket_connect(struct smbcli_state *cli, const char *server,
- struct resolve_context *resolve_ctx,
+ const char **ports, struct resolve_context *resolve_ctx,
int max_xmit, int max_mux)
{
struct smbcli_socket *sock;
- sock = smbcli_sock_connect_byname(server, 0, NULL, resolve_ctx,
+ sock = smbcli_sock_connect_byname(server, ports, NULL, resolve_ctx,
NULL);
if (sock == NULL) return false;
@@ -136,6 +136,7 @@ NTSTATUS smbcli_tconX(struct smbcli_state *cli, const char *sharename,
NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
struct smbcli_state **ret_cli,
const char *host,
+ const char **ports,
const char *sharename,
const char *devtype,
struct cli_credentials *credentials,
@@ -147,7 +148,8 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
*ret_cli = NULL;
status = smbcli_tree_full_connection(parent_ctx,
- &tree, host, 0, sharename, devtype,
+ &tree, host, ports,
+ sharename, devtype,
credentials, ev);
if (!NT_STATUS_IS_OK(status)) {
goto done;
diff --git a/source4/libcli/nbt/nameregister.c b/source4/libcli/nbt/nameregister.c
index 3d7ab7f72f..6667564664 100644
--- a/source4/libcli/nbt/nameregister.c
+++ b/source4/libcli/nbt/nameregister.c
@@ -370,7 +370,7 @@ struct composite_context *nbt_name_register_wins_send(struct nbt_name_socket *nb
state->io = talloc(state, struct nbt_name_register);
if (state->io == NULL) goto failed;
- state->wins_port = lp_nbt_port(global_loadparm);
+ state->wins_port = io->in.wins_port;
state->wins_servers = str_list_copy(state, io->in.wins_servers);
if (state->wins_servers == NULL ||
state->wins_servers[0] == NULL) goto failed;
diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c
index c09104e256..9732ab1638 100644
--- a/source4/libcli/raw/clisocket.c
+++ b/source4/libcli/raw/clisocket.c
@@ -45,12 +45,13 @@ static void smbcli_sock_connect_recv_conn(struct composite_context *ctx);
struct composite_context *smbcli_sock_connect_send(TALLOC_CTX *mem_ctx,
const char *host_addr,
- int port,
+ const char **ports,
const char *host_name,
struct event_context *event_ctx)
{
struct composite_context *result, *ctx;
struct sock_connect_state *state;
+ int i;
result = talloc_zero(mem_ctx, struct composite_context);
if (result == NULL) goto failed;
@@ -72,26 +73,11 @@ struct composite_context *smbcli_sock_connect_send(TALLOC_CTX *mem_ctx,
state->host_name = talloc_strdup(state, host_name);
if (state->host_name == NULL) goto failed;
- if (port == 0) {
- const char **ports = lp_smb_ports(global_loadparm);
- int i;
-
- for (i=0;ports[i];i++) /* noop */ ;
- if (i == 0) {
- DEBUG(3, ("no smb ports defined\n"));
- goto failed;
- }
- state->num_ports = i;
- state->ports = talloc_array(state, uint16_t, i);
- if (state->ports == NULL) goto failed;
- for (i=0;ports[i];i++) {
- state->ports[i] = atoi(ports[i]);
- }
- } else {
- state->ports = talloc_array(state, uint16_t, 1);
- if (state->ports == NULL) goto failed;
- state->num_ports = 1;
- state->ports[0] = port;
+ state->num_ports = str_list_length(ports);
+ state->ports = talloc_array(state, uint16_t, state->num_ports);
+ if (state->ports == NULL) goto failed;
+ for (i=0;ports[i];i++) {
+ state->ports[i] = atoi(ports[i]);
}
ctx = socket_connect_multi_send(state, host_addr,
@@ -164,13 +150,13 @@ NTSTATUS smbcli_sock_connect_recv(struct composite_context *c,
sync version of the function
*/
NTSTATUS smbcli_sock_connect(TALLOC_CTX *mem_ctx,
- const char *host_addr, int port,
+ const char *host_addr, const char **ports,
const char *host_name,
struct event_context *event_ctx,
struct smbcli_socket **result)
{
struct composite_context *c =
- smbcli_sock_connect_send(mem_ctx, host_addr, port, host_name,
+ smbcli_sock_connect_send(mem_ctx, host_addr, ports, host_name,
event_ctx);
return smbcli_sock_connect_recv(c, mem_ctx, result);
}
@@ -198,7 +184,7 @@ void smbcli_sock_set_options(struct smbcli_socket *sock, const char *options)
/****************************************************************************
resolve a hostname and connect
****************************************************************************/
-struct smbcli_socket *smbcli_sock_connect_byname(const char *host, int port,
+struct smbcli_socket *smbcli_sock_connect_byname(const char *host, const char **ports,
TALLOC_CTX *mem_ctx,
struct resolve_context *resolve_ctx,
struct event_context *event_ctx)
@@ -247,7 +233,7 @@ struct smbcli_socket *smbcli_sock_connect_byname(const char *host, int port,
return NULL;
}
- status = smbcli_sock_connect(mem_ctx, address, port, name, event_ctx,
+ status = smbcli_sock_connect(mem_ctx, address, ports, name, event_ctx,
&result);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/libcli/raw/clitree.c b/source4/libcli/raw/clitree.c
index 54f8ac95a4..890d5470da 100644
--- a/source4/libcli/raw/clitree.c
+++ b/source4/libcli/raw/clitree.c
@@ -171,7 +171,7 @@ NTSTATUS smb_tree_disconnect(struct smbcli_tree *tree)
*/
NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
struct smbcli_tree **ret_tree,
- const char *dest_host, int port,
+ const char *dest_host, const char **dest_ports,
const char *service, const char *service_type,
struct cli_credentials *credentials,
struct event_context *ev)
@@ -184,7 +184,7 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
}
io.in.dest_host = dest_host;
- io.in.port = port;
+ io.in.dest_ports = dest_ports;
io.in.called_name = strupper_talloc(tmp_ctx, dest_host);
io.in.service = service;
io.in.service_type = service_type;
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c
index 8b75e125b0..4d250fdded 100644
--- a/source4/libcli/smb2/connect.c
+++ b/source4/libcli/smb2/connect.c
@@ -147,11 +147,12 @@ static void continue_resolve(struct composite_context *creq)
struct smb2_connect_state *state = talloc_get_type(c->private_data,
struct smb2_connect_state);
const char *addr;
-
+ const char *ports[2] = { "445", NULL };
+
c->status = resolve_name_recv(creq, state, &addr);
if (!composite_is_ok(c)) return;
- creq = smbcli_sock_connect_send(state, addr, 445, state->host, c->event_ctx);
+ creq = smbcli_sock_connect_send(state, addr, ports, state->host, c->event_ctx);
composite_continue(c, creq, continue_socket, c);
}
diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c
index 1a8262c76a..fafd3b0173 100644
--- a/source4/libcli/smb_composite/connect.c
+++ b/source4/libcli/smb_composite/connect.c
@@ -360,7 +360,8 @@ static NTSTATUS connect_resolve(struct composite_context *c,
status = resolve_name_recv(state->creq, state, &address);
NT_STATUS_NOT_OK_RETURN(status);
- state->creq = smbcli_sock_connect_send(state, address, io->in.port,
+ state->creq = smbcli_sock_connect_send(state, address,
+ io->in.dest_ports,
io->in.dest_host, c->event_ctx);
NT_STATUS_HAVE_NO_MEMORY(state->creq);
diff --git a/source4/libcli/smb_composite/fetchfile.c b/source4/libcli/smb_composite/fetchfile.c
index 2dbaff5a66..a4f73ffd70 100644
--- a/source4/libcli/smb_composite/fetchfile.c
+++ b/source4/libcli/smb_composite/fetchfile.c
@@ -137,7 +137,7 @@ struct composite_context *smb_composite_fetchfile_send(struct smb_composite_fetc
state->io = io;
state->connect->in.dest_host = io->in.dest_host;
- state->connect->in.port = io->in.port;
+ state->connect->in.dest_ports = io->in.ports;
state->connect->in.called_name = io->in.called_name;
state->connect->in.service = io->in.service;
state->connect->in.service_type = io->in.service_type;
diff --git a/source4/libcli/smb_composite/fsinfo.c b/source4/libcli/smb_composite/fsinfo.c
index faf3723539..f37213e2f9 100644
--- a/source4/libcli/smb_composite/fsinfo.c
+++ b/source4/libcli/smb_composite/fsinfo.c
@@ -143,7 +143,7 @@ struct composite_context *smb_composite_fsinfo_send(struct smbcli_tree *tree,
if (state->connect == NULL) goto failed;
state->connect->in.dest_host = io->in.dest_host;
- state->connect->in.port = io->in.port;
+ state->connect->in.dest_ports = io->in.dest_ports;
state->connect->in.called_name = io->in.called_name;
state->connect->in.service = io->in.service;
state->connect->in.service_type = io->in.service_type;
diff --git a/source4/libcli/smb_composite/smb_composite.h b/source4/libcli/smb_composite/smb_composite.h
index 617daaf442..a3188c4fe2 100644
--- a/source4/libcli/smb_composite/smb_composite.h
+++ b/source4/libcli/smb_composite/smb_composite.h
@@ -45,7 +45,7 @@ struct smb_composite_loadfile {
struct smb_composite_fetchfile {
struct {
const char *dest_host;
- int port;
+ const char **ports;
const char *called_name;
const char *service;
const char *service_type;
@@ -84,7 +84,7 @@ struct smb_composite_savefile {
struct smb_composite_connect {
struct {
const char *dest_host;
- int port;
+ const char **dest_ports;
const char *called_name;
const char *service;
const char *service_type;
@@ -121,7 +121,7 @@ struct smb_composite_sesssetup {
struct smb_composite_fsinfo {
struct {
const char *dest_host;
- int port;
+ const char **dest_ports;
const char *called_name;
const char *service;
const char *service_type;
diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c
index 6d7fcd09ad..8297172a58 100644
--- a/source4/libnet/libnet_join.c
+++ b/source4/libnet/libnet_join.c
@@ -390,7 +390,7 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J
r->out.account_guid = samdb_result_guid(res->msgs[0], "objectGUID");
if (r->in.acct_type == ACB_SVRTRUST) {
- status = libnet_JoinSite(remote_ldb, r);
+ status = libnet_JoinSite(ctx, remote_ldb, r);
}
talloc_free(tmp_ctx);
diff --git a/source4/libnet/libnet_site.c b/source4/libnet/libnet_site.c
index ab51b5cf3b..0e498e8523 100644
--- a/source4/libnet/libnet_site.c
+++ b/source4/libnet/libnet_site.c
@@ -116,7 +116,8 @@ NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_JoinSite *r)
* 2. Add entry CN=<netbios name>,CN=Servers,CN=<site name>,CN=Sites,CN=Configuration,<domain dn>.
* TODO: 3.) use DsAddEntry() to create CN=NTDS Settings,CN=<netbios name>,CN=Servers,CN=<site name>,...
*/
-NTSTATUS libnet_JoinSite(struct ldb_context *remote_ldb,
+NTSTATUS libnet_JoinSite(struct libnet_context *ctx,
+ struct ldb_context *remote_ldb,
struct libnet_JoinDomain *libnet_r)
{
NTSTATUS status;
@@ -147,7 +148,7 @@ NTSTATUS libnet_JoinSite(struct ldb_context *remote_ldb,
}
make_nbt_name_client(&name, libnet_r->out.samr_binding->host);
- status = resolve_name(lp_resolve_context(global_loadparm), &name, r, &dest_addr, NULL);
+ status = resolve_name(lp_resolve_context(ctx->lp_ctx), &name, r, &dest_addr, NULL);
if (!NT_STATUS_IS_OK(status)) {
libnet_r->out.error_string = NULL;
talloc_free(tmp_ctx);
diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c
index a7c26f2f93..8fd783fb83 100644
--- a/source4/librpc/rpc/dcerpc_connect.c
+++ b/source4/librpc/rpc/dcerpc_connect.c
@@ -111,7 +111,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CT
/* prepare smb connection parameters: we're connecting to IPC$ share on
remote rpc server */
conn->in.dest_host = s->io.binding->host;
- conn->in.port = 0;
+ conn->in.dest_ports = lp_smb_ports(global_loadparm);
if (s->io.binding->target_hostname == NULL)
conn->in.called_name = "*SMBSERVER"; /* FIXME: This is invalid */
else
diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c
index 001ad58f62..1d07f4a60a 100644
--- a/source4/nbt_server/wins/winsclient.c
+++ b/source4/nbt_server/wins/winsclient.c
@@ -237,6 +237,7 @@ void nbtd_winsclient_register(struct nbtd_iface_name *iname)
/* setup a wins name register request */
io.in.name = iname->name;
+ io.in.wins_port = lp_nbt_port(iname->iface->nbtsrv->task->lp_ctx);
io.in.wins_servers = lp_wins_server_list(iname->iface->nbtsrv->task->lp_ctx);
io.in.addresses = nbtd_address_list(iface, iname);
io.in.nb_flags = iname->nb_flags;
diff --git a/source4/nbt_server/wins/winsserver.c b/source4/nbt_server/wins/winsserver.c
index 693e667078..f116c45898 100644
--- a/source4/nbt_server/wins/winsserver.c
+++ b/source4/nbt_server/wins/winsserver.c
@@ -378,7 +378,7 @@ static void wins_register_wack(struct nbt_name_socket *nbtsock,
if (talloc_reference(s, src) == NULL) goto failed;
s->io.in.nbtd_server = iface->nbtsrv;
- s->io.in.nbtd_port = lp_nbt_port(iface->nbtsrv->task->lp_ctx);
+ s->io.in.nbt_port = lp_nbt_port(iface->nbtsrv->task->lp_ctx);
s->io.in.event_ctx = iface->nbtsrv->task->event_ctx;
s->io.in.name = rec->name;
s->io.in.num_addresses = winsdb_addr_list_length(rec->addresses);
diff --git a/source4/nbt_server/wins/winswack.c b/source4/nbt_server/wins/winswack.c
index 6dc90af317..3ffa2df79c 100644
--- a/source4/nbt_server/wins/winswack.c
+++ b/source4/nbt_server/wins/winswack.c
@@ -27,6 +27,7 @@
#include "system/time.h"
#include "libcli/composite/composite.h"
#include "param/param.h"
+#include "smbd/service_task.h"
struct wins_challenge_state {
struct wins_challenge_io *io;
@@ -162,7 +163,7 @@ static void wins_release_demand_handler(struct nbt_name_request *req)
if (state->current_address < state->io->in.num_addresses) {
struct nbtd_interface *iface;
- state->release.in.dest_port = lp_nbt_port(global_loadparm);
+ state->release.in.dest_port = lp_nbt_port(state->io->in.nbtd_server->task->lp_ctx);
state->release.in.dest_addr = state->io->in.addresses[state->current_address];
state->release.in.address = state->release.in.dest_addr;
state->release.in.timeout = (state->addresses_left > 1 ? 2 : 1);
diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c
index 152a4056c5..178e9b01cc 100644
--- a/source4/ntvfs/cifs/vfs_cifs.c
+++ b/source4/ntvfs/cifs/vfs_cifs.c
@@ -194,7 +194,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
/* connect to the server, using the smbd event context */
io.in.dest_host = host;
- io.in.port = 0;
+ io.in.dest_ports = lp_smb_ports(ntvfs->ctx->lp_ctx);
io.in.called_name = host;
io.in.credentials = credentials;
io.in.fallback_to_anonymous = false;
diff --git a/source4/scripting/ejs/smbcalls_cli.c b/source4/scripting/ejs/smbcalls_cli.c
index e08a098833..a7210eb0fb 100644
--- a/source4/scripting/ejs/smbcalls_cli.c
+++ b/source4/scripting/ejs/smbcalls_cli.c
@@ -437,7 +437,7 @@ static int ejs_tree_connect(MprVarHandle eid, int argc, char **argv)
/* Do connect */
io.in.dest_host = hostname;
- io.in.port = 0;
+ io.in.dest_ports = lp_smb_ports(global_loadparm);
io.in.called_name = strupper_talloc(mem_ctx, hostname);
io.in.service = sharename;
io.in.service_type = "?????";
diff --git a/source4/smbd/service_stream.h b/source4/smbd/service_stream.h
index 6eb26a4282..04d23a56f2 100644
--- a/source4/smbd/service_stream.h
+++ b/source4/smbd/service_stream.h
@@ -48,6 +48,7 @@ struct stream_connection {
struct socket_context *socket;
struct messaging_context *msg_ctx;
+ struct loadparm_context *lp_ctx;
bool processing;
const char *terminate;
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)) {