SMB2 Write truncate

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

Truncating a file in SMB2 should be

On Tue, Jan 14, 2020 at 9:29 AM David Mulder via samba-technical
<samba-technical at> 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
> 1800 Novell Place
> Provo, UT 84606
> (P)+1 801.861.6571
> dmulder at<mailto:dmulder at>
> []<>

More information about the samba-technical mailing list