Whilst developing my OS/2 Samba client, I discovered that cli_ftruncate is failing with a SMB2 or above connection. cli_error returns 22 (EINVAL). From: Jeremy on samba-technical "Good catch - looks like we missed converting cli_ftruncate() to call SMB2+ under the covers. Inside cli_getatr() for example we have: if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) { return cli_smb2_getatr(cli, fname, attr, size, write_time); } We need the same adding for cli_ftruncate() and a callout to a cli_smb2_ftruncate() which needs adding inside source3/libsmb/cli_smb2_fnum.c."
Created attachment 12775 [details] test patch for master
Created attachment 12776 [details] Doh - fixed patch including size. Doh - sorry - ignore previous patch. I forgot to add the 'size' argument to cli_smb2_ftruncate() (would always have truncated to zero).
Test fix appears to work fine here! Thanks!
Any idea when this fix will get committed?
Created attachment 12792 [details] git-am fix for master. Contains regression test.
Created attachment 12800 [details] git-am fix for 4.5.next. Back-ported from master.
Created attachment 12801 [details] git-am fix for 4.4.next Back-ported from master.
Comment on attachment 12800 [details] git-am fix for 4.5.next. Oops, just spotted something (in master too, in SMB1 code too) - there's no check on the talloc_stackframe() result. Jeremy, what do you think? Isn't it our coding convention to check tallocs? Maybe add it as a followup patch and backport that too?
talloc_stackframe() calls abort() by design if it fails. It's so integral that it's treated (rightly IMHO) as a catastrophic failure.
Assigning to Karolin for inclusion in 4.4.next and 4.5.next. Thanks, Uri.
(In reply to Uri Simchoni from comment #10) Pushed to autobild-v4-{5,4}-test.
(In reply to Karolin Seeger from comment #11) Pushed to both branches. Closing out bug report. Thanks!