]> git.sur5r.net Git - openldap/blobdiff - servers/ldapd/main.c
Fix idl_firstid to return NOID when !(nids > 1) instead of when (nids == 1)
[openldap] / servers / ldapd / main.c
index 9ef964106cb94780fa8a673f8aa4e5792edbc60b..85f9b5d71f46cf53c34b1557c7a4a673a909ef4f 100644 (file)
@@ -49,12 +49,11 @@ int allow_severity = LOG_INFO;
 int deny_severity = LOG_NOTICE;
 #endif /* TCP_WRAPPERS */
 
-void log_and_exit();
-static int     set_socket();
-static void    do_queries();
-static RETSIGTYPE wait4child();
+static int     set_socket( int port, int udp );
+static void    do_queries( int clientsock, int udp );
+static RETSIGTYPE wait4child( int sig );
 #ifdef LDAP_CONNECTIONLESS
-static int     udp_init();
+static int     udp_init( int port, int createsocket );
 #endif
 
 #ifdef LDAP_DEBUG
@@ -83,8 +82,6 @@ char  *kerberos_keyfile;
 int    dtblsize;
 int    RunFromInetd = 0;
 
-extern char Versionstr[];
-
 static void
 usage( char *name )
 {
@@ -102,9 +99,7 @@ usage( char *name )
 }
 
 int
-main (argc, argv)
-int    argc;
-char   **argv;
+main( int argc, char **argv )
 {
        int                     tcps, ns;
 #ifdef LDAP_CONNECTIONLESS
@@ -119,12 +114,9 @@ char       **argv;
        int                     len;
        int                     dsapargc;
        char                    **dsapargv;
-       RETSIGTYPE                      wait4child();
 #ifdef LDAP_PROCTITLE
        char                    title[80];
 #endif
-       extern char             *optarg;
-       extern int              optind;
 
 #ifdef VMS
        /* Pick up socket from inetd-type server on VMS */
@@ -275,8 +267,8 @@ char        **argv;
                lutil_detach( 0, 1 );
 #  endif
 #endif
-               (void) SIGNAL( SIGCHLD, (void *) wait4child );
-               (void) SIGNAL( SIGINT, (void *) log_and_exit );
+               (void) SIGNAL( SIGCHLD, wait4child );
+               (void) SIGNAL( SIGINT, log_and_exit );
        }
 
        /* 
@@ -450,7 +442,7 @@ char        **argv;
                    hp->h_name );
 #endif
                gettimeofday( &conn_start_tv, (struct timezone *) NULL );
-               (void) SIGNAL( SIGPIPE, (void *) log_and_exit );
+               (void) SIGNAL( SIGPIPE, log_and_exit );
 
                do_queries( ns, 0 );
                /* NOT REACHED */
@@ -466,7 +458,7 @@ char        **argv;
                        setproctitle( title );
 #endif
                        gettimeofday( &conn_start_tv, (struct timezone *) NULL );
-                       (void) SIGNAL( SIGPIPE, (void *) log_and_exit );
+                       (void) SIGNAL( SIGPIPE, log_and_exit );
 
                        do_queries( ns, 0 );
                        break;
@@ -539,7 +531,6 @@ do_queries(
        timeout.tv_usec = 0;
        for ( ;; ) {
                struct conn             *dsaconn;
-               extern struct conn      *conns;
 
                FD_ZERO( &readfds );
                FD_SET( clientsock, &readfds );
@@ -652,7 +643,8 @@ set_socket(
        return( s );
 }
 
-static RETSIGTYPE wait4child()
+static RETSIGTYPE
+wait4child( int sig )
 {
 #ifndef HAVE_WAITPID
        WAITSTATUSTYPE     status;
@@ -661,18 +653,18 @@ static RETSIGTYPE wait4child()
        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
 
-       (void) SIGNAL( SIGCHLD, (void *) wait4child );
+       (void) SIGNAL( SIGCHLD, wait4child );
 }
 
 
-void
+RETSIGTYPE
 log_and_exit( int exitcode )
 {
        struct timeval  tv;
@@ -700,9 +692,6 @@ udp_init(
 {
        int     s, bound;
        char    *matched;
-       extern char             *dsa_address;
-       extern struct PSAPaddr  *psap_cpy();
-       extern struct conn      *conns;
 
        if ( createsocket )
                s = set_socket( port, 1 );