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

clients build under FreeBSD

parent 4bce7aa7
......@@ -19,15 +19,13 @@
* faxtotpc() returns a pointer to a string allocated with malloc(3).
*/
#include "portable.h"
#include <stdio.h>
#include <string.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"
......
......@@ -10,24 +10,27 @@
* is provided ``as is'' without express or implied warranty.
*/
#include "portable.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <memory.h>
#include <sys/types.h>
#include <sys/time.h>
#include <syslog.h>
#include <ac/socket.h>
#include <ac/string.h>
#include <ac/syslog.h>
#include <ac/time.h>
#include <ac/wait.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <sys/resource.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include <sysexits.h>
#include <ldapconfig.h>
#include "portable.h"
#include "lber.h"
#include "ldap.h"
#include <ldapconfig.h>
#define USER 0
#define GROUP_ERRORS 1
......@@ -308,7 +311,7 @@ connect_to_x500()
ld->ld_sizelimit = FAX_MAXAMBIGUOUS;
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" );
return( -1 );
}
......@@ -921,14 +924,14 @@ send_message( to )
char **to;
{
int pid;
#ifndef USE_WAITPID
#ifndef HAVE_WAITPID
WAITSTATUSTYPE status;
#endif
/* parent */
if ( pid = fork() ) {
#ifdef USE_WAITPID
#ifdef HAVE_WAITPID
waitpid( pid, (int *) NULL, 0 );
#else
wait4( pid, &status, WAIT_FLAGS, 0 );
......@@ -953,7 +956,7 @@ send_group( group, ngroup )
char **argv;
int argc;
char *iargv[7];
#ifndef USE_WAITPID
#ifndef HAVE_WAITPID
WAITSTATUSTYPE status;
#endif
......@@ -976,7 +979,7 @@ send_group( group, ngroup )
/* parent */
if ( pid = fork() ) {
#ifdef USE_WAITPID
#ifdef HAVE_WAITPID
waitpid( pid, (int *) NULL, 0 );
#else
wait4( pid, &status, WAIT_FLAGS, 0 );
......
......@@ -10,28 +10,30 @@
* is provided ``as is'' without express or implied warranty.
*/
#include "portable.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 <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 "lber.h"
#include "ldap.h"
#define DEFAULT_PORT 79
#define DEFAULT_SIZELIMIT 50
int debug;
char *ldaphost = LDAPHOST;
char *base = DEFAULT_BASE;
char *ldaphost = LDAPHOST;
char *base = RP_BASE;
int deref;
int sizelimit;
LDAPFiltDesc *filtd;
......@@ -114,7 +116,7 @@ main (argc, argv)
ld->ld_sizelimit = sizelimit ? sizelimit : DEFAULT_SIZELIMIT;
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" );
ldap_perror( ld, "ldap_simple_bind_s" );
exit( -1 );
......
......@@ -10,31 +10,27 @@
* is provided ``as is'' without express or implied warranty.
*/
#include "lber.h"
#include "ldap.h"
#include "disptmpl.h"
#include "portable.h"
#include <stdio.h>
#include <string.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 "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"
#ifdef USE_SYSCONF
#include <unistd.h>
#endif /* USE_SYSCONF */
int dosyslog = 1;
char *ldaphost = LDAPHOST;
......@@ -166,7 +162,9 @@ static do_query()
ld->ld_sizelimit = FINGER_SIZELIMIT;
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 );
ldap_perror( ld, "ldap_simple_bind_s" );
exit( 1 );
......@@ -178,6 +176,12 @@ static do_query()
tblsize = getdtablesize();
#endif /* USE_SYSCONF */
#ifdef FD_SETSIZE
if (tblsize > FD_SETSIZE) {
tblsize = FD_SETSIZE;
}
#endif /* FD_SETSIZE*/
timeout.tv_sec = FINGER_TIMEOUT;
timeout.tv_usec = 0;
FD_ZERO( &readfds );
......
......@@ -10,28 +10,35 @@
* is provided ``as is'' without express or implied warranty.
*/
#include "portable.h"
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <signal.h>
#include "portable.h"
#ifdef USE_SYSCONF
#include <unistd.h>
#endif /* USE_SYSCONF */
#include <ac/unistd.h>
detach( debug )
int debug;
{
int i, sd, nbits;
#ifdef USE_SYSCONF
#if defined( HAVE_SYSCONF )
nbits = sysconf( _SC_OPEN_MAX );
#else /* USE_SYSCONF */
#elif defined( HAVE_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 )) ) {
for ( i = 0; i < 5; i++ ) {
......
......@@ -10,33 +10,30 @@
* 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 <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/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 */
int debug;
int dosyslog;
int inetd;
......@@ -52,7 +49,7 @@ char myhost[MAXHOSTNAMELEN];
int myport;
static set_socket();
static SIG_FN wait4child();
static RETSIGTYPE wait4child();
static do_queries();
static do_error();
static do_search();
......@@ -78,7 +75,7 @@ char **argv;
struct hostent *hp;
struct sockaddr_in from;
int fromlen;
SIG_FN wait4child();
RETSIGTYPE wait4child();
extern char *optarg;
extern char **Argv;
extern int Argc;
......@@ -146,6 +143,13 @@ char **argv;
dtblsize = getdtablesize();
#endif /* USE_SYSCONF */
#ifdef FD_SETSIZE
if (dtblsize > FD_SETSIZE) {
dtblsize = FD_SETSIZE;
}
#endif /* FD_SETSIZE*/
/* detach if stderr is redirected or no debugging */
if ( inetd == 0 )
(void) detach( debug );
......@@ -292,18 +296,22 @@ int 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 );
}
......@@ -372,7 +380,7 @@ int s;
}
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",
......
......@@ -10,32 +10,30 @@
* is provided ``as is'' without express or implied warranty.
*/
#include "lber.h"
#include "ldap.h"
#include "disptmpl.h"
#include "portable.h"
#include <stdio.h>
#include <string.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>
#ifdef aix
#include <sys/select.h>
#endif /* aix */
#include "portable.h"
#include "ldapconfig.h"
#ifdef USE_SYSCONF
#include <unistd.h>
#endif /* USE_SYSCONF */
#include <ac/time.h>
#include <ac/socket.h>
#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 dosyslog;
......@@ -52,7 +50,7 @@ char *friendlyfile = FRIENDLYFILE;
int rdncount = GO500GW_RDNCOUNT;
static set_socket();
static SIG_FN wait4child();
static RETSIGTYPE wait4child();
static do_queries();
static do_menu();
static do_list();
......@@ -85,7 +83,7 @@ char **argv;
struct hostent *hp;
struct sockaddr_in from;
int fromlen;
SIG_FN wait4child();
RETSIGTYPE wait4child();
extern char *optarg;
extern char **Argv;
extern int Argc;
......@@ -150,11 +148,21 @@ char **argv;
}
}
#ifdef USE_SYSCONF
#ifdef HAVE_SYSCONF
dtblsize = sysconf( _SC_OPEN_MAX );
#else /* USE_SYSCONF */
#elif HAVE_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
strcpy( myhost, GO500GW_HOSTNAME );
......@@ -314,18 +322,22 @@ int port;
return( s );
}
static SIG_FN
static RETSIGTYPE
wait4child()
{
WAITSTATUSTYPE status;
if ( debug ) printf( "parent: catching child status\n" );
#ifdef USE_WAITPID
while (waitpid ((pid_t) -1, 0, WAIT_FLAGS) > 0)
#else /* USE_WAITPID */
while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 )
#endif /* USE_WAITPID */
; /* NULL */
#ifndef HAVE_WAITPID
WAITSTATUSTYPE status;
#endif
if ( debug ) printf( "parent: catching child status\n" );
#ifdef HAVE_WAITPID
while (waitpid ((pid_t) -1, NULL, WAIT_FLAGS) > 0)
; /* NULL */
#else
while (wait3( &status, WAIT_FLAGS, 0 ) > 0 )
; /* NULL */
#endif
(void) signal( SIGCHLD, (void *) wait4child );
}
......
......@@ -10,6 +10,8 @@
* is provided ``as is'' without express or implied warranty.
*/
#include "portable.h"
char **Argv; /* pointer to original (main's) argv */
int Argc; /* original argc */
......
......@@ -10,18 +10,23 @@
* is provided ``as is'' without express or implied warranty.
*/
#include "portable.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <memory.h>
#include <sys/types.h>
#include <sys/time.h>
#include <syslog.h>
#include <ac/string.h>
#include <ac/syslog.h>
#include <ac/time.h>
#include <ac/wait.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <sys/resource.h>
#include <sys/wait.h>
#include <sysexits.h>
#include "portable.h"
#include "lber.h"
#include "ldap.h"
......@@ -1029,7 +1034,7 @@ send_message( to )
char **to;
{
int pid;
#ifndef USE_WAITPID
#ifndef HAVE_WAITPID
WAITSTATUSTYPE status;
#endif
......@@ -1048,7 +1053,7 @@ send_message( to )
/* parent */
if ( pid = fork() ) {
#ifdef USE_WAITPID
#ifdef HAVE_WAITPID
waitpid( pid, (int *) NULL, 0 );
#else
wait4( pid, &status, WAIT_FLAGS, 0 );
......@@ -1073,7 +1078,7 @@ send_group( group, ngroup )
char **argv;
int argc;
char *iargv[7];
#ifndef USE_WAITPID
#ifndef HAVE_WAITPID
WAITSTATUSTYPE status;
#endif
......@@ -1108,7 +1113,7 @@ send_group( group, ngroup )
/* parent */
if ( pid = fork() ) {
#ifdef USE_WAITPID
#ifdef HAVE_WAITPID
waitpid( pid, (int *) NULL, 0 );
#else
wait4( pid, &status, WAIT_FLAGS, 0 );
......@@ -1136,7 +1141,7 @@ send_errors( err, nerr )
int fd[2];
char *argv[8];
char buf[1024];
#ifndef USE_WAITPID
#ifndef HAVE_WAITPID
WAITSTATUSTYPE status;
#endif
......@@ -1255,7 +1260,7 @@ send_errors( err, nerr )
}
fclose( fp );
#ifdef USE_WAITPID
#ifdef HAVE_WAITPID
waitpid( pid, (int *) NULL, 0 );
#else
wait4( pid, &status, WAIT_FLAGS, 0 );
......
......@@ -6,7 +6,9 @@
* All Rights Reserved
*/
#include <stdio.h>
#include "portable.h"
#include <stdlib.h>
#include "rcpt500.h"
struct command cmds[] = {
......
......@@ -6,12 +6,17 @@
* All Rights Reserved
*/
#include "portable.h"
#include <stdio.h>
#include <syslog.h>
#include <string.h>
#include <ac/syslog.h>
#include <ac/string.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include "portable.h"
#include "ldapconfig.h"
#include "rcpt500.h"