The Samba-Bugzilla – Bug 6623
smb2_write should send packets to server based on payload size and available credits
Last modified: 2012-06-04 11:11:22 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 126.96.36.199 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 188.8.131.52, 184.108.40.206.5)
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.
Add metze to CC list since he does some work on SMB(2) and torture.
Metze, would you like to work on this?
Steven, would you like to fix the s4 SMB2 client library? This is also needed for s4 smbtorture.
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.
I'm working on improvements of the smb2 client library currently
should be fixed in master