Changeset 578 for branches/samba-3.3.x/source
- Timestamp:
- Jun 25, 2011, 7:14:41 PM (14 years ago)
- Location:
- branches/samba-3.3.x/source
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/VERSION
r491 r578 26 26 SAMBA_VERSION_MAJOR=3 27 27 SAMBA_VERSION_MINOR=3 28 SAMBA_VERSION_RELEASE=1 428 SAMBA_VERSION_RELEASE=15 29 29 30 30 ######################################################## -
branches/samba-3.3.x/source/client/client.c
r221 r578 4380 4380 again: 4381 4381 4382 if (cli->fd == -1) 4382 if (cli->fd < 0 || cli->fd >= FD_SETSIZE) { 4383 errno = EBADF; 4383 4384 return; 4385 } 4384 4386 4385 4387 FD_ZERO(&fds); -
branches/samba-3.3.x/source/client/dnsbrowse.c
r206 r578 80 80 if (fdset != NULL) { 81 81 TALLOC_FREE(fdset); 82 } 83 84 if (mdnsfd < 0 || mdnsfd >= FD_SETSIZE) { 85 errno = EBADF; 86 break; 82 87 } 83 88 … … 184 189 fdsetsz = howmany(mdnsfd + 1, NFDBITS) * sizeof(fd_mask); 185 190 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 186 198 FD_SET(mdnsfd, fdset); 187 199 -
branches/samba-3.3.x/source/lib/events.c
r221 r578 141 141 struct fd_event *fde; 142 142 143 if (fd < 0 || fd >= FD_SETSIZE) { 144 errno = EBADF; 145 return NULL; 146 } 147 143 148 if (!(fde = TALLOC_P(mem_ctx, struct fd_event))) { 144 149 return NULL; … … 191 196 192 197 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 193 206 if (fde->flags & EVENT_FD_READ) { 194 207 FD_SET(fde->fd, read_fds); -
branches/samba-3.3.x/source/lib/packet.c
r206 r578 107 107 fd_set r_fds; 108 108 109 if (ctx->fd < 0 || ctx->fd >= FD_SETSIZE) { 110 errno = EBADF; 111 return map_nt_error_from_unix(errno); 112 } 113 109 114 FD_ZERO(&r_fds); 110 115 FD_SET(ctx->fd, &r_fds); -
branches/samba-3.3.x/source/lib/readline.c
r206 r578 92 92 timeout.tv_usec = 0; 93 93 94 if (fd < 0 || fd >= FD_SETSIZE) { 95 errno = EBADF; 96 break; 97 } 98 94 99 FD_ZERO(&fds); 95 100 FD_SET(fd,&fds); -
branches/samba-3.3.x/source/lib/select.c
r206 r578 66 66 smb_panic("Could not create select pipe"); 67 67 68 if (select_pipe[0] < 0 || select_pipe[0] >= FD_SETSIZE) { 69 errno = EBADF; 70 return -1; 71 } 72 68 73 /* 69 74 * These next two lines seem to fix a bug with the Linux … … 92 97 FD_ZERO(readfds2); 93 98 } 99 94 100 FD_SET(select_pipe[0], readfds2); 95 101 -
branches/samba-3.3.x/source/lib/util_sock.c
r206 r578 961 961 962 962 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 963 968 FD_ZERO(&fds); 964 969 FD_SET(fd,&fds); … … 1493 1498 for (i=0; i<num_addrs; i++) { 1494 1499 sockets[i] = socket(addrs[i].ss_family, SOCK_STREAM, 0); 1495 if (sockets[i] < 0 )1500 if (sockets[i] < 0 || sockets[i] >= FD_SETSIZE) 1496 1501 goto done; 1497 1502 set_blocking(sockets[i], false); … … 1542 1547 1543 1548 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. */ 1545 1551 continue; 1552 } 1546 1553 FD_SET(sockets[i], &wr_fds); 1547 1554 FD_SET(sockets[i], &r_fds); -
branches/samba-3.3.x/source/libaddns/dnssock.c
r206 r578 219 219 ssize_t ret; 220 220 int fd_ready; 221 221 222 if (fd < 0 || fd >= FD_SETSIZE) { 223 return ERROR_DNS_SOCKET_ERROR; 224 } 225 222 226 FD_ZERO( &rfds ); 223 227 FD_SET( fd, &rfds ); -
branches/samba-3.3.x/source/libsmb/nmblib.c
r206 r578 1098 1098 int ret; 1099 1099 1100 if (fd < 0 || fd >= FD_SETSIZE) { 1101 errno = EBADF; 1102 return NULL; 1103 } 1104 1100 1105 FD_ZERO(&fds); 1101 1106 FD_SET(fd,&fds); -
branches/samba-3.3.x/source/nmbd/nmbd_packets.c
r206 r578 1684 1684 count++; 1685 1685 1686 if((count*2) + 2 > FD_SETSIZE) {1686 if((count*2) + 2 >= FD_SETSIZE) { 1687 1687 DEBUG(0,("create_listen_fdset: Too many file descriptors needed (%d). We can \ 1688 1688 only use %d.\n", (count*2) + 2, FD_SETSIZE)); … … 1700 1700 1701 1701 /* 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 1702 1708 FD_SET(ClientNMB,pset); 1703 1709 sock_array[num++] = ClientNMB; … … 1706 1712 /* Add in the 137 sockets on all the interfaces. */ 1707 1713 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 } 1708 1718 FD_SET(subrec->nmb_sock,pset); 1709 1719 sock_array[num++] = subrec->nmb_sock; … … 1712 1722 1713 1723 /* 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 1714 1730 FD_SET(ClientDGRAM,pset); 1715 1731 sock_array[num++] = ClientDGRAM; … … 1718 1734 /* Add in the 138 sockets on all the interfaces. */ 1719 1735 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 } 1720 1740 FD_SET(subrec->dgram_sock,pset); 1721 1741 sock_array[num++] = subrec->dgram_sock; … … 1768 1788 #ifndef SYNC_DNS 1769 1789 dns_fd = asyncdns_fd(); 1770 if (dns_fd != -1) {1790 if (dns_fd >= 0 && dns_fd < FD_SETSIZE) { 1771 1791 FD_SET(dns_fd, &r_fds); 1772 1792 maxfd = MAX( maxfd, dns_fd); -
branches/samba-3.3.x/source/nsswitch/wb_common.c
r206 r578 241 241 switch (errno) { 242 242 case EINPROGRESS: 243 244 if (fd < 0 || fd >= FD_SETSIZE) { 245 errno = EBADF; 246 goto error_out; 247 } 248 243 249 FD_ZERO(&w_fds); 244 250 FD_SET(fd, &w_fds); … … 384 390 struct timeval tv; 385 391 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 387 399 /* Catch pipe close on other end by checking if a read() 388 400 call would not block by calling select(). */ … … 444 456 struct timeval tv; 445 457 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 447 465 /* Catch pipe close on other end by checking if a read() 448 466 call would not block by calling select(). */ -
branches/samba-3.3.x/source/printing/printing.c
r256 r578 1413 1413 } 1414 1414 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 1415 1420 background_lpq_updater_pid = sys_fork(); 1416 1421 -
branches/samba-3.3.x/source/smbd/dnsregister.c
r370 r578 126 126 if (dns_state->srv_ref != NULL) { 127 127 mdnsd_conn_fd = DNSServiceRefSockFD(dns_state->srv_ref); 128 if (mdnsd_conn_fd < 0 || mdnsd_conn_fd >= FD_SETSIZE) { 129 return; 130 } 128 131 FD_SET(mdnsd_conn_fd, listen_set); 129 132 return; … … 157 160 158 161 mdnsd_conn_fd = DNSServiceRefSockFD(dns_state->srv_ref); 162 if (mdnsd_conn_fd < 0 || mdnsd_conn_fd >= FD_SETSIZE) { 163 return; 164 } 159 165 FD_SET(mdnsd_conn_fd, listen_set); 160 166 *maxfd = MAX(*maxfd, mdnsd_conn_fd); -
branches/samba-3.3.x/source/smbd/oplock.c
r224 r578 242 242 { 243 243 if (koplocks) { 244 return koplocks->notification_fd; 244 int fd = koplocks->notification_fd; 245 if (fd < 0 || fd >= FD_SETSIZE) { 246 return -1; 247 } 245 248 } 246 249 -
branches/samba-3.3.x/source/smbd/oplock_irix.c
r206 r578 285 285 } 286 286 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 287 292 oplock_pipe_read = pfd[0]; 288 293 oplock_pipe_write = pfd[1]; -
branches/samba-3.3.x/source/smbd/process.c
r467 r578 699 699 static int select_on_fd(int fd, int maxfd, fd_set *fds) 700 700 { 701 if (fd != -1 ) {701 if (fd != -1 && fd < FD_SETSIZE) { 702 702 FD_SET(fd, fds); 703 703 maxfd = MAX(maxfd, fd); -
branches/samba-3.3.x/source/smbd/server.c
r423 r578 210 210 /* We will abort gracefully when the client or remote system 211 211 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); 213 219 214 220 /* close our standard file descriptors */ … … 437 443 ifss, 438 444 true); 439 if(s == -1) { 445 if(s < 0 || s >= FD_SETSIZE) { 446 close(s); 440 447 continue; 441 448 } … … 517 524 &ss, 518 525 true); 519 if (s == -1) {526 if (s < 0 || s >= FD_SETSIZE) { 520 527 continue; 521 528 } … … 710 717 socklen_t in_addrlen = sizeof(addr); 711 718 pid_t child = 0; 719 int fd; 712 720 713 721 s = -1; … … 722 730 } 723 731 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) 727 734 continue; 728 729 if (smbd_server_fd() == -1) { 735 if (fd == -1) { 730 736 DEBUG(2,("open_sockets_smbd: accept: %s\n", 731 737 strerror(errno))); 732 738 continue; 733 739 } 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); 734 747 735 748 /* Ensure child is set to blocking mode */ -
branches/samba-3.3.x/source/utils/smbfilter.c
r206 r578 163 163 164 164 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); 167 167 168 168 num = sys_select_intr(MAX(s+1, c+1),&fds,NULL,NULL,NULL); … … 236 236 socklen_t in_addrlen = sizeof(ss); 237 237 238 if (s < 0 || s >= FD_SETSIZE) { 239 break; 240 } 241 238 242 FD_ZERO(&fds); 239 243 FD_SET(s, &fds); -
branches/samba-3.3.x/source/winbindd/winbindd.c
r342 r578 837 837 listen_priv_sock = open_winbindd_priv_socket(); 838 838 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) { 840 841 perror("open_winbind_socket"); 841 842 exit(1); … … 862 863 FD_ZERO(&r_fds); 863 864 FD_ZERO(&w_fds); 865 866 /* We check the range for listen_sock and 867 listen_priv_sock above. */ 864 868 FD_SET(listen_sock, &r_fds); 865 869 FD_SET(listen_priv_sock, &r_fds); … … 891 895 892 896 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 893 903 if (ev->flags & EVENT_FD_READ) { 894 904 FD_SET(ev->fd, &r_fds); -
branches/samba-3.3.x/source/winbindd/winbindd_dual.c
r221 r578 1251 1251 } 1252 1252 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 1253 1259 ZERO_STRUCT(state); 1254 1260 state.pid = sys_getpid(); … … 1406 1412 1407 1413 FD_ZERO(&read_fds); 1414 /* We check state.sock against FD_SETSIZE above. */ 1408 1415 FD_SET(state.sock, &read_fds); 1409 1416
Note:
See TracChangeset
for help on using the changeset viewer.