SMB3 issues with smbclient

Paul Smedley paul at smedley.id.au
Tue Dec 20 00:57:46 UTC 2016


Hi Jeremy,

On 20/12/16 11:18, Jeremy Allison wrote:
> 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.
>
4.4.7 - I added a d_printf("fnum = %d\n",fnum); after the first 
cli_open() call in smbclient and with default settings (ie SMB1) get an 
fnum like 26614; with -mSMB3 - it's always 2.

I can test with 4.5.x if you think it's worthwhile.

Cheers,

Paul



More information about the samba-technical mailing list