Re: [PATCH] ksmbd: return unsupported error on smb1 mount

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

 



2023-03-23 11:53 GMT+09:00, Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>:
> On (23/03/21 22:33), Namjae Jeon wrote:
> [..]
>> @@ -442,9 +442,26 @@ static int smb_handle_negotiate(struct ksmbd_work
>> *work)
>>  {
>>  	struct smb_negotiate_rsp *neg_rsp = work->response_buf;
>>
>> -	ksmbd_debug(SMB, "Unsupported SMB protocol\n");
>> -	neg_rsp->hdr.Status.CifsError = STATUS_INVALID_LOGON_TYPE;
>> -	return -EINVAL;
>> +	ksmbd_debug(SMB, "Unsupported SMB1 protocol\n");
>> +
>> +	/*
>> +	 * Remove 4 byte direct TCP header, add 1 byte wc, 2 byte bcc
>> +	 * and 2 byte DialectIndex.
>> +	 */
>> +	*(__be32 *)work->response_buf =
>> +		cpu_to_be32(sizeof(struct smb_hdr) - 4 + 2 + 2);
>
> 	In other words cpu_to_be32(sizeof(struct smb_hdr)).
Yes, that's possible too, but wouldn't this make the comments easier
to understand..?
>
>> +	neg_rsp->hdr.Status.CifsError = STATUS_SUCCESS;
>> +
>> +	neg_rsp->hdr.Command = SMB_COM_NEGOTIATE;
>> +	*(__le32 *)neg_rsp->hdr.Protocol = SMB1_PROTO_NUMBER;
>
> 	I assume this should say cpu_to_le32(SMB1_PROTO_NUMBER).
SMB1_PROTO_NUMBER is declared as:
#define SMB1_PROTO_NUMBER		cpu_to_le32(0x424d53ff)

Thanks!
>



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

  Powered by Linux