ksmbd_smb_request can be removed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In smb_common.c you have this function :   ksmbd_smb_request() which
is called from connection.c once you have read the initial 4 bytes for
the next length+smb2 blob.

It checks the first byte of this 4 byte preamble for valid values,
i.e. a NETBIOSoverTCP SESSION_MESSAGE or a SESSION_KEEP_ALIVE.

We don't need to check this for ksmbd since it only implements SMB2
over TCP port 445.
The netbios stuff was only used in very old servers when SMB ran over
TCP port 139.
Now that we run over TCP port 445, this is actually not a NB header anymore
and you can just treat it as a 4 byte length field that must be less
than 16Mbyte.

I.e. you can change it to just be :
bool ksmbd_smb_request(struct ksmbd_conn *conn)
{
    return conn->request_buf[0] == 0;
}

and remove the references to the RFC1002 constants that no longer applies.

(See MS-SMB2 2.1)



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux