diff options
author | Pali Rohár <pali@kernel.org> | 2024-10-31 00:46:20 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2025-03-26 22:50:51 +0300 |
commit | 781802aa5a5950f99899f13ff9d760f5db81d36d (patch) | |
tree | 18dbd56dd7d87faf243f27c8683930a9c9df1b4d /rust/helpers/helpers.c | |
parent | ad9364a6835c45c52f47587ffbe0577bb7cd4c5b (diff) | |
download | linux-781802aa5a5950f99899f13ff9d760f5db81d36d.tar.xz |
cifs: Fix establishing NetBIOS session for SMB2+ connection
Function ip_rfc1001_connect() which establish NetBIOS session for SMB
connections, currently uses smb_send() function for sending NetBIOS Session
Request packet. This function expects that the passed buffer is SMB packet
and for SMB2+ connections it mangles packet header, which breaks prepared
NetBIOS Session Request packet. Result is that this function send garbage
packet for SMB2+ connection, which SMB2+ server cannot parse. That function
is not mangling packets for SMB1 connections, so it somehow works for SMB1.
Fix this problem and instead of smb_send(), use smb_send_kvec() function
which does not mangle prepared packet, this function send them as is. Just
API of this function takes struct msghdr (kvec) instead of packet buffer.
[MS-SMB2] specification allows SMB2 protocol to use NetBIOS as a transport
protocol. NetBIOS can be used over TCP via port 139. So this is a valid
configuration, just not so common. And even recent Windows versions (e.g.
Windows Server 2022) still supports this configuration: SMB over TCP port
139, including for modern SMB2 and SMB3 dialects.
This change fixes SMB2 and SMB3 connections over TCP port 139 which
requires establishing of NetBIOS session. Tested that this change fixes
establishing of SMB2 and SMB3 connections with Windows Server 2022.
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'rust/helpers/helpers.c')
0 files changed, 0 insertions, 0 deletions