SMB2 Write truncate

ronnie sahlberg ronniesahlberg at gmail.com
Tue Jan 14 00:10:38 UTC 2020


Truncating a file in SMB2 should be
SET_INFO/FILE_END_OF_FILE_INFORMATION

On Tue, Jan 14, 2020 at 9:29 AM David Mulder via samba-technical
<samba-technical at lists.samba.org> wrote:
>
> 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