X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fldapd%2Fmain.c;h=5e91ec6ea31fea8159093d4234c6986ada064e71;hb=c9eacbdc6407b65b395c13e1e93e8fe25bbbf041;hp=f4e179a5ff94c047d5996a89ccc3f826dcb32dca;hpb=7e6ad5100c2702b1d56a285bdfb341ddf38c0d76;p=openldap diff --git a/servers/ldapd/main.c b/servers/ldapd/main.c index f4e179a5ff..5e91ec6ea3 100644 --- a/servers/ldapd/main.c +++ b/servers/ldapd/main.c @@ -117,8 +117,6 @@ main( int argc, char **argv ) #ifdef LDAP_PROCTITLE char title[80]; #endif - extern char *optarg; - extern int optind; #ifdef VMS /* Pick up socket from inetd-type server on VMS */ @@ -156,7 +154,7 @@ main( int argc, char **argv ) #ifdef LDAP_DEBUG ldap_debug = atoi( optarg ); if ( ldap_debug & LDAP_DEBUG_PACKETS ) - lber_debug = ldap_debug; + lber_int_debug = ldap_debug; #else fprintf( stderr, "Not compiled with -DLDAP_DEBUG!\n" ); #endif @@ -517,18 +515,10 @@ do_queries( conn_init(); } - (void) memset( (void *) &sb, '\0', sizeof( sb ) ); - sb.sb_sd = clientsock; - sb.sb_naddr = ( udp ) ? 1 : 0; -#ifdef LDAP_CONNECTIONLESS - sb.sb_addrs = (void **)saddrlist; - sb.sb_fromaddr = &faddr; - sb.sb_useaddr = saddrlist[ 0 ] = &saddr; -#endif - sb.sb_ber.ber_buf = NULL; - sb.sb_ber.ber_ptr = NULL; - sb.sb_ber.ber_end = NULL; - + lber_pvt_sb_init( &sb ); + lber_pvt_sb_set_desc( &sb, clientsock ); + lber_pvt_sb_set_io( &sb, (udp) ? &lber_pvt_sb_io_udp : + &lber_pvt_sb_io_tcp, NULL ); timeout.tv_sec = idletime; timeout.tv_usec = 0; for ( ;; ) { @@ -557,7 +547,7 @@ do_queries( * already waiting for us on the client sock. */ - if ( sb.sb_ber.ber_ptr >= sb.sb_ber.ber_end ) { + if ( ! lber_pvt_sb_data_ready( &sb ) ) { if ( (rc = select( dtblsize, &readfds, 0, 0, udp ? 0 : &timeout )) < 1 ) { #ifdef LDAP_DEBUG @@ -583,7 +573,7 @@ do_queries( } } - if ( sb.sb_ber.ber_ptr < sb.sb_ber.ber_end || + if ( lber_pvt_sb_data_ready( &sb ) || FD_ISSET( clientsock, &readfds ) ) { client_request( &sb, conns, udp ); } else { @@ -655,10 +645,10 @@ wait4child( int sig ) Debug( LDAP_DEBUG_TRACE, "parent: catching child status\n", 0, 0, 0 ); #ifdef HAVE_WAITPID - while( waitpid( (pid_t) -1, NULL, WAIT_FLAGS ) > 0 ) + while( waitpid( (pid_t) -1, (int *) NULL, WAIT_FLAGS ) > 0 ) ; /* NULL */ #else - while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 ) + while ( wait4( (pid_t) -1, &status, WAIT_FLAGS, 0 ) > 0 ) ; /* NULL */ #endif