summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli')
-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
9 files changed, 33 insertions, 16 deletions
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"