mirror of
https://github.com/samba-team/samba.git
synced 2025-11-07 12:23:51 +03:00
r3352: make smbcli_read() and smbcli_write() work with very small negotiated SMB buffer sizes
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
1993128cb1
commit
320ca0214d
@@ -42,8 +42,7 @@ ssize_t smbcli_read(struct smbcli_tree *tree, int fnum, char *buf, off_t offset,
|
|||||||
* Set readsize to the maximum size we can handle in one readX,
|
* Set readsize to the maximum size we can handle in one readX,
|
||||||
* rounded down to a multiple of 1024.
|
* rounded down to a multiple of 1024.
|
||||||
*/
|
*/
|
||||||
readsize = (tree->session->transport->negotiate.max_xmit -
|
readsize = (tree->session->transport->negotiate.max_xmit - (MIN_SMB_SIZE+32));
|
||||||
(MIN_SMB_SIZE+32)) & ~1023;
|
|
||||||
if (readsize > 0xFFFF) readsize = 0xFFFF;
|
if (readsize > 0xFFFF) readsize = 0xFFFF;
|
||||||
|
|
||||||
while (total < size) {
|
while (total < size) {
|
||||||
@@ -87,7 +86,7 @@ ssize_t smbcli_write(struct smbcli_tree *tree,
|
|||||||
const uint8_t *buf, off_t offset, size_t size)
|
const uint8_t *buf, off_t offset, size_t size)
|
||||||
{
|
{
|
||||||
union smb_write parms;
|
union smb_write parms;
|
||||||
int block = (tree->session->transport->negotiate.max_xmit - (MIN_SMB_SIZE+32)) & ~1023;
|
int block = (tree->session->transport->negotiate.max_xmit - (MIN_SMB_SIZE+32));
|
||||||
ssize_t total = 0;
|
ssize_t total = 0;
|
||||||
|
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user