Bug 6623 - smb2_write should send packets to server based on payload size and available credits
smb2_write should send packets to server based on payload size and available ...
Product: Samba 4.0
Classification: Unclassified
Component: smbtorture
All Windows 7
: P3 normal
: ---
Assigned To: Stefan Metzmacher
Depends on:
  Show dependency treegraph
Reported: 2009-08-08 18:57 UTC by Long Li
Modified: 2012-06-04 11:11 UTC (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Long Li 2009-08-08 18:57:02 UTC
In ./source4/libcli/smb2/write.c, smb2_write always uses one SMB2 packet to send data to the server: it assumes the client has enough credits regardless of payload size. 

But it fails to write 70000 bytes in a SMB2_WRITE request. The payload size determines the credits the client may have to consume in this SMB2_WRITE request. The following is taken from MS-SMB2 Section Application Requests Writing to a File or Named Pipe:

If the client requests writing to a file and the server supports multi-credit operations, the CreditCharge field in the SMB2 header MUST be set to ( 1 + (Length – 1) / 65536 ).

There are two changes needs to made here:

1. The client should send SMB2_WRITE requests based on payload size and how many credits the server has granted to this client. (MS-SMB2,

2. The client should set the CreditCharge in SMB2_HEADER if SMB 2.1 dialect is used. (MS-SMB2 2.2.1)

The same also applies to SMB2_READ requests.
Comment 1 Matthias Dieter Wallnöfer 2009-10-15 02:46:22 UTC
Add metze to CC list since he does some work on SMB(2) and torture.
Comment 2 Matthias Dieter Wallnöfer 2009-11-24 11:30:19 UTC
Metze, would you like to work on this?
Comment 3 Matthias Dieter Wallnöfer 2010-03-05 06:53:56 UTC
Steven, would you like to fix the s4 SMB2 client library? This is also needed for s4 smbtorture.
Comment 4 Steven Danneman 2010-03-05 12:31:44 UTC
Mathias I won't have time to do this in the near future (~1 month) but I do need
this functionality for tests I'll be writing soon.  I'll leave this unassigned if
any one wants to take it in the mean time.
Comment 5 Stefan Metzmacher 2011-09-09 21:15:05 UTC
I'm working on improvements of the smb2 client library currently
Comment 6 Stefan Metzmacher 2012-06-04 11:11:22 UTC
should be fixed in master