SMB3 issues with smbclient

Jeremy Allison jra at
Tue Dec 20 00:48:20 UTC 2016

On Tue, Dec 20, 2016 at 10:48:35AM +1030, Paul Smedley wrote:
> Hi All,
> As I've posted previously, I'm working on a Samba client for the OS/2
> operating system, which is a fuse style plugin for 'netdrive'.
> I've just discovered what I think is a bug in SMB2+ support, which I believe
> also exists in smbclient.
> A user reported a problem to me, with file corruption when saving a file to
> a Samba share (the file ends up as 0 bytes),
> I believe this is due to an an incorrect fnum being returned from cli_open()
> when SMB2 is used.
> In my own code, with a file being opened over SMB1, I get fnum in the 10000+
> range which I'd expect. Additionally, each file opened gets a differeent
> fnum.
> When a file is opened via SMB2, in my code fnum is always 1.
> I tried similar operations using smbclient - similar things occur:
> - SMB1 I get valid fnum returned
> - SMB3 I get a fnum of 2 (why this is different to my own testcase I'm not
> sure)
> Any thoughts?
> Should cli_open() be returning a valid valid for fnum when SMB3 is used?

What version of Samba ? In current 4.5.x cli_open() under the covers
will create an SMB1/2/3 handle depending on what has been negotiated
on the wire.

More information about the samba-technical mailing list