From: Stefan Metzmacher Date: Wed, 1 Jul 2020 16:27:40 +0000 (+0200) Subject: s4:libcli/smb2: allow smb2_connect*() to fake session and tcon X-Git-Tag: samba-4.13.0rc1~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d06874478edb29a14eedcd8d634f3bf5d8dee50;p=thirdparty%2Fsamba.git s4:libcli/smb2: allow smb2_connect*() to fake session and tcon For multichannel connection we want a way to have just a connection with a negprot finished. For now we just fake a tcon and session in order to avoid changes in the caller. We can clean that up later if needed. Signed-off-by: Stefan Metzmacher Reviewed-by: Günther Deschner --- diff --git a/source4/libcli/raw/libcliraw.h b/source4/libcli/raw/libcliraw.h index df0690fa223..0e99618df25 100644 --- a/source4/libcli/raw/libcliraw.h +++ b/source4/libcli/raw/libcliraw.h @@ -104,6 +104,7 @@ struct smbcli_options { uint32_t smb2_capabilities; struct GUID client_guid; uint64_t max_credits; + unsigned int only_negprot; }; /* this is the context for the client transport layer */ diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c index e4cbf8c5c41..98aa148ea2c 100644 --- a/source4/libcli/smb2/connect.c +++ b/source4/libcli/smb2/connect.c @@ -218,6 +218,15 @@ static void smb2_connect_session_start(struct tevent_req *req) return; } + if (state->options.only_negprot) { + state->tree = smb2_tree_init(state->session, state, true); + if (tevent_req_nomem(state->tree, req)) { + return; + } + tevent_req_done(req); + return; + } + subreq = smb2_session_setup_spnego_send(state, state->ev, state->session, state->credentials,