11 #include <ac/unistd.h>
13 #include "ldap_defaults.h"
19 int allow_severity = LOG_INFO;
20 int deny_severity = LOG_NOTICE;
21 #endif /* TCP Wrappers */
25 ber_socket_t dtblsize;
27 typedef struct slap_listener {
33 struct sockaddr_in sl_addr;
36 Listener **slap_listeners;
40 extern ldap_pvt_thread_cond_t started_event;
42 /* forward reference */
43 static void hit_socket(void);
45 char *WSAGetLastErrorString();
46 static ldap_pvt_thread_t hit_tid;
48 #define WAKE_LISTENER(w) \
51 ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );\
56 #define WAKE_LISTENER(w) \
59 ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );\
67 volatile sig_atomic_t slapd_shutdown = 0;
69 static ldap_pvt_thread_t listener_tid;
70 static volatile sig_atomic_t slapd_listener = 0;
72 static struct slap_daemon {
73 ldap_pvt_thread_mutex_t sd_mutex;
78 /* In winsock, accept() returns values higher than dtblsize
79 so don't bother with this optimization */
89 * Add a descriptor to daemon control
91 static void slapd_add(ber_socket_t s) {
92 ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
94 assert( !FD_ISSET( s, &slap_daemon.sd_actives ));
95 assert( !FD_ISSET( s, &slap_daemon.sd_readers ));
96 assert( !FD_ISSET( s, &slap_daemon.sd_writers ));
99 if (s >= slap_daemon.sd_nfds) {
100 slap_daemon.sd_nfds = s + 1;
104 FD_SET( s, &slap_daemon.sd_actives );
105 FD_SET( s, &slap_daemon.sd_readers );
107 Debug( LDAP_DEBUG_CONNS, "daemon: added %ld%s%s\n",
109 FD_ISSET(s, &slap_daemon.sd_readers) ? "r" : "",
110 FD_ISSET(s, &slap_daemon.sd_writers) ? "w" : "" );
112 ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
116 * Remove the descriptor from daemon control
118 void slapd_remove(ber_socket_t s, int wake) {
119 ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
122 Debug( LDAP_DEBUG_CONNS, "daemon: removing %ld%s%s\n",
124 FD_ISSET(s, &slap_daemon.sd_readers) ? "r" : "",
125 FD_ISSET(s, &slap_daemon.sd_writers) ? "w" : "" );
127 FD_CLR( s, &slap_daemon.sd_actives );
128 FD_CLR( s, &slap_daemon.sd_readers );
129 FD_CLR( s, &slap_daemon.sd_writers );
131 ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
134 void slapd_clr_write(ber_socket_t s, int wake) {
135 ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
138 assert( FD_ISSET( s, &slap_daemon.sd_actives) );
139 FD_CLR( s, &slap_daemon.sd_writers );
141 ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
144 ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );
148 void slapd_set_write(ber_socket_t s, int wake) {
149 ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
152 assert( FD_ISSET( s, &slap_daemon.sd_actives) );
153 FD_SET( (unsigned) s, &slap_daemon.sd_writers );
155 ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
158 ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );
162 void slapd_clr_read(ber_socket_t s, int wake) {
163 ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
166 assert( FD_ISSET( s, &slap_daemon.sd_actives) );
167 FD_CLR( s, &slap_daemon.sd_readers );
169 ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
172 ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );
176 void slapd_set_read(ber_socket_t s, int wake) {
177 ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
180 assert( FD_ISSET( s, &slap_daemon.sd_actives) );
181 FD_SET( s, &slap_daemon.sd_readers );
183 ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
186 ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );
190 static void slapd_close(ber_socket_t s) {
191 Debug( LDAP_DEBUG_CONNS, "daemon: closing %ld\n",
208 rc = ldap_url_parse( url, &lud );
210 if( rc != LDAP_URL_SUCCESS ) {
211 Debug( LDAP_DEBUG_ANY,
212 "daemon: listen URL \"%s\" parse error=%d\n",
218 if( lud->lud_ldaps ) {
219 Debug( LDAP_DEBUG_ANY,
220 "daemon: TLS not supported (%s)\n",
222 ldap_free_urldesc( lud );
226 if(! lud->lud_port ) {
227 lud->lud_port = port;
231 if(! lud->lud_port ) {
232 lud->lud_port = lud->lud_ldaps ? tls_port : port;
236 (void) memset( (void*) &l.sl_addr, '\0', sizeof(l.sl_addr) );
238 l.sl_addr.sin_family = AF_INET;
239 l.sl_addr.sin_port = htons( (unsigned short) lud->lud_port );
241 if( lud->lud_host == NULL || lud->lud_host[0] == '\0'
242 || strcmp(lud->lud_host, "*") == 0 )
244 l.sl_addr.sin_addr.s_addr = htonl(INADDR_ANY);
247 /* host or address was specified */
249 if( isdigit( lud->lud_host[0] ) ) {
251 if(!(l.sl_addr.sin_addr.S_un.S_addr = inet_addr(lud->lud_host)))
253 if(!inet_aton(lud->lud_host, &l.sl_addr.sin_addr))
256 Debug( LDAP_DEBUG_ANY, "invalid address (%s) in URL: %s",
257 lud->lud_host, url, 0);
258 ldap_free_urldesc( lud );
263 struct hostent *he = gethostbyname( lud->lud_host );
265 Debug( LDAP_DEBUG_ANY, "invalid host (%s) in URL: %s",
266 lud->lud_host, url, 0);
267 ldap_free_urldesc( lud );
272 if(!(l.sl_addr.sin_addr.S_un.S_addr = inet_addr(he->h_addr)))
274 if(!inet_aton(he->h_addr, &l.sl_addr.sin_addr))
277 Debug( LDAP_DEBUG_ANY, "%s has invalid address (%s) in URL: %s",
278 lud->lud_host, he->h_addr, url );
279 ldap_free_urldesc( lud );
285 ldap_free_urldesc( lud );
288 if ( (l.sl_sd = socket( AF_INET, SOCK_STREAM, 0 )) == AC_SOCKET_INVALID ) {
291 Debug( LDAP_DEBUG_ANY,
292 "daemon: socket() failed errno %d (%s)\n", err,
293 err > -1 && err < sys_nerr ? sys_errlist[err] :
296 Debug( LDAP_DEBUG_ANY,
297 "daemon: socket() failed errno %d (%s)\n",
299 WSAGetLastErrorString(), 0 );
301 return( AC_SOCKET_INVALID );
305 if ( l.sl_sd >= dtblsize ) {
306 Debug( LDAP_DEBUG_ANY,
307 "daemon: listener descriptor %ld is too great %ld\n",
308 (long) l.sl_sd, (long) dtblsize, 0 );
309 tcp_close( l.sl_sd );
310 return( AC_SOCKET_INVALID );
316 if ( setsockopt( l.sl_sd, SOL_SOCKET, SO_REUSEADDR,
317 (char *) &tmp, sizeof(tmp) ) == -1 )
320 Debug( LDAP_DEBUG_ANY,
321 "slapd(%ld): setsockopt() failed errno %d (%s)\n",
323 err > -1 && err < sys_nerr
324 ? sys_errlist[err] : "unknown" );
329 if ( setsockopt( l.sl_sd, SOL_SOCKET, SO_KEEPALIVE,
330 (char *) &tmp, sizeof(tmp) ) == -1 )
333 Debug( LDAP_DEBUG_ANY,
334 "slapd(%ld): setsockopt(KEEPALIVE) failed errno %d (%s)\n",
336 err > -1 && err < sys_nerr
337 ? sys_errlist[err] : "unknown" );
341 if ( bind( l.sl_sd, (struct sockaddr *) &l.sl_addr, sizeof(l.sl_addr) ) == -1 ) {
343 Debug( LDAP_DEBUG_ANY, "daemon: bind(%ld) failed errno %d (%s)\n",
345 err > -1 && err < sys_nerr
346 ? sys_errlist[err] : "unknown" );
347 tcp_close( l.sl_sd );
348 return AC_SOCKET_INVALID;
351 l.sl_url = ch_strdup( url );
353 li = ch_malloc( sizeof( Listener ) );
359 static int sockinit(void);
360 static int sockdestroy(void);
362 slapd_daemon_init(char *urls, int port, int tls_port )
368 assert( tls_port == 0 );
371 if( rc = sockinit() ) {
376 dtblsize = sysconf( _SC_OPEN_MAX );
377 #elif HAVE_GETDTABLESIZE
378 dtblsize = getdtablesize();
380 dtblsize = FD_SETSIZE;
384 if(dtblsize > FD_SETSIZE) {
385 dtblsize = FD_SETSIZE;
387 #endif /* !FD_SETSIZE */
389 FD_ZERO( &slap_daemon.sd_readers );
390 FD_ZERO( &slap_daemon.sd_writers );
393 urls = ch_strdup("ldap://");
396 u = str2charray( urls, " " );
402 for(i = 0; u[i] == NULL; i++ ) {
406 slap_listeners = ch_malloc( (i+1)*sizeof(Listener *) );
408 for(i = 0; u[i] == NULL; i++ ) {
409 slap_listeners[i] = open_listener( u[i], port, tls_port );
411 if( slap_listeners[i] == NULL ) {
415 slap_listeners[i] = NULL;
420 ldap_pvt_thread_mutex_init( &slap_daemon.sd_mutex );
426 slapd_daemon_destroy(void)
428 connections_destroy();
443 for ( l = 0; slap_listeners[l] != NULL; l++ ) {
444 if ( slap_listeners[l]->sl_sd == AC_SOCKET_INVALID )
447 if ( listen( slap_listeners[l]->sl_sd, 5 ) == -1 ) {
449 Debug( LDAP_DEBUG_ANY,
450 "daemon: listen(%s, 5) failed errno %d (%s)\n",
451 (long) slap_listeners[l]->sl_url, err,
452 err > -1 && err < sys_nerr
453 ? sys_errlist[err] : "unknown" );
458 slapd_add( slap_listeners[l]->sl_sd );
462 if ( started_event != NULL ) {
463 ldap_pvt_thread_cond_signal( &started_event );
466 /* initialization complete. Here comes the loop. */
468 while ( !slapd_shutdown ) {
473 #define SLAPD_EBADF_LIMIT 10
476 #define SLAPD_IDLE_CHECK_LIMIT 4
477 time_t last_idle_check = slap_get_time();
484 struct sockaddr_in from;
485 #if defined(SLAPD_RLOOKUPS) || defined(HAVE_TCPD)
494 if( global_idletimeout > 0 && difftime(
495 last_idle_check+global_idletimeout/SLAPD_IDLE_CHECK_LIMIT,
498 connections_timeout_idle(now);
501 FD_ZERO( &writefds );
507 ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
509 #ifdef FD_SET_MANUAL_COPY
510 for( s = 0; s < nfds; s++ ) {
511 if(FD_ISSET( &slap_sd_writers, s )) {
512 FD_SET( &writefds, s );
514 if(FD_ISSET( &slap_sd_writers, s )) {
515 FD_SET( &writefds, s );
519 memcpy( &readfds, &slap_daemon.sd_readers, sizeof(fd_set) );
520 memcpy( &writefds, &slap_daemon.sd_writers, sizeof(fd_set) );
523 for ( l = 0; slap_listeners[l] != NULL; l++ ) {
524 if ( slap_listeners[l]->sl_sd == AC_SOCKET_INVALID )
526 FD_SET( slap_listeners[l]->sl_sd, &readfds );
530 nfds = slap_daemon.sd_nfds;
535 ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
537 ldap_pvt_thread_mutex_lock( &active_threads_mutex );
539 ldap_pvt_thread_mutex_unlock( &active_threads_mutex );
541 #if defined( HAVE_YIELDING_SELECT ) || defined( NO_THREADS )
544 tvp = at ? &zero : NULL;
547 for ( l = 0; slap_listeners[l] != NULL; l++ ) {
548 if ( slap_listeners[l]->sl_sd == AC_SOCKET_INVALID )
551 Debug( LDAP_DEBUG_CONNS,
552 "daemon: select: listen=%d active_threads=%d tvp=%s\n",
553 slap_listeners[l]->sl_sd, at,
554 tvp == NULL ? "NULL" : "zero" );
557 switch(ns = select( nfds, &readfds,
559 /* don't pass empty fd_set */
560 ( writefds.fd_count > 0 ? &writefds : NULL ),
566 case -1: { /* failure - try again */
568 int err = WSAGetLastError();
573 if( err == EBADF && ++ebadf < SLAPD_EBADF_LIMIT) {
578 Debug( LDAP_DEBUG_CONNS,
579 "daemon: select failed (%d): %s\n",
581 err >= 0 && err < sys_nerr
582 ? sys_errlist[err] : "unknown",
591 case 0: /* timeout - let threads run */
593 Debug( LDAP_DEBUG_CONNS, "daemon: select timeout - yielding\n",
595 ldap_pvt_thread_yield();
598 default: /* something happened - deal with it */
600 Debug( LDAP_DEBUG_CONNS, "daemon: activity on %d descriptors\n",
605 for ( l = 0; slap_listeners[l] != NULL; l++ ) {
607 socklen_t len = sizeof(from);
610 if ( slap_listeners[l]->sl_sd == AC_SOCKET_INVALID )
613 if ( !FD_ISSET( slap_listeners[l]->sl_sd, &readfds ) )
616 if ( (s = accept( slap_listeners[l]->sl_sd,
617 (struct sockaddr *) &from, &len )) == AC_SOCKET_INVALID )
620 Debug( LDAP_DEBUG_ANY,
621 "daemon: accept(%ld) failed errno %d (%s)\n", err,
622 (long) slap_listeners[l]->sl_sd,
623 err >= 0 && err < sys_nerr ?
624 sys_errlist[err] : "unknown");
629 ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
631 /* newly accepted stream should not be in any of the FD SETS */
633 assert( !FD_ISSET( s, &slap_daemon.sd_actives) );
634 assert( !FD_ISSET( s, &slap_daemon.sd_readers) );
635 assert( !FD_ISSET( s, &slap_daemon.sd_writers) );
637 ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
641 /* make sure descriptor number isn't too great */
642 if ( s >= dtblsize ) {
643 Debug( LDAP_DEBUG_ANY,
644 "daemon: %ld beyond descriptor table size %ld\n",
645 (long) s, (long) dtblsize, 0 );
651 Debug( LDAP_DEBUG_CONNS, "daemon: new connection on %ld\n",
655 if ( getpeername( s, (struct sockaddr *) &from, &len ) == 0 ) {
656 client_addr = inet_ntoa( from.sin_addr );
658 #if defined(SLAPD_RLOOKUPS) || defined(HAVE_TCPD)
659 hp = gethostbyaddr( (char *)
660 &(from.sin_addr.s_addr),
661 sizeof(from.sin_addr.s_addr), AF_INET );
665 client_name = hp->h_name;
667 /* normalize the domain */
668 for ( p = client_name; *p; p++ ) {
669 *p = TOLOWER( (unsigned char) *p );
685 if(!hosts_ctl("slapd",
686 client_name != NULL ? client_name : STRING_UNKNOWN,
687 client_addr != NULL ? client_addr : STRING_UNKNOWN,
691 Statslog( LDAP_DEBUG_ANY,
692 "fd=%ld connection from %s (%s) denied.\n",
694 client_name == NULL ? "unknown" : client_name,
695 client_addr == NULL ? "unknown" : client_addr,
701 #endif /* HAVE_TCPD */
703 if( (id = connection_init(s, client_name, client_addr,
705 slap_listeners[l]->sl_is_tls
711 Debug( LDAP_DEBUG_ANY,
712 "daemon: connection_init(%ld, %s, %s) failed.\n",
714 client_name == NULL ? "unknown" : client_name,
715 client_addr == NULL ? "unknown" : client_addr);
720 Statslog( LDAP_DEBUG_STATS,
721 "daemon: conn=%d fd=%ld connection from %s (%s) accepted.\n",
723 client_name == NULL ? "unknown" : client_name,
724 client_addr == NULL ? "unknown" : client_addr,
732 Debug( LDAP_DEBUG_CONNS, "daemon: activity on:", 0, 0, 0 );
734 for ( i = 0; i < readfds.fd_count; i++ ) {
735 Debug( LDAP_DEBUG_CONNS, " %d%s",
736 readfds.fd_array[i], "r", 0 );
738 for ( i = 0; i < writefds.fd_count; i++ ) {
739 Debug( LDAP_DEBUG_CONNS, " %d%s",
740 writefds.fd_array[i], "w", 0 );
743 for ( i = 0; i < nfds; i++ ) {
747 for ( l = 0; slap_listeners[l] != NULL; l++ ) {
748 if ( i == slap_listeners[l]->sl_sd ) {
756 r = FD_ISSET( i, &readfds );
757 w = FD_ISSET( i, &writefds );
759 Debug( LDAP_DEBUG_CONNS, " %d%s%s", i,
760 r ? "r" : "", w ? "w" : "" );
764 Debug( LDAP_DEBUG_CONNS, "\n", 0, 0, 0 );
767 /* loop through the writers */
769 for ( i = 0; i < writefds.fd_count; i++ )
771 for ( i = 0; i < nfds; i++ )
777 wd = writefds.fd_array[i];
779 if( ! FD_ISSET( i, &writefds ) ) {
785 for ( l = 0; slap_listeners[l] != NULL; l++ ) {
786 if ( i == slap_listeners[l]->sl_sd ) {
794 Debug( LDAP_DEBUG_CONNS,
795 "daemon: write active on %d\n",
799 * NOTE: it is possible that the connection was closed
800 * and that the stream is now inactive.
801 * connection_write() must valid the stream is still
805 if ( connection_write( wd ) < 0 ) {
806 FD_CLR( (unsigned) wd, &readfds );
812 for ( i = 0; i < readfds.fd_count; i++ )
814 for ( i = 0; i < nfds; i++ )
822 rd = readfds.fd_array[i];
824 if( ! FD_ISSET( i, &readfds ) ) {
830 for ( l = 0; slap_listeners[l] != NULL; l++ ) {
831 if ( i == slap_listeners[l]->sl_sd ) {
840 Debug ( LDAP_DEBUG_CONNS,
841 "daemon: read activity on %d\n", rd, 0, 0 );
844 * NOTE: it is possible that the connection was closed
845 * and that the stream is now inactive.
846 * connection_read() must valid the stream is still
850 while ( ( rc = connection_read( rd ) ) > 0 )
856 ldap_pvt_thread_yield();
859 if( slapd_shutdown > 0 ) {
860 Debug( LDAP_DEBUG_TRACE,
861 "daemon: shutdown requested and initiated.\n",
864 } else if ( slapd_shutdown < 0 ) {
865 Debug( LDAP_DEBUG_TRACE,
866 "daemon: abnormal condition, shutdown initiated.\n",
869 Debug( LDAP_DEBUG_TRACE,
870 "daemon: no active streams, shutdown initiated.\n",
874 for ( l = 0; slap_listeners[l] != NULL; l++ ) {
875 if ( slap_listeners[l]->sl_sd != AC_SOCKET_INVALID ) {
876 slapd_close( slap_listeners[l]->sl_sd );
881 ldap_pvt_thread_mutex_lock( &active_threads_mutex );
882 Debug( LDAP_DEBUG_ANY,
883 "slapd shutdown: waiting for %d threads to terminate\n",
884 active_threads, 0, 0 );
885 while ( active_threads > 0 ) {
886 ldap_pvt_thread_cond_wait(&active_threads_cond, &active_threads_mutex);
888 ldap_pvt_thread_mutex_unlock( &active_threads_mutex );
894 int slapd_daemon( void )
900 #define SLAPD_LISTENER_THREAD 1
901 #if defined( SLAPD_LISTENER_THREAD ) || !defined(HAVE_PTHREADS)
903 /* listener as a separate THREAD */
904 rc = ldap_pvt_thread_create( &listener_tid,
905 0, slapd_daemon_task, NULL );
908 Debug( LDAP_DEBUG_ANY,
909 "listener ldap_pvt_thread_create failed (%d)\n", rc, 0, 0 );
913 /* wait for the listener thread to complete */
914 ldap_pvt_thread_join( listener_tid, (void *) NULL );
916 /* expermimental code */
917 listener_tid = pthread_self();
918 slapd_daemon_task( NULL );
928 WORD wVersionRequested;
932 wVersionRequested = MAKEWORD( 2, 0 );
934 err = WSAStartup( wVersionRequested, &wsaData );
936 /* Tell the user that we couldn't find a usable */
941 /* Confirm that the WinSock DLL supports 2.0.*/
942 /* Note that if the DLL supports versions greater */
943 /* than 2.0 in addition to 2.0, it will still return */
944 /* 2.0 in wVersion since that is the version we */
947 if ( LOBYTE( wsaData.wVersion ) != 2 ||
948 HIBYTE( wsaData.wVersion ) != 0 )
950 /* Tell the user that we couldn't find a usable */
956 /* The WinSock DLL is acceptable. Proceed. */
960 int sockdestroy(void)
966 void hit_socket(void)
970 extern struct sockaddr_in bind_addr;
972 /* throw something at the socket to terminate the select() in the daemon thread. */
973 if (( s = socket( AF_INET, SOCK_STREAM, 0 )) == AC_SOCKET_INVALID )
974 Debug( LDAP_DEBUG_ANY,
975 "slap_set_shutdown: socket failed\n\tWSAGetLastError=%d (%s)\n",
976 WSAGetLastError(), WSAGetLastErrorString(), 0 );
978 if ( ioctlsocket( s, FIONBIO, &on ) == -1 )
979 Debug( LDAP_DEBUG_ANY,
980 "slap_set_shutdown:FIONBIO ioctl on %d faled\n\tWSAGetLastError=%d (%s)\n",
981 s, WSAGetLastError(), WSAGetLastError() );
983 bind_addr.sin_addr.s_addr = htonl( INADDR_LOOPBACK );
985 if ( connect( s, (struct sockaddr *)&bind_addr, sizeof( struct sockaddr_in )) == SOCKET_ERROR ) {
986 Debug( LDAP_DEBUG_ANY,
987 "hit_socket: error on connect: %d\n",
988 WSAGetLastError(), 0, 0 );
989 /* we can probably expect some error to occur here, mostly WSAEWOULDBLOCK */
996 static int sockinit(void)
998 if ( WSAStartup( 0x0101, &wsaData ) != 0 ) {
1003 static int sockdestroy(void)
1010 static int sockinit(void)
1014 static int sockdestroy(void)
1021 slap_set_shutdown( int sig )
1024 slapd_shutdown = sig;
1025 #ifndef HAVE_WINSOCK
1026 if(slapd_listener) {
1027 ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );
1030 Debug( LDAP_DEBUG_TRACE, "Shutdown %d ordered", sig, 0, 0 );
1031 /* trying to "hit" the socket seems to always get a */
1032 /* EWOULDBLOCK error, so just close the listen socket to */
1033 /* break out of the select since we're shutting down anyway */
1034 for ( l = 0; slap_listeners[l] != NULL; l++ ) {
1035 if ( slap_listeners[l]->sl_sd >= 0 ) {
1036 tcp_close( slap_listeners[l]->sl_sd );
1040 /* reinstall self */
1041 (void) SIGNAL( sig, slap_set_shutdown );
1045 slap_do_nothing( int sig )
1047 /* reinstall self */
1048 (void) SIGNAL( sig, slap_do_nothing );