Ignore:
Timestamp:
May 29, 2008, 11:30:31 AM (17 years ago)
Author:
Paul Smedley
Message:

Update source to 3.0.30

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/lib/util_sock.c

    r30 r135  
    697697
    698698/****************************************************************************
    699  Read an smb from a fd. Note that the buffer *MUST* be of size
    700  BUFFER_SIZE+SAFETY_MARGIN.
     699 Read an smb from a fd.
    701700 The timeout is in milliseconds.
    702701 This function will return on receipt of a session keepalive packet.
     
    704703****************************************************************************/
    705704
    706 BOOL receive_smb_raw(int fd, char *buffer, unsigned int timeout)
     705BOOL receive_smb_raw(int fd, char *buffer, size_t buflen, unsigned int timeout)
    707706{
    708707        ssize_t len,ret;
     
    725724        }
    726725
    727         /*
    728          * A WRITEX with CAP_LARGE_WRITEX can be 64k worth of data plus 65 bytes
    729          * of header. Don't print the error if this fits.... JRA.
    730          */
    731 
    732         if (len > (BUFFER_SIZE + LARGE_WRITEX_HDR_SIZE)) {
     726        if (len > buflen) {
    733727                DEBUG(0,("Invalid packet length! (%lu bytes).\n",(unsigned long)len));
    734                 if (len > BUFFER_SIZE + (SAFETY_MARGIN/2)) {
    735 
    736                         /*
    737                          * Correct fix. smb_read_error may have already been
    738                          * set. Only set it here if not already set. Global
    739                          * variables still suck :-). JRA.
    740                          */
    741 
    742                         if (smb_read_error == 0)
    743                                 smb_read_error = READ_ERROR;
    744                         return False;
    745                 }
     728
     729                /*
     730                 * smb_read_error may have already been
     731                 * set. Only set it here if not already set. Global
     732                 * variables still suck :-). JRA.
     733                 */
     734
     735                if (smb_read_error == 0)
     736                        smb_read_error = READ_ERROR;
     737                return False;
    746738        }
    747739
     
    773765****************************************************************************/
    774766
    775 BOOL receive_smb(int fd, char *buffer, unsigned int timeout)
    776 {
    777         if (!receive_smb_raw(fd, buffer, timeout)) {
     767BOOL receive_smb(int fd, char *buffer, size_t buflen, unsigned int timeout)
     768{
     769        if (!receive_smb_raw(fd, buffer, buflen, timeout)) {
    778770                return False;
    779771        }
Note: See TracChangeset for help on using the changeset viewer.