* is provided ``as is'' without express or implied warranty.
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
+
+#include <ac/ctype.h>
+#include <ac/signal.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/syslog.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+#include <ac/wait.h>
+
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <syslog.h>
+#endif
+
#include <sys/resource.h>
-#include <sys/wait.h>
-#ifdef aix
-#include <sys/select.h>
-#endif /* aix */
-#include <signal.h>
-#include "portable.h"
+
#include "ldapconfig.h"
#include "lber.h"
#include "ldap.h"
-#include "disptmpl.h"
-#ifdef USE_SYSCONF
-#include <unistd.h>
-#endif /* USE_SYSCONF */
+#if LDAP_VERSION < LDAP_VERSION3
+/* quick fix until we have ldap_set_options */
+#include "../libraries/libldap/ldap-int.h"
+#endif
+
+#include "disptmpl.h"
int debug;
int dosyslog;
int myport;
static set_socket();
-static SIG_FN wait4child();
+static RETSIGTYPE wait4child();
static do_queries();
static do_error();
static do_search();
struct hostent *hp;
struct sockaddr_in from;
int fromlen;
- SIG_FN wait4child();
+ RETSIGTYPE wait4child();
extern char *optarg;
extern char **Argv;
extern int Argc;
}
#endif
-#ifdef USE_SYSCONF
+#ifdef HAVE_SYSCONF
dtblsize = sysconf( _SC_OPEN_MAX );
-#else /* USE_SYSCONF */
+#elif HAVE_GETDTABLESIZE
dtblsize = getdtablesize();
-#endif /* USE_SYSCONF */
+#else
+ dtblsize = FD_SETSIZE;
+#endif
+
+#ifdef FD_SETSIZE
+ if (dtblsize > FD_SETSIZE) {
+ dtblsize = FD_SETSIZE;
+ }
+#endif /* FD_SETSIZE*/
+
/* detach if stderr is redirected or no debugging */
if ( inetd == 0 )
s = set_socket( port );
/* arrange to reap children */
- (void) signal( SIGCHLD, (void *) wait4child );
+ (void) SIGNAL( SIGCHLD, wait4child );
} else {
myport = GO500_PORT;
return( s );
}
-static SIG_FN
+static RETSIGTYPE
wait4child()
{
+#ifndef HAVE_WAITPID
WAITSTATUSTYPE status;
+#endif
if ( debug ) printf( "parent: catching child status\n" );
-#ifdef USE_WAITPID
+
+#ifdef HAVE_WAITPID
while (waitpid ((pid_t) -1, 0, WAIT_FLAGS) > 0)
-#else /* USE_WAITPID */
- while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 )
-#endif /* USE_WAITPID */
- ; /* NULL */
+ ; /* NULL */
+#else
+ while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 )
+ ; /* NULL */
+#endif
- (void) signal( SIGCHLD, (void *) wait4child );
+ (void) SIGNAL( SIGCHLD, wait4child );
}
static
}
ld->ld_deref = GO500_DEREF;
- if ( (rc = ldap_simple_bind_s( ld, GO500_BINDDN, NULL ))
+ if ( (rc = ldap_simple_bind_s( ld, GO500_BINDDN, GO500_BIND_CRED ))
!= LDAP_SUCCESS ) {
fprintf(fp,
"0An error occurred (explanation)\t@%d\t%s\t%d\r\n",