Re: [PATCH] ksmbd: add default data stream name in FILE_STREAM_INFORMATION

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

 



This doesn't appear to be what's documented in MS-FSA section 2.1.5.11.29.
There, it appears to call for returning an empty stream list,
and STATUS_SUCCESS, when no streams are present.

Also, why does the code special-case directories? The conditionals
on StreamSize and StreamAllocation size are entirely redundant,
after the top-level if (!S_ISDIR...), btw.

I'd suggest asking Microsoft dochelp for clarification before
implementing this.

Tom.

On 9/18/2021 8:02 AM, Namjae Jeon wrote:
Windows client expect to get default stream name(::DATA) in
FILE_STREAM_INFORMATION response even if there is no stream data in file.
This patch fix update failure when writing ppt or doc files.

Signed-off-by: Namjae Jeon <linkinjeon@xxxxxxxxxx>
---
  fs/ksmbd/smb2pdu.c | 8 +++-----
  1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index 49a1ca75f427..301605e0cbf7 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -4465,17 +4465,15 @@ static void get_file_stream_info(struct ksmbd_work *work,
  		file_info->NextEntryOffset = cpu_to_le32(next);
  	}
- if (nbytes) {
+	if (!S_ISDIR(stat.mode)) {
  		file_info = (struct smb2_file_stream_info *)
  			&rsp->Buffer[nbytes];
  		streamlen = smbConvertToUTF16((__le16 *)file_info->StreamName,
  					      "::$DATA", 7, conn->local_nls, 0);
  		streamlen *= 2;
  		file_info->StreamNameLength = cpu_to_le32(streamlen);
-		file_info->StreamSize = S_ISDIR(stat.mode) ? 0 :
-			cpu_to_le64(stat.size);
-		file_info->StreamAllocationSize = S_ISDIR(stat.mode) ? 0 :
-			cpu_to_le64(stat.size);
+		file_info->StreamSize = 0;
+		file_info->StreamAllocationSize = 0;
  		nbytes += sizeof(struct smb2_file_stream_info) + streamlen;
  	}



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

  Powered by Linux