Skip to content

Commit 6510ef4

Browse files
paliSteve French
authored andcommitted
cifs: Fix encoding of SMB1 Session Setup NTLMSSP Request in non-UNICODE mode
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>
1 parent f1e7a27 commit 6510ef4

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

fs/smb/client/sess.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,22 +1684,22 @@ _sess_auth_rawntlmssp_assemble_req(struct sess_data *sess_data)
16841684
pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base;
16851685

16861686
capabilities = cifs_ssetup_hdr(ses, server, pSMB);
1687-
if ((pSMB->req.hdr.Flags2 & SMBFLG2_UNICODE) == 0) {
1688-
cifs_dbg(VFS, "NTLMSSP requires Unicode support\n");
1689-
return -ENOSYS;
1690-
}
1691-
16921687
pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC;
16931688
capabilities |= CAP_EXTENDED_SECURITY;
16941689
pSMB->req.Capabilities |= cpu_to_le32(capabilities);
16951690

16961691
bcc_ptr = sess_data->iov[2].iov_base;
1697-
/* unicode strings must be word aligned */
1698-
if (!IS_ALIGNED(sess_data->iov[0].iov_len + sess_data->iov[1].iov_len, 2)) {
1699-
*bcc_ptr = 0;
1700-
bcc_ptr++;
1692+
1693+
if (pSMB->req.hdr.Flags2 & SMBFLG2_UNICODE) {
1694+
/* unicode strings must be word aligned */
1695+
if (!IS_ALIGNED(sess_data->iov[0].iov_len + sess_data->iov[1].iov_len, 2)) {
1696+
*bcc_ptr = 0;
1697+
bcc_ptr++;
1698+
}
1699+
unicode_oslm_strings(&bcc_ptr, sess_data->nls_cp);
1700+
} else {
1701+
ascii_oslm_strings(&bcc_ptr, sess_data->nls_cp);
17011702
}
1702-
unicode_oslm_strings(&bcc_ptr, sess_data->nls_cp);
17031703

17041704
sess_data->iov[2].iov_len = (long) bcc_ptr -
17051705
(long) sess_data->iov[2].iov_base;

0 commit comments

Comments
 (0)