diff options
author | bubulle <bubulle@alioth.debian.org> | 2008-05-28 19:16:34 +0000 |
---|---|---|
committer | bubulle <bubulle@alioth.debian.org> | 2008-05-28 19:16:34 +0000 |
commit | 9c742a9c47eb5741e0b51f0311dbe51308d247d9 (patch) | |
tree | f6a65f3ac16fc49d766dbcc44e199a0b9d244fb0 /source/lib/util_sock.c | |
parent | 695ee7a6446c9295644e74f44fc37d22e5fceae0 (diff) | |
download | samba-9c742a9c47eb5741e0b51f0311dbe51308d247d9.tar.gz |
Load samba-3.0.30 into branches/samba/upstream.upstream/3.0.30
git-svn-id: svn://svn.debian.org/svn/pkg-samba/branches/samba/upstream@1900 fc4039ab-9d04-0410-8cac-899223bdd6b0
Diffstat (limited to 'source/lib/util_sock.c')
-rw-r--r-- | source/lib/util_sock.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/source/lib/util_sock.c b/source/lib/util_sock.c index 94c5e82d15..4715ca7dcb 100644 --- a/source/lib/util_sock.c +++ b/source/lib/util_sock.c @@ -654,14 +654,13 @@ ssize_t read_smb_length(int fd, char *inbuf, unsigned int timeout) } /**************************************************************************** - Read an smb from a fd. Note that the buffer *MUST* be of size - BUFFER_SIZE+SAFETY_MARGIN. + Read an smb from a fd. The timeout is in milliseconds. This function will return on receipt of a session keepalive packet. Doesn't check the MAC on signed packets. ****************************************************************************/ -BOOL receive_smb_raw(int fd, char *buffer, unsigned int timeout) +BOOL receive_smb_raw(int fd, char *buffer, size_t buflen, unsigned int timeout) { ssize_t len,ret; @@ -682,25 +681,18 @@ BOOL receive_smb_raw(int fd, char *buffer, unsigned int timeout) return False; } - /* - * A WRITEX with CAP_LARGE_WRITEX can be 64k worth of data plus 65 bytes - * of header. Don't print the error if this fits.... JRA. - */ - - if (len > (BUFFER_SIZE + LARGE_WRITEX_HDR_SIZE)) { + if (len > buflen) { DEBUG(0,("Invalid packet length! (%lu bytes).\n",(unsigned long)len)); - if (len > BUFFER_SIZE + (SAFETY_MARGIN/2)) { - /* - * Correct fix. smb_read_error may have already been - * set. Only set it here if not already set. Global - * variables still suck :-). JRA. - */ + /* + * smb_read_error may have already been + * set. Only set it here if not already set. Global + * variables still suck :-). JRA. + */ - if (smb_read_error == 0) - smb_read_error = READ_ERROR; - return False; - } + if (smb_read_error == 0) + smb_read_error = READ_ERROR; + return False; } if(len > 0) { @@ -730,9 +722,9 @@ BOOL receive_smb_raw(int fd, char *buffer, unsigned int timeout) Checks the MAC on signed packets. ****************************************************************************/ -BOOL receive_smb(int fd, char *buffer, unsigned int timeout) +BOOL receive_smb(int fd, char *buffer, size_t buflen, unsigned int timeout) { - if (!receive_smb_raw(fd, buffer, timeout)) { + if (!receive_smb_raw(fd, buffer, buflen, timeout)) { return False; } |