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)

Location:
branches/samba-3.3.x/source
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/VERSION

    r491 r578  
    2626SAMBA_VERSION_MAJOR=3
    2727SAMBA_VERSION_MINOR=3
    28 SAMBA_VERSION_RELEASE=14
     28SAMBA_VERSION_RELEASE=15
    2929
    3030########################################################
  • branches/samba-3.3.x/source/client/client.c

    r221 r578  
    43804380 again:
    43814381
    4382         if (cli->fd == -1)
     4382        if (cli->fd < 0 || cli->fd >= FD_SETSIZE) {
     4383                errno = EBADF;
    43834384                return;
     4385        }
    43844386
    43854387        FD_ZERO(&fds);
  • branches/samba-3.3.x/source/client/dnsbrowse.c

    r206 r578  
    8080                if (fdset != NULL) {
    8181                        TALLOC_FREE(fdset);
     82                }
     83
     84                if (mdnsfd < 0 || mdnsfd >= FD_SETSIZE) {
     85                        errno = EBADF;
     86                        break;
    8287                }
    8388
     
    184189                fdsetsz = howmany(mdnsfd + 1, NFDBITS) * sizeof(fd_mask);
    185190                fdset = TALLOC_ZERO(ctx, fdsetsz);
     191
     192                if (mdnsfd < 0 || mdnsfd >= FD_SETSIZE) {
     193                        errno = EBADF;
     194                        TALLOC_FREE(ctx);
     195                        return 1;
     196                }
     197
    186198                FD_SET(mdnsfd, fdset);
    187199
  • branches/samba-3.3.x/source/lib/events.c

    r221 r578  
    141141        struct fd_event *fde;
    142142
     143        if (fd < 0 || fd >= FD_SETSIZE) {
     144                errno = EBADF;
     145                return NULL;
     146        }
     147
    143148        if (!(fde = TALLOC_P(mem_ctx, struct fd_event))) {
    144149                return NULL;
     
    191196
    192197        for (fde = event_ctx->fd_events; fde; fde = fde->next) {
     198                if (fde->fd < 0 || fde->fd >= FD_SETSIZE) {
     199                        /* We ignore here, as it shouldn't be
     200                           possible to add an invalid fde->fd
     201                           but we don't want FD_SET to see an
     202                           invalid fd. */
     203                        continue;
     204                }
     205
    193206                if (fde->flags & EVENT_FD_READ) {
    194207                        FD_SET(fde->fd, read_fds);
  • branches/samba-3.3.x/source/lib/packet.c

    r206 r578  
    107107        fd_set r_fds;
    108108
     109        if (ctx->fd < 0 || ctx->fd >= FD_SETSIZE) {
     110                errno = EBADF;
     111                return map_nt_error_from_unix(errno);
     112        }
     113
    109114        FD_ZERO(&r_fds);
    110115        FD_SET(ctx->fd, &r_fds);
  • branches/samba-3.3.x/source/lib/readline.c

    r206 r578  
    9292                timeout.tv_usec = 0;
    9393
     94                if (fd < 0 || fd >= FD_SETSIZE) {
     95                        errno = EBADF;
     96                        break;
     97                }
     98
    9499                FD_ZERO(&fds);
    95100                FD_SET(fd,&fds);
  • branches/samba-3.3.x/source/lib/select.c

    r206 r578  
    6666                        smb_panic("Could not create select pipe");
    6767
     68                if (select_pipe[0] < 0 || select_pipe[0] >= FD_SETSIZE) {
     69                        errno = EBADF;
     70                        return -1;
     71                }
     72
    6873                /*
    6974                 * These next two lines seem to fix a bug with the Linux
     
    9297                FD_ZERO(readfds2);
    9398        }
     99
    94100        FD_SET(select_pipe[0], readfds2);
    95101
  • branches/samba-3.3.x/source/lib/util_sock.c

    r206 r578  
    961961
    962962        for (nread=0; nread < mincnt; ) {
     963                if (fd < 0 || fd >= FD_SETSIZE) {
     964                        errno = EBADF;
     965                        return map_nt_error_from_unix(EBADF);
     966                }
     967
    963968                FD_ZERO(&fds);
    964969                FD_SET(fd,&fds);
     
    14931498        for (i=0; i<num_addrs; i++) {
    14941499                sockets[i] = socket(addrs[i].ss_family, SOCK_STREAM, 0);
    1495                 if (sockets[i] < 0)
     1500                if (sockets[i] < 0 || sockets[i] >= FD_SETSIZE)
    14961501                        goto done;
    14971502                set_blocking(sockets[i], false);
     
    15421547
    15431548        for (i=0; i<num_addrs; i++) {
    1544                 if (sockets[i] == -1)
     1549                if (sockets[i] < 0 || sockets[i] >= FD_SETSIZE) {
     1550                        /* This cannot happen - ignore if so. */
    15451551                        continue;
     1552                }
    15461553                FD_SET(sockets[i], &wr_fds);
    15471554                FD_SET(sockets[i], &r_fds);
  • branches/samba-3.3.x/source/libaddns/dnssock.c

    r206 r578  
    219219                ssize_t ret;
    220220                int fd_ready;
    221                
     221
     222                if (fd < 0 || fd >= FD_SETSIZE) {
     223                        return ERROR_DNS_SOCKET_ERROR;
     224                }
     225
    222226                FD_ZERO( &rfds );
    223227                FD_SET( fd, &rfds );
  • branches/samba-3.3.x/source/libsmb/nmblib.c

    r206 r578  
    10981098        int ret;
    10991099
     1100        if (fd < 0 || fd >= FD_SETSIZE) {
     1101                errno = EBADF;
     1102                return NULL;
     1103        }
     1104
    11001105        FD_ZERO(&fds);
    11011106        FD_SET(fd,&fds);
  • branches/samba-3.3.x/source/nmbd/nmbd_packets.c

    r206 r578  
    16841684                count++;
    16851685
    1686         if((count*2) + 2 > FD_SETSIZE) {
     1686        if((count*2) + 2 >= FD_SETSIZE) {
    16871687                DEBUG(0,("create_listen_fdset: Too many file descriptors needed (%d). We can \
    16881688only use %d.\n", (count*2) + 2, FD_SETSIZE));
     
    17001700
    17011701        /* Add in the broadcast socket on 137. */
     1702        if (ClientNMB < 0 || ClientNMB >= FD_SETSIZE) {
     1703                errno = EBADF;
     1704                SAFE_FREE(pset);
     1705                return True;
     1706        }
     1707
    17021708        FD_SET(ClientNMB,pset);
    17031709        sock_array[num++] = ClientNMB;
     
    17061712        /* Add in the 137 sockets on all the interfaces. */
    17071713        for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) {
     1714                if (subrec->nmb_sock < 0 || subrec->nmb_sock >= FD_SETSIZE) {
     1715                        /* We have to ignore sockets outside FD_SETSIZE. */
     1716                        continue;
     1717                }
    17081718                FD_SET(subrec->nmb_sock,pset);
    17091719                sock_array[num++] = subrec->nmb_sock;
     
    17121722
    17131723        /* Add in the broadcast socket on 138. */
     1724        if (ClientDGRAM < 0 || ClientDGRAM >= FD_SETSIZE) {
     1725                errno = EBADF;
     1726                SAFE_FREE(pset);
     1727                return True;
     1728        }
     1729
    17141730        FD_SET(ClientDGRAM,pset);
    17151731        sock_array[num++] = ClientDGRAM;
     
    17181734        /* Add in the 138 sockets on all the interfaces. */
    17191735        for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) {
     1736                if (subrec->dgram_sock < 0 || subrec->dgram_sock >= FD_SETSIZE) {
     1737                        /* We have to ignore sockets outside FD_SETSIZE. */
     1738                        continue;
     1739                }
    17201740                FD_SET(subrec->dgram_sock,pset);
    17211741                sock_array[num++] = subrec->dgram_sock;
     
    17681788#ifndef SYNC_DNS
    17691789        dns_fd = asyncdns_fd();
    1770         if (dns_fd != -1) {
     1790        if (dns_fd >= 0 && dns_fd < FD_SETSIZE) {
    17711791                FD_SET(dns_fd, &r_fds);
    17721792                maxfd = MAX( maxfd, dns_fd);
  • branches/samba-3.3.x/source/nsswitch/wb_common.c

    r206 r578  
    241241                switch (errno) {
    242242                        case EINPROGRESS:
     243
     244                                if (fd < 0 || fd >= FD_SETSIZE) {
     245                                        errno = EBADF;
     246                                        goto error_out;
     247                                }
     248
    243249                                FD_ZERO(&w_fds);
    244250                                FD_SET(fd, &w_fds);
     
    384390                struct timeval tv;
    385391                fd_set r_fds;
    386                
     392
     393                if (winbindd_fd < 0 || winbindd_fd >= FD_SETSIZE) {
     394                        errno = EBADF;
     395                        winbind_close_sock();
     396                        return -1;
     397                }
     398
    387399                /* Catch pipe close on other end by checking if a read()
    388400                   call would not block by calling select(). */
     
    444456                struct timeval tv;
    445457                fd_set r_fds;
    446                
     458
     459                if (winbindd_fd < 0 || winbindd_fd >= FD_SETSIZE) {
     460                        errno = EBADF;
     461                        winbind_close_sock();
     462                        return -1;
     463                }
     464
    447465                /* Catch pipe close on other end by checking if a read()
    448466                   call would not block by calling select(). */
  • branches/samba-3.3.x/source/printing/printing.c

    r256 r578  
    14131413        }
    14141414
     1415        if (pause_pipe[1] < 0 || pause_pipe[1] >= FD_SETSIZE) {
     1416                DEBUG(5,("start_background_queue: pipe fd out of range.\n"));
     1417                exit(1);
     1418        }
     1419
    14151420        background_lpq_updater_pid = sys_fork();
    14161421
  • branches/samba-3.3.x/source/smbd/dnsregister.c

    r370 r578  
    126126        if (dns_state->srv_ref != NULL) {
    127127                mdnsd_conn_fd = DNSServiceRefSockFD(dns_state->srv_ref);
     128                if (mdnsd_conn_fd < 0 || mdnsd_conn_fd >= FD_SETSIZE) {
     129                        return;
     130                }
    128131                FD_SET(mdnsd_conn_fd, listen_set);
    129132                return;
     
    157160
    158161        mdnsd_conn_fd = DNSServiceRefSockFD(dns_state->srv_ref);
     162        if (mdnsd_conn_fd < 0 || mdnsd_conn_fd >= FD_SETSIZE) {
     163                return;
     164        }
    159165        FD_SET(mdnsd_conn_fd, listen_set);
    160166        *maxfd = MAX(*maxfd, mdnsd_conn_fd);
  • branches/samba-3.3.x/source/smbd/oplock.c

    r224 r578  
    242242{
    243243        if (koplocks) {
    244                 return koplocks->notification_fd;
     244                int fd = koplocks->notification_fd;
     245                if (fd < 0 || fd >= FD_SETSIZE) {
     246                        return -1;
     247                }
    245248        }
    246249
  • branches/samba-3.3.x/source/smbd/oplock_irix.c

    r206 r578  
    285285        }
    286286
     287        if (pfd[0] < 0 || pfd[0] >= FD_SETSIZE) {
     288                DEBUG(0,("setup_kernel_oplock_pipe: fd out of range.\n"));
     289                return False;
     290        }
     291
    287292        oplock_pipe_read = pfd[0];
    288293        oplock_pipe_write = pfd[1];
  • branches/samba-3.3.x/source/smbd/process.c

    r467 r578  
    699699static int select_on_fd(int fd, int maxfd, fd_set *fds)
    700700{
    701         if (fd != -1) {
     701        if (fd != -1 && fd < FD_SETSIZE) {
    702702                FD_SET(fd, fds);
    703703                maxfd = MAX(maxfd, fd);
  • 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 */
  • branches/samba-3.3.x/source/utils/smbfilter.c

    r206 r578  
    163163               
    164164                FD_ZERO(&fds);
    165                 if (s != -1) FD_SET(s, &fds);
    166                 if (c != -1) FD_SET(c, &fds);
     165                if (s >= 0 && s < FD_SETSIZE) FD_SET(s, &fds);
     166                if (c >= 0 && c < FD_SETSIZE) FD_SET(c, &fds);
    167167
    168168                num = sys_select_intr(MAX(s+1, c+1),&fds,NULL,NULL,NULL);
     
    236236                socklen_t in_addrlen = sizeof(ss);
    237237               
     238                if (s < 0 || s >= FD_SETSIZE) {
     239                        break;
     240                }
     241
    238242                FD_ZERO(&fds);
    239243                FD_SET(s, &fds);
  • branches/samba-3.3.x/source/winbindd/winbindd.c

    r342 r578  
    837837        listen_priv_sock = open_winbindd_priv_socket();
    838838
    839         if (listen_sock == -1 || listen_priv_sock == -1) {
     839        if (listen_sock < 0 || listen_sock >= FD_SETSIZE ||
     840                        listen_priv_sock < 0 || listen_priv_sock >= FD_SETSIZE) {
    840841                perror("open_winbind_socket");
    841842                exit(1);
     
    862863        FD_ZERO(&r_fds);
    863864        FD_ZERO(&w_fds);
     865
     866        /* We check the range for listen_sock and
     867           listen_priv_sock above. */
    864868        FD_SET(listen_sock, &r_fds);
    865869        FD_SET(listen_priv_sock, &r_fds);
     
    891895
    892896        for (ev = fd_events; ev; ev = ev->next) {
     897                if (ev->fd < 0 || ev->fd >= FD_SETSIZE) {
     898                        /* Ignore here - event_add_to_select_args
     899                           should make this impossible. */
     900                        continue;
     901                }
     902
    893903                if (ev->flags & EVENT_FD_READ) {
    894904                        FD_SET(ev->fd, &r_fds);
  • branches/samba-3.3.x/source/winbindd/winbindd_dual.c

    r221 r578  
    12511251        }
    12521252
     1253        if (fdpair[0] < 0 || fdpair[0] >= FD_SETSIZE) {
     1254                DEBUG(0, ("fork_domain_child: bad fd range (%d)\n", fdpair[0]));
     1255                errno = EBADF;
     1256                return False;
     1257        }
     1258
    12531259        ZERO_STRUCT(state);
    12541260        state.pid = sys_getpid();
     
    14061412
    14071413                FD_ZERO(&read_fds);
     1414                /* We check state.sock against FD_SETSIZE above. */
    14081415                FD_SET(state.sock, &read_fds);
    14091416
Note: See TracChangeset for help on using the changeset viewer.