Ignore:
Timestamp:
Jun 25, 2011, 7:14:41 PM (14 years ago)
Author:
Herwig Bauernfeind
Message:

Update Samba 3.3 to 3.3.15 (security update)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/smbd/server.c

    r423 r578  
    210210        /* We will abort gracefully when the client or remote system
    211211           goes away */
    212         smbd_set_server_fd(dup(0));
     212        int fd = dup(0);
     213
     214        if (fd < 0 || fd >= FD_SETSIZE) {
     215                return false;
     216        }
     217
     218        smbd_set_server_fd(fd);
    213219       
    214220        /* close our standard file descriptors */
     
    437443                                                        ifss,
    438444                                                        true);
    439                                 if(s == -1) {
     445                                if(s < 0 || s >= FD_SETSIZE) {
     446                                        close(s);
    440447                                        continue;
    441448                                }
     
    517524                                                &ss,
    518525                                                true);
    519                                 if (s == -1) {
     526                                if (s < 0 || s >= FD_SETSIZE) {
    520527                                        continue;
    521528                                }
     
    710717                        socklen_t in_addrlen = sizeof(addr);
    711718                        pid_t child = 0;
     719                        int fd;
    712720
    713721                        s = -1;
     
    722730                        }
    723731
    724                         smbd_set_server_fd(accept(s,&addr,&in_addrlen));
    725 
    726                         if (smbd_server_fd() == -1 && errno == EINTR)
     732                        fd = accept(s,&addr,&in_addrlen);
     733                        if (fd == -1 && errno == EINTR)
    727734                                continue;
    728 
    729                         if (smbd_server_fd() == -1) {
     735                        if (fd == -1) {
    730736                                DEBUG(2,("open_sockets_smbd: accept: %s\n",
    731737                                         strerror(errno)));
    732738                                continue;
    733739                        }
     740                        if (fd < 0 || fd >= FD_SETSIZE) {
     741                                DEBUG(2,("open_sockets_smbd: bad fd %d\n",
     742                                        fd ));
     743                                continue;
     744                        }
     745
     746                        smbd_set_server_fd(fd);
    734747
    735748                        /* Ensure child is set to blocking mode */
Note: See TracChangeset for help on using the changeset viewer.