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

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

 



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)).

> +	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).



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

  Powered by Linux