mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
r26646: libcli/smb_composite: Allow specifying SMB parameters in smb_composite_connect structure. AFAIK no global variables will now be used when doing RPC client connections.
(This used to be commit 0ef75e4e3c
)
This commit is contained in:
parent
40acf23a92
commit
969b8579c7
@ -192,6 +192,14 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
|
||||
io.in.credentials = credentials;
|
||||
io.in.fallback_to_anonymous = false;
|
||||
io.in.workgroup = lp_workgroup(global_loadparm);
|
||||
io.in.max_xmit = lp_max_xmit(global_loadparm);
|
||||
io.in.max_mux = lp_maxmux(global_loadparm);
|
||||
io.in.ntstatus_support = lp_nt_status_support(global_loadparm);
|
||||
io.in.max_protocol = lp_cli_maxprotocol(global_loadparm);
|
||||
io.in.unicode = lp_unicode(global_loadparm);
|
||||
io.in.use_spnego = lp_use_spnego(global_loadparm) && lp_nt_status_support(global_loadparm);
|
||||
|
||||
|
||||
|
||||
status = smb_composite_connect(&io, parent_ctx, resolve_ctx, ev);
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
|
@ -63,8 +63,7 @@ static NTSTATUS connect_send_negprot(struct composite_context *c,
|
||||
{
|
||||
struct connect_state *state = talloc_get_type(c->private_data, struct connect_state);
|
||||
|
||||
state->req = smb_raw_negotiate_send(state->transport, lp_unicode(global_loadparm),
|
||||
lp_cli_maxprotocol(global_loadparm));
|
||||
state->req = smb_raw_negotiate_send(state->transport, io->in.unicode, io->in.max_protocol);
|
||||
NT_STATUS_HAVE_NO_MEMORY(state->req);
|
||||
|
||||
state->req->async.fn = request_handler;
|
||||
@ -308,9 +307,9 @@ 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_use_spnego(global_loadparm) && lp_nt_status_support(global_loadparm));
|
||||
io->in.max_xmit,
|
||||
io->in.max_mux,
|
||||
io->in.use_spnego);
|
||||
NT_STATUS_HAVE_NO_MEMORY(state->transport);
|
||||
|
||||
if (is_ipaddress(state->sock->hostname) &&
|
||||
|
@ -147,6 +147,14 @@ 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->connect->in.max_xmit = lp_max_xmit(global_loadparm);
|
||||
state->connect->in.max_mux = lp_maxmux(global_loadparm);
|
||||
state->connect->in.ntstatus_support = lp_nt_status_support(global_loadparm);
|
||||
state->connect->in.max_protocol = lp_cli_maxprotocol(global_loadparm);
|
||||
state->connect->in.unicode = lp_unicode(global_loadparm);
|
||||
state->connect->in.use_spnego = lp_use_spnego(global_loadparm) &&
|
||||
lp_nt_status_support(global_loadparm);
|
||||
|
||||
state->creq = smb_composite_connect_send(state->connect, state,
|
||||
lp_resolve_context(global_loadparm), event_ctx);
|
||||
if (state->creq == NULL) goto failed;
|
||||
|
@ -153,6 +153,14 @@ struct composite_context *smb_composite_fsinfo_send(struct smbcli_tree *tree,
|
||||
state->connect->in.fallback_to_anonymous = false;
|
||||
state->connect->in.workgroup = io->in.workgroup;
|
||||
|
||||
state->connect->in.max_xmit = lp_max_xmit(global_loadparm);
|
||||
state->connect->in.max_mux = lp_maxmux(global_loadparm);
|
||||
state->connect->in.ntstatus_support = lp_nt_status_support(global_loadparm);
|
||||
state->connect->in.max_protocol = lp_cli_maxprotocol(global_loadparm);
|
||||
state->connect->in.unicode = lp_unicode(global_loadparm);
|
||||
state->connect->in.use_spnego = lp_use_spnego(global_loadparm) &&
|
||||
lp_nt_status_support(global_loadparm);
|
||||
|
||||
c->state = COMPOSITE_STATE_IN_PROGRESS;
|
||||
state->stage = FSINFO_CONNECT;
|
||||
c->event_ctx = talloc_reference(c, tree->session->transport->socket->event.ctx);
|
||||
|
@ -91,6 +91,12 @@ struct smb_composite_connect {
|
||||
struct cli_credentials *credentials;
|
||||
bool fallback_to_anonymous;
|
||||
const char *workgroup;
|
||||
bool use_spnego;
|
||||
bool ntstatus_support;
|
||||
bool unicode;
|
||||
int max_xmit;
|
||||
int max_mux;
|
||||
int max_protocol;
|
||||
} in;
|
||||
struct {
|
||||
struct smbcli_tree *tree;
|
||||
|
@ -119,6 +119,13 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CT
|
||||
conn->in.service_type = NULL;
|
||||
conn->in.workgroup = lp_workgroup(lp_ctx);
|
||||
|
||||
conn->in.max_xmit = lp_max_xmit(lp_ctx);
|
||||
conn->in.max_mux = lp_maxmux(lp_ctx);
|
||||
conn->in.ntstatus_support = lp_nt_status_support(lp_ctx);
|
||||
conn->in.max_protocol = lp_cli_maxprotocol(lp_ctx);
|
||||
conn->in.unicode = lp_unicode(lp_ctx);
|
||||
conn->in.use_spnego = lp_use_spnego(lp_ctx) && lp_nt_status_support(lp_ctx);
|
||||
|
||||
/*
|
||||
* provide proper credentials - user supplied, but allow a
|
||||
* fallback to anonymous if this is an schannel connection
|
||||
|
@ -202,6 +202,12 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
|
||||
io.in.workgroup = lp_workgroup(ntvfs->ctx->lp_ctx);
|
||||
io.in.service = remote_share;
|
||||
io.in.service_type = "?????";
|
||||
io.in.max_xmit = lp_max_xmit(ntvfs->ctx->lp_ctx);
|
||||
io.in.max_mux = lp_maxmux(ntvfs->ctx->lp_ctx);
|
||||
io.in.ntstatus_support = lp_nt_status_support(ntvfs->ctx->lp_ctx);
|
||||
io.in.max_protocol = lp_cli_maxprotocol(ntvfs->ctx->lp_ctx);
|
||||
io.in.unicode = lp_unicode(ntvfs->ctx->lp_ctx);
|
||||
io.in.use_spnego = lp_use_spnego(ntvfs->ctx->lp_ctx) && lp_nt_status_support(ntvfs->ctx->lp_ctx);
|
||||
|
||||
creq = smb_composite_connect_send(&io, private,
|
||||
lp_resolve_context(ntvfs->ctx->lp_ctx),
|
||||
|
@ -445,6 +445,12 @@ static int ejs_tree_connect(MprVarHandle eid, int argc, char **argv)
|
||||
io.in.credentials = creds;
|
||||
io.in.fallback_to_anonymous = false;
|
||||
io.in.workgroup = lp_workgroup(global_loadparm);
|
||||
io.in.max_xmit = lp_max_xmit(global_loadparm);
|
||||
io.in.max_mux = lp_maxmux(global_loadparm);
|
||||
io.in.ntstatus_support = lp_nt_status_support(global_loadparm);
|
||||
io.in.max_protocol = lp_cli_maxprotocol(global_loadparm);
|
||||
io.in.unicode = lp_unicode(global_loadparm);
|
||||
io.in.use_spnego = lp_use_spnego(global_loadparm) && lp_nt_status_support(global_loadparm);
|
||||
|
||||
result = smb_composite_connect(&io, mem_ctx,
|
||||
lp_resolve_context(global_loadparm),
|
||||
|
@ -821,6 +821,12 @@ static struct composite_context *torture_connect_async(
|
||||
smb->in.credentials=cmdline_credentials;
|
||||
smb->in.fallback_to_anonymous=false;
|
||||
smb->in.workgroup=workgroup;
|
||||
smb->in.max_xmit = lp_max_xmit(tctx->lp_ctx);
|
||||
smb->in.max_mux = lp_maxmux(tctx->lp_ctx);
|
||||
smb->in.ntstatus_support = lp_nt_status_support(tctx->lp_ctx);
|
||||
smb->in.max_protocol = lp_cli_maxprotocol(tctx->lp_ctx);
|
||||
smb->in.unicode = lp_unicode(tctx->lp_ctx);
|
||||
smb->in.use_spnego = lp_use_spnego(tctx->lp_ctx) && lp_nt_status_support(tctx->lp_ctx);
|
||||
|
||||
return smb_composite_connect_send(smb,mem_ctx,
|
||||
lp_resolve_context(tctx->lp_ctx),ev);
|
||||
|
@ -193,6 +193,12 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
|
||||
io->in.credentials = cmdline_credentials;
|
||||
io->in.fallback_to_anonymous = false;
|
||||
io->in.workgroup = lp_workgroup(state->tctx->lp_ctx);
|
||||
io->in.max_xmit = lp_max_xmit(state->tctx->lp_ctx);
|
||||
io->in.max_mux = lp_maxmux(state->tctx->lp_ctx);
|
||||
io->in.ntstatus_support = lp_nt_status_support(state->tctx->lp_ctx);
|
||||
io->in.max_protocol = lp_cli_maxprotocol(state->tctx->lp_ctx);
|
||||
io->in.unicode = lp_unicode(state->tctx->lp_ctx);
|
||||
io->in.use_spnego = lp_use_spnego(state->tctx->lp_ctx) && lp_nt_status_support(state->tctx->lp_ctx);
|
||||
|
||||
/* kill off the remnants of the old connection */
|
||||
talloc_free(state->tree);
|
||||
|
@ -131,6 +131,12 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
|
||||
io->in.credentials = cmdline_credentials;
|
||||
io->in.fallback_to_anonymous = false;
|
||||
io->in.workgroup = lp_workgroup(state->tctx->lp_ctx);
|
||||
io->in.max_xmit = lp_max_xmit(state->tctx->lp_ctx);
|
||||
io->in.max_mux = lp_maxmux(state->tctx->lp_ctx);
|
||||
io->in.ntstatus_support = lp_nt_status_support(state->tctx->lp_ctx);
|
||||
io->in.max_protocol = lp_cli_maxprotocol(state->tctx->lp_ctx);
|
||||
io->in.unicode = lp_unicode(state->tctx->lp_ctx);
|
||||
io->in.use_spnego = lp_use_spnego(state->tctx->lp_ctx) && lp_nt_status_support(state->tctx->lp_ctx);
|
||||
|
||||
/* kill off the remnants of the old connection */
|
||||
talloc_free(state->tree);
|
||||
|
Loading…
Reference in New Issue
Block a user