SMB3 issues with smbclient

Jeremy Allison jra at samba.org
Wed Dec 21 17:24:24 UTC 2016


On Wed, Dec 21, 2016 at 06:56:23PM +1030, Paul Smedley wrote:
> Hi Again Metze!
> 
> On 21/12/16 07:10, Paul Smedley wrote:
> <snip>
> 
> >>What was the problem in your case? Did you send the value "1" over
> >>the net?
> >
> >In this case, a particular application (MED editor) when saving a file
> >on a SMB2+ share, creates a 0 byte file. Same application and plugin
> >over SMB1 works fine.
> >
> >I'll comb back through the logs and potentially add some more logging
> >and see what I can fine.
> >
> >I'll also test against a Win2k server, just to rule out the issue being
> >with Samba Server.
> OK some updates.
> 
> Issues happens with both Samba Server 4.4.5 & Win2k08.
> 
> I had a closer look at the logs. cli_ftruncate() is failing with SMB2+.
> 
> Part of the Netdrive (kinda like Fuse but for OS/2) api is a command to set
> the file size.
> 
> The implementation of this calls:
> 	if (!NT_STATUS_IS_OK(cli_ftruncate(cli, file->fd, newsize)))
> file->fd is the fnum of the file handle, newsize is the size.
> 
> This works fine with SMB1. With SMB3, cli_errno(cli) returns an errno of 22.
> 
> Digging in more now....

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.

Can you log a bug on this and I'll see if I can quickly
code this up over the holidays ?

As this is exposed via libsmbclient we need to fix this
asap as the Gnome or KDE vfs clients may trip over this.

Jeremy.



More information about the samba-technical mailing list