Commit 727f6aa1 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

clients build under FreeBSD

parent 4bce7aa7
...@@ -19,15 +19,13 @@ ...@@ -19,15 +19,13 @@
* faxtotpc() returns a pointer to a string allocated with malloc(3). * faxtotpc() returns a pointer to a string allocated with malloc(3).
*/ */
#include "portable.h"
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <ctype.h> #include <ctype.h>
#include <sys/types.h>
#ifdef ultrix
extern char *strdup();
#endif
#include <sys/types.h>
#include <ac/string.h>
#define TPCDOMAIN "tpc.int" #define TPCDOMAIN "tpc.int"
......
...@@ -10,24 +10,27 @@ ...@@ -10,24 +10,27 @@
* is provided ``as is'' without express or implied warranty. * is provided ``as is'' without express or implied warranty.
*/ */
#include "portable.h"
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <ctype.h> #include <ctype.h>
#include <memory.h>
#include <sys/types.h> #include <ac/socket.h>
#include <sys/time.h> #include <ac/string.h>
#include <syslog.h> #include <ac/syslog.h>
#include <ac/time.h>
#include <ac/wait.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h> #include <sys/param.h>
#endif
#include <sys/resource.h> #include <sys/resource.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include <sysexits.h> #include <sysexits.h>
#include <ldapconfig.h>
#include "portable.h"
#include "lber.h" #include "lber.h"
#include "ldap.h" #include "ldap.h"
#include <ldapconfig.h>
#define USER 0 #define USER 0
#define GROUP_ERRORS 1 #define GROUP_ERRORS 1
...@@ -308,7 +311,7 @@ connect_to_x500() ...@@ -308,7 +311,7 @@ connect_to_x500()
ld->ld_sizelimit = FAX_MAXAMBIGUOUS; ld->ld_sizelimit = FAX_MAXAMBIGUOUS;
ld->ld_deref = LDAP_DEREF_ALWAYS; ld->ld_deref = LDAP_DEREF_ALWAYS;
if ( ldap_simple_bind_s( ld, FAX_BINDDN, NULL ) != LDAP_SUCCESS ) { if ( ldap_simple_bind_s( ld, FAX_BINDDN, FAX_BIND_CRED ) != LDAP_SUCCESS ) {
syslog( LOG_ALERT, "ldap_simple_bind_s failed" ); syslog( LOG_ALERT, "ldap_simple_bind_s failed" );
return( -1 ); return( -1 );
} }
...@@ -921,14 +924,14 @@ send_message( to ) ...@@ -921,14 +924,14 @@ send_message( to )
char **to; char **to;
{ {
int pid; int pid;
#ifndef USE_WAITPID #ifndef HAVE_WAITPID
WAITSTATUSTYPE status; WAITSTATUSTYPE status;
#endif #endif
/* parent */ /* parent */
if ( pid = fork() ) { if ( pid = fork() ) {
#ifdef USE_WAITPID #ifdef HAVE_WAITPID
waitpid( pid, (int *) NULL, 0 ); waitpid( pid, (int *) NULL, 0 );
#else #else
wait4( pid, &status, WAIT_FLAGS, 0 ); wait4( pid, &status, WAIT_FLAGS, 0 );
...@@ -953,7 +956,7 @@ send_group( group, ngroup ) ...@@ -953,7 +956,7 @@ send_group( group, ngroup )
char **argv; char **argv;
int argc; int argc;
char *iargv[7]; char *iargv[7];
#ifndef USE_WAITPID #ifndef HAVE_WAITPID
WAITSTATUSTYPE status; WAITSTATUSTYPE status;
#endif #endif
...@@ -976,7 +979,7 @@ send_group( group, ngroup ) ...@@ -976,7 +979,7 @@ send_group( group, ngroup )
/* parent */ /* parent */
if ( pid = fork() ) { if ( pid = fork() ) {
#ifdef USE_WAITPID #ifdef HAVE_WAITPID
waitpid( pid, (int *) NULL, 0 ); waitpid( pid, (int *) NULL, 0 );
#else #else
wait4( pid, &status, WAIT_FLAGS, 0 ); wait4( pid, &status, WAIT_FLAGS, 0 );
......
...@@ -10,28 +10,30 @@ ...@@ -10,28 +10,30 @@
* is provided ``as is'' without express or implied warranty. * is provided ``as is'' without express or implied warranty.
*/ */
#include "portable.h"
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <syslog.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <signal.h> #include <signal.h>
#include <ac/socket.h>
#include <ac/string.h>
#include <ac/syslog.h>
#include <ac/time.h>
#include <ac/wait.h>
#include <sys/resource.h>
#include <lber.h>
#include <ldap.h>
#include <ldapconfig.h> #include <ldapconfig.h>
#include "lber.h"
#include "ldap.h"
#define DEFAULT_PORT 79 #define DEFAULT_PORT 79
#define DEFAULT_SIZELIMIT 50 #define DEFAULT_SIZELIMIT 50
int debug; int debug;
char *ldaphost = LDAPHOST; char *ldaphost = LDAPHOST;
char *base = DEFAULT_BASE; char *base = RP_BASE;
int deref; int deref;
int sizelimit; int sizelimit;
LDAPFiltDesc *filtd; LDAPFiltDesc *filtd;
...@@ -114,7 +116,7 @@ main (argc, argv) ...@@ -114,7 +116,7 @@ main (argc, argv)
ld->ld_sizelimit = sizelimit ? sizelimit : DEFAULT_SIZELIMIT; ld->ld_sizelimit = sizelimit ? sizelimit : DEFAULT_SIZELIMIT;
ld->ld_deref = deref; ld->ld_deref = deref;
if ( ldap_simple_bind_s( ld, RP_BINDDN, NULL ) != LDAP_SUCCESS ) { if ( ldap_simple_bind_s( ld, RP_BINDDN, RP_BIND_CRED ) != LDAP_SUCCESS ) {
fprintf( stderr, "X.500 is temporarily unavailable.\n" ); fprintf( stderr, "X.500 is temporarily unavailable.\n" );
ldap_perror( ld, "ldap_simple_bind_s" ); ldap_perror( ld, "ldap_simple_bind_s" );
exit( -1 ); exit( -1 );
......
...@@ -10,31 +10,27 @@ ...@@ -10,31 +10,27 @@
* is provided ``as is'' without express or implied warranty. * is provided ``as is'' without express or implied warranty.
*/ */
#include "lber.h" #include "portable.h"
#include "ldap.h"
#include "disptmpl.h"
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <ctype.h> #include <ctype.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <syslog.h>
#include <sys/resource.h>
#include <sys/wait.h>
#ifdef aix
#include <sys/select.h>
#endif /* aix */
#include <signal.h> #include <signal.h>
#include "portable.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>
#include <sys/resource.h>
#include "lber.h"
#include "ldap.h"
#include "disptmpl.h"
#include "ldapconfig.h" #include "ldapconfig.h"
#ifdef USE_SYSCONF
#include <unistd.h>
#endif /* USE_SYSCONF */
int dosyslog = 1; int dosyslog = 1;
char *ldaphost = LDAPHOST; char *ldaphost = LDAPHOST;
...@@ -166,7 +162,9 @@ static do_query() ...@@ -166,7 +162,9 @@ static do_query()
ld->ld_sizelimit = FINGER_SIZELIMIT; ld->ld_sizelimit = FINGER_SIZELIMIT;
ld->ld_deref = deref; ld->ld_deref = deref;
if ( ldap_simple_bind_s( ld, FINGER_BINDDN, NULL ) != LDAP_SUCCESS ) { if ( ldap_simple_bind_s( ld, FINGER_BINDDN, FINGER_BIND_CRED )
!= LDAP_SUCCESS )
{
fprintf( stderr, FINGER_UNAVAILABLE ); fprintf( stderr, FINGER_UNAVAILABLE );
ldap_perror( ld, "ldap_simple_bind_s" ); ldap_perror( ld, "ldap_simple_bind_s" );
exit( 1 ); exit( 1 );
...@@ -178,6 +176,12 @@ static do_query() ...@@ -178,6 +176,12 @@ static do_query()
tblsize = getdtablesize(); tblsize = getdtablesize();
#endif /* USE_SYSCONF */ #endif /* USE_SYSCONF */
#ifdef FD_SETSIZE
if (tblsize > FD_SETSIZE) {
tblsize = FD_SETSIZE;
}
#endif /* FD_SETSIZE*/
timeout.tv_sec = FINGER_TIMEOUT; timeout.tv_sec = FINGER_TIMEOUT;
timeout.tv_usec = 0; timeout.tv_usec = 0;
FD_ZERO( &readfds ); FD_ZERO( &readfds );
......
...@@ -10,28 +10,35 @@ ...@@ -10,28 +10,35 @@
* is provided ``as is'' without express or implied warranty. * is provided ``as is'' without express or implied warranty.
*/ */
#include "portable.h"
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <signal.h>
#include <sys/file.h> #include <sys/file.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <fcntl.h> #include <fcntl.h>
#include <signal.h>
#include "portable.h"
#ifdef USE_SYSCONF #include <ac/unistd.h>
#include <unistd.h>
#endif /* USE_SYSCONF */
detach( debug ) detach( debug )
int debug; int debug;
{ {
int i, sd, nbits; int i, sd, nbits;
#ifdef USE_SYSCONF #if defined( HAVE_SYSCONF )
nbits = sysconf( _SC_OPEN_MAX ); nbits = sysconf( _SC_OPEN_MAX );
#else /* USE_SYSCONF */ #elif defined( HAVE_GETDTABLESIZE )
nbits = getdtablesize(); nbits = getdtablesize();
#endif /* USE_SYSCONF */ #else
nbits = 32;
#endif
#ifdef FD_SETSIZE
if (nbits > FD_SETSIZE) {
nbits = FD_SETSIZE;
}
#endif /* FD_SETSIZE*/
if ( debug == 0 || !(isatty( 1 )) ) { if ( debug == 0 || !(isatty( 1 )) ) {
for ( i = 0; i < 5; i++ ) { for ( i = 0; i < 5; i++ ) {
......
...@@ -10,33 +10,30 @@ ...@@ -10,33 +10,30 @@
* is provided ``as is'' without express or implied warranty. * is provided ``as is'' without express or implied warranty.
*/ */
#include "portable.h"
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <ctype.h> #include <ctype.h>
#include <sys/types.h> #include <signal.h>
#include <ac/string.h>
#include <ac/time.h>
#include <ac/socket.h>
#include <ac/syslog.h>
#include <ac/unistd.h>
#include <ac/wait.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h> #include <sys/param.h>
#include <sys/time.h> #endif
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <syslog.h>
#include <sys/resource.h> #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 "ldapconfig.h"
#include "lber.h" #include "lber.h"
#include "ldap.h" #include "ldap.h"
#include "disptmpl.h" #include "disptmpl.h"
#ifdef USE_SYSCONF
#include <unistd.h>
#endif /* USE_SYSCONF */
int debug; int debug;
int dosyslog; int dosyslog;
int inetd; int inetd;
...@@ -52,7 +49,7 @@ char myhost[MAXHOSTNAMELEN]; ...@@ -52,7 +49,7 @@ char myhost[MAXHOSTNAMELEN];
int myport; int myport;
static set_socket(); static set_socket();
static SIG_FN wait4child(); static RETSIGTYPE wait4child();
static do_queries(); static do_queries();
static do_error(); static do_error();
static do_search(); static do_search();
...@@ -78,7 +75,7 @@ char **argv; ...@@ -78,7 +75,7 @@ char **argv;
struct hostent *hp; struct hostent *hp;
struct sockaddr_in from; struct sockaddr_in from;
int fromlen; int fromlen;
SIG_FN wait4child(); RETSIGTYPE wait4child();
extern char *optarg; extern char *optarg;
extern char **Argv; extern char **Argv;
extern int Argc; extern int Argc;
...@@ -146,6 +143,13 @@ char **argv; ...@@ -146,6 +143,13 @@ char **argv;
dtblsize = getdtablesize(); dtblsize = getdtablesize();
#endif /* USE_SYSCONF */ #endif /* USE_SYSCONF */
#ifdef FD_SETSIZE
if (dtblsize > FD_SETSIZE) {
dtblsize = FD_SETSIZE;
}
#endif /* FD_SETSIZE*/
/* detach if stderr is redirected or no debugging */ /* detach if stderr is redirected or no debugging */
if ( inetd == 0 ) if ( inetd == 0 )
(void) detach( debug ); (void) detach( debug );
...@@ -292,18 +296,22 @@ int port; ...@@ -292,18 +296,22 @@ int port;
return( s ); return( s );
} }
static SIG_FN static RETSIGTYPE
wait4child() wait4child()
{ {
#ifndef HAVE_WAITPID
WAITSTATUSTYPE status; WAITSTATUSTYPE status;
#endif
if ( debug ) printf( "parent: catching child status\n" ); if ( debug ) printf( "parent: catching child status\n" );
#ifdef USE_WAITPID
#ifdef HAVE_WAITPID
while (waitpid ((pid_t) -1, 0, WAIT_FLAGS) > 0) while (waitpid ((pid_t) -1, 0, WAIT_FLAGS) > 0)
#else /* USE_WAITPID */ ; /* NULL */
while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 ) #else
#endif /* USE_WAITPID */ while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 )
; /* NULL */ ; /* NULL */
#endif
(void) signal( SIGCHLD, (void *) wait4child ); (void) signal( SIGCHLD, (void *) wait4child );
} }
...@@ -372,7 +380,7 @@ int s; ...@@ -372,7 +380,7 @@ int s;
} }
ld->ld_deref = GO500_DEREF; 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 ) { != LDAP_SUCCESS ) {
fprintf(fp, fprintf(fp,
"0An error occurred (explanation)\t@%d\t%s\t%d\r\n", "0An error occurred (explanation)\t@%d\t%s\t%d\r\n",
......
...@@ -10,32 +10,30 @@ ...@@ -10,32 +10,30 @@
* is provided ``as is'' without express or implied warranty. * is provided ``as is'' without express or implied warranty.
*/ */
#include "lber.h" #include "portable.h"
#include "ldap.h"
#include "disptmpl.h"
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <ctype.h> #include <ctype.h>
#include <sys/types.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>
#include <sys/resource.h>
#include <sys/wait.h>
#include <signal.h> #include <signal.h>
#ifdef aix
#include <sys/select.h>
#endif /* aix */
#include "portable.h"
#include "ldapconfig.h"
#ifdef USE_SYSCONF #include <ac/time.h>
#include <unistd.h> #include <ac/socket.h>
#endif /* USE_SYSCONF */ #include <ac/string.h>
#include <ac/syslog.h>
#include <ac/unistd.h>
#include <ac/wait.h>
#include <sys/resource.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include "lber.h"
#include "ldap.h"
#include "disptmpl.h"
#include "ldapconfig.h"
int debug; int debug;
int dosyslog; int dosyslog;
...@@ -52,7 +50,7 @@ char *friendlyfile = FRIENDLYFILE; ...@@ -52,7 +50,7 @@ char *friendlyfile = FRIENDLYFILE;
int rdncount = GO500GW_RDNCOUNT; int rdncount = GO500GW_RDNCOUNT;
static set_socket(); static set_socket();
static SIG_FN wait4child(); static RETSIGTYPE wait4child();
static do_queries(); static do_queries();
static do_menu(); static do_menu();
static do_list(); static do_list();
...@@ -85,7 +83,7 @@ char **argv; ...@@ -85,7 +83,7 @@ char **argv;
struct hostent *hp; struct hostent *hp;
struct sockaddr_in from; struct sockaddr_in from;
int fromlen; int fromlen;
SIG_FN wait4child(); RETSIGTYPE wait4child();
extern char *optarg; extern char *optarg;
extern char **Argv; extern char **Argv;
extern int Argc; extern int Argc;
...@@ -150,11 +148,21 @@ char **argv; ...@@ -150,11 +148,21 @@ char **argv;
} }
} }
#ifdef USE_SYSCONF #ifdef HAVE_SYSCONF
dtblsize = sysconf( _SC_OPEN_MAX ); dtblsize = sysconf( _SC_OPEN_MAX );
#else /* USE_SYSCONF */ #elif HAVE_GETDTABLESIZE
dtblsize = getdtablesize(); dtblsize = getdtablesize();
#endif /* USE_SYSCONF */ #else
dtblsize = 32;
#endif
#ifdef FD_SETSIZE
if ( dtblsize > FD_SETSIZE ) {
dtblsize = FD_SETSIZE;
}
#endif /* FD_SETSIZE*/
#ifdef GO500GW_HOSTNAME #ifdef GO500GW_HOSTNAME
strcpy( myhost, GO500GW_HOSTNAME ); strcpy( myhost, GO500GW_HOSTNAME );
...@@ -314,18 +322,22 @@ int port; ...@@ -314,18 +322,22 @@ int port;
return( s ); return( s );
} }
static SIG_FN