SMB2 Write truncate

David Mulder dmulder at suse.com
Mon Jan 13 22:47:26 UTC 2020


Based on the behavior of tests in source4/torture/basic/delaywrite.c, it seems sending a write request in smb1, with a buffer size of 0, would truncate the file (at least that's what the comments say in the test). There doesn't seem to be any reason for the offset size in these tests (some are less than the current size of the file, others are much greater than the current size, which doesn't make much sense).

I'm working on converting these tests to SMB2, but the behavior isn't the same. An SMB2 write responds with NT_STATUS_INVALID_PARAMETER when you set the buffer size to 0. I can't find in the MS-SMB2 spec how to correctly truncate a file. Anyone know how to do this?

--

David Mulder
Labs Software Engineer, Samba
SUSE
1800 Novell Place
Provo, UT 84606
(P)+1 801.861.6571
dmulder at suse.com<mailto:dmulder at suse.com>
[https://www.suse.com/email/img/2016/email_signature_suse.png]<http://www.suse.com/>


More information about the samba-technical mailing list