Lines 654-667
ssize_t read_smb_length(int fd, char *inbuf, unsigned int timeout)
Link Here
|
654 |
} |
654 |
} |
655 |
|
655 |
|
656 |
/**************************************************************************** |
656 |
/**************************************************************************** |
657 |
Read an smb from a fd. Note that the buffer *MUST* be of size |
657 |
Read an smb from a fd. |
658 |
BUFFER_SIZE+SAFETY_MARGIN. |
|
|
659 |
The timeout is in milliseconds. |
658 |
The timeout is in milliseconds. |
660 |
This function will return on receipt of a session keepalive packet. |
659 |
This function will return on receipt of a session keepalive packet. |
661 |
Doesn't check the MAC on signed packets. |
660 |
Doesn't check the MAC on signed packets. |
662 |
****************************************************************************/ |
661 |
****************************************************************************/ |
663 |
|
662 |
|
664 |
BOOL receive_smb_raw(int fd, char *buffer, unsigned int timeout) |
663 |
BOOL receive_smb_raw(int fd, char *buffer, size_t buflen, unsigned int timeout) |
665 |
{ |
664 |
{ |
666 |
ssize_t len,ret; |
665 |
ssize_t len,ret; |
667 |
|
666 |
|
Lines 682-706
BOOL receive_smb_raw(int fd, char *buffer, unsigned int timeout)
Link Here
|
682 |
return False; |
681 |
return False; |
683 |
} |
682 |
} |
684 |
|
683 |
|
685 |
/* |
684 |
if (len > buflen) { |
686 |
* A WRITEX with CAP_LARGE_WRITEX can be 64k worth of data plus 65 bytes |
|
|
687 |
* of header. Don't print the error if this fits.... JRA. |
688 |
*/ |
689 |
|
690 |
if (len > (BUFFER_SIZE + LARGE_WRITEX_HDR_SIZE)) { |
691 |
DEBUG(0,("Invalid packet length! (%lu bytes).\n",(unsigned long)len)); |
685 |
DEBUG(0,("Invalid packet length! (%lu bytes).\n",(unsigned long)len)); |
692 |
if (len > BUFFER_SIZE + (SAFETY_MARGIN/2)) { |
|
|
693 |
|
686 |
|
694 |
/* |
687 |
/* |
695 |
* Correct fix. smb_read_error may have already been |
688 |
* smb_read_error may have already been |
696 |
* set. Only set it here if not already set. Global |
689 |
* set. Only set it here if not already set. Global |
697 |
* variables still suck :-). JRA. |
690 |
* variables still suck :-). JRA. |
698 |
*/ |
691 |
*/ |
699 |
|
692 |
|
700 |
if (smb_read_error == 0) |
693 |
if (smb_read_error == 0) |
701 |
smb_read_error = READ_ERROR; |
694 |
smb_read_error = READ_ERROR; |
702 |
return False; |
695 |
return False; |
703 |
} |
|
|
704 |
} |
696 |
} |
705 |
|
697 |
|
706 |
if(len > 0) { |
698 |
if(len > 0) { |
Lines 730-738
BOOL receive_smb_raw(int fd, char *buffer, unsigned int timeout)
Link Here
|
730 |
Checks the MAC on signed packets. |
722 |
Checks the MAC on signed packets. |
731 |
****************************************************************************/ |
723 |
****************************************************************************/ |
732 |
|
724 |
|
733 |
BOOL receive_smb(int fd, char *buffer, unsigned int timeout) |
725 |
BOOL receive_smb(int fd, char *buffer, size_t buflen, unsigned int timeout) |
734 |
{ |
726 |
{ |
735 |
if (!receive_smb_raw(fd, buffer, timeout)) { |
727 |
if (!receive_smb_raw(fd, buffer, buflen, timeout)) { |
736 |
return False; |
728 |
return False; |
737 |
} |
729 |
} |
738 |
|
730 |
|