mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-22 07:39:35 -05:00
Changed FD_SETSIZE checks for consistency. Added checks where needed.
This commit is contained in:
parent
dfeabf5213
commit
f51765eead
12 changed files with 72 additions and 48 deletions
15
Make-common
15
Make-common
|
|
@ -45,9 +45,9 @@ RUNTIMEETCDIR?= $(ETCDIR)
|
||||||
## General compiler options ##
|
## General compiler options ##
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# Passed to every compile (cc or gcc). This is where you put -O or -g, etc.
|
# Passed to every compile (cc or gcc). This is where you put -O or -g, etc.
|
||||||
EXTRACFLAGS=-O -g
|
#EXTRACFLAGS=-O -g
|
||||||
#EXTRACFLAGS=-O
|
#EXTRACFLAGS=-O
|
||||||
#EXTRACFLAGS=-g
|
EXTRACFLAGS=-g
|
||||||
# Passed to every link (ld). Include -g here if you did in EXTRACFLAGS.
|
# Passed to every link (ld). Include -g here if you did in EXTRACFLAGS.
|
||||||
EXTRALDFLAGS=-g
|
EXTRALDFLAGS=-g
|
||||||
|
|
||||||
|
|
@ -142,8 +142,15 @@ SLAPD_BACKENDS= -DLDAP_LDBM # -DLDAP_SHELL -DLDAP_PASSWD
|
||||||
LDBMBACKEND?=-DLDBM_USE_NDBM
|
LDBMBACKEND?=-DLDBM_USE_NDBM
|
||||||
LDBMINCLUDE?=
|
LDBMINCLUDE?=
|
||||||
LDBMLIB?=
|
LDBMLIB?=
|
||||||
#
|
# if you want to use a non-default threads package change the defines below
|
||||||
# if you want to use a non-default threads package change these lines
|
# to one of:
|
||||||
|
# -DPOSIX_THREADS (draft 10 or standard)
|
||||||
|
# -DTHREAD_MIT_PTHREADS (draft 4)
|
||||||
|
# -DTHREAD_NEXT_CTHREADS
|
||||||
|
# -DTHREAD_DCE_PTHREADS
|
||||||
|
# -DTHREAD_SUNOS4_LWP
|
||||||
|
# -DTHREAD_SUNOS5_LWP
|
||||||
|
# and select the appropriate library.
|
||||||
#THREADS?=-DNO_THREADS
|
#THREADS?=-DNO_THREADS
|
||||||
#THREADSLIB?=
|
#THREADSLIB?=
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,18 +18,12 @@ LDBMINCLUDE=-I/usr/include
|
||||||
# package. Rather than resolve this globally, I have marked the
|
# package. Rather than resolve this globally, I have marked the
|
||||||
# threading as "preeemptive", even though it is technically not.
|
# threading as "preeemptive", even though it is technically not.
|
||||||
#
|
#
|
||||||
# As far as I have been able to determine, there are not buzz-loop
|
|
||||||
# based races in the LDAP code (at least not now that I've fixed
|
|
||||||
# the bogus FD_SETSIZE assumptions about the select(2) system call
|
|
||||||
# implementation being in any way related to getdtablesize(2) --
|
|
||||||
# if it were, sys/types.h would define FD_SETSIZE in terms of the
|
|
||||||
# getdtablesize(2) call, and there would be no implicit limits).
|
|
||||||
#
|
|
||||||
# This means that the implicit-yield threading is topologically
|
# This means that the implicit-yield threading is topologically
|
||||||
# equivalent to preemptive threading.
|
# equivalent to preemptive threading.
|
||||||
#
|
#
|
||||||
THREADS= -D_THREAD_SAFE -DPOSIX_THREADS -DPTHREAD_PREEMPTIVE
|
THREADS= -D_THREAD_SAFE -DPOSIX_THREADS -DPTHREAD_PREEMPTIVE
|
||||||
THREADSLIB= -pthread
|
THREADSLIB= -pthread
|
||||||
|
#THREADSLIB= -lc_r
|
||||||
|
|
||||||
# we need to link in the V3 library to get sigset()
|
# we need to link in the V3 library to get sigset()
|
||||||
PLATFORMLIBS= -lcrypt
|
PLATFORMLIBS= -lcrypt
|
||||||
|
|
|
||||||
|
|
@ -172,20 +172,17 @@ static do_query()
|
||||||
exit( 1 );
|
exit( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FD_SETSIZE
|
|
||||||
/*
|
|
||||||
* It is invalid to use a set size in excess of the type
|
|
||||||
* scope, as defined for the fd_set in sys/types.h. This
|
|
||||||
* is true for any OS.
|
|
||||||
*/
|
|
||||||
tblsize = FD_SETSIZE;
|
|
||||||
#else /* !FD_SETSIZE*/
|
|
||||||
#ifdef USE_SYSCONF
|
#ifdef USE_SYSCONF
|
||||||
tblsize = sysconf( _SC_OPEN_MAX );
|
tblsize = sysconf( _SC_OPEN_MAX );
|
||||||
#else /* USE_SYSCONF */
|
#else /* USE_SYSCONF */
|
||||||
tblsize = getdtablesize();
|
tblsize = getdtablesize();
|
||||||
#endif /* USE_SYSCONF */
|
#endif /* USE_SYSCONF */
|
||||||
#endif /* !FD_SETSIZE*/
|
|
||||||
|
#ifdef FD_SETSIZE
|
||||||
|
if (tblsize > FD_SETSIZE) {
|
||||||
|
tblsize = FD_SETSIZE;
|
||||||
|
}
|
||||||
|
#endif /* FD_SETSIZE*/
|
||||||
|
|
||||||
timeout.tv_sec = FINGER_TIMEOUT;
|
timeout.tv_sec = FINGER_TIMEOUT;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,13 @@ int debug;
|
||||||
nbits = getdtablesize();
|
nbits = getdtablesize();
|
||||||
#endif /* USE_SYSCONF */
|
#endif /* USE_SYSCONF */
|
||||||
|
|
||||||
|
#ifdef FD_SETSIZE
|
||||||
|
if (nbits > FD_SETSIZE) {
|
||||||
|
nbits = FD_SETSIZE;
|
||||||
|
}
|
||||||
|
#endif /* FD_SETSIZE*/
|
||||||
|
|
||||||
|
|
||||||
if ( debug == 0 || !(isatty( 1 )) ) {
|
if ( debug == 0 || !(isatty( 1 )) ) {
|
||||||
for ( i = 0; i < 5; i++ ) {
|
for ( i = 0; i < 5; i++ ) {
|
||||||
switch ( fork() ) {
|
switch ( fork() ) {
|
||||||
|
|
|
||||||
|
|
@ -140,20 +140,18 @@ char **argv;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FD_SETSIZE
|
|
||||||
/*
|
|
||||||
* It is invalid to use a set size in excess of the type
|
|
||||||
* scope, as defined for the fd_set in sys/types.h. This
|
|
||||||
* is true for any OS.
|
|
||||||
*/
|
|
||||||
dtblsize = FD_SETSIZE;
|
|
||||||
#else /* !FD_SETSIZE*/
|
|
||||||
#ifdef USE_SYSCONF
|
#ifdef USE_SYSCONF
|
||||||
dtblsize = sysconf( _SC_OPEN_MAX );
|
dtblsize = sysconf( _SC_OPEN_MAX );
|
||||||
#else /* USE_SYSCONF */
|
#else /* USE_SYSCONF */
|
||||||
dtblsize = getdtablesize();
|
dtblsize = getdtablesize();
|
||||||
#endif /* USE_SYSCONF */
|
#endif /* USE_SYSCONF */
|
||||||
#endif /* !FD_SETSIZE*/
|
|
||||||
|
#ifdef FD_SETSIZE
|
||||||
|
if (dtblsize > FD_SETSIZE) {
|
||||||
|
dtblsize = FD_SETSIZE;
|
||||||
|
}
|
||||||
|
#endif /* FD_SETSIZE*/
|
||||||
|
|
||||||
|
|
||||||
/* detach if stderr is redirected or no debugging */
|
/* detach if stderr is redirected or no debugging */
|
||||||
if ( inetd == 0 )
|
if ( inetd == 0 )
|
||||||
|
|
|
||||||
|
|
@ -150,20 +150,19 @@ char **argv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FD_SETSIZE
|
|
||||||
/*
|
|
||||||
* It is invalid to use a set size in excess of the type
|
|
||||||
* scope, as defined for the fd_set in sys/types.h. This
|
|
||||||
* is true for any OS.
|
|
||||||
*/
|
|
||||||
dtblsize = FD_SETSIZE;
|
|
||||||
#else /* !FD_SETSIZE*/
|
|
||||||
#ifdef USE_SYSCONF
|
#ifdef USE_SYSCONF
|
||||||
dtblsize = sysconf( _SC_OPEN_MAX );
|
dtblsize = sysconf( _SC_OPEN_MAX );
|
||||||
#else /* USE_SYSCONF */
|
#else /* USE_SYSCONF */
|
||||||
dtblsize = getdtablesize();
|
dtblsize = getdtablesize();
|
||||||
#endif /* USE_SYSCONF */
|
#endif /* USE_SYSCONF */
|
||||||
#endif /* !FD_SETSIZE*/
|
|
||||||
|
#ifdef FD_SETSIZE
|
||||||
|
if ( dtblsize > FD_SETSIZE ) {
|
||||||
|
dtblsize = FD_SETSIZE;
|
||||||
|
}
|
||||||
|
#endif /* FD_SETSIZE*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef GO500GW_HOSTNAME
|
#ifdef GO500GW_HOSTNAME
|
||||||
strcpy( myhost, GO500GW_HOSTNAME );
|
strcpy( myhost, GO500GW_HOSTNAME );
|
||||||
|
|
|
||||||
|
|
@ -50,16 +50,14 @@ char *token;
|
||||||
int i, status, tablesize;
|
int i, status, tablesize;
|
||||||
|
|
||||||
if ( buffer == NULL ) {
|
if ( buffer == NULL ) {
|
||||||
#ifdef FD_SETSIZE
|
|
||||||
/*
|
|
||||||
* It is invalid to use a set size in excess of the type
|
|
||||||
* scope, as defined for the fd_set in sys/types.h. This
|
|
||||||
* is true for any OS.
|
|
||||||
*/
|
|
||||||
tablesize = FD_SETSIZE;
|
|
||||||
#else /* !FD_SETSIZE*/
|
|
||||||
tablesize = getdtablesize();
|
tablesize = getdtablesize();
|
||||||
#endif /* !FD_SETSIZE*/
|
|
||||||
|
#ifdef FD_SETSIZE
|
||||||
|
if ( tablesize > FD_SETSIZE ) {
|
||||||
|
tablesize = FD_SETSIZE;
|
||||||
|
}
|
||||||
|
#endif /* FD_SETSIZE */
|
||||||
|
|
||||||
timeout.tv_sec = 60;
|
timeout.tv_sec = 60;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
FD_ZERO( &readfds );
|
FD_ZERO( &readfds );
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,12 @@ detach()
|
||||||
nbits = getdtablesize();
|
nbits = getdtablesize();
|
||||||
#endif /* USE_SYSCONF */
|
#endif /* USE_SYSCONF */
|
||||||
|
|
||||||
|
#ifdef FD_SETSIZE
|
||||||
|
if( nbits > FD_SETSIZE ) {
|
||||||
|
nbits = FD_SETSIZE;
|
||||||
|
}
|
||||||
|
#endif /* FD_SETSIZE */
|
||||||
|
|
||||||
#ifdef LDAP_DEBUG
|
#ifdef LDAP_DEBUG
|
||||||
if ( ldap_debug == 0 ) {
|
if ( ldap_debug == 0 ) {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -241,6 +241,12 @@ char **argv;
|
||||||
dtblsize = getdtablesize();
|
dtblsize = getdtablesize();
|
||||||
#endif /* USE_SYSCONF */
|
#endif /* USE_SYSCONF */
|
||||||
|
|
||||||
|
#ifdef FD_SETSIZE
|
||||||
|
if( dtblsize > FD_SETSIZE ) {
|
||||||
|
dtblsize = FD_SETSIZE;
|
||||||
|
}
|
||||||
|
#endif /* FD_SETSIZE */
|
||||||
|
|
||||||
#ifndef NOSETPROCTITLE
|
#ifndef NOSETPROCTITLE
|
||||||
/* for setproctitle */
|
/* for setproctitle */
|
||||||
Argv = argv;
|
Argv = argv;
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ slapd_daemon(
|
||||||
if(dtblsize > FD_SETSIZE) {
|
if(dtblsize > FD_SETSIZE) {
|
||||||
dtblsize = FD_SETSIZE;
|
dtblsize = FD_SETSIZE;
|
||||||
}
|
}
|
||||||
#endif /* !FD_SETSIZE*/
|
#endif /* !FD_SETSIZE */
|
||||||
|
|
||||||
c = (Connection *) ch_calloc( 1, dtblsize * sizeof(Connection) );
|
c = (Connection *) ch_calloc( 1, dtblsize * sizeof(Connection) );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,12 @@ detach()
|
||||||
nbits = getdtablesize();
|
nbits = getdtablesize();
|
||||||
#endif /* USE_SYSCONF */
|
#endif /* USE_SYSCONF */
|
||||||
|
|
||||||
|
#ifdef FD_SETSIZE
|
||||||
|
if ( nbits > FD_SETSIZE ) {
|
||||||
|
nbits = FD_SETSIZE;
|
||||||
|
}
|
||||||
|
#endif /* FD_SETSIZE */
|
||||||
|
|
||||||
#ifdef LDAP_DEBUG
|
#ifdef LDAP_DEBUG
|
||||||
if ( ldap_debug == 0 ) {
|
if ( ldap_debug == 0 ) {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,12 @@ detach()
|
||||||
nbits = getdtablesize();
|
nbits = getdtablesize();
|
||||||
#endif /* USE_SYSCONF */
|
#endif /* USE_SYSCONF */
|
||||||
|
|
||||||
|
#ifdef FD_SETSIZE
|
||||||
|
if ( nbits > FD_SETSIZE ) {
|
||||||
|
nbits = FD_SETSIZE;
|
||||||
|
}
|
||||||
|
#endif /* FD_SETSIZE */
|
||||||
|
|
||||||
#ifdef LDAP_DEBUG
|
#ifdef LDAP_DEBUG
|
||||||
if ( ldap_debug == 0 ) {
|
if ( ldap_debug == 0 ) {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue