summaryrefslogtreecommitdiff
path: root/source4/libcli/smb2
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2018-07-19 23:04:33 +0200
committerAlexander Bokovoy <ab@samba.org>2018-07-24 06:55:24 +0200
commit5188454bdce80f6e2bfc45deca18bd1b7289a7a6 (patch)
treed4fe175e18fe076566d359537906ea82e5ddfa00 /source4/libcli/smb2
parentca000d8901e6acb8a7c59d26d4f75c9d92bafece (diff)
downloadsamba-5188454bdce80f6e2bfc45deca18bd1b7289a7a6.tar.gz
s4:libcli: allow a fallback to NTLMSSP if SPNEGO is not supported locally
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
Diffstat (limited to 'source4/libcli/smb2')
-rw-r--r--source4/libcli/smb2/session.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/source4/libcli/smb2/session.c b/source4/libcli/smb2/session.c
index b2cb8384f95..e94512d3d33 100644
--- a/source4/libcli/smb2/session.c
+++ b/source4/libcli/smb2/session.c
@@ -195,13 +195,38 @@ struct tevent_req *smb2_session_setup_spnego_send(
if (state->out_secblob.length > 0) {
chosen_oid = GENSEC_OID_SPNEGO;
+ status = gensec_start_mech_by_oid(session->gensec, chosen_oid);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to start set GENSEC client mechanism %s: %s\n",
+ gensec_get_name_by_oid(session->gensec,
+ chosen_oid),
+ nt_errstr(status)));
+ state->out_secblob = data_blob_null;
+ chosen_oid = GENSEC_OID_NTLMSSP;
+ status = gensec_start_mech_by_oid(session->gensec,
+ chosen_oid);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to start set (fallback) GENSEC client mechanism %s: %s\n",
+ gensec_get_name_by_oid(session->gensec,
+ chosen_oid),
+ nt_errstr(status)));
+ }
+ }
+ if (tevent_req_nterror(req, status)) {
+ return tevent_req_post(req, ev);
+ }
} else {
chosen_oid = GENSEC_OID_NTLMSSP;
- }
-
- status = gensec_start_mech_by_oid(session->gensec, chosen_oid);
- if (tevent_req_nterror(req, status)) {
- return tevent_req_post(req, ev);
+ status = gensec_start_mech_by_oid(session->gensec, chosen_oid);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to start set GENSEC client mechanism %s: %s\n",
+ gensec_get_name_by_oid(session->gensec,
+ chosen_oid),
+ nt_errstr(status)));
+ }
+ if (tevent_req_nterror(req, status)) {
+ return tevent_req_post(req, ev);
+ }
}
smb2_session_setup_spnego_gensec_next(req);