mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-30 13:30:57 +08:00
Fix unprotected (and bad) FD_SET asserts.
This commit is contained in:
parent
fac246b834
commit
64bb1a99f4
@ -400,9 +400,17 @@ slapd_daemon_task(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert( !FD_ISSET( 0, &slap_daemon.sd_actives) );
|
#ifdef LDAP_DEBUG
|
||||||
assert( !FD_ISSET( 0, &slap_daemon.sd_readers) );
|
ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
|
||||||
assert( !FD_ISSET( 0, &slap_daemon.sd_writers) );
|
|
||||||
|
/* newly accepted stream should not be in any of the FD SETS */
|
||||||
|
|
||||||
|
assert( !FD_ISSET( s, &slap_daemon.sd_actives) );
|
||||||
|
assert( !FD_ISSET( s, &slap_daemon.sd_readers) );
|
||||||
|
assert( !FD_ISSET( s, &slap_daemon.sd_writers) );
|
||||||
|
|
||||||
|
ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_WINSOCK
|
#ifndef HAVE_WINSOCK
|
||||||
/* make sure descriptor number isn't too great */
|
/* make sure descriptor number isn't too great */
|
||||||
@ -492,12 +500,10 @@ slapd_daemon_task(
|
|||||||
#ifdef LDAP_DEBUG
|
#ifdef LDAP_DEBUG
|
||||||
Debug( LDAP_DEBUG_CONNS, "daemon: activity on:", 0, 0, 0 );
|
Debug( LDAP_DEBUG_CONNS, "daemon: activity on:", 0, 0, 0 );
|
||||||
#ifdef HAVE_WINSOCK
|
#ifdef HAVE_WINSOCK
|
||||||
for ( i = 0; i < readfds.fd_count; i++ )
|
for ( i = 0; i < readfds.fd_count; i++ ) {
|
||||||
{
|
|
||||||
Debug( LDAP_DEBUG_CONNS, " %d%s", readfds.fd_array[i], "r" );
|
Debug( LDAP_DEBUG_CONNS, " %d%s", readfds.fd_array[i], "r" );
|
||||||
}
|
}
|
||||||
for ( i = 0; i < writefds.fd_count; i++ )
|
for ( i = 0; i < writefds.fd_count; i++ ) {
|
||||||
{
|
|
||||||
Debug( LDAP_DEBUG_CONNS, " %d%s", writefds.fd_array[i], "w" );
|
Debug( LDAP_DEBUG_CONNS, " %d%s", writefds.fd_array[i], "w" );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -528,8 +534,6 @@ slapd_daemon_task(
|
|||||||
"daemon: signalling write waiter on %d\n",
|
"daemon: signalling write waiter on %d\n",
|
||||||
wd, 0, 0 );
|
wd, 0, 0 );
|
||||||
|
|
||||||
assert( FD_ISSET( wd, &slap_daemon.sd_actives) );
|
|
||||||
|
|
||||||
slapd_clr_write( wd, 0 );
|
slapd_clr_write( wd, 0 );
|
||||||
if ( connection_write( wd ) < 0 ) {
|
if ( connection_write( wd ) < 0 ) {
|
||||||
FD_CLR( (unsigned) wd, &readfds );
|
FD_CLR( (unsigned) wd, &readfds );
|
||||||
@ -545,8 +549,6 @@ slapd_daemon_task(
|
|||||||
Debug( LDAP_DEBUG_CONNS,
|
Debug( LDAP_DEBUG_CONNS,
|
||||||
"daemon: signaling write waiter on %d\n", i, 0, 0 );
|
"daemon: signaling write waiter on %d\n", i, 0, 0 );
|
||||||
|
|
||||||
assert( FD_ISSET( i, &slap_daemon.sd_actives) );
|
|
||||||
|
|
||||||
/* clear the write flag */
|
/* clear the write flag */
|
||||||
slapd_clr_write( i, 0 );
|
slapd_clr_write( i, 0 );
|
||||||
|
|
||||||
@ -566,7 +568,10 @@ slapd_daemon_task(
|
|||||||
}
|
}
|
||||||
Debug ( LDAP_DEBUG_CONNS,
|
Debug ( LDAP_DEBUG_CONNS,
|
||||||
"daemon: read activity on %d\n", rd, 0, 0 );
|
"daemon: read activity on %d\n", rd, 0, 0 );
|
||||||
|
|
||||||
|
ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
|
||||||
assert( FD_ISSET( rd, &slap_daemon.sd_actives) );
|
assert( FD_ISSET( rd, &slap_daemon.sd_actives) );
|
||||||
|
ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
|
||||||
|
|
||||||
if ( connection_read( rd ) < 0 ) {
|
if ( connection_read( rd ) < 0 ) {
|
||||||
slapd_close( rd );
|
slapd_close( rd );
|
||||||
|
Loading…
Reference in New Issue
Block a user