From: Kurt Zeilenga Date: Tue, 20 Oct 1998 23:31:56 +0000 (+0000) Subject: clients build under FreeBSD X-Git-Tag: PHP3_TOOL_0_0~18^2~36 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=727f6aa131b05c94108442856f04d11ecf508d03;p=openldap clients build under FreeBSD --- diff --git a/clients/fax500/faxtotpc.c b/clients/fax500/faxtotpc.c index d4631b43e6..10d3ce2411 100644 --- a/clients/fax500/faxtotpc.c +++ b/clients/fax500/faxtotpc.c @@ -19,15 +19,13 @@ * faxtotpc() returns a pointer to a string allocated with malloc(3). */ +#include "portable.h" + #include -#include #include -#include - -#ifdef ultrix -extern char *strdup(); -#endif +#include +#include #define TPCDOMAIN "tpc.int" diff --git a/clients/fax500/main.c b/clients/fax500/main.c index 7481d4980e..cb458ccb3a 100644 --- a/clients/fax500/main.c +++ b/clients/fax500/main.c @@ -10,24 +10,27 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" #include -#include #include -#include -#include -#include -#include + +#include +#include +#include +#include +#include + +#ifdef HAVE_SYS_PARAM_H #include +#endif + #include -#include -#include #include -#include -#include "portable.h" #include "lber.h" #include "ldap.h" +#include #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 ); diff --git a/clients/fax500/rp500.c b/clients/fax500/rp500.c index 25eece609d..540554cfba 100644 --- a/clients/fax500/rp500.c +++ b/clients/fax500/rp500.c @@ -10,28 +10,30 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include + +#include +#include +#include +#include +#include + +#include + +#include +#include + #include -#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 ); diff --git a/clients/finger/main.c b/clients/finger/main.c index 38c8dfc769..d9ce474fdb 100644 --- a/clients/finger/main.c +++ b/clients/finger/main.c @@ -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 -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef aix -#include -#endif /* aix */ #include -#include "portable.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include "lber.h" +#include "ldap.h" +#include "disptmpl.h" + #include "ldapconfig.h" -#ifdef USE_SYSCONF -#include -#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 ); diff --git a/clients/gopher/detach.c b/clients/gopher/detach.c index f543cc3060..ce327fef20 100644 --- a/clients/gopher/detach.c +++ b/clients/gopher/detach.c @@ -10,28 +10,35 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include +#include + #include #include #include -#include -#include "portable.h" -#ifdef USE_SYSCONF -#include -#endif /* USE_SYSCONF */ +#include 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++ ) { diff --git a/clients/gopher/go500.c b/clients/gopher/go500.c index 333787677a..aef3ea376d 100644 --- a/clients/gopher/go500.c +++ b/clients/gopher/go500.c @@ -10,33 +10,30 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include #include -#include +#include + +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_SYS_PARAM_H #include -#include -#include -#include -#include -#include -#include +#endif + #include -#include -#ifdef aix -#include -#endif /* aix */ -#include -#include "portable.h" + #include "ldapconfig.h" #include "lber.h" #include "ldap.h" #include "disptmpl.h" -#ifdef USE_SYSCONF -#include -#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", diff --git a/clients/gopher/go500gw.c b/clients/gopher/go500gw.c index 7f74fbf57c..725d2b1c53 100644 --- a/clients/gopher/go500gw.c +++ b/clients/gopher/go500gw.c @@ -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 -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#ifdef aix -#include -#endif /* aix */ -#include "portable.h" -#include "ldapconfig.h" -#ifdef USE_SYSCONF -#include -#endif /* USE_SYSCONF */ +#include +#include +#include +#include +#include +#include + +#include + +#ifdef HAVE_SYS_PARAM_H +#include +#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 ); } diff --git a/clients/gopher/setproctitle.c b/clients/gopher/setproctitle.c index 26b42c0cee..1d1ae3b6d2 100644 --- a/clients/gopher/setproctitle.c +++ b/clients/gopher/setproctitle.c @@ -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 */ diff --git a/clients/mail500/main.c b/clients/mail500/main.c index 5fdea96201..534eb0111d 100644 --- a/clients/mail500/main.c +++ b/clients/mail500/main.c @@ -10,18 +10,23 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include #include -#include -#include -#include -#include + +#include +#include +#include +#include + +#ifdef HAVE_SYS_PARAM_H #include +#endif + #include -#include + #include -#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 ); diff --git a/clients/rcpt500/cmds.c b/clients/rcpt500/cmds.c index fe89309567..8b5a938f2e 100644 --- a/clients/rcpt500/cmds.c +++ b/clients/rcpt500/cmds.c @@ -6,7 +6,9 @@ * All Rights Reserved */ -#include +#include "portable.h" + +#include #include "rcpt500.h" struct command cmds[] = { diff --git a/clients/rcpt500/help.c b/clients/rcpt500/help.c index 0f541ab9be..b789da2343 100644 --- a/clients/rcpt500/help.c +++ b/clients/rcpt500/help.c @@ -6,12 +6,17 @@ * All Rights Reserved */ +#include "portable.h" + #include -#include -#include + +#include +#include + +#ifdef HAVE_FCNTL_H #include +#endif -#include "portable.h" #include "ldapconfig.h" #include "rcpt500.h" diff --git a/clients/rcpt500/main.c b/clients/rcpt500/main.c index 3e65ac233b..b29920ff40 100644 --- a/clients/rcpt500/main.c +++ b/clients/rcpt500/main.c @@ -6,24 +6,24 @@ * All Rights Reserved */ +#include "portable.h" + #include #include -#include -#include #include -#include "portable.h" +#include +#include + + #include "ldapconfig.h" #include "rcpt500.h" -#ifdef ultrix -extern char *strdup(); -#endif - int dosyslog = 0; -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS int do_cldap = 0; -#endif /* CLDAP */ +#endif /* LDAP_CONNECTIONLESS */ + int derefaliases = 1; int sizelimit = RCPT500_SIZELIMIT; int rdncount = RCPT500_RDNCOUNT; @@ -78,11 +78,12 @@ main( argc, argv ) dosyslog = 1; break; case 'U': -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS do_cldap = 1; -#else /* CLDAP */ - fprintf( stderr, "Compile with -DCLDAP for -U support\n" ); -#endif /* CLDAP */ +#else /* LDAP_CONNECTIONLESS */ + fprintf( stderr, + "Compile with -DLDAP_CONNECTIONLESS for -U support\n" ); +#endif /* LDAP_CONNECTIONLESS */ break; case 'b': searchbase = optarg; diff --git a/clients/rcpt500/query.c b/clients/rcpt500/query.c index 1ac78c17c9..4ba778a1bd 100644 --- a/clients/rcpt500/query.c +++ b/clients/rcpt500/query.c @@ -6,18 +6,21 @@ * All Rights Reserved */ +#include "portable.h" + #include -#include -#include #include -#include + +#include +#include +#include #include "lber.h" #include "ldap.h" -#include "portable.h" -#include "ldapconfig.h" #include "disptmpl.h" + #include "rcpt500.h" +#include "ldapconfig.h" extern int dosyslog; extern int do_cldap; diff --git a/clients/rcpt500/rcpt500.h b/clients/rcpt500/rcpt500.h index 537f92c1c4..8b3a5ea17d 100644 --- a/clients/rcpt500/rcpt500.h +++ b/clients/rcpt500/rcpt500.h @@ -6,6 +6,10 @@ * All Rights Reserved */ +#include + +LDAP_BEGIN_DECL + struct msginfo { char *msg_subject; char *msg_replyto; /* actually could be from From: line */ @@ -16,8 +20,8 @@ struct msginfo { }; struct command { - char *cmd_text; /* text for command, e.g. "HELP" */ - int (*cmd_handler)(); /* pointer to handler function */ + char *cmd_text; /* text for command, e.g. "HELP" */ + int (*cmd_handler)LDAP_P(()); /* pointer to handler function */ }; @@ -27,10 +31,12 @@ struct command { /* * functions */ -int help_cmd(); -int query_cmd(); +int help_cmd LDAP_P(()); +int query_cmd LDAP_P(()); /* * externs */ extern struct command cmds[]; + +LDAP_END_DECL diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c index 49c1763e12..36a325c850 100644 --- a/clients/tools/ldapdelete.c +++ b/clients/tools/ldapdelete.c @@ -8,7 +8,6 @@ #include #include -#include #include #include diff --git a/clients/ud/auth.c b/clients/ud/auth.c index be4727695b..a245a05f13 100644 --- a/clients/ud/auth.c +++ b/clients/ud/auth.c @@ -10,18 +10,21 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include #include -#include +#include #include + +#include +#include + #include #include #include + #include "ud.h" -#ifdef KERBEROS -#include -#include -#endif extern LDAP *ld; /* our LDAP descriptor */ extern int verbose; /* verbosity indicator */ @@ -48,7 +51,7 @@ int implicit; int name_provided; /* was a name passed in? */ struct passwd *pw; /* for getting user id */ char uidname[20]; -#ifdef KERBEROS +#ifdef HAVE_KERBEROS char **krbnames; /* for kerberos names */ int kinited, ikrb; char buf[5]; @@ -130,7 +133,7 @@ int implicit; rdns = ldap_explode_dn(Entry.DN, TRUE); printf(" Authenticating to the directory as \"%s\"...\n", *rdns ); -#ifdef KERBEROS +#ifdef HAVE_KERBEROS /* * First, if the user has a choice of auth methods, ask which * one they want to use. if they want kerberos, ask which @@ -155,7 +158,7 @@ int implicit; if ( hassimple && !kinited ) { printf(" Which password would you like to use?\n"); - printf(" 1 -> X.500 password\n"); + printf(" 1 -> LDAP password\n"); #ifdef UOFM printf(" 2 -> UMICH password (aka Uniqname or Kerberos password)\n"); #else @@ -221,7 +224,7 @@ int implicit; } else { #endif authmethod = LDAP_AUTH_SIMPLE; - sprintf(prompt, " Enter your X.500 password: "); + sprintf(prompt, " Enter your LDAP password: "); do { passwd = mygetpass(prompt); } while (passwd != NULL && *passwd == '\0'); @@ -229,7 +232,7 @@ int implicit; (void) ldap_value_free(rdns); return(0); } -#ifdef KERBEROS +#ifdef HAVE_KERBEROS } (void) ldap_value_free(krbnames); #endif @@ -239,19 +242,19 @@ int implicit; if (ld->ld_errno == LDAP_NO_SUCH_ATTRIBUTE) fprintf(stderr, " Entry has no password\n"); else if (ld->ld_errno == LDAP_INVALID_CREDENTIALS) -#ifdef KERBEROS +#ifdef HAVE_KERBEROS if ( authmethod == LDAP_AUTH_KRBV4 ) { fprintf(stderr, " The Kerberos credentials are invalid.\n"); } else { #endif fprintf(stderr, " The password you provided is incorrect.\n"); -#ifdef KERBEROS +#ifdef HAVE_KERBEROS } #endif else ldap_perror(ld, "ldap_bind_s" ); (void) ldap_bind_s(ld, default_bind_object, - (char *) UD_PASSWD, LDAP_AUTH_SIMPLE); + (char *) UD_BIND_CRED, LDAP_AUTH_SIMPLE); if (default_bind_object == NULL) set_bound_dn(NULL); else @@ -274,12 +277,12 @@ int implicit; return(0); } -#ifdef KERBEROS +#ifdef HAVE_KERBEROS #define FIVEMINS ( 5 * 60 ) #define TGT "krbtgt" -str2upper( s ) +static void str2upper( s ) char *s; { char *p; @@ -307,12 +310,12 @@ static valid_tgt( names ) return( 0 ); } -#ifdef AFSKERBEROS +#ifdef HAVE_AFS_KERBEROS /* * realm must be uppercase for krb_ routines */ str2upper( realm ); -#endif /* AFSKERBEROS */ +#endif /* HAVE_AFS_KERBEROS */ /* * check ticket file for a valid ticket granting ticket @@ -351,7 +354,7 @@ krbgetpass( user, inst, realm, pw, key ) return(-1); } -#ifdef AFSKERBEROS +#ifdef HAVE_AFS_KERBEROS strcpy( lcrealm, realm ); for ( p = lcrealm; *p != '\0'; ++p ) { if ( isupper( *p )) { @@ -360,9 +363,9 @@ krbgetpass( user, inst, realm, pw, key ) } ka_StringToKey( passwd, lcrealm, key ); -#else /* AFSKERBEROS */ +#else /* HAVE_AFS_KERBEROS */ string_to_key( passwd, key ); -#endif /* AFSKERBEROS */ +#endif /* HAVE_AFS_KERBEROS */ return( 0 ); } @@ -382,12 +385,12 @@ static kinit( kname ) return( -1 ); } -#ifdef AFSKERBEROS +#ifdef HAVE_AFS_KERBEROS /* * realm must be uppercase for krb_ routines */ str2upper( realm ); -#endif /* AFSKERBEROS */ +#endif /* HAVE_AFS_KERBEROS */ rc = krb_get_in_tkt( name, inst, realm, TGT, realm, DEFAULT_TKT_LIFE, krbgetpass, NULL, NULL ); @@ -407,7 +410,7 @@ static kinit( kname ) return( 0 ); } -destroy_tickets() +void destroy_tickets(void) { if ( *tktpath != '\0' ) { unlink( tktpath ); @@ -415,13 +418,12 @@ destroy_tickets() } #endif -static void set_bound_dn(s) -char *s; +static void set_bound_dn(char *s) { extern void Free(); extern char *bound_dn; if (bound_dn != NULL) Free(bound_dn); - bound_dn = strdup(s); + bound_dn = (s == NULL) ? NULL : strdup(s); } diff --git a/clients/ud/edit.c b/clients/ud/edit.c index eb8969c533..d9458e0db2 100644 --- a/clients/ud/edit.c +++ b/clients/ud/edit.c @@ -10,14 +10,18 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include #include -#include -#include -#include -#include -#include #include + +#include +#include +#include + +#include + #include #include #include diff --git a/clients/ud/find.c b/clients/ud/find.c index 3551c1af6d..960fa0f337 100644 --- a/clients/ud/find.c +++ b/clients/ud/find.c @@ -10,14 +10,17 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include #include -#ifndef __STDC__ -#include -#endif + +#include +#include + #include #include + #include "ud.h" extern char *search_base; /* search base */ @@ -224,7 +227,7 @@ int quiet; } else if (matches == 1) { if (ldap_search_s(ld, ldap_get_dn(ld, ldap_first_entry(ld, res)), LDAP_SCOPE_BASE, "objectClass=*", read_attrs, FALSE, &res) != LDAP_SUCCESS) { if (ld->ld_errno == LDAP_UNAVAILABLE) - printf(" Could not contact the X.500 server to find \"%s\".\n", who); + printf(" Could not contact the LDAP server to find \"%s\".\n", who); else ldap_perror(ld, "ldap_search_s"); return(NULL); diff --git a/clients/ud/globals.c b/clients/ud/globals.c index 121f36be21..cbde607652 100644 --- a/clients/ud/globals.c +++ b/clients/ud/globals.c @@ -10,6 +10,8 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include #include "ud.h" diff --git a/clients/ud/group.c b/clients/ud/group.c index 64006170eb..c628e94083 100644 --- a/clients/ud/group.c +++ b/clients/ud/group.c @@ -11,10 +11,15 @@ * */ +#include "portable.h" + #include #include +#include + #include #include + #include #include "ud.h" @@ -175,7 +180,7 @@ char *name; #endif /* - * Now add this to the X.500 Directory. + * Now add this to the LDAP Directory. */ if (ldap_add_s(ld, dn, attrs) != 0) { ldap_perror(ld, " ldap_add_s"); @@ -225,7 +230,7 @@ char *name; return; /* - * Now remove this from the X.500 Directory. + * Now remove this from the LDAP Directory. */ if (ldap_delete_s(ld, dn) != 0) { if (ld->ld_errno == LDAP_INSUFFICIENT_ACCESS) @@ -452,7 +457,7 @@ char *group; } /* - * Add the X.500 style names. + * Add the LDAP style names. */ if (count_x500 > 0) { mods[0] = &mod; @@ -562,7 +567,7 @@ char *group; vp = Entry.attrs[attr_to_index("member")].values; if (vp == NULL) { if (verbose) - printf(" \"%s\" has no X.500 members. There is nothing to purge.\n", group); + printf(" \"%s\" has no LDAP members. There is nothing to purge.\n", group); return; } for (; *vp != NULL; vp++) { @@ -805,7 +810,7 @@ int offset; } if (verbose) { printf("\n"); - format("Values may be specified as a name (which is then looked up in the X.500 Directory) or as a domain-style (i.e., user@domain) e-mail address. Simply hit the RETURN key at the prompt when finished.\n", 75, 2); + format("Values may be specified as a name (which is then looked up in the LDAP Directory) or as a domain-style (i.e., user@domain) e-mail address. Simply hit the RETURN key at the prompt when finished.\n", 75, 2); printf("\n"); } diff --git a/clients/ud/help.c b/clients/ud/help.c index 5a1ff231e0..381a8958b7 100644 --- a/clients/ud/help.c +++ b/clients/ud/help.c @@ -10,11 +10,17 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include #include -#include + +#include +#include + #include #include + #include "ud.h" #ifdef DEBUG @@ -88,7 +94,7 @@ char *s; format("should be specified as a ordinary name (e.g., 'Friends of maX500').", 75, 15); printf("\n"); printf(" [where] A place in the Directory needs to be specified. This name\n"); - format("should be specified as an X.500-style name (e.g., 'ou=people, o=University of Michigan, c=United States of America'). In most cases, it is easier to omit the [where] and allow the program to guide you.", 75, 15); + format("should be specified as an LDAP-style name (e.g., 'ou=people, o=University of Michigan, c=United States of America'). In most cases, it is easier to omit the [where] and allow the program to guide you.", 75, 15); printf("\n"); printf(" [who] A person in the Directory needs to be specified. This name\n"); format("can be specified as either a ordinary name (e.g., 'Jane Doe'), or as some other identifying characteristic (e.g., 'uid=babs').", 75, 15); @@ -111,7 +117,7 @@ char *s; } else if (!strncasecmp("groupbase", s, len)) { printf(" groupbase [where]\n\n"); - format("The syntax and use of this command is identical to the more commonly used 'cb' command. This command sets the base which is used to create groups in the X.500 Directory. Setting the base to a certain value does not necessarily grant the person write-access to that part of the Directory in order to successfully create a group.", 75, 2); + format("The syntax and use of this command is identical to the more commonly used 'cb' command. This command sets the base which is used to create groups in the LDAP Directory. Setting the base to a certain value does not necessarily grant the person write-access to that part of the Directory in order to successfully create a group.", 75, 2); } else if (!strncasecmp("cd", s, len) || !strncasecmp("cb", s,len)) { printf(" cb [where]\n"); @@ -125,7 +131,7 @@ char *s; printf("\n * cb default\n\n"); format("sets the search base to its original default value.", 75, 2); printf("\n * cb o=Merit Computer Network, c=US\n\n"); - format("sets the search base to organization given, the Merit Computer Network in this case. This comamnd checks the validity of the specified search base, and rejects it if it is not a valid Distinguished Name (DN). A DN uniquely identifies a portion of the global X.500 namespace.", 75, 2); + format("sets the search base to organization given, the Merit Computer Network in this case. This comamnd checks the validity of the specified search base, and rejects it if it is not a valid Distinguished Name (DN). A DN uniquely identifies a portion of the global LDAP namespace.", 75, 2); } else if (!strncasecmp("quit", s, len) || !strncasecmp("stop",s, len)) { printf(" quit\n"); @@ -145,7 +151,7 @@ char *s; else if (!strncasecmp("modify", s, len) || !strncasecmp("change", s, len)) { printf(" modify [entry]\n"); printf(" change [entry]\n\n"); - format("Changes information associated with an entry in the X.500 Directory. 'change' is an alias for 'modify'.", 75, 2); + format("Changes information associated with an entry in the LDAP Directory. 'change' is an alias for 'modify'.", 75, 2); } else if (!strncasecmp("verbose", s, len)) { printf(" verbose\n\n"); @@ -182,7 +188,7 @@ char *s; } else if (!strncasecmp("tidy", s, len)) { printf(" tidy\n\n"); - format("Unsubscribes you from non-existent groups. Useful when you cannot resign from a group because, while your X.500 entry still contains a pointer to it, someone has removed a group of which you were a subscriber.", 75, 2); + format("Unsubscribes you from non-existent groups. Useful when you cannot resign from a group because, while your LDAP entry still contains a pointer to it, someone has removed a group of which you were a subscriber.", 75, 2); } else if (*s == '?') { format("Prints out a brief description of each command. Same as typing 'help help'.", 75, 2); diff --git a/clients/ud/main.c b/clients/ud/main.c index cb2030c283..3bab4f83b9 100644 --- a/clients/ud/main.c +++ b/clients/ud/main.c @@ -16,34 +16,26 @@ * Simon Fraser University, Academic Computing Services */ +#include "portable.h" + #include -#include -#if defined(NeXT) #include -#include -#else NeXT -#include -#endif NeXT -#include -#include -#ifndef DOS -#if defined( NeXT ) || defined( ultrix ) || defined( osf1 ) || (defined(SunOS) && SunOS < 40) -#include -#else /* defined( NeXT ) || defined( ultrix ) etc. */ -#include -#endif /* defined( NeXT ) || defined( ultrix ) etc. */ -#endif /* !DOS */ -#if defined( aix ) || defined( __NetBSD__ ) -#include -#endif /* aix || __NetBSD__ */ -#include #include #include -#include +#include + +#include +#include +#include +#include + +#ifdef HAVE_SYS_FILE_H +#include +#endif + #include #include #include -#include "portable.h" #include "ud.h" #ifndef lint @@ -68,8 +60,8 @@ static int dereference = TRUE; char *default_bind_object = UD_BINDDN; char *bound_dn; /* bound user's Distinguished Name */ -char *group_base; /* place in X.500 tree where groups are */ -char *search_base; /* place in X.500 tree where searches start */ +char *group_base; /* place in LDAP tree where groups are */ +char *search_base; /* place in LDAP tree where searches start */ static jmp_buf env; /* spot to jump to on an interrupt */ @@ -374,7 +366,7 @@ char **base, *s; } /* - * User wants to ascend one level in the X.500 tree. + * User wants to ascend one level in the LDAP tree. * Easy: Just strip off the first element of the * current search base, unless it's the root, in * which case we just do nothing. @@ -540,7 +532,7 @@ initialize_client() char *term; /* for tty set-up */ char *config; /* config file to use */ static char bp[1024]; /* for tty set-up */ - extern SIG_FN attn(); /* ^C signal handler */ + extern RETSIGTYPE attn(); /* ^C signal handler */ extern char *getenv(); extern void Free(); @@ -627,13 +619,13 @@ initialize_client() * because we want to be sure to use TCP, not UDP. */ if ((ld = ldap_open(server, ldap_port)) == NULL) { - fprintf(stderr, " The X.500 Directory is temporarily unavailable. Please try again later.\n"); + fprintf(stderr, " The LDAP Directory is temporarily unavailable. Please try again later.\n"); exit(0); /* NOTREACHED */ } - if (ldap_bind_s(ld, (char *) default_bind_object, (char *) UD_PASSWD, + if (ldap_bind_s(ld, (char *) default_bind_object, (char *) UD_BIND_CRED, LDAP_AUTH_SIMPLE) != LDAP_SUCCESS) { - fprintf(stderr, " The X.500 Directory is temporarily unavailable. Please try again later.\n"); + fprintf(stderr, " The LDAP Directory is temporarily unavailable. Please try again later.\n"); if (ld->ld_errno != LDAP_UNAVAILABLE) ldap_perror(ld, " ldap_bind_s"); exit(0); @@ -667,10 +659,10 @@ initialize_client() (void) signal(SIGINT, attn); -#if !defined(DOS) && !defined(NOTERMCAP) +#ifndef NO_TERMCAP { struct winsize win; /* for tty set-up */ - extern SIG_FN chwinsz(); /* WINSZ signal handler */ + extern RETSIGTYPE chwinsz(); /* WINSZ signal handler */ if (((term = getenv("TERM")) == NULL) || (tgetent(bp, term) <= 0)) return; @@ -696,7 +688,7 @@ initialize_client() #endif } -SIG_FN attn() +RETSIGTYPE attn() { fflush(stderr); fflush(stdout); @@ -707,8 +699,8 @@ SIG_FN attn() longjmp(env, 1); } -#if !defined(DOS) && !defined(NOTERMCAP) -SIG_FN chwinsz() +#ifndef NO_TERMCAP +RETSIGTYPE chwinsz() { struct winsize win; diff --git a/clients/ud/mod.c b/clients/ud/mod.c index ef7099e948..551941800d 100644 --- a/clients/ud/mod.c +++ b/clients/ud/mod.c @@ -10,15 +10,19 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include #include #include -#include -#include +#include #ifndef __STDC__ #include #endif #include + +#include +#include #include "ud.h" extern struct entry Entry; @@ -109,7 +113,7 @@ char *who; if (verbose && !printed_warning && (ld->ld_errno == LDAP_NO_SUCH_ATTRIBUTE)) { printed_warning = 1; printf("\n WARNING!\n"); - printf(" You are about to make a modification to an X.500 entry\n"); + printf(" You are about to make a modification to an LDAP entry\n"); printf(" that has its \"automatic updates\" field set to ON.\n"); printf(" This means that the entry will be automatically updated\n"); printf(" each month from official University sources like the\n"); @@ -481,7 +485,7 @@ mail_is_good: if (lmp == (LDAPMessage *) NULL) { printf(" Could not find \"%s\" in the Directory\n", line); if (verbose) - format("Owners of groups must be valid entries in the X.500 Directory. The name you have typed above could not be found in the X.500 Directory.", 72, 2); + format("Owners of groups must be valid entries in the LDAP Directory. The name you have typed above could not be found in the LDAP Directory.", 72, 2); return(NULL); } elmp = ldap_first_entry(ld, lmp); @@ -620,9 +624,9 @@ char *who; if (verbose) { printf("\n By default, updates that are received from the Personnel\n"); printf(" Office and the Office of the Registrar are applied to all\n"); - printf(" entries in the X.500 database each month. Sometimes this\n"); + printf(" entries in the LDAP database each month. Sometimes this\n"); printf(" feature is undesirable. For example, if you maintain your\n"); - printf(" entry in the X.500 database manually, you may not want to\n"); + printf(" entry in the LDAP database manually, you may not want to\n"); printf(" have these updates applied to your entry, possibly overwriting\n"); printf(" correct information with out-dated information.\n\n"); } diff --git a/clients/ud/print.c b/clients/ud/print.c index 4185bdaef3..7eafd315b5 100644 --- a/clients/ud/print.c +++ b/clients/ud/print.c @@ -10,6 +10,8 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include #include #include diff --git a/clients/ud/string_to_key.c b/clients/ud/string_to_key.c index f1adfa8f0a..cea78a7a6c 100644 --- a/clients/ud/string_to_key.c +++ b/clients/ud/string_to_key.c @@ -1,3 +1,5 @@ +#include "portable.h" + #if defined(KERBEROS) && !defined(openbsd) /* * $Source: /repo/OpenLDAP/pkg/ldap/clients/ud/string_to_key.c,v $ diff --git a/clients/ud/util.c b/clients/ud/util.c index 0e6dda6ccc..c7fc697dbd 100644 --- a/clients/ud/util.c +++ b/clients/ud/util.c @@ -10,45 +10,25 @@ * is provided ``as is'' without express or implied warranty. */ -#define DISABLE_BRIDGE #include "portable.h" #include #include -#include +#include #include -#ifdef DOS -#include -#endif -#include -#if defined( NeXT ) -#endif -#include +#include +#include #include -#include +#include +#include #include #include - #include -#if !defined(DOS) && !defined( VMS) -#include -#endif -#include "portable.h" -#ifdef USE_TERMIOS -#include -#else /* USE_TERMIOS */ -#include -#endif /* USE_TERMIOS */ - #include "ud.h" -#if defined(VMS) -#define getch getchar -#endif - #ifdef DEBUG extern int debug; #endif @@ -81,7 +61,7 @@ char *prompt; register char *p; register int c; FILE *fi; - SIG_FN (*sig)(); + RETSIGTYPE (*sig)(); #ifdef DEBUG if (debug & D_TRACE) diff --git a/configure b/configure index c4f6d6b700..2cd35bfb9a 100755 --- a/configure +++ b/configure @@ -5922,15 +5922,16 @@ for ac_func in \ strtol \ strtoul \ sysconf \ + waitpid \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5929: checking for $ac_func" >&5 +echo "configure:5930: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5981,12 +5982,12 @@ done for ac_func in getopt strdup do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5985: checking for $ac_func" >&5 +echo "configure:5986: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6039,13 +6040,13 @@ done # Check Configuration echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6 -echo "configure:6043: checking declaration of sys_errlist" >&5 +echo "configure:6044: checking declaration of sys_errlist" >&5 if eval "test \"`echo '$''{'ol_cv_dcl_sys_errlist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -6055,7 +6056,7 @@ int main() { char *c = (char *) *sys_errlist ; return 0; } EOF -if { (eval echo configure:6059: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6060: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ol_cv_dcl_sys_errlist=yes else @@ -6076,20 +6077,20 @@ if test $ol_cv_dcl_sys_errlist = no ; then EOF echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6 -echo "configure:6080: checking existence of sys_errlist" >&5 +echo "configure:6081: checking existence of sys_errlist" >&5 if eval "test \"`echo '$''{'ol_cv_have_sys_errlist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *c = (char *) *sys_errlist ; return 0; } EOF -if { (eval echo configure:6093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ol_cv_have_sys_errlist=yes else diff --git a/configure.in b/configure.in index 0b5967cc63..725008a5e8 100644 --- a/configure.in +++ b/configure.in @@ -755,6 +755,7 @@ AC_CHECK_FUNCS( \ strtol \ strtoul \ sysconf \ + waitpid \ ) AC_REPLACE_FUNCS(getopt strdup) diff --git a/include/ac/socket.h b/include/ac/socket.h index 573601ea60..d6a3405702 100644 --- a/include/ac/socket.h +++ b/include/ac/socket.h @@ -12,6 +12,10 @@ #ifdef HAVE_SYS_SOCKET_H #include +#ifdef HAVE_SYS_SELECT_H +#include +#endif + #include #include #include diff --git a/include/ac/wait.h b/include/ac/wait.h index 274dddd5f5..af2eb5b18a 100644 --- a/include/ac/wait.h +++ b/include/ac/wait.h @@ -16,4 +16,10 @@ # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif +#ifdef WCONTINUED +# define WAIT_FLAGS ( WNOHANG | WUNTRACED | WCONTINUED ) +#else +# define WAIT_FLAGS ( WNOHANG | WUNTRACED ) +#endif + #endif /* _AC_WAIT_H */ diff --git a/include/ldap.h b/include/ldap.h index acb1d50ae7..605356408d 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -501,6 +501,10 @@ typedef struct ldap_url_desc { #define LDAP_URL_ERR_BADSCOPE 3 /* URL scope string is invalid */ #define LDAP_URL_ERR_MEM 4 /* can't allocate memory space */ +/* this typedef is never used, only exists to rid of declaration + in function param list warning */ +typedef struct timeval LDAPtv; + /* * in abandon.c: */ diff --git a/include/portable.h.in b/include/portable.h.in index dd1f58b804..67a861f055 100644 --- a/include/portable.h.in +++ b/include/portable.h.in @@ -306,6 +306,9 @@ is provided ``as is'' without express or implied warranty. /* Define if you have the sysconf function. */ #undef HAVE_SYSCONF +/* Define if you have the waitpid function. */ +#undef HAVE_WAITPID + /* Define if you have the header file. */ #undef HAVE_DB_H diff --git a/include/portable.h.nt b/include/portable.h.nt index 0dc0aac5de..b81d8d1656 100644 --- a/include/portable.h.nt +++ b/include/portable.h.nt @@ -319,6 +319,9 @@ typedef char * caddr_t; /* Define if you have the sysconf function. */ /* #undef HAVE_SYSCONF */ +/* Define if you have the waitpid function. */ +#define HAVE_WAITPID 1 + /* Define if you have the header file. */ /* #undef HAVE_DB_H */