SMB3 issues with smbclient

Paul Smedley paul at
Tue Dec 20 00:18:35 UTC 2016

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?

I believe my client issue with corrupt files occurs due to operations 
being attempted on the fnum that's invalid.

If people believe this is a valid issue, I'll open a bug, if not, I'll 
keep digging as to why my client is behaving incorrectly :)



More information about the samba-technical mailing list