cifs: Fix encoding of SMB1 Session Setup NTLMSSP Request in non-UNICODE mode
[ Upstream commit 6510ef4230b68c960309e0c1d6eb3e32eb785142 ] SMB1 Session Setup NTLMSSP Request in non-UNICODE mode is similar to UNICODE mode, just strings are encoded in ASCII and not in UTF-16. With this change it is possible to setup SMB1 session with NTLM authentication in non-UNICODE mode with Windows SMB server. This change fixes mounting SMB1 servers with -o nounicode mount option together with -o sec=ntlmssp mount option (which is the default sec=). Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0e7f0e6e14
commit
670c1c546c
@@ -1740,22 +1740,22 @@ _sess_auth_rawntlmssp_assemble_req(struct sess_data *sess_data)
|
|||||||
pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base;
|
pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base;
|
||||||
|
|
||||||
capabilities = cifs_ssetup_hdr(ses, server, pSMB);
|
capabilities = cifs_ssetup_hdr(ses, server, pSMB);
|
||||||
if ((pSMB->req.hdr.Flags2 & SMBFLG2_UNICODE) == 0) {
|
|
||||||
cifs_dbg(VFS, "NTLMSSP requires Unicode support\n");
|
|
||||||
return -ENOSYS;
|
|
||||||
}
|
|
||||||
|
|
||||||
pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC;
|
pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC;
|
||||||
capabilities |= CAP_EXTENDED_SECURITY;
|
capabilities |= CAP_EXTENDED_SECURITY;
|
||||||
pSMB->req.Capabilities |= cpu_to_le32(capabilities);
|
pSMB->req.Capabilities |= cpu_to_le32(capabilities);
|
||||||
|
|
||||||
bcc_ptr = sess_data->iov[2].iov_base;
|
bcc_ptr = sess_data->iov[2].iov_base;
|
||||||
/* unicode strings must be word aligned */
|
|
||||||
if (!IS_ALIGNED(sess_data->iov[0].iov_len + sess_data->iov[1].iov_len, 2)) {
|
if (pSMB->req.hdr.Flags2 & SMBFLG2_UNICODE) {
|
||||||
*bcc_ptr = 0;
|
/* unicode strings must be word aligned */
|
||||||
bcc_ptr++;
|
if (!IS_ALIGNED(sess_data->iov[0].iov_len + sess_data->iov[1].iov_len, 2)) {
|
||||||
|
*bcc_ptr = 0;
|
||||||
|
bcc_ptr++;
|
||||||
|
}
|
||||||
|
unicode_oslm_strings(&bcc_ptr, sess_data->nls_cp);
|
||||||
|
} else {
|
||||||
|
ascii_oslm_strings(&bcc_ptr, sess_data->nls_cp);
|
||||||
}
|
}
|
||||||
unicode_oslm_strings(&bcc_ptr, sess_data->nls_cp);
|
|
||||||
|
|
||||||
sess_data->iov[2].iov_len = (long) bcc_ptr -
|
sess_data->iov[2].iov_len = (long) bcc_ptr -
|
||||||
(long) sess_data->iov[2].iov_base;
|
(long) sess_data->iov[2].iov_base;
|
||||||
|
Reference in New Issue
Block a user