Ignore:
Timestamp:
Jul 1, 2011, 10:18:23 AM (14 years ago)
Author:
Herwig Bauernfeind
Message:

Samba 3.5: Update trunk to 3.5.7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/source3/nmbd/nmbd_packets.c

    r414 r593  
    16971697        count *= 4;
    16981698
    1699         if(count > FD_SETSIZE) {
     1699        if(count >= FD_SETSIZE) {
    17001700                DEBUG(0,("create_listen_fdset: Too many file descriptors needed (%d). We can \
    17011701only use %d.\n", count, FD_SETSIZE));
     
    17131713
    17141714        /* Add in the lp_socket_address() interface on 137. */
     1715        if (ClientNMB < 0 || ClientNMB >= FD_SETSIZE) {
     1716                errno = EBADF;
     1717                SAFE_FREE(pset);
     1718                return True;
     1719        }
     1720
    17151721        FD_SET(ClientNMB,pset);
    17161722        sock_array[num++] = ClientNMB;
     
    17221728        /* Add in the 137 sockets on all the interfaces. */
    17231729        for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) {
     1730                if (subrec->nmb_sock < 0 || subrec->nmb_sock >= FD_SETSIZE) {
     1731                        /* We have to ignore sockets outside FD_SETSIZE. */
     1732                        continue;
     1733                }
    17241734                FD_SET(subrec->nmb_sock,pset);
    17251735                sock_array[num++] = subrec->nmb_sock;
    17261736                *maxfd = MAX( *maxfd, subrec->nmb_sock);
    17271737
     1738                if (subrec->nmb_bcast < 0 || subrec->nmb_bcast >= FD_SETSIZE) {
     1739                        /* We have to ignore sockets outside FD_SETSIZE. */
     1740                        continue;
     1741                }
    17281742                sock_array[num++] = subrec->nmb_bcast;
    1729                 if (subrec->nmb_bcast != -1) {
    1730                         FD_SET(subrec->nmb_bcast,pset);
    1731                         *maxfd = MAX( *maxfd, subrec->nmb_bcast);
    1732                 }
     1743                FD_SET(subrec->nmb_bcast,pset);
     1744                *maxfd = MAX( *maxfd, subrec->nmb_bcast);
    17331745        }
    17341746
    17351747        /* Add in the lp_socket_address() interface on 138. */
     1748        if (ClientDGRAM < 0 || ClientDGRAM >= FD_SETSIZE) {
     1749                errno = EBADF;
     1750                SAFE_FREE(pset);
     1751                return True;
     1752        }
    17361753        FD_SET(ClientDGRAM,pset);
    17371754        sock_array[num++] = ClientDGRAM;
     
    17431760        /* Add in the 138 sockets on all the interfaces. */
    17441761        for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) {
     1762                if (subrec->dgram_sock < 0 || subrec->dgram_sock >= FD_SETSIZE) {
     1763                        /* We have to ignore sockets outside FD_SETSIZE. */
     1764                        continue;
     1765                }
    17451766                FD_SET(subrec->dgram_sock,pset);
    17461767                sock_array[num++] = subrec->dgram_sock;
    17471768                *maxfd = MAX( *maxfd, subrec->dgram_sock);
    17481769
     1770                if (subrec->dgram_bcast < 0 || subrec->dgram_bcast >= FD_SETSIZE) {
     1771                        /* We have to ignore sockets outside FD_SETSIZE. */
     1772                        continue;
     1773                }
    17491774                sock_array[num++] = subrec->dgram_bcast;
    17501775                if (subrec->dgram_bcast != -1) {
     
    18771902#ifndef SYNC_DNS
    18781903        dns_fd = asyncdns_fd();
    1879         if (dns_fd != -1) {
     1904        if (dns_fd >= 0 && dns_fd < FD_SETSIZE) {
    18801905                FD_SET(dns_fd, &r_fds);
    18811906                maxfd = MAX( maxfd, dns_fd);
Note: See TracChangeset for help on using the changeset viewer.