summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source4/auth/auth_winbind.c6
-rw-r--r--source4/client/cifsdd.c18
-rw-r--r--source4/client/cifsdd.h3
-rw-r--r--source4/client/cifsddio.c17
-rw-r--r--source4/client/client.c13
-rw-r--r--source4/libcli/cliconnect.c7
-rw-r--r--source4/libcli/raw/clisocket.c7
-rw-r--r--source4/libcli/raw/clitransport.c6
-rw-r--r--source4/libcli/raw/clitree.c3
-rw-r--r--source4/libcli/smb2/connect.c4
-rw-r--r--source4/libcli/smb_composite/connect.c12
-rw-r--r--source4/libcli/smb_composite/fetchfile.c5
-rw-r--r--source4/libcli/smb_composite/fsinfo.c4
-rw-r--r--source4/libcli/smb_composite/smb_composite.h1
-rw-r--r--source4/librpc/rpc/dcerpc_connect.c4
-rw-r--r--source4/ntvfs/cifs/vfs_cifs.c5
-rw-r--r--source4/scripting/ejs/smbcalls_cli.c5
-rw-r--r--source4/torture/basic/base.c2
-rw-r--r--source4/torture/basic/misc.c3
-rw-r--r--source4/torture/gentest.c5
-rw-r--r--source4/torture/locktest.c5
-rw-r--r--source4/torture/masktest.c8
-rw-r--r--source4/torture/raw/lockbench.c5
-rw-r--r--source4/torture/raw/openbench.c5
-rw-r--r--source4/torture/rpc/join.c3
-rw-r--r--source4/torture/rpc/samba3rpc.c19
-rw-r--r--source4/torture/unix/unix_info2.c4
-rw-r--r--source4/torture/unix/whoami.c4
-rw-r--r--source4/torture/util_smb.c5
29 files changed, 130 insertions, 58 deletions
diff --git a/source4/auth/auth_winbind.c b/source4/auth/auth_winbind.c
index bfbcbbfd5d..89ae3195df 100644
--- a/source4/auth/auth_winbind.c
+++ b/source4/auth/auth_winbind.c
@@ -29,7 +29,7 @@
#include "lib/messaging/irpc.h"
#include "param/param.h"
-static NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct winbindd_response *response, struct netr_SamInfo3 *info3)
+static NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, struct winbindd_response *response, struct netr_SamInfo3 *info3)
{
size_t len = response->length - sizeof(struct winbindd_response);
if (len > 4) {
@@ -39,7 +39,7 @@ static NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct winbindd_response
blob.data = (uint8_t *)(((char *)response->extra_data.data) + 4);
ndr_err = ndr_pull_struct_blob(&blob, mem_ctx,
- lp_iconv_convenience(global_loadparm), info3,
+ iconv_convenience, info3,
(ndr_pull_flags_fn_t)ndr_pull_netr_SamInfo3);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return ndr_map_error2ntstatus(ndr_err);
@@ -122,7 +122,7 @@ static NTSTATUS winbind_check_password_samba3(struct auth_method_context *ctx,
if (result == NSS_STATUS_SUCCESS && response.extra_data.data) {
union netr_Validation validation;
- nt_status = get_info3_from_ndr(mem_ctx, &response, &info3);
+ nt_status = get_info3_from_ndr(mem_ctx, lp_iconv_convenience(ctx->auth_ctx->lp_ctx), &response, &info3);
SAFE_FREE(response.extra_data.data);
NT_STATUS_NOT_OK_RETURN(nt_status);
diff --git a/source4/client/cifsdd.c b/source4/client/cifsdd.c
index 08c152c3a5..8749a82573 100644
--- a/source4/client/cifsdd.c
+++ b/source4/client/cifsdd.c
@@ -22,6 +22,7 @@
#include "system/filesys.h"
#include "auth/gensec/gensec.h"
#include "lib/cmdline/popt_common.h"
+#include "libcli/resolve/resolve.h"
#include "cifsdd.h"
#include "param/param.h"
@@ -351,7 +352,8 @@ static void print_transfer_stats(void)
}
}
-static struct dd_iohandle * open_file(const char * which, const char **ports)
+static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx,
+ const char * which, const char **ports)
{
int options = 0;
const char * path = NULL;
@@ -371,13 +373,13 @@ static struct dd_iohandle * open_file(const char * which, const char **ports)
if (strcmp(which, "if") == 0) {
path = check_arg_pathname("if");
- handle = dd_open_path(path, ports, check_arg_numeric("ibs"),
- options);
+ handle = dd_open_path(resolve_ctx, 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, ports, check_arg_numeric("obs"),
- options);
+ handle = dd_open_path(resolve_ctx, path, ports,
+ check_arg_numeric("obs"), options);
} else {
SMB_ASSERT(0);
return(NULL);
@@ -431,11 +433,13 @@ 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", lp_smb_ports(lp_ctx)))) {
+ if (!(ifile = open_file(lp_resolve_context(lp_ctx), "if",
+ lp_smb_ports(lp_ctx)))) {
return(FILESYS_EXIT_CODE);
}
- if (!(ofile = open_file("of", lp_smb_ports(lp_ctx)))) {
+ if (!(ofile = open_file(lp_resolve_context(lp_ctx), "of",
+ lp_smb_ports(lp_ctx)))) {
return(FILESYS_EXIT_CODE);
}
diff --git a/source4/client/cifsdd.h b/source4/client/cifsdd.h
index 994c209103..0c44b91581 100644
--- a/source4/client/cifsdd.h
+++ b/source4/client/cifsdd.h
@@ -88,7 +88,8 @@ struct dd_iohandle
#define DD_WRITE 0x00000004
#define DD_OPLOCK 0x00000008
-struct dd_iohandle * dd_open_path(const char * path,
+struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx,
+ const char * path,
const char **ports,
uint64_t io_size, int options);
bool dd_fill_block(struct dd_iohandle * h, uint8_t * buf,
diff --git a/source4/client/cifsddio.c b/source4/client/cifsddio.c
index c30bf53196..2e5aedc4f9 100644
--- a/source4/client/cifsddio.c
+++ b/source4/client/cifsddio.c
@@ -220,7 +220,8 @@ static bool smb_write_func(void * handle, uint8_t * buf, uint64_t wanted,
return(true);
}
-static struct smbcli_state * init_smb_session(const char * host,
+static struct smbcli_state * init_smb_session(struct resolve_context *resolve_ctx,
+ const char * host,
const char **ports,
const char * share)
{
@@ -231,7 +232,8 @@ static struct smbcli_state * init_smb_session(const char * host,
* each connection, but for now, we just use the same one for both.
*/
ret = smbcli_full_connection(NULL, &cli, host, ports, share,
- NULL /* devtype */, cmdline_credentials, NULL /* events */);
+ NULL /* devtype */, cmdline_credentials, resolve_ctx,
+ NULL /* events */);
if (!NT_STATUS_IS_OK(ret)) {
fprintf(stderr, "%s: connecting to //%s/%s: %s\n",
@@ -289,7 +291,8 @@ static int open_smb_file(struct smbcli_state * cli,
return(o.ntcreatex.out.file.fnum);
}
-static struct dd_iohandle * open_cifs_handle(const char * host,
+static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx,
+ const char * host,
const char **ports,
const char * share,
const char * path,
@@ -314,7 +317,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, ports, share)) == NULL) {
+ if ((smbh->cli = init_smb_session(resolve_ctx, host, ports, share)) == NULL) {
return(NULL);
}
@@ -329,7 +332,8 @@ static struct dd_iohandle * open_cifs_handle(const char * host,
/* Abstract IO interface. */
/* ------------------------------------------------------------------------- */
-struct dd_iohandle * dd_open_path(const char * path,
+struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx,
+ const char * path,
const char **ports,
uint64_t io_size,
int options)
@@ -347,7 +351,8 @@ struct dd_iohandle * dd_open_path(const char * path,
/* Skip over leading directory separators. */
while (*remain == '/' || *remain == '\\') { remain++; }
- return(open_cifs_handle(host, ports, share, remain,
+ return(open_cifs_handle(resolve_ctx, host, ports,
+ share, remain,
io_size, options));
}
diff --git a/source4/client/client.c b/source4/client/client.c
index 2f6a7abcc0..7ce3268d3a 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -3019,7 +3019,8 @@ static int process_stdin(struct smbclient_context *ctx)
/*****************************************************
return a connection to a server
*******************************************************/
-static bool do_connect(struct smbclient_context *ctx,
+static bool do_connect(struct smbclient_context *ctx,
+ struct resolve_context *resolve_ctx,
const char *specified_server, const char **ports, const char *specified_share, struct cli_credentials *cred)
{
NTSTATUS status;
@@ -3038,7 +3039,7 @@ static bool do_connect(struct smbclient_context *ctx,
ctx->remote_cur_dir = talloc_strdup(ctx, "\\");
status = smbcli_full_connection(ctx, &ctx->cli, server, ports,
- share, NULL, cred,
+ share, NULL, cred, resolve_ctx,
cli_credentials_get_event_context(cred));
if (!NT_STATUS_IS_OK(status)) {
d_printf("Connection to \\\\%s\\%s failed - %s\n",
@@ -3064,7 +3065,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 **destports, 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, bool use_spnego)
{
struct nbt_name called, calling;
const char *server_name;
@@ -3076,7 +3077,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, destports, 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, use_spnego)) {
d_printf("Connection to %s failed\n", server_name);
return 1;
}
@@ -3224,10 +3225,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, 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));
+ 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), lp_nt_status_support(cmdline_lp_ctx) && lp_use_spnego(cmdline_lp_ctx));
}
- if (!do_connect(ctx, desthost, lp_smb_ports(cmdline_lp_ctx), service, cmdline_credentials))
+ if (!do_connect(ctx, lp_resolve_context(cmdline_lp_ctx), desthost, lp_smb_ports(cmdline_lp_ctx), service, cmdline_credentials))
return 1;
if (base_directory)
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index 7ec914e831..c13dde9711 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -32,7 +32,7 @@
*/
bool smbcli_socket_connect(struct smbcli_state *cli, const char *server,
const char **ports, struct resolve_context *resolve_ctx,
- int max_xmit, int max_mux)
+ int max_xmit, int max_mux, bool use_spnego)
{
struct smbcli_socket *sock;
@@ -42,7 +42,7 @@ bool smbcli_socket_connect(struct smbcli_state *cli, const char *server,
if (sock == NULL) return false;
cli->transport = smbcli_transport_init(sock, cli, true, max_xmit,
- max_mux);
+ max_mux, use_spnego);
if (!cli->transport) {
return false;
}
@@ -140,6 +140,7 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
const char *sharename,
const char *devtype,
struct cli_credentials *credentials,
+ struct resolve_context *resolve_ctx,
struct event_context *ev)
{
struct smbcli_tree *tree;
@@ -150,7 +151,7 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
status = smbcli_tree_full_connection(parent_ctx,
&tree, host, ports,
sharename, devtype,
- credentials, ev);
+ credentials, resolve_ctx, ev);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c
index 9732ab1638..8beaef3daa 100644
--- a/source4/libcli/raw/clisocket.c
+++ b/source4/libcli/raw/clisocket.c
@@ -47,6 +47,7 @@ struct composite_context *smbcli_sock_connect_send(TALLOC_CTX *mem_ctx,
const char *host_addr,
const char **ports,
const char *host_name,
+ struct resolve_context *resolve_ctx,
struct event_context *event_ctx)
{
struct composite_context *result, *ctx;
@@ -152,11 +153,13 @@ NTSTATUS smbcli_sock_connect_recv(struct composite_context *c,
NTSTATUS smbcli_sock_connect(TALLOC_CTX *mem_ctx,
const char *host_addr, const char **ports,
const char *host_name,
+ struct resolve_context *resolve_ctx,
struct event_context *event_ctx,
struct smbcli_socket **result)
{
struct composite_context *c =
smbcli_sock_connect_send(mem_ctx, host_addr, ports, host_name,
+ resolve_ctx,
event_ctx);
return smbcli_sock_connect_recv(c, mem_ctx, result);
}
@@ -233,8 +236,8 @@ struct smbcli_socket *smbcli_sock_connect_byname(const char *host, const char **
return NULL;
}
- status = smbcli_sock_connect(mem_ctx, address, ports, name, event_ctx,
- &result);
+ status = smbcli_sock_connect(mem_ctx, address, ports, name, resolve_ctx,
+ event_ctx, &result);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(9, ("smbcli_sock_connect failed: %s\n",
diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c
index 11df6c6c96..bdaeaeb58a 100644
--- a/source4/libcli/raw/clitransport.c
+++ b/source4/libcli/raw/clitransport.c
@@ -75,7 +75,8 @@ struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock,
TALLOC_CTX *parent_ctx,
bool primary,
int max_xmit,
- int max_mux)
+ int max_mux,
+ bool use_spnego)
{
struct smbcli_transport *transport;
@@ -88,8 +89,7 @@ struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock,
transport->socket = talloc_reference(transport, sock);
}
transport->negotiate.protocol = PROTOCOL_NT1;
- transport->options.use_spnego = lp_use_spnego(global_loadparm) &&
- lp_nt_status_support(global_loadparm);
+ transport->options.use_spnego = use_spnego;
transport->options.max_xmit = max_xmit;
transport->options.max_mux = max_mux;
transport->options.request_timeout = SMB_REQUEST_TIMEOUT;
diff --git a/source4/libcli/raw/clitree.c b/source4/libcli/raw/clitree.c
index 890d5470da..6b14893c4e 100644
--- a/source4/libcli/raw/clitree.c
+++ b/source4/libcli/raw/clitree.c
@@ -174,6 +174,7 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
const char *dest_host, const char **dest_ports,
const char *service, const char *service_type,
struct cli_credentials *credentials,
+ struct resolve_context *resolve_ctx,
struct event_context *ev)
{
struct smb_composite_connect io;
@@ -192,7 +193,7 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
io.in.fallback_to_anonymous = false;
io.in.workgroup = lp_workgroup(global_loadparm);
- status = smb_composite_connect(&io, parent_ctx, ev);
+ status = smb_composite_connect(&io, parent_ctx, resolve_ctx, ev);
if (NT_STATUS_IS_OK(status)) {
*ret_tree = io.out.tree;
}
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c
index 4d250fdded..4518203183 100644
--- a/source4/libcli/smb2/connect.c
+++ b/source4/libcli/smb2/connect.c
@@ -29,6 +29,7 @@
struct smb2_connect_state {
struct cli_credentials *credentials;
+ struct resolve_context *resolve_ctx;
const char *host;
const char *share;
struct smb2_negprot negprot;
@@ -152,7 +153,7 @@ static void continue_resolve(struct composite_context *creq)
c->status = resolve_name_recv(creq, state, &addr);
if (!composite_is_ok(c)) return;
- creq = smbcli_sock_connect_send(state, addr, ports, state->host, c->event_ctx);
+ creq = smbcli_sock_connect_send(state, addr, ports, state->host, state->resolve_ctx, c->event_ctx);
composite_continue(c, creq, continue_socket, c);
}
@@ -185,6 +186,7 @@ struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx,
if (composite_nomem(state->host, c)) return c;
state->share = talloc_strdup(c, share);
if (composite_nomem(state->share, c)) return c;
+ state->resolve_ctx = talloc_reference(state, resolve_ctx);
ZERO_STRUCT(name);
name.name = host;
diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c
index fafd3b0173..b71cfc2c19 100644
--- a/source4/libcli/smb_composite/connect.c
+++ b/source4/libcli/smb_composite/connect.c
@@ -309,7 +309,8 @@ static NTSTATUS connect_socket(struct composite_context *c,
/* the socket is up - we can initialise the smbcli transport layer */
state->transport = smbcli_transport_init(state->sock, state, true,
lp_max_xmit(global_loadparm),
- lp_maxmux(global_loadparm));
+ lp_maxmux(global_loadparm),
+ lp_use_spnego(global_loadparm) && lp_nt_status_support(global_loadparm));
NT_STATUS_HAVE_NO_MEMORY(state->transport);
if (is_ipaddress(state->sock->hostname) &&
@@ -362,7 +363,8 @@ static NTSTATUS connect_resolve(struct composite_context *c,
state->creq = smbcli_sock_connect_send(state, address,
io->in.dest_ports,
- io->in.dest_host, c->event_ctx);
+ io->in.dest_host,
+ NULL, c->event_ctx);
NT_STATUS_HAVE_NO_MEMORY(state->creq);
state->stage = CONNECT_SOCKET;
@@ -440,6 +442,7 @@ static void composite_handler(struct composite_context *creq)
*/
struct composite_context *smb_composite_connect_send(struct smb_composite_connect *io,
TALLOC_CTX *mem_ctx,
+ struct resolve_context *resolve_ctx,
struct event_context *event_ctx)
{
struct composite_context *c;
@@ -464,7 +467,7 @@ struct composite_context *smb_composite_connect_send(struct smb_composite_connec
state->stage = CONNECT_RESOLVE;
make_nbt_name_server(&name, io->in.dest_host);
- state->creq = resolve_name_send(lp_resolve_context(global_loadparm), &name, c->event_ctx);
+ state->creq = resolve_name_send(resolve_ctx, &name, c->event_ctx);
if (state->creq == NULL) goto failed;
state->creq->async.private_data = c;
@@ -498,8 +501,9 @@ NTSTATUS smb_composite_connect_recv(struct composite_context *c, TALLOC_CTX *mem
sync version of smb_composite_connect
*/
NTSTATUS smb_composite_connect(struct smb_composite_connect *io, TALLOC_CTX *mem_ctx,
+ struct resolve_context *resolve_ctx,
struct event_context *ev)
{
- struct composite_context *c = smb_composite_connect_send(io, mem_ctx, ev);
+ struct composite_context *c = smb_composite_connect_send(io, mem_ctx, resolve_ctx, ev);
return smb_composite_connect_recv(c, mem_ctx);
}
diff --git a/source4/libcli/smb_composite/fetchfile.c b/source4/libcli/smb_composite/fetchfile.c
index a4f73ffd70..f3934a2123 100644
--- a/source4/libcli/smb_composite/fetchfile.c
+++ b/source4/libcli/smb_composite/fetchfile.c
@@ -23,6 +23,8 @@
#include "includes.h"
#include "libcli/composite/composite.h"
#include "libcli/smb_composite/smb_composite.h"
+#include "param/param.h"
+#include "libcli/resolve/resolve.h"
enum fetchfile_stage {FETCHFILE_CONNECT,
FETCHFILE_READ};
@@ -145,7 +147,8 @@ struct composite_context *smb_composite_fetchfile_send(struct smb_composite_fetc
state->connect->in.fallback_to_anonymous = false;
state->connect->in.workgroup = io->in.workgroup;
- state->creq = smb_composite_connect_send(state->connect, state, event_ctx);
+ state->creq = smb_composite_connect_send(state->connect, state,
+ lp_resolve_context(global_loadparm), event_ctx);
if (state->creq == NULL) goto failed;
state->creq->async.private_data = c;
diff --git a/source4/libcli/smb_composite/fsinfo.c b/source4/libcli/smb_composite/fsinfo.c
index f37213e2f9..2d8240572e 100644
--- a/source4/libcli/smb_composite/fsinfo.c
+++ b/source4/libcli/smb_composite/fsinfo.c
@@ -6,6 +6,8 @@
#include "libcli/raw/libcliraw.h"
#include "libcli/composite/composite.h"
#include "libcli/smb_composite/smb_composite.h"
+#include "param/param.h"
+#include "libcli/resolve/resolve.h"
/* the stages of this call */
enum fsinfo_stage {FSINFO_CONNECT, FSINFO_QUERY};
@@ -157,7 +159,7 @@ struct composite_context *smb_composite_fsinfo_send(struct smbcli_tree *tree,
c->private_data = state;
state->creq = smb_composite_connect_send(state->connect, state,
- c->event_ctx);
+ lp_resolve_context(global_loadparm), c->event_ctx);
if (state->creq == NULL) goto failed;
diff --git a/source4/libcli/smb_composite/smb_composite.h b/source4/libcli/smb_composite/smb_composite.h
index a3188c4fe2..5574495079 100644
--- a/source4/libcli/smb_composite/smb_composite.h
+++ b/source4/libcli/smb_composite/smb_composite.h
@@ -171,5 +171,6 @@ struct smb_composite_connectmulti {
};
struct smbcli_session;
+struct resolve_context;
#include "libcli/smb_composite/proto.h"
diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c
index c0f61e0141..4c11a56272 100644
--- a/source4/librpc/rpc/dcerpc_connect.c
+++ b/source4/librpc/rpc/dcerpc_connect.c
@@ -133,7 +133,9 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CT
}
/* send smb connect request */
- conn_req = smb_composite_connect_send(conn, s->io.pipe->conn, s->io.pipe->conn->event_ctx);
+ conn_req = smb_composite_connect_send(conn, s->io.pipe->conn,
+ lp_resolve_context(lp_ctx),
+ s->io.pipe->conn->event_ctx);
if (composite_nomem(conn_req, c)) return c;
composite_continue(c, conn_req, continue_smb_connect, c);
diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c
index 9426355ecb..adfea6d2a2 100644
--- a/source4/ntvfs/cifs/vfs_cifs.c
+++ b/source4/ntvfs/cifs/vfs_cifs.c
@@ -32,6 +32,7 @@
#include "ntvfs/ntvfs.h"
#include "lib/util/dlinklist.h"
#include "param/param.h"
+#include "libcli/resolve/resolve.h"
struct cvfs_file {
struct cvfs_file *prev, *next;
@@ -202,7 +203,9 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
io.in.service = remote_share;
io.in.service_type = "?????";
- creq = smb_composite_connect_send(&io, private, ntvfs->ctx->event_ctx);
+ creq = smb_composite_connect_send(&io, private,
+ lp_resolve_context(ntvfs->ctx->lp_ctx),
+ ntvfs->ctx->event_ctx);
status = smb_composite_connect_recv(creq, private);
NT_STATUS_NOT_OK_RETURN(status);
diff --git a/source4/scripting/ejs/smbcalls_cli.c b/source4/scripting/ejs/smbcalls_cli.c
index a7210eb0fb..bb1e445d04 100644
--- a/source4/scripting/ejs/smbcalls_cli.c
+++ b/source4/scripting/ejs/smbcalls_cli.c
@@ -26,6 +26,7 @@
#include "libcli/composite/composite.h"
#include "libcli/smb_composite/smb_composite.h"
#include "libcli/libcli.h"
+#include "libcli/resolve/resolve.h"
#include "auth/credentials/credentials.h"
#include "param/param.h"
@@ -445,7 +446,9 @@ static int ejs_tree_connect(MprVarHandle eid, int argc, char **argv)
io.in.fallback_to_anonymous = false;
io.in.workgroup = lp_workgroup(global_loadparm);
- result = smb_composite_connect(&io, mem_ctx, NULL);
+ result = smb_composite_connect(&io, mem_ctx,
+ lp_resolve_context(global_loadparm),
+ NULL);
tree = io.out.tree;
talloc_free(mem_ctx);
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c
index cba57ac413..9820a02f27 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_smb_ports(tctx->lp_ctx), 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), lp_nt_status_support(tctx->lp_ctx) && lp_use_spnego(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 0832556b53..ccff18bfc4 100644
--- a/source4/torture/basic/misc.c
+++ b/source4/torture/basic/misc.c
@@ -822,7 +822,8 @@ static struct composite_context *torture_connect_async(
smb->in.fallback_to_anonymous=false;
smb->in.workgroup=workgroup;
- return smb_composite_connect_send(smb,mem_ctx,ev);
+ return smb_composite_connect_send(smb,mem_ctx,
+ lp_resolve_context(tctx->lp_ctx),ev);
}
bool run_benchrw(struct torture_context *tctx)
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index b257f1dc35..9e5ef73ea6 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -25,6 +25,7 @@
#include "libcli/raw/libcliraw.h"
#include "librpc/gen_ndr/security.h"
#include "auth/credentials/credentials.h"
+#include "libcli/resolve/resolve.h"
#include "auth/gensec/gensec.h"
#include "param/param.h"
#include "dynconfig.h"
@@ -187,7 +188,9 @@ static bool connect_servers(struct loadparm_context *lp_ctx)
servers[i].server_name,
lp_smb_ports(lp_ctx),
servers[i].share_name, NULL,
- servers[i].credentials, NULL);
+ servers[i].credentials,
+ lp_resolve_context(lp_ctx),
+ NULL);
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 9758cd2cf6..08313b6d57 100644
--- a/source4/torture/locktest.c
+++ b/source4/torture/locktest.c
@@ -26,6 +26,7 @@
#include "libcli/libcli.h"
#include "param/param.h"
#include "dynconfig.h"
+#include "libcli/resolve/resolve.h"
static int numops = 1000;
static bool showall;
@@ -155,7 +156,9 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
server,
lp_smb_ports(lp_ctx),
share, NULL,
- servers[snum], NULL);
+ servers[snum],
+ lp_resolve_context(lp_ctx),
+ NULL);
if (!NT_STATUS_IS_OK(status)) {
sleep(2);
}
diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index c88b4f704b..28dfe27960 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -28,6 +28,7 @@
#include "auth/gensec/gensec.h"
#include "param/param.h"
#include "dynconfig.h"
+#include "libcli/resolve/resolve.h"
static struct cli_credentials *credentials;
static bool showall = false;
@@ -72,7 +73,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(char *share, const char **ports)
+static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx,
+ char *share, const char **ports)
{
struct smbcli_state *c;
fstring server;
@@ -90,7 +92,7 @@ static struct smbcli_state *connect_one(char *share, const char **ports)
server,
ports,
share, NULL,
- credentials, NULL);
+ credentials, resolve_ctx, NULL);
if (!NT_STATUS_IS_OK(status)) {
return NULL;
@@ -380,7 +382,7 @@ static void usage(void)
argc -= optind;
argv += optind;
- cli = connect_one(share, lp_smb_ports(lp_ctx));
+ cli = connect_one(lp_resolve_context(lp_ctx), share, lp_smb_ports(lp_ctx));
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 744aab66b1..9131128f81 100644
--- a/source4/torture/raw/lockbench.c
+++ b/source4/torture/raw/lockbench.c
@@ -30,6 +30,7 @@
#include "lib/cmdline/popt_common.h"
#include "libcli/composite/composite.h"
#include "libcli/smb_composite/smb_composite.h"
+#include "libcli/resolve/resolve.h"
#include "param/param.h"
#define BASEDIR "\\benchlock"
@@ -197,7 +198,9 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
talloc_free(state->tree);
state->tree = NULL;
- ctx = smb_composite_connect_send(io, state->mem_ctx, state->ev);
+ ctx = smb_composite_connect_send(io, state->mem_ctx,
+ lp_resolve_context(state->tctx->lp_ctx),
+ state->ev);
if (ctx == NULL) {
DEBUG(0,("Failed to setup async reconnect\n"));
exit(1);
diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c
index ceb52cdfcf..881f487cb0 100644
--- a/source4/torture/raw/openbench.c
+++ b/source4/torture/raw/openbench.c
@@ -30,6 +30,7 @@
#include "lib/cmdline/popt_common.h"
#include "libcli/composite/composite.h"
#include "libcli/smb_composite/smb_composite.h"
+#include "libcli/resolve/resolve.h"
#include "param/param.h"
#define BASEDIR "\\benchopen"
@@ -136,7 +137,9 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
state->tree = NULL;
state->fnum = -1;
- ctx = smb_composite_connect_send(io, state->mem_ctx, state->ev);
+ ctx = smb_composite_connect_send(io, state->mem_ctx,
+ lp_resolve_context(state->tctx->lp_ctx),
+ state->ev);
if (ctx == NULL) {
DEBUG(0,("Failed to setup async reconnect\n"));
exit(1);
diff --git a/source4/torture/rpc/join.c b/source4/torture/rpc/join.c
index 8ab6ae03ea..dd2912380d 100644
--- a/source4/torture/rpc/join.c
+++ b/source4/torture/rpc/join.c
@@ -5,6 +5,7 @@
#include "auth/credentials/credentials.h"
#include "torture/rpc/rpc.h"
+#include "libcli/resolve/resolve.h"
#include "param/param.h"
#define TORTURE_NETBIOS_NAME "smbtorturejoin"
@@ -34,6 +35,7 @@ bool torture_rpc_join(struct torture_context *torture)
lp_smb_ports(torture->lp_ctx),
"IPC$", NULL,
machine_account,
+ lp_resolve_context(torture->lp_ctx),
NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
@@ -59,6 +61,7 @@ bool torture_rpc_join(struct torture_context *torture)
lp_smb_ports(torture->lp_ctx),
"IPC$", NULL,
machine_account,
+ lp_resolve_context(torture->lp_ctx),
NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 36461ad629..fd8236544e 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -50,6 +50,7 @@
#include "libcli/security/proto.h"
#include "param/param.h"
#include "lib/registry/registry.h"
+#include "libcli/resolve/resolve.h"
/*
* This tests a RPC call using an invalid vuid
@@ -82,6 +83,7 @@ bool torture_bind_authcontext(struct torture_context *torture)
torture_setting_string(torture, "host", NULL),
lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, cmdline_credentials,
+ lp_resolve_context(torture->lp_ctx),
NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
@@ -292,6 +294,7 @@ bool torture_bind_samba3(struct torture_context *torture)
torture_setting_string(torture, "host", NULL),
lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, cmdline_credentials,
+ lp_resolve_context(torture->lp_ctx),
NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
@@ -1152,7 +1155,9 @@ 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);
+ "IPC$", NULL, anon_creds,
+ lp_resolve_context(torture->lp_ctx),
+ NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
nt_errstr(status));
@@ -1234,7 +1239,9 @@ 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);
+ "IPC$", NULL, smb_creds,
+ lp_resolve_context(tctx->lp_ctx),
+ NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
nt_errstr(status));
@@ -1599,7 +1606,9 @@ 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);
+ "IPC$", NULL, cmdline_credentials,
+ lp_resolve_context(torture->lp_ctx),
+ NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) smbcli_full_connection failed: %s\n",
__location__, nt_errstr(status));
@@ -1624,7 +1633,9 @@ 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);
+ "IPC$", NULL, anon_creds,
+ lp_resolve_context(torture->lp_ctx),
+ NULL);
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 d5fe8bc260..9fa0d55c9e 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 "libcli/resolve/resolve.h"
#include "param/param.h"
struct unix_info2 {
@@ -58,7 +59,8 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx)
status = smbcli_full_connection(tctx, &cli, host,
lp_smb_ports(tctx->lp_ctx),
share, NULL,
- cmdline_credentials, NULL);
+ cmdline_credentials,
+ lp_resolve_context(tctx->lp_ctx), NULL);
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 412a256da7..4477713bfe 100644
--- a/source4/torture/unix/whoami.c
+++ b/source4/torture/unix/whoami.c
@@ -25,6 +25,7 @@
#include "lib/cmdline/popt_common.h"
#include "auth/credentials/credentials.h"
#include "param/param.h"
+#include "libcli/resolve/resolve.h"
/* Size (in bytes) of the required fields in the SMBwhoami response. */
#define WHOAMI_REQUIRED_SIZE 40
@@ -78,7 +79,8 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx,
status = smbcli_full_connection(tctx, &cli, host,
lp_smb_ports(tctx->lp_ctx),
share, NULL,
- creds, NULL);
+ creds, lp_resolve_context(tctx->lp_ctx),
+ NULL);
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 1168f31679..7d35b1296e 100644
--- a/source4/torture/util_smb.c
+++ b/source4/torture/util_smb.c
@@ -31,6 +31,7 @@
#include "torture/torture.h"
#include "util/dlinklist.h"
#include "auth/credentials/credentials.h"
+#include "libcli/resolve/resolve.h"
#include "param/param.h"
@@ -476,7 +477,9 @@ _PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx,
status = smbcli_full_connection(mem_ctx, c, hostname,
lp_smb_ports(tctx->lp_ctx),
sharename, NULL,
- cmdline_credentials, ev);
+ cmdline_credentials,
+ lp_resolve_context(tctx->lp_ctx),
+ ev);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to open connection - %s\n", nt_errstr(status));
return false;