From: Stefan Metzmacher Date: Thu, 19 Jul 2018 21:04:33 +0000 (+0200) Subject: s4:libcli: allow a fallback to NTLMSSP if SPNEGO is not supported locally X-Git-Tag: ldb-1.3.6~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcaa67ffa4d8e4dc311de683dc68922a2e343b08;p=thirdparty%2Fsamba.git s4:libcli: allow a fallback to NTLMSSP if SPNEGO is not supported locally Signed-off-by: Stefan Metzmacher Reviewed-by: Alexander Bokovoy (cherry picked from commit 5188454bdce80f6e2bfc45deca18bd1b7289a7a6) --- diff --git a/source4/libcli/smb2/session.c b/source4/libcli/smb2/session.c index e3e54cbe31a..a8985b2542c 100644 --- a/source4/libcli/smb2/session.c +++ b/source4/libcli/smb2/session.c @@ -196,13 +196,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);