s/exit(1)/exit(EXIT_FAILURE)/

s/exit(0)/exit(EXIT_SUCCESS)/
add <ac/stdlib.h> where needed and other minor header adjustments
This commit is contained in:
Kurt Zeilenga 1999-08-03 18:14:24 +00:00
parent 32ba884d8a
commit df8f7cbb9b
82 changed files with 434 additions and 404 deletions

View file

@ -338,6 +338,15 @@ Package=<4>
Begin Project Dependency Begin Project Dependency
Project_Dep_Name liblber Project_Dep_Name liblber
End Project Dependency End Project Dependency
Begin Project Dependency
Project_Dep_Name libldif
End Project Dependency
Begin Project Dependency
Project_Dep_Name libldap
End Project Dependency
Begin Project Dependency
Project_Dep_Name liblutil
End Project Dependency
}}} }}}
############################################################################### ###############################################################################

View file

@ -34,12 +34,10 @@
#include <sys/resource.h> #include <sys/resource.h>
#endif #endif
#include "lber.h" #include <ldap.h>
#include "ldap.h"
#include "fax500.h" #include "fax500.h"
#include "ldap_defaults.h"
#include <ldap_defaults.h>
#define USER 0 #define USER 0
#define GROUP_ERRORS 1 #define GROUP_ERRORS 1

View file

@ -33,8 +33,7 @@
#include <ldap.h> #include <ldap.h>
#include "fax500.h" #include "fax500.h"
#include "ldap_defaults.h"
#include <ldap_defaults.h>
#define DEFAULT_PORT 79 #define DEFAULT_PORT 79
#define DEFAULT_SIZELIMIT 50 #define DEFAULT_SIZELIMIT 50
@ -219,7 +218,7 @@ main( int argc, char **argv )
if ( fgets( buf, sizeof(buf), stdin ) == NULL if ( fgets( buf, sizeof(buf), stdin ) == NULL
|| buf[0] == '\n' ) { || buf[0] == '\n' ) {
exit( 1 ); exit( EXIT_FAILURE );
} }
i = atoi( buf ) - 1; i = atoi( buf ) - 1;
e = ldap_first_entry( ld, result ); e = ldap_first_entry( ld, result );
@ -228,13 +227,13 @@ main( int argc, char **argv )
} }
if ( e == NULL ) { if ( e == NULL ) {
fprintf( stderr, "Invalid choice!\n" ); fprintf( stderr, "Invalid choice!\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
print_entry( ld, e ); print_entry( ld, e );
} else if ( matches == 0 ) { } else if ( matches == 0 ) {
fprintf( stderr, "No matches found for \"%s\"\n", key ); fprintf( stderr, "No matches found for \"%s\"\n", key );
exit( 1 ); exit( EXIT_FAILURE );
} else { } else {
fprintf( stderr, "Error return from ldap_count_entries\n" ); fprintf( stderr, "Error return from ldap_count_entries\n" );
exit( -1 ); exit( -1 );
@ -260,7 +259,7 @@ print_entry( LDAP *ld, LDAPMessage *e )
if ( (fax = ldap_get_values( ld, e, "facsimileTelephoneNumber" )) if ( (fax = ldap_get_values( ld, e, "facsimileTelephoneNumber" ))
== NULL ) { == NULL ) {
fprintf( stderr, "Entry \"%s\" has no fax number.\n", dn ); fprintf( stderr, "Entry \"%s\" has no fax number.\n", dn );
exit( 1 ); exit( EXIT_FAILURE );
} }
faxmail = faxtotpc( fax[0], NULL ); faxmail = faxtotpc( fax[0], NULL );
title = ldap_get_values( ld, e, "title" ); title = ldap_get_values( ld, e, "title" );

View file

@ -29,10 +29,8 @@
#include <sys/resource.h> #include <sys/resource.h>
#endif #endif
#include "lber.h" #include <ldap.h>
#include "ldap.h" #include <disptmpl.h>
#include "disptmpl.h"
#include "ldap_defaults.h" #include "ldap_defaults.h"
@ -54,7 +52,7 @@ static void
usage( char *name ) usage( char *name )
{ {
fprintf( stderr, "usage: %s [-l] [-x ldaphost] [-p ldapport] [-f filterfile] [-t templatefile] [-c rdncount]\r\n", name ); fprintf( stderr, "usage: %s [-l] [-x ldaphost] [-p ldapport] [-f filterfile] [-t templatefile] [-c rdncount]\r\n", name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -108,7 +106,7 @@ main( int argc, char **argv )
if ( getpeername( 0, (struct sockaddr *)&peername, if ( getpeername( 0, (struct sockaddr *)&peername,
&peernamelen ) != 0 ) { &peernamelen ) != 0 ) {
perror( "getpeername" ); perror( "getpeername" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
@ -161,7 +159,7 @@ do_query( void )
if ( (ld = ldap_init( ldaphost, ldapport )) == NULL ) { if ( (ld = ldap_init( ldaphost, ldapport )) == NULL ) {
fprintf( stderr, FINGER_UNAVAILABLE ); fprintf( stderr, FINGER_UNAVAILABLE );
perror( "ldap_init" ); perror( "ldap_init" );
exit( 1 ); exit( EXIT_FAILURE );
} }
{ {
@ -175,7 +173,7 @@ do_query( void )
{ {
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( EXIT_FAILURE );
} }
#ifdef HAVE_SYSCONF #ifdef HAVE_SYSCONF
@ -202,11 +200,11 @@ do_query( void )
perror( "select" ); perror( "select" );
else else
fprintf( stderr, "connection timed out on input\r\n" ); fprintf( stderr, "connection timed out on input\r\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( fgets( buf, sizeof(buf), stdin ) == NULL ) if ( fgets( buf, sizeof(buf), stdin ) == NULL )
exit( 1 ); exit( EXIT_FAILURE );
len = strlen( buf ); len = strlen( buf );
@ -279,7 +277,7 @@ do_search( LDAP *ld, char *buf )
!= LDAP_SUCCESS && rc != LDAP_SIZELIMIT_EXCEEDED ) { != LDAP_SUCCESS && rc != LDAP_SIZELIMIT_EXCEEDED ) {
fprintf( stderr, FINGER_UNAVAILABLE ); fprintf( stderr, FINGER_UNAVAILABLE );
ldap_perror( ld, "ldap_search_st" ); ldap_perror( ld, "ldap_search_st" );
exit( 1 ); exit( EXIT_FAILURE );
} }
matches = ldap_count_entries( ld, result ); matches = ldap_count_entries( ld, result );
@ -290,7 +288,7 @@ do_search( LDAP *ld, char *buf )
== NULL ) { == NULL ) {
fprintf( stderr, "Cannot open filter file (%s)\n", fprintf( stderr, "Cannot open filter file (%s)\n",
filterfile ); filterfile );
exit( 1 ); exit( EXIT_FAILURE );
} }
for ( fi = ldap_getfirstfilter( fd, "finger", buf ); for ( fi = ldap_getfirstfilter( fd, "finger", buf );
@ -306,7 +304,7 @@ do_search( LDAP *ld, char *buf )
{ {
fprintf( stderr, FINGER_UNAVAILABLE ); fprintf( stderr, FINGER_UNAVAILABLE );
ldap_perror( ld, "ldap_search_st" ); ldap_perror( ld, "ldap_search_st" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( (matches = ldap_count_entries( ld, result )) != 0 ) if ( (matches = ldap_count_entries( ld, result )) != 0 )
@ -330,7 +328,7 @@ do_search( LDAP *ld, char *buf )
fflush( stdout ); fflush( stdout );
} else if ( matches < 0 ) { } else if ( matches < 0 ) {
fprintf( stderr, "error return from ldap_count_entries\r\n" ); fprintf( stderr, "error return from ldap_count_entries\r\n" );
exit( 1 ); exit( EXIT_FAILURE );
} else if ( matches <= FINGER_LISTLIMIT ) { } else if ( matches <= FINGER_LISTLIMIT ) {
printf( "%d %s match%s found for \"%s\":\r\n", matches, printf( "%d %s match%s found for \"%s\":\r\n", matches,
ufn ? "UFN" : fi->lfi_desc, matches > 1 ? "es" : "", buf ); ufn ? "UFN" : fi->lfi_desc, matches > 1 ? "es" : "", buf );
@ -431,7 +429,7 @@ do_read( LDAP *ld, LDAPMessage *e )
defvals, entry2textwrite, (void *)stdout, "\r\n", rdncount, defvals, entry2textwrite, (void *)stdout, "\r\n", rdncount,
LDAP_DISP_OPT_DOSEARCHACTIONS ) != LDAP_SUCCESS ) { LDAP_DISP_OPT_DOSEARCHACTIONS ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_entry2text_search" ); ldap_perror( ld, "ldap_entry2text_search" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( tmpllist != NULL ) { if ( tmpllist != NULL ) {

View file

@ -35,16 +35,16 @@
#include <sys/resource.h> #include <sys/resource.h>
#endif #endif
#include <ldap.h>
#include <disptmpl.h>
#include "ldap_defaults.h" #include "ldap_defaults.h"
#include "lber.h"
#include "ldap.h"
#define ldap_debug debug #define ldap_debug debug
#include "ldap_log.h" #include "ldap_log.h"
#include "lutil.h" #include "lutil.h"
#include "disptmpl.h"
int debug; int debug;
int dosyslog; int dosyslog;
@ -74,7 +74,7 @@ static void
usage( char *name ) usage( char *name )
{ {
fprintf( stderr, "usage: %s [-d debuglevel] [-f filterfile] [-t templatefile]\r\n\t[-a] [-l] [-p port] [-x ldaphost] [-b searchbase] [-c rdncount]\r\n", name ); fprintf( stderr, "usage: %s [-d debuglevel] [-f filterfile] [-t templatefile]\r\n\t[-a] [-l] [-p port] [-x ldaphost] [-b searchbase] [-c rdncount]\r\n", name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -144,7 +144,7 @@ main( int argc, char **argv )
if ( myhost[0] == '\0' && gethostname( myhost, sizeof(myhost) ) if ( myhost[0] == '\0' && gethostname( myhost, sizeof(myhost) )
== -1 ) { == -1 ) {
perror( "gethostname" ); perror( "gethostname" );
exit( 1 ); exit( EXIT_FAILURE );
} }
#endif #endif
@ -222,7 +222,7 @@ main( int argc, char **argv )
do_queries( 0 ); do_queries( 0 );
exit( 0 ); exit( EXIT_SUCCESS );
} }
for ( ;; ) { for ( ;; ) {
@ -243,7 +243,7 @@ main( int argc, char **argv )
if ( (ns = accept( s, (struct sockaddr *) &from, &fromlen )) if ( (ns = accept( s, (struct sockaddr *) &from, &fromlen ))
== -1 ) { == -1 ) {
if ( debug ) perror( "accept" ); if ( debug ) perror( "accept" );
exit( 1 ); exit( EXIT_FAILURE );
} }
hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr), hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr),
@ -287,7 +287,7 @@ set_socket( int port )
if ( (s = socket( AF_INET, SOCK_STREAM, 0 )) == -1 ) { if ( (s = socket( AF_INET, SOCK_STREAM, 0 )) == -1 ) {
perror( "socket" ); perror( "socket" );
exit( 1 ); exit( EXIT_FAILURE );
} }
/* set option so clients can't keep us from coming back up */ /* set option so clients can't keep us from coming back up */
@ -295,7 +295,7 @@ set_socket( int port )
if ( setsockopt( s, SOL_SOCKET, SO_REUSEADDR, (char *) &one, if ( setsockopt( s, SOL_SOCKET, SO_REUSEADDR, (char *) &one,
sizeof(one) ) < 0 ) { sizeof(one) ) < 0 ) {
perror( "setsockopt" ); perror( "setsockopt" );
exit( 1 ); exit( EXIT_FAILURE );
} }
/* bind to a name */ /* bind to a name */
@ -304,13 +304,13 @@ set_socket( int port )
addr.sin_port = htons( port ); addr.sin_port = htons( port );
if ( bind( s, (struct sockaddr *) &addr, sizeof(addr) ) ) { if ( bind( s, (struct sockaddr *) &addr, sizeof(addr) ) ) {
perror( "bind" ); perror( "bind" );
exit( 1 ); exit( EXIT_FAILURE );
} }
/* listen for connections */ /* listen for connections */
if ( listen( s, 5 ) == -1 ) { if ( listen( s, 5 ) == -1 ) {
perror( "listen" ); perror( "listen" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( debug ) printf("tcp socket allocated, bound, and listening\n"); if ( debug ) printf("tcp socket allocated, bound, and listening\n");
@ -350,7 +350,7 @@ do_queries( int s )
LDAP *ld; LDAP *ld;
if ( (fp = fdopen( s, "a+")) == NULL ) { if ( (fp = fdopen( s, "a+")) == NULL ) {
exit( 1 ); exit( EXIT_FAILURE );
} }
timeout.tv_sec = GO500_TIMEOUT; timeout.tv_sec = GO500_TIMEOUT;
@ -359,10 +359,10 @@ do_queries( int s )
FD_SET( fileno( fp ), &readfds ); FD_SET( fileno( fp ), &readfds );
if ( (rc = select( dtblsize, &readfds, 0, 0, &timeout )) <= 0 ) if ( (rc = select( dtblsize, &readfds, 0, 0, &timeout )) <= 0 )
exit( 1 ); exit( EXIT_FAILURE );
if ( fgets( buf, sizeof(buf), fp ) == NULL ) if ( fgets( buf, sizeof(buf), fp ) == NULL )
exit( 1 ); exit( EXIT_FAILURE );
len = strlen( buf ); len = strlen( buf );
if ( debug ) { if ( debug ) {
@ -398,7 +398,7 @@ do_queries( int s )
LDAP_SERVER_DOWN, myhost, myport ); LDAP_SERVER_DOWN, myhost, myport );
fprintf( fp, ".\r\n" ); fprintf( fp, ".\r\n" );
rewind(fp); rewind(fp);
exit( 1 ); exit( EXIT_FAILURE );
} else { } else {
int deref = GO500_DEREF; int deref = GO500_DEREF;
ldap_set_option(ld, LDAP_OPT_DEREF, &deref); ldap_set_option(ld, LDAP_OPT_DEREF, &deref);
@ -410,7 +410,7 @@ do_queries( int s )
rc, myhost, myport ); rc, myhost, myport );
fprintf( fp, ".\r\n" ); fprintf( fp, ".\r\n" );
rewind(fp); rewind(fp);
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
@ -443,7 +443,7 @@ do_queries( int s )
ldap_unbind( ld ); ldap_unbind( ld );
} }
exit( 1 ); exit( EXIT_FAILURE );
/* NOT REACHED */ /* NOT REACHED */
} }
@ -493,7 +493,7 @@ do_search( LDAP *ld, FILE *fp, char *buf )
if ( (filtd = ldap_init_getfilter( filterfile )) == NULL ) { if ( (filtd = ldap_init_getfilter( filterfile )) == NULL ) {
fprintf( stderr, "Cannot open filter file (%s)\n", fprintf( stderr, "Cannot open filter file (%s)\n",
filterfile ); filterfile );
exit( 1 ); exit( EXIT_FAILURE );
} }
tv.tv_sec = GO500_TIMEOUT; tv.tv_sec = GO500_TIMEOUT;
@ -585,7 +585,7 @@ do_read( LDAP *ld, FILE *fp, char *dn )
entry2textwrite, (void *) fp, "\r\n", rdncount, entry2textwrite, (void *) fp, "\r\n", rdncount,
LDAP_DISP_OPT_DOSEARCHACTIONS ) != LDAP_SUCCESS ) { LDAP_DISP_OPT_DOSEARCHACTIONS ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_entry2text_search" ); ldap_perror( ld, "ldap_entry2text_search" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( tmpllist != NULL ) { if ( tmpllist != NULL ) {

View file

@ -36,15 +36,14 @@
#endif #endif
#include "lber.h" #include <ldap.h>
#include "ldap.h" #include <disptmpl.h>
#define ldap_debug debug #define ldap_debug debug
#include "ldap_log.h" #include "ldap_log.h"
#include "lutil.h" #include "lutil.h"
#include "disptmpl.h"
#include "ldap_defaults.h" #include "ldap_defaults.h"
@ -88,7 +87,7 @@ static void
usage( char *name ) usage( char *name )
{ {
fprintf( stderr, "usage: %s [-d debuglevel] [-I] [-p port] [-P ldapport] [-l]\r\n\t[-x ldaphost] [-a] [-h helpfile] [-f filterfile] [-t templatefile] [-c rdncount]\r\n", name ); fprintf( stderr, "usage: %s [-d debuglevel] [-I] [-p port] [-P ldapport] [-l]\r\n\t[-x ldaphost] [-a] [-h helpfile] [-f filterfile] [-t templatefile] [-c rdncount]\r\n", name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -182,7 +181,7 @@ main (int argc, char **argv )
if ( myhost[0] == '\0' && gethostname( myhost, sizeof(myhost) ) if ( myhost[0] == '\0' && gethostname( myhost, sizeof(myhost) )
== -1 ) { == -1 ) {
perror( "gethostname" ); perror( "gethostname" );
exit( 1 ); exit( EXIT_FAILURE );
} }
#endif #endif
@ -248,7 +247,7 @@ main (int argc, char **argv )
tcp_close( 0 ); tcp_close( 0 );
exit( 0 ); exit( EXIT_SUCCESS );
} }
for ( ;; ) { for ( ;; ) {
@ -269,7 +268,7 @@ main (int argc, char **argv )
if ( (ns = accept( s, (struct sockaddr *) &from, &fromlen )) if ( (ns = accept( s, (struct sockaddr *) &from, &fromlen ))
== -1 ) { == -1 ) {
if ( debug ) perror( "accept" ); if ( debug ) perror( "accept" );
exit( 1 ); exit( EXIT_FAILURE );
} }
hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr), hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr),
@ -313,7 +312,7 @@ set_socket( int port )
if ( (s = socket( AF_INET, SOCK_STREAM, 0 )) == -1 ) { if ( (s = socket( AF_INET, SOCK_STREAM, 0 )) == -1 ) {
perror( "socket" ); perror( "socket" );
exit( 1 ); exit( EXIT_FAILURE );
} }
/* set option so clients can't keep us from coming back up */ /* set option so clients can't keep us from coming back up */
@ -321,7 +320,7 @@ set_socket( int port )
if ( setsockopt( s, SOL_SOCKET, SO_REUSEADDR, (char *) &one, if ( setsockopt( s, SOL_SOCKET, SO_REUSEADDR, (char *) &one,
sizeof(one) ) < 0 ) { sizeof(one) ) < 0 ) {
perror( "setsockopt" ); perror( "setsockopt" );
exit( 1 ); exit( EXIT_FAILURE );
} }
/* bind to a name */ /* bind to a name */
@ -330,13 +329,13 @@ set_socket( int port )
addr.sin_port = htons( port ); addr.sin_port = htons( port );
if ( bind( s, (struct sockaddr *) &addr, sizeof(addr) ) ) { if ( bind( s, (struct sockaddr *) &addr, sizeof(addr) ) ) {
perror( "bind" ); perror( "bind" );
exit( 1 ); exit( EXIT_FAILURE );
} }
/* listen for connections */ /* listen for connections */
if ( listen( s, 5 ) == -1 ) { if ( listen( s, 5 ) == -1 ) {
perror( "listen" ); perror( "listen" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( debug ) if ( debug )
@ -379,7 +378,7 @@ do_queries( int s )
if ( (fp = fdopen( s, "a+")) == NULL ) { if ( (fp = fdopen( s, "a+")) == NULL ) {
perror( "fdopen" ); perror( "fdopen" );
exit( 1 ); exit( EXIT_FAILURE );
} }
timeout.tv_sec = GO500GW_TIMEOUT; timeout.tv_sec = GO500GW_TIMEOUT;
@ -388,10 +387,10 @@ do_queries( int s )
FD_SET( fileno( fp ), &readfds ); FD_SET( fileno( fp ), &readfds );
if ( (rc = select( dtblsize, &readfds, 0, 0, &timeout )) <= 0 ) if ( (rc = select( dtblsize, &readfds, 0, 0, &timeout )) <= 0 )
exit( 1 ); exit( EXIT_FAILURE );
if ( fgets( buf, sizeof(buf), fp ) == NULL ) if ( fgets( buf, sizeof(buf), fp ) == NULL )
exit( 1 ); exit( EXIT_FAILURE );
len = strlen( buf ); len = strlen( buf );
if ( debug ) { if ( debug ) {
@ -437,7 +436,7 @@ do_queries( int s )
fprintf( fp, ".\r\n" ); fprintf( fp, ".\r\n" );
rewind(fp); rewind(fp);
exit( 0 ); exit( EXIT_SUCCESS );
/* NOT REACHED */ /* NOT REACHED */
} }
@ -447,7 +446,7 @@ do_queries( int s )
LDAP_SERVER_DOWN, myhost, myport ); LDAP_SERVER_DOWN, myhost, myport );
fprintf( fp, ".\r\n" ); fprintf( fp, ".\r\n" );
rewind(fp); rewind(fp);
exit( 1 ); exit( EXIT_FAILURE );
} }
deref = LDAP_DEREF_ALWAYS; deref = LDAP_DEREF_ALWAYS;
@ -463,7 +462,7 @@ do_queries( int s )
rc, myhost, myport ); rc, myhost, myport );
fprintf( fp, ".\r\n" ); fprintf( fp, ".\r\n" );
rewind(fp); rewind(fp);
exit( 1 ); exit( EXIT_FAILURE );
} }
switch ( *query++ ) { switch ( *query++ ) {
@ -487,7 +486,7 @@ do_queries( int s )
fprintf( fp, ".\r\n" ); fprintf( fp, ".\r\n" );
rewind(fp); rewind(fp);
exit( 0 ); exit( EXIT_SUCCESS );
/* NOT REACHED */ /* NOT REACHED */
} }
@ -729,7 +728,7 @@ do_search( LDAP *ld, FILE *fp, char *query )
if ( (filter = strchr( query, '\t' )) == NULL ) { if ( (filter = strchr( query, '\t' )) == NULL ) {
fprintf( fp, "3Missing filter!\r\n" ); fprintf( fp, "3Missing filter!\r\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
*filter++ = '\0'; *filter++ = '\0';
base = query; base = query;
@ -757,7 +756,7 @@ do_search( LDAP *ld, FILE *fp, char *query )
#endif #endif
if ( (scope = make_scope( ld, base )) == -1 ) { if ( (scope = make_scope( ld, base )) == -1 ) {
fprintf( fp, "3Bad scope\r\n" ); fprintf( fp, "3Bad scope\r\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
filtertype = (scope == LDAP_SCOPE_ONELEVEL ? filtertype = (scope == LDAP_SCOPE_ONELEVEL ?
@ -771,7 +770,7 @@ do_search( LDAP *ld, FILE *fp, char *query )
if ( (filtd = ldap_init_getfilter( filterfile )) == NULL ) { if ( (filtd = ldap_init_getfilter( filterfile )) == NULL ) {
fprintf( stderr, "Cannot open filter file (%s)\n", fprintf( stderr, "Cannot open filter file (%s)\n",
filterfile ); filterfile );
exit( 1 ); exit( EXIT_FAILURE );
} }
count = 0; count = 0;

View file

@ -39,8 +39,7 @@
#include <sys/resource.h> #include <sys/resource.h>
#endif #endif
#include "lber.h" #include <ldap.h>
#include "ldap.h"
#include "ldap_defaults.h" #include "ldap_defaults.h"

View file

@ -112,7 +112,7 @@ main( int argc, char **argv )
} }
if ( errflg || optind < argc ) { if ( errflg || optind < argc ) {
fprintf( stderr, usage, prog ); fprintf( stderr, usage, prog );
exit( 1 ); exit( EXIT_FAILURE );
} }
#ifdef SIGPIPE #ifdef SIGPIPE
@ -243,7 +243,7 @@ read_hdr( FILE *fp, int offset, char *buf, int MAXSIZEe, char **linep )
if ( dosyslog ) { if ( dosyslog ) {
syslog( LOG_ERR, "strdup: %m" ); syslog( LOG_ERR, "strdup: %m" );
} }
exit( 1 ); exit( EXIT_FAILURE );
} }
while ( 1 ) { while ( 1 ) {
@ -257,7 +257,7 @@ read_hdr( FILE *fp, int offset, char *buf, int MAXSIZEe, char **linep )
if ( dosyslog ) { if ( dosyslog ) {
syslog( LOG_ERR, "realloc: %m" ); syslog( LOG_ERR, "realloc: %m" );
} }
exit( 1 ); exit( EXIT_FAILURE );
} }
strcat( hdr, "\n" ); strcat( hdr, "\n" );
strcat( hdr, *linep ); strcat( hdr, *linep );

View file

@ -8,8 +8,6 @@
#include "portable.h" #include "portable.h"
#include <stdio.h>
#include <ac/stdlib.h> #include <ac/stdlib.h>
#include <ac/ctype.h> #include <ac/ctype.h>
@ -17,10 +15,10 @@
#include <ac/syslog.h> #include <ac/syslog.h>
#include <ac/time.h> #include <ac/time.h>
#include "lber.h" #include <stdio.h>
#include "ldap.h"
#include "disptmpl.h" #include <ldap.h>
#include <disptmpl.h>
#include "rcpt500.h" #include "rcpt500.h"
#include "ldap_defaults.h" #include "ldap_defaults.h"

View file

@ -81,7 +81,7 @@ main( int argc, char **argv )
case 'f': /* read DNs from a file */ case 'f': /* read DNs from a file */
if (( fp = fopen( optarg, "r" )) == NULL ) { if (( fp = fopen( optarg, "r" )) == NULL ) {
perror( optarg ); perror( optarg );
exit( 1 ); exit( EXIT_FAILURE );
} }
break; break;
case 'd': case 'd':

View file

@ -26,9 +26,9 @@
#include <lber.h> #include <lber.h>
#include <ldap.h> #include <ldap.h>
#include <ldif.h>
#include <ldap_defaults.h> #include "ldif.h"
#include "ldap_defaults.h"
static char *prog; static char *prog;
static char *binddn = NULL; static char *binddn = NULL;
@ -405,7 +405,7 @@ process_ldif_rec( char *rbuf, int count )
} else if ( strcasecmp( type, T_DN_STR ) == 0 ) { } else if ( strcasecmp( type, T_DN_STR ) == 0 ) {
if (( dn = strdup( value )) == NULL ) { if (( dn = strdup( value )) == NULL ) {
perror( "strdup" ); perror( "strdup" );
exit( 1 ); exit( EXIT_FAILURE );
} }
expect_ct = 1; expect_ct = 1;
} }
@ -471,7 +471,7 @@ process_ldif_rec( char *rbuf, int count )
if ( strcasecmp( type, T_NEWRDNSTR ) == 0 ) { if ( strcasecmp( type, T_NEWRDNSTR ) == 0 ) {
if (( newrdn = strdup( value )) == NULL ) { if (( newrdn = strdup( value )) == NULL ) {
perror( "strdup" ); perror( "strdup" );
exit( 1 ); exit( EXIT_FAILURE );
} }
expect_deleteoldrdn = 1; expect_deleteoldrdn = 1;
expect_newrdn = 0; expect_newrdn = 0;
@ -495,7 +495,7 @@ process_ldif_rec( char *rbuf, int count )
if ( strcasecmp( type, T_NEWSUPSTR ) == 0 ) { if ( strcasecmp( type, T_NEWSUPSTR ) == 0 ) {
if (( newsup = strdup( value )) == NULL ) { if (( newsup = strdup( value )) == NULL ) {
perror( "strdup" ); perror( "strdup" );
exit( 1 ); exit( EXIT_FAILURE );
} }
expect_newsup = 0; expect_newsup = 0;
} else { } else {
@ -579,7 +579,7 @@ process_ldapmod_rec( char *rbuf )
if ( dn == NULL ) { /* first line contains DN */ if ( dn == NULL ) { /* first line contains DN */
if (( dn = strdup( line )) == NULL ) { if (( dn = strdup( line )) == NULL ) {
perror( "strdup" ); perror( "strdup" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} else { } else {
if (( p = strchr( line, '=' )) == NULL ) { if (( p = strchr( line, '=' )) == NULL ) {
@ -682,19 +682,19 @@ addmodifyop( LDAPMod ***pmodsp, int modop, char *attr, char *value, int vlen )
if (( pmods = (LDAPMod **)ber_memrealloc( pmods, (i + 2) * if (( pmods = (LDAPMod **)ber_memrealloc( pmods, (i + 2) *
sizeof( LDAPMod * ))) == NULL ) { sizeof( LDAPMod * ))) == NULL ) {
perror( "realloc" ); perror( "realloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
*pmodsp = pmods; *pmodsp = pmods;
pmods[ i + 1 ] = NULL; pmods[ i + 1 ] = NULL;
if (( pmods[ i ] = (LDAPMod *)ber_memcalloc( 1, sizeof( LDAPMod ))) if (( pmods[ i ] = (LDAPMod *)ber_memcalloc( 1, sizeof( LDAPMod )))
== NULL ) { == NULL ) {
perror( "calloc" ); perror( "calloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
pmods[ i ]->mod_op = modop; pmods[ i ]->mod_op = modop;
if (( pmods[ i ]->mod_type = ber_strdup( attr )) == NULL ) { if (( pmods[ i ]->mod_type = ber_strdup( attr )) == NULL ) {
perror( "strdup" ); perror( "strdup" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
@ -709,25 +709,25 @@ addmodifyop( LDAPMod ***pmodsp, int modop, char *attr, char *value, int vlen )
(struct berval **)ber_memrealloc( pmods[ i ]->mod_bvalues, (struct berval **)ber_memrealloc( pmods[ i ]->mod_bvalues,
(j + 2) * sizeof( struct berval * ))) == NULL ) { (j + 2) * sizeof( struct berval * ))) == NULL ) {
perror( "ber_realloc" ); perror( "ber_realloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
pmods[ i ]->mod_bvalues[ j + 1 ] = NULL; pmods[ i ]->mod_bvalues[ j + 1 ] = NULL;
if (( bvp = (struct berval *)ber_memalloc( sizeof( struct berval ))) if (( bvp = (struct berval *)ber_memalloc( sizeof( struct berval )))
== NULL ) { == NULL ) {
perror( "ber_memalloc" ); perror( "ber_memalloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
pmods[ i ]->mod_bvalues[ j ] = bvp; pmods[ i ]->mod_bvalues[ j ] = bvp;
if ( valsfromfiles && *value == '/' ) { /* get value from file */ if ( valsfromfiles && *value == '/' ) { /* get value from file */
if ( fromfile( value, bvp ) < 0 ) { if ( fromfile( value, bvp ) < 0 ) {
exit( 1 ); exit( EXIT_FAILURE );
} }
} else { } else {
bvp->bv_len = vlen; bvp->bv_len = vlen;
if (( bvp->bv_val = (char *)ber_memalloc( vlen + 1 )) == NULL ) { if (( bvp->bv_val = (char *)ber_memalloc( vlen + 1 )) == NULL ) {
perror( "malloc" ); perror( "malloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
SAFEMEMCPY( bvp->bv_val, value, vlen ); SAFEMEMCPY( bvp->bv_val, value, vlen );
bvp->bv_val[ vlen ] = '\0'; bvp->bv_val[ vlen ] = '\0';
@ -926,7 +926,7 @@ read_one_record( FILE *fp )
if (( buf = (char *)realloc( buf, lmax )) == NULL ) { if (( buf = (char *)realloc( buf, lmax )) == NULL ) {
perror( "realloc" ); perror( "realloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }

View file

@ -78,6 +78,18 @@ Package=<4>
############################################################################### ###############################################################################
Project: "setup"=..\..\include\setup.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global: Global:
Package=<5> Package=<5>

View file

@ -351,7 +351,7 @@ usage (char *s)
fprintf (stderr, " -Y saltlen\tsalt length to use\n"); fprintf (stderr, " -Y saltlen\tsalt length to use\n");
/* fprintf (stderr, " -y salt\tsalt to use\n"); */ /* fprintf (stderr, " -y salt\tsalt to use\n"); */
fprintf (stderr, " -z size\tsize limit\n"); fprintf (stderr, " -z size\tsize limit\n");
exit (1); exit( EXIT_FAILURE );
} }
int int

View file

@ -10,8 +10,8 @@
#include <ac/unistd.h> #include <ac/unistd.h>
#include <ldap.h> #include <ldap.h>
#include <ldif.h>
#include "ldif.h"
#include "ldap_defaults.h" #include "ldap_defaults.h"
#define DEFSEP "=" #define DEFSEP "="

View file

@ -28,8 +28,8 @@
#include <lber.h> #include <lber.h>
#include <ldap.h> #include <ldap.h>
#include <ldap_defaults.h>
#include "ldap_defaults.h"
#include "ud.h" #include "ud.h"
#ifdef HAVE_KERBEROS #ifdef HAVE_KERBEROS

View file

@ -32,7 +32,8 @@
#include <lber.h> #include <lber.h>
#include <ldap.h> #include <ldap.h>
#include <ldap_defaults.h>
#include "ldap_defaults.h"
#include "ud.h" #include "ud.h"
static int load_editor( void ); static int load_editor( void );

View file

@ -26,7 +26,8 @@
#include <lber.h> #include <lber.h>
#include <ldap.h> #include <ldap.h>
#include <ldap_defaults.h>
#include "ldap_defaults.h"
#include "ud.h" #include "ud.h"
static char * bind_and_fetch(char *name); static char * bind_and_fetch(char *name);

View file

@ -46,7 +46,7 @@
#include <lber.h> #include <lber.h>
#include <ldap.h> #include <ldap.h>
#include <ldap_defaults.h> #include "ldap_defaults.h"
#include "ud.h" #include "ud.h"
/* /*
@ -139,10 +139,10 @@ main( int argc, char **argv )
printf(" 64 authentication information\n"); printf(" 64 authentication information\n");
printf(" 128 initialization information\n\n"); printf(" 128 initialization information\n\n");
format("These are masks, and may be added to form multiple debug levels. For example, '-d 35' would perform a function trace, print out information about the find() function, and would print out information about the output routines too.", 75, 2); format("These are masks, and may be added to form multiple debug levels. For example, '-d 35' would perform a function trace, print out information about the find() function, and would print out information about the output routines too.", 75, 2);
exit(0); exit( EXIT_SUCCESS );
default: default:
fprintf(stderr, "Usage: %s [-c filter-config-file] [-d debug-level] [-l ldap-debug-level] [-s server] [-p port] [-V]\n", argv[0]); fprintf(stderr, "Usage: %s [-c filter-config-file] [-d debug-level] [-l ldap-debug-level] [-s server] [-p port] [-V]\n", argv[0]);
exit(-1); exit( EXIT_FAILURE);
/* NOTREACHED */ /* NOTREACHED */
} }
} }
@ -282,7 +282,7 @@ do_commands( void )
#ifdef HAVE_KERBEROS #ifdef HAVE_KERBEROS
destroy_tickets(); destroy_tickets();
#endif #endif
exit(0); exit( EXIT_SUCCESS );
/* NOTREACHED */ /* NOTREACHED */
} }
@ -650,7 +650,7 @@ initialize_client( void )
*/ */
if ((ld = ldap_init(server, ldap_port)) == NULL) { if ((ld = ldap_init(server, ldap_port)) == NULL) {
fprintf(stderr, " Initialization of LDAP session failed.\n"); fprintf(stderr, " Initialization of LDAP session failed.\n");
exit(0); exit( EXIT_FAILURE );
/* NOTREACHED */ /* NOTREACHED */
} }
if (ldap_bind_s(ld, (char *) default_bind_object, NULL, if (ldap_bind_s(ld, (char *) default_bind_object, NULL,
@ -661,7 +661,7 @@ initialize_client( void )
fprintf(stderr, " The LDAP Directory is temporarily unavailable. Please try again later.\n"); fprintf(stderr, " The LDAP Directory is temporarily unavailable. Please try again later.\n");
if (ld_errno != LDAP_UNAVAILABLE) if (ld_errno != LDAP_UNAVAILABLE)
ldap_perror(ld, " ldap_bind_s"); ldap_perror(ld, " ldap_bind_s");
exit(0); exit( EXIT_FAILURE );
/* NOTREACHED */ /* NOTREACHED */
} }
{ {

View file

@ -26,8 +26,8 @@
#include <lber.h> #include <lber.h>
#include <ldap.h> #include <ldap.h>
#include <ldap_defaults.h>
#include "ldap_defaults.h"
#include "ud.h" #include "ud.h"
void void
@ -102,7 +102,7 @@ fatal( char *s )
#ifdef HAVE_KERBEROS #ifdef HAVE_KERBEROS
destroy_tickets(); destroy_tickets();
#endif #endif
exit(-1); exit( EXIT_FAILURE );
} }
int int
@ -451,7 +451,7 @@ Malloc( unsigned int size )
void_ptr = (void *) malloc(size); void_ptr = (void *) malloc(size);
if (void_ptr == NULL) { if (void_ptr == NULL) {
perror("malloc"); perror("malloc");
exit(-1); exit( EXIT_FAILURE );
/*NOTREACHED*/ /*NOTREACHED*/
} }
return(void_ptr); return(void_ptr);

View file

@ -634,7 +634,7 @@ int main(int argc, char **argv)
if (error_flag) { if (error_flag) {
fprintf(stderr, "usage: %s [-h host] [-p portnumber] [-u X500UserName]\n\t[-c credentials] [-d debug-level]\n", fprintf(stderr, "usage: %s [-h host] [-p portnumber] [-u X500UserName]\n\t[-c credentials] [-d debug-level]\n",
progname); progname);
exit(2); exit( EXIT_FAILURE );
} }
rc = user_tailor(); rc = user_tailor();
@ -642,7 +642,7 @@ int main(int argc, char **argv)
if (!(ld = ldap_init(hostname, portnum))) { if (!(ld = ldap_init(hostname, portnum))) {
fprintf(stderr, "%s: unable to initialize LDAP session (%s:%d)\n", fprintf(stderr, "%s: unable to initialize LDAP session (%s:%d)\n",
progname, hostname, portnum); progname, hostname, portnum);
exit(2); exit( EXIT_FAILURE );
} }
if (!bind_user()) if (!bind_user())

View file

@ -19,7 +19,7 @@
#include <lber.h> #include <lber.h>
#include <ldap.h> #include <ldap.h>
#include <ldif.h> #include "ldif.h"
#include "maint_form.h" /* for HTML Form manipulations */ #include "maint_form.h" /* for HTML Form manipulations */
/* default values */ /* default values */
@ -178,12 +178,12 @@ main(int argc, char ** argv) {
if (strcompare(getenv("REQUEST_METHOD"),"POST")) if (strcompare(getenv("REQUEST_METHOD"),"POST"))
{ {
printf("<p>++ Error - This script should be referenced with a METHOD of POST.\n"); printf("<p>++ Error - This script should be referenced with a METHOD of POST.\n");
exit(1); exit( EXIT_FAILURE );
} }
if (strcompare(getenv("CONTENT_TYPE"),"application/x-www-form-urlencoded")) if (strcompare(getenv("CONTENT_TYPE"),"application/x-www-form-urlencoded"))
{ {
printf("<p>++ Error - This script can only be used to decode form results. \n"); printf("<p>++ Error - This script can only be used to decode form results. \n");
exit(1); exit( EXIT_FAILURE );
} }
cl = atoi(getenv("CONTENT_LENGTH")); cl = atoi(getenv("CONTENT_LENGTH"));
@ -209,7 +209,7 @@ main(int argc, char ** argv) {
printf("%s%s%s", "This script expected a 'FORM' value returned ", printf("%s%s%s", "This script expected a 'FORM' value returned ",
"and did not get one. Make sure the HTML used for this ", "and did not get one. Make sure the HTML used for this ",
"script is correct."); "script is correct.");
exit(1); exit( EXIT_FAILURE );
} }
/* Looking for: /* Looking for:
@ -341,7 +341,7 @@ main(int argc, char ** argv) {
} }
} }
printf("</body>\n</html>\n"); printf("</body>\n</html>\n");
exit(1); exit( EXIT_FAILURE );
} }
/*authenticate as nobody */ /*authenticate as nobody */
@ -373,7 +373,7 @@ main(int argc, char ** argv) {
} }
} }
printf("</body>\n</html>\n"); printf("</body>\n</html>\n");
exit(1); exit( EXIT_FAILURE );
} }
printf("<b>Directory Lookup Results</b>\n<pre>\n"); printf("<b>Directory Lookup Results</b>\n<pre>\n");

View file

@ -41,8 +41,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <netinet/in.h> #include <netinet/in.h>
#include "syslog.h" #include "syslog.h"
#include "lber.h" #include <ldap.h>
#include "ldap.h"
#define EQ(x,y) (strcasecmp(x,y) == 0) #define EQ(x,y) (strcasecmp(x,y) == 0)

View file

@ -14,7 +14,7 @@
#include <stdlib.h> #include <stdlib.h>
/* Not sure if !STDC_HEADERS is needed */ /* Ignore malloc.h if we have STDC_HEADERS */
#if defined(HAVE_MALLOC_H) && !defined(STDC_HEADERS) #if defined(HAVE_MALLOC_H) && !defined(STDC_HEADERS)
# include <malloc.h> # include <malloc.h>
#endif #endif

View file

@ -73,6 +73,10 @@ ldap_str2charray LDAP_P((
char *str, char *str,
char *brkstr )); char *brkstr ));
/* url.c */
void ldap_pvt_hex_unescape LDAP_P(( char *s ));
int ldap_pvt_unhex( int c );
LDAP_END_DECL LDAP_END_DECL
#endif #endif

View file

@ -27,7 +27,7 @@ static char avl_version[] = "AVL library version 1.0\n";
#define ROTATERIGHT(x) { \ #define ROTATERIGHT(x) { \
Avlnode *tmp;\ Avlnode *tmp;\
if ( *(x) == NULL || (*(x))->avl_left == NULL ) {\ if ( *(x) == NULL || (*(x))->avl_left == NULL ) {\
(void) fputs("RR error\n", stderr); exit(1); \ (void) fputs("RR error\n", stderr); exit( EXIT_FAILURE ); \
}\ }\
tmp = (*(x))->avl_left;\ tmp = (*(x))->avl_left;\
(*(x))->avl_left = tmp->avl_right;\ (*(x))->avl_left = tmp->avl_right;\
@ -37,7 +37,7 @@ static char avl_version[] = "AVL library version 1.0\n";
#define ROTATELEFT(x) { \ #define ROTATELEFT(x) { \
Avlnode *tmp;\ Avlnode *tmp;\
if ( *(x) == NULL || (*(x))->avl_right == NULL ) {\ if ( *(x) == NULL || (*(x))->avl_right == NULL ) {\
(void) fputs("RL error\n", stderr); exit(1); \ (void) fputs("RL error\n", stderr); exit( EXIT_FAILURE ); \
}\ }\
tmp = (*(x))->avl_right;\ tmp = (*(x))->avl_right;\
(*(x))->avl_right = tmp->avl_left;\ (*(x))->avl_right = tmp->avl_left;\

View file

@ -47,7 +47,7 @@ main( int argc, char **argv )
case 'f': /* find */ case 'f': /* find */
printf( "data? " ); printf( "data? " );
if ( fgets( name, sizeof( name ), stdin ) == NULL ) if ( fgets( name, sizeof( name ), stdin ) == NULL )
exit( 0 ); exit( EXIT_SUCCESS );
name[ strlen( name ) - 1 ] = '\0'; name[ strlen( name ) - 1 ] = '\0';
if ( (p = (char *) avl_find( tree, name, (AVL_CMP) strcmp )) if ( (p = (char *) avl_find( tree, name, (AVL_CMP) strcmp ))
== NULL ) == NULL )
@ -58,7 +58,7 @@ main( int argc, char **argv )
case 'i': /* insert */ case 'i': /* insert */
printf( "data? " ); printf( "data? " );
if ( fgets( name, sizeof( name ), stdin ) == NULL ) if ( fgets( name, sizeof( name ), stdin ) == NULL )
exit( 0 ); exit( EXIT_SUCCESS );
name[ strlen( name ) - 1 ] = '\0'; name[ strlen( name ) - 1 ] = '\0';
if ( avl_insert( &tree, strdup( name ), (AVL_CMP) strcmp, if ( avl_insert( &tree, strdup( name ), (AVL_CMP) strcmp,
avl_dup_error ) != 0 ) avl_dup_error ) != 0 )
@ -67,13 +67,13 @@ main( int argc, char **argv )
case 'd': /* delete */ case 'd': /* delete */
printf( "data? " ); printf( "data? " );
if ( fgets( name, sizeof( name ), stdin ) == NULL ) if ( fgets( name, sizeof( name ), stdin ) == NULL )
exit( 0 ); exit( EXIT_SUCCESS );
name[ strlen( name ) - 1 ] = '\0'; name[ strlen( name ) - 1 ] = '\0';
if ( avl_delete( &tree, name, (AVL_CMP) strcmp ) == NULL ) if ( avl_delete( &tree, name, (AVL_CMP) strcmp ) == NULL )
printf( "\nNot found!\n" ); printf( "\nNot found!\n" );
break; break;
case 'q': /* quit */ case 'q': /* quit */
exit( 0 ); exit( EXIT_SUCCESS );
break; break;
case '\n': case '\n':
break; break;

View file

@ -36,29 +36,29 @@ main( int argc, char **argv )
/* read the pe from standard in */ /* read the pe from standard in */
if ( (psin = ps_alloc( std_open )) == NULLPS ) { if ( (psin = ps_alloc( std_open )) == NULLPS ) {
perror( "ps_alloc" ); perror( "ps_alloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( std_setup( psin, stdin ) == NOTOK ) { if ( std_setup( psin, stdin ) == NOTOK ) {
perror( "std_setup" ); perror( "std_setup" );
exit( 1 ); exit( EXIT_FAILURE );
} }
/* write the pe to standard out */ /* write the pe to standard out */
if ( (psout = ps_alloc( std_open )) == NULLPS ) { if ( (psout = ps_alloc( std_open )) == NULLPS ) {
perror( "ps_alloc" ); perror( "ps_alloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( std_setup( psout, stdout ) == NOTOK ) { if ( std_setup( psout, stdout ) == NOTOK ) {
perror( "std_setup" ); perror( "std_setup" );
exit( 1 ); exit( EXIT_FAILURE );
} }
/* pretty print it to standard error */ /* pretty print it to standard error */
if ( (pserr = ps_alloc( std_open )) == NULLPS ) { if ( (pserr = ps_alloc( std_open )) == NULLPS ) {
perror( "ps_alloc" ); perror( "ps_alloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( std_setup( pserr, stderr ) == NOTOK ) { if ( std_setup( pserr, stderr ) == NOTOK ) {
perror( "std_setup" ); perror( "std_setup" );
exit( 1 ); exit( EXIT_FAILURE );
} }
while ( (pe = ps2pe( psin )) != NULLPE ) { while ( (pe = ps2pe( psin )) != NULLPE ) {
@ -66,7 +66,7 @@ main( int argc, char **argv )
pe2ps( psout, pe ); pe2ps( psout, pe );
} }
exit( 0 ); exit( EXIT_SUCCESS );
#else #else
fprintf(stderr, "requires ISODE X.500 distribution.\n"); fprintf(stderr, "requires ISODE X.500 distribution.\n");
return( EXIT_FAILURE ); return( EXIT_FAILURE );

View file

@ -12,12 +12,11 @@
*/ */
#include "portable.h" #include "portable.h"
#include <stdio.h>
#include <ac/stdlib.h> #include <ac/stdlib.h>
#include "lber.h" #include <stdio.h>
#include "ldap.h"
#include <ldap.h>
int int
main(int argc, char **argv) main(int argc, char **argv)

View file

@ -6,14 +6,14 @@
* DIGEST-MD5 routines * DIGEST-MD5 routines
*/ */
#include <portable.h> #include "portable.h"
#include <ac/ctype.h> #include <ac/ctype.h>
#include <ac/string.h> #include <ac/string.h>
#include <ac/time.h> #include <ac/time.h>
#include "ldap-int.h" #include "ldap-int.h"
#include <ldap_pvt.h> #include "ldap_pvt.h"
#define TK_NOENDQUOTE -2 #define TK_NOENDQUOTE -2
#define TK_OUTOFMEM -1 #define TK_OUTOFMEM -1

View file

@ -343,7 +343,7 @@ main( int argc, char **argv )
if ( errflg || optind < argc - 1 ) { if ( errflg || optind < argc - 1 ) {
fprintf( stderr, usage, argv[ 0 ] ); fprintf( stderr, usage, argv[ 0 ] );
exit( 1 ); exit( EXIT_FAILURE );
} }
printf( "%s( %s, %d )\n", printf( "%s( %s, %d )\n",
@ -360,14 +360,14 @@ main( int argc, char **argv )
if ( ld == NULL ) { if ( ld == NULL ) {
perror( cldapflg ? "cldap_open" : "ldap_init" ); perror( cldapflg ? "cldap_open" : "ldap_init" );
exit(1); exit( EXIT_FAILURE );
} }
if ( copyfname != NULL ) { if ( copyfname != NULL ) {
if ( (ld->ld_sb.sb_fd = open( copyfname, O_WRONLY | O_CREAT, if ( (ld->ld_sb.sb_fd = open( copyfname, O_WRONLY | O_CREAT,
0600 )) == -1 ) { 0600 )) == -1 ) {
perror( copyfname ); perror( copyfname );
exit ( 1 ); exit ( EXIT_FAILURE );
} }
ld->ld_sb.sb_options = copyoptions; ld->ld_sb.sb_options = copyoptions;
} }
@ -549,7 +549,7 @@ main( int argc, char **argv )
if ( !cldapflg ) { if ( !cldapflg ) {
ldap_unbind( ld ); ldap_unbind( ld );
} }
exit( 0 ); exit( EXIT_SUCCESS );
break; break;
case 'r': /* result or remove */ case 'r': /* result or remove */

View file

@ -21,11 +21,10 @@
#include <sys/file.h> #include <sys/file.h>
#endif #endif
#include "lber.h" #include <ldap.h>
#include "ldap.h" #include <disptmpl.h>
#include "ldap_log.h" #include "ldap_log.h"
#include "disptmpl.h"
#include "ldap-int.h" #include "ldap-int.h"
#include "ldap_defaults.h" #include "ldap_defaults.h"

View file

@ -13,12 +13,11 @@
#ifdef HAVE_CONSOLE_H #ifdef HAVE_CONSOLE_H
#include <console.h> #include <console.h>
#endif /* MACOS */ #endif /* HAVE_CONSOLE_H */
#include "lber.h" #include <ldap.h>
#include "ldap.h" #include <disptmpl.h>
#include "disptmpl.h" #include <srchpref.h>
#include "srchpref.h"
static void dump_tmpl ( struct ldap_disptmpl *tmpl ); static void dump_tmpl ( struct ldap_disptmpl *tmpl );
static void dump_srchpref( struct ldap_searchobj *sp ); static void dump_srchpref( struct ldap_searchobj *sp );
@ -43,13 +42,13 @@ main( int argc, char **argv )
if (( err = ldap_init_templates( "ldaptemplates.conf", &templates )) if (( err = ldap_init_templates( "ldaptemplates.conf", &templates ))
!= 0 ) { != 0 ) {
fprintf( stderr, "ldap_init_templates failed (%d)\n", err ); fprintf( stderr, "ldap_init_templates failed (%d)\n", err );
exit( 1 ); exit( EXIT_FAILURE );
} }
if (( err = ldap_init_searchprefs( "ldapsearchprefs.conf", &so )) if (( err = ldap_init_searchprefs( "ldapsearchprefs.conf", &so ))
!= 0 ) { != 0 ) {
fprintf( stderr, "ldap_init_searchprefs failed (%d)\n", err ); fprintf( stderr, "ldap_init_searchprefs failed (%d)\n", err );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( argc == 1 ) { if ( argc == 1 ) {
@ -79,7 +78,7 @@ main( int argc, char **argv )
ldap_free_templates( templates ); ldap_free_templates( templates );
ldap_free_searchprefs( so ); ldap_free_searchprefs( so );
exit( 0 ); exit( EXIT_SUCCESS );
} }

View file

@ -40,8 +40,6 @@ static const char* skip_url_prefix LDAP_P((
const char *url, const char *url,
int *enclosedp, int *enclosedp,
int *ldaps )); int *ldaps ));
static void hex_unescape LDAP_P(( char *s ));
static int unhex( char c );
int int
@ -229,7 +227,7 @@ ldap_url_parse( LDAP_CONST char *url_in, LDAPURLDesc **ludpp )
if (( q = strchr( url, ':' )) != NULL ) { if (( q = strchr( url, ':' )) != NULL ) {
*q++ = '\0'; *q++ = '\0';
hex_unescape( q ); ldap_pvt_hex_unescape( q );
if( *q == '\0' ) { if( *q == '\0' ) {
LDAP_FREE( url ); LDAP_FREE( url );
@ -240,7 +238,7 @@ ldap_url_parse( LDAP_CONST char *url_in, LDAPURLDesc **ludpp )
ludp->lud_port = atoi( q ); ludp->lud_port = atoi( q );
} }
hex_unescape( url ); ldap_pvt_hex_unescape( url );
ludp->lud_host = LDAP_STRDUP( url ); ludp->lud_host = LDAP_STRDUP( url );
if( ludp->lud_host == NULL ) { if( ludp->lud_host == NULL ) {
@ -265,7 +263,7 @@ ldap_url_parse( LDAP_CONST char *url_in, LDAPURLDesc **ludpp )
if( *p != '\0' ) { if( *p != '\0' ) {
/* parse dn part */ /* parse dn part */
hex_unescape( p ); ldap_pvt_hex_unescape( p );
ludp->lud_dn = LDAP_STRDUP( p ); ludp->lud_dn = LDAP_STRDUP( p );
} else { } else {
ludp->lud_dn = LDAP_STRDUP( "" ); ludp->lud_dn = LDAP_STRDUP( "" );
@ -295,7 +293,7 @@ ldap_url_parse( LDAP_CONST char *url_in, LDAPURLDesc **ludpp )
if( *p != '\0' ) { if( *p != '\0' ) {
/* parse attributes */ /* parse attributes */
hex_unescape( p ); ldap_pvt_hex_unescape( p );
ludp->lud_attrs = ldap_str2charray( p, "," ); ludp->lud_attrs = ldap_str2charray( p, "," );
if( ludp->lud_attrs == NULL ) { if( ludp->lud_attrs == NULL ) {
@ -323,7 +321,7 @@ ldap_url_parse( LDAP_CONST char *url_in, LDAPURLDesc **ludpp )
if( *p != '\0' ) { if( *p != '\0' ) {
/* parse the scope */ /* parse the scope */
hex_unescape( p ); ldap_pvt_hex_unescape( p );
ludp->lud_scope = str2scope( p ); ludp->lud_scope = str2scope( p );
if( ludp->lud_scope == -1 ) { if( ludp->lud_scope == -1 ) {
@ -351,7 +349,7 @@ ldap_url_parse( LDAP_CONST char *url_in, LDAPURLDesc **ludpp )
if( *p != '\0' ) { if( *p != '\0' ) {
/* parse the filter */ /* parse the filter */
hex_unescape( p ); ldap_pvt_hex_unescape( p );
if( ! *p ) { if( ! *p ) {
/* missing filter */ /* missing filter */
@ -398,7 +396,7 @@ ldap_url_parse( LDAP_CONST char *url_in, LDAPURLDesc **ludpp )
} }
for( i=0; ludp->lud_exts[i] != NULL; i++ ) { for( i=0; ludp->lud_exts[i] != NULL; i++ ) {
hex_unescape( ludp->lud_exts[i] ); ldap_pvt_hex_unescape( ludp->lud_exts[i] );
} }
if( i == 0 ) { if( i == 0 ) {
@ -544,8 +542,8 @@ ldap_url_search_s(
} }
static void void
hex_unescape( char *s ) ldap_pvt_hex_unescape( char *s )
{ {
/* /*
* Remove URL hex escapes from s... done in place. The basic concept for * Remove URL hex escapes from s... done in place. The basic concept for
@ -556,10 +554,10 @@ hex_unescape( char *s )
for ( p = s; *s != '\0'; ++s ) { for ( p = s; *s != '\0'; ++s ) {
if ( *s == '%' ) { if ( *s == '%' ) {
if ( *++s != '\0' ) { if ( *++s != '\0' ) {
*p = unhex( *s ) << 4; *p = ldap_pvt_unhex( *s ) << 4;
} }
if ( *++s != '\0' ) { if ( *++s != '\0' ) {
*p++ += unhex( *s ); *p++ += ldap_pvt_unhex( *s );
} }
} else { } else {
*p++ = *s; *p++ = *s;
@ -570,8 +568,8 @@ hex_unescape( char *s )
} }
static int int
unhex( char c ) ldap_pvt_unhex( int c )
{ {
return( c >= '0' && c <= '9' ? c - '0' return( c >= '0' && c <= '9' ? c - '0'
: c >= 'A' && c <= 'F' ? c - 'A' + 10 : c >= 'A' && c <= 'F' ? c - 'A' + 10

View file

@ -16,6 +16,7 @@
#include "ldap_log.h" #include "ldap_log.h"
#include "lber_pvt.h" #include "lber_pvt.h"
#include "ldap_pvt.h"
#include "ldif.h" #include "ldif.h"
int int
@ -25,13 +26,40 @@ ldif_fetch_url(
ber_len_t *vlenp ber_len_t *vlenp
) )
{ {
#ifdef HAVE_FETCH FILE *url;
FILE *url = fetchGetURL( (char*) urlstr, "" );
char buffer[1024]; char buffer[1024];
char *p = NULL; char *p = NULL;
size_t total; size_t total;
size_t bytes; size_t bytes;
*valuep = NULL;
*vlenp = 0;
#ifdef HAVE_FETCH
url = fetchGetURL( (char*) urlstr, "" );
#else
if( strncasecmp( "file://", urlstr, sizeof("file://")-1 ) == 0 ) {
p = strchr( &urlstr[sizeof("file://")-1], '/' );
if( p == NULL ) {
return -1;
}
if( *p != *LDAP_DIRSEP ) {
/* skip over false root */
p++;
}
p = ber_strdup( p );
ldap_pvt_hex_unescape( p );
url = fopen( p, "r" );
} else {
return -1;
}
#endif
if( url == NULL ) { if( url == NULL ) {
return -1; return -1;
} }
@ -56,11 +84,5 @@ ldif_fetch_url(
*vlenp = total; *vlenp = total;
return 0; return 0;
#else
*valuep = NULL;
*vlenp = 0;
return -1;
#endif
} }

View file

@ -123,6 +123,10 @@ LIB32=link.exe -lib
# Name "libldif - Win32 Single Release" # Name "libldif - Win32 Single Release"
# Begin Source File # Begin Source File
SOURCE=.\fetch.c
# End Source File
# Begin Source File
SOURCE=..\..\include\ldif.h SOURCE=..\..\include\ldif.h
# End Source File # End Source File
# Begin Source File # Begin Source File

View file

@ -65,7 +65,7 @@ lutil_detach( int debug, int do_close )
break; break;
default: default:
_exit( 0 ); _exit( EXIT_SUCCESS );
} }
break; break;
} }
@ -78,7 +78,7 @@ lutil_detach( int debug, int do_close )
if ( (sd = open( "/dev/null", O_RDWR )) == -1 ) { if ( (sd = open( "/dev/null", O_RDWR )) == -1 ) {
perror( "/dev/null" ); perror( "/dev/null" );
exit( 1 ); exit( EXIT_FAILURE );
} }
for ( i = 0; i < 3; i++ ) for ( i = 0; i < 3; i++ )
if ( sd != i && isatty( i ) ) if ( sd != i && isatty( i ) )

View file

@ -35,7 +35,8 @@
#include <lber.h> #include <lber.h>
#include <ldap.h> #include <ldap.h>
#include <ldap_defaults.h>
#include "ldap_defaults.h"
char * char *
getpass( const char *prompt ) getpass( const char *prompt )

View file

@ -299,7 +299,7 @@ main (int argc, char **argv )
if (argc < 2) if (argc < 2)
{ {
fprintf (stderr, "usage: %s string-to-hash\n", argv[0]); fprintf (stderr, "usage: %s string-to-hash\n", argv[0]);
exit (1); return EXIT_FAILURE;
} }
for (j = 1; j < argc; ++j) for (j = 1; j < argc; ++j)
{ {
@ -313,6 +313,6 @@ main (int argc, char **argv )
} }
printf ("\n"); printf ("\n");
} }
return 0; return EXIT_SUCCESS;
} }
#endif /* TEST */ #endif /* TEST */

View file

@ -9,7 +9,7 @@
#include <windows.h> #include <windows.h>
#include <winsvc.h> #include <winsvc.h>
#include "ldap.h" #include <ldap.h>
#define ldap_debug slap_debug #define ldap_debug slap_debug
extern int slap_debug; extern int slap_debug;

View file

@ -439,7 +439,7 @@ acl_usage( void )
"\t[domain=<regex>] [sockurl=<regex>]\n" "\t[domain=<regex>] [sockurl=<regex>]\n"
"<access> ::= [self]{none|auth|compare|search|read|write}\n" "<access> ::= [self]{none|auth|compare|search|read|write}\n"
); );
exit( 1 ); exit( EXIT_FAILURE );
} }
static void static void

View file

@ -195,7 +195,6 @@ add_created_attrs( Operation *op, Entry *e )
struct berval bv; struct berval bv;
struct berval *bvals[2]; struct berval *bvals[2];
Attribute *a; Attribute *a;
Attribute *tmp;
struct tm *ltm; struct tm *ltm;
time_t currenttime; time_t currenttime;

View file

@ -324,7 +324,7 @@ attr_syntax_config(
if ( code ) { if ( code ) {
fprintf( stderr, "%s: line %d: %s %s\n", fprintf( stderr, "%s: line %d: %s %s\n",
fname, lineno, scherr2str(code), err); fname, lineno, scherr2str(code), err);
exit( 1 ); exit( EXIT_FAILURE );
} }
ldap_memfree(at); ldap_memfree(at);
} }

View file

@ -128,7 +128,7 @@ bdb2i_txn_attr_config(
if ( open ) { if ( open ) {
pthread_kill( pthread_self(), LDAP_SIGUSR1 ); pthread_kill( pthread_self(), LDAP_SIGUSR1 );
} else { } else {
exit( 1 ); exit( EXIT_FAILURE );
} }
} }

View file

@ -79,7 +79,7 @@ ldbm_back_startup(
fprintf( stderr, fprintf( stderr,
"ldbm_back_startup(): FATAL error in db_appinit() : %s\n", "ldbm_back_startup(): FATAL error in db_appinit() : %s\n",
error ); error );
exit( 1 ); exit( EXIT_FAILURE );
} }
#endif #endif

View file

@ -125,7 +125,7 @@ perl_back_db_config(
if ( return_code != 0 ) { if ( return_code != 0 ) {
fprintf( stderr, fprintf( stderr,
"Unknown perl backeng config: %s\n", argv[0]); "Unknown perl backeng config: %s\n", argv[0]);
exit( 1 ); exit( EXIT_FAILURE );
} }
} }

View file

@ -50,13 +50,13 @@ forkandexec(
close( c2p[0] ); close( c2p[0] );
if ( dup2( p2c[0], 0 ) == -1 || dup2( c2p[1], 1 ) == -1 ) { if ( dup2( p2c[0], 0 ) == -1 || dup2( c2p[1], 1 ) == -1 ) {
Debug( LDAP_DEBUG_ANY, "dup2 failed\n", 0, 0, 0 ); Debug( LDAP_DEBUG_ANY, "dup2 failed\n", 0, 0, 0 );
exit( -1 ); exit( EXIT_FAILURE );
} }
execv( args[0], args ); execv( args[0], args );
Debug( LDAP_DEBUG_ANY, "execv failed\n", 0, 0, 0 ); Debug( LDAP_DEBUG_ANY, "execv failed\n", 0, 0, 0 );
exit( -1 ); exit( EXIT_FAILURE );
case -1: /* trouble */ case -1: /* trouble */
Debug( LDAP_DEBUG_ANY, "fork failed\n", 0, 0, 0 ); Debug( LDAP_DEBUG_ANY, "fork failed\n", 0, 0, 0 );

View file

@ -21,7 +21,7 @@ ch_malloc(
if ( (new = (void *) ber_memalloc( size )) == NULL ) { if ( (new = (void *) ber_memalloc( size )) == NULL ) {
Debug( LDAP_DEBUG_ANY, "ch_malloc of %lu bytes failed\n", Debug( LDAP_DEBUG_ANY, "ch_malloc of %lu bytes failed\n",
(long) size, 0, 0 ); (long) size, 0, 0 );
exit( 1 ); exit( EXIT_SUCCESS );
} }
return( new ); return( new );
@ -46,7 +46,7 @@ ch_realloc(
if ( (new = (void *) ber_memrealloc( block, size )) == NULL ) { if ( (new = (void *) ber_memrealloc( block, size )) == NULL ) {
Debug( LDAP_DEBUG_ANY, "ch_realloc of %lu bytes failed\n", Debug( LDAP_DEBUG_ANY, "ch_realloc of %lu bytes failed\n",
(long) size, 0, 0 ); (long) size, 0, 0 );
exit( 1 ); exit( EXIT_SUCCESS );
} }
return( new ); return( new );
@ -63,7 +63,7 @@ ch_calloc(
if ( (new = (void *) ber_memcalloc( nelem, size )) == NULL ) { if ( (new = (void *) ber_memcalloc( nelem, size )) == NULL ) {
Debug( LDAP_DEBUG_ANY, "ch_calloc of %lu elems of %lu bytes failed\n", Debug( LDAP_DEBUG_ANY, "ch_calloc of %lu elems of %lu bytes failed\n",
(long) nelem, (long) size, 0 ); (long) nelem, (long) size, 0 );
exit( 1 ); exit( EXIT_FAILURE );
} }
return( new ); return( new );
@ -78,7 +78,7 @@ ch_strdup(
if ( (new = ber_strdup( string )) == NULL ) { if ( (new = ber_strdup( string )) == NULL ) {
Debug( LDAP_DEBUG_ANY, "ch_strdup(%s) failed\n", string, 0, 0 ); Debug( LDAP_DEBUG_ANY, "ch_strdup(%s) failed\n", string, 0, 0 );
exit( 1 ); exit( EXIT_FAILURE );
} }
return( new ); return( new );

View file

@ -655,13 +655,13 @@ read_config( char *fname )
Debug( LDAP_DEBUG_ANY, Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing filename in \"loadmodule <filename>\" line\n", "%s: line %d: missing filename in \"loadmodule <filename>\" line\n",
fname, lineno, 0 ); fname, lineno, 0 );
exit( 1 ); exit( EXIT_FAILURE );
} }
if (!load_module(cargv[1], cargc - 2, (cargc > 2) ? cargv + 2 : NULL)) { if (!load_module(cargv[1], cargc - 2, (cargc > 2) ? cargv + 2 : NULL)) {
Debug( LDAP_DEBUG_ANY, Debug( LDAP_DEBUG_ANY,
"%s: line %d: failed to load or initialize module %s\n", "%s: line %d: failed to load or initialize module %s\n",
fname, lineno, cargv[1]); fname, lineno, cargv[1]);
exit( 1 ); exit( EXIT_FAILURE );
} }
#endif /*SLAPD_MODULES*/ #endif /*SLAPD_MODULES*/

View file

@ -856,7 +856,6 @@ slapd_daemon_task(
{ {
ber_socket_t rd; ber_socket_t rd;
int is_listener = 0; int is_listener = 0;
int rc;
#ifdef HAVE_WINSOCK #ifdef HAVE_WINSOCK
rd = readfds.fd_array[i]; rd = readfds.fd_array[i];

View file

@ -273,7 +273,7 @@ int main( int argc, char **argv )
case 'c': /* do connectionless (udp) */ case 'c': /* do connectionless (udp) */
/* udp = 1; */ /* udp = 1; */
fprintf( stderr, "connectionless support not supported"); fprintf( stderr, "connectionless support not supported");
exit( -1 ); exit( EXIT_FAILURE );
break; break;
#endif #endif

View file

@ -2,6 +2,7 @@
#ifdef HAVE_CYRUS_SASL #ifdef HAVE_CYRUS_SASL
#include <ac/stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "slap.h" #include "slap.h"
@ -32,7 +33,7 @@ int sasl_init( void )
if( rc != SASL_OK ) { if( rc != SASL_OK ) {
Debug( LDAP_DEBUG_ANY, "sasl_server_init failed\n", Debug( LDAP_DEBUG_ANY, "sasl_server_init failed\n",
0, 0, 0 ); 0, 0, 0 );
exit(-1); return EXIT_FAILURE;
} }
rc = sasl_server_new( "ldap", NULL, NULL, NULL, rc = sasl_server_new( "ldap", NULL, NULL, NULL,
@ -42,7 +43,7 @@ int sasl_init( void )
if( rc != SASL_OK ) { if( rc != SASL_OK ) {
Debug( LDAP_DEBUG_ANY, "sasl_server_new failed\n", Debug( LDAP_DEBUG_ANY, "sasl_server_new failed\n",
0, 0, 0 ); 0, 0, 0 );
exit(-1); return EXIT_FAILURE;
} }
memset(&secprops, 0, sizeof(secprops)); memset(&secprops, 0, sizeof(secprops));
@ -55,7 +56,7 @@ int sasl_init( void )
if( rc != SASL_OK ) { if( rc != SASL_OK ) {
Debug( LDAP_DEBUG_ANY, "sasl_setprop failed\n", Debug( LDAP_DEBUG_ANY, "sasl_setprop failed\n",
0, 0, 0 ); 0, 0, 0 );
exit(-1); return EXIT_FAILURE;
} }
rc = sasl_listmech( server, NULL, NULL, ",", NULL, rc = sasl_listmech( server, NULL, NULL, ",", NULL,
@ -64,13 +65,13 @@ int sasl_init( void )
if( rc != SASL_OK ) { if( rc != SASL_OK ) {
Debug( LDAP_DEBUG_ANY, "sasl_listmech failed: %d\n", Debug( LDAP_DEBUG_ANY, "sasl_listmech failed: %d\n",
rc, 0, 0 ); rc, 0, 0 );
exit(-1); return EXIT_FAILURE;
} }
Debug( LDAP_DEBUG_TRACE, "SASL mechanisms: %s\n", Debug( LDAP_DEBUG_TRACE, "SASL mechanisms: %s\n",
data, 0, 0 ); data, 0, 0 );
return 0; return EXIT_SUCCESS;
} }
int sasl_destory( void ) int sasl_destory( void )

View file

@ -1006,7 +1006,7 @@ schema_init( void )
if ( res ) { if ( res ) {
fprintf( stderr, "schema_init: Error registering syntax %s\n", fprintf( stderr, "schema_init: Error registering syntax %s\n",
syntax_defs[i].sd_desc ); syntax_defs[i].sd_desc );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
for ( i=0; mrule_defs[i].mrd_desc != NULL; i++ ) { for ( i=0; mrule_defs[i].mrd_desc != NULL; i++ ) {
@ -1018,7 +1018,7 @@ schema_init( void )
if ( res ) { if ( res ) {
fprintf( stderr, "schema_init: Error registering matching rule %s\n", fprintf( stderr, "schema_init: Error registering matching rule %s\n",
mrule_defs[i].mrd_desc ); mrule_defs[i].mrd_desc );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
schema_init_done = 1; schema_init_done = 1;

View file

@ -113,7 +113,7 @@ parse_oc_old(
if ( code ) { if ( code ) {
fprintf( stderr, "%s: line %d: %s %s\n", fprintf( stderr, "%s: line %d: %s %s\n",
fname, lineno, scherr2str(code), *namep); fname, lineno, scherr2str(code), *namep);
exit( 1 ); exit( EXIT_FAILURE );
} }
namep++; namep++;
} }
@ -125,7 +125,7 @@ parse_oc_old(
if ( code ) { if ( code ) {
fprintf( stderr, "%s: line %d: %s %s\n", fprintf( stderr, "%s: line %d: %s %s\n",
fname, lineno, scherr2str(code), *namep); fname, lineno, scherr2str(code), *namep);
exit( 1 ); exit( EXIT_FAILURE );
} }
namep++; namep++;
} }
@ -135,7 +135,7 @@ parse_oc_old(
if ( code ) { if ( code ) {
fprintf( stderr, "%s: line %d: %s %s\n", fprintf( stderr, "%s: line %d: %s %s\n",
fname, lineno, scherr2str(code), err); fname, lineno, scherr2str(code), err);
exit( 1 ); exit( EXIT_FAILURE );
} }
ldap_memfree(oc); ldap_memfree(oc);
} }
@ -161,7 +161,7 @@ parse_oc(
if ( code ) { if ( code ) {
fprintf( stderr, "%s: line %d: %s %s\n", fprintf( stderr, "%s: line %d: %s %s\n",
fname, lineno, scherr2str(code), err); fname, lineno, scherr2str(code), err);
exit( 1 ); exit( EXIT_FAILURE );
} }
ldap_memfree(oc); ldap_memfree(oc);
} }
@ -180,7 +180,7 @@ oc_usage( void )
fprintf( stderr, " [ \"MUST\" oids ] ; AttributeTypes\n"); fprintf( stderr, " [ \"MUST\" oids ] ; AttributeTypes\n");
fprintf( stderr, " [ \"MAY\" oids ] ; AttributeTypes\n"); fprintf( stderr, " [ \"MAY\" oids ] ; AttributeTypes\n");
fprintf( stderr, "whsp \")\"\n"); fprintf( stderr, "whsp \")\"\n");
exit( 1 ); exit( EXIT_FAILURE );
} }
static void static void
@ -189,7 +189,7 @@ oc_usage_old( void )
fprintf( stderr, "<oc clause> ::= objectclass <ocname>\n" ); fprintf( stderr, "<oc clause> ::= objectclass <ocname>\n" );
fprintf( stderr, " [ requires <attrlist> ]\n" ); fprintf( stderr, " [ requires <attrlist> ]\n" );
fprintf( stderr, " [ allows <attrlist> ]\n" ); fprintf( stderr, " [ allows <attrlist> ]\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
static void static void
@ -215,7 +215,7 @@ at_usage( void )
fprintf( stderr, " ; distributedOperation\n"); fprintf( stderr, " ; distributedOperation\n");
fprintf( stderr, " ; dSAOperation\n"); fprintf( stderr, " ; dSAOperation\n");
fprintf( stderr, "whsp \")\"\n"); fprintf( stderr, "whsp \")\"\n");
exit( 1 ); exit( EXIT_FAILURE );
} }
void void
@ -239,7 +239,7 @@ parse_at(
if ( code ) { if ( code ) {
fprintf( stderr, "%s: line %d: %s %s\n", fprintf( stderr, "%s: line %d: %s %s\n",
fname, lineno, scherr2str(code), err); fname, lineno, scherr2str(code), err);
exit( 1 ); exit( EXIT_FAILURE );
} }
ldap_memfree(at); ldap_memfree(at);
} }

View file

@ -68,7 +68,7 @@ main( int argc, char **argv )
if ( errflg || optind < argc ) { if ( errflg || optind < argc ) {
fprintf( stderr, "usage: %s [-d]\n", progname ); fprintf( stderr, "usage: %s [-d]\n", progname );
exit( 1 ); exit( EXIT_FAILURE );
} }
debug_printf( "started\n" ); debug_printf( "started\n" );
@ -76,13 +76,13 @@ main( int argc, char **argv )
(void) memset( (char *)&op, '\0', sizeof( op )); (void) memset( (char *)&op, '\0', sizeof( op ));
if ( parse_input( stdin, stdout, &op ) < 0 ) { if ( parse_input( stdin, stdout, &op ) < 0 ) {
exit( 0 ); exit( EXIT_SUCCESS );
} }
if ( op.ldop_op != LDOP_SEARCH ) { if ( op.ldop_op != LDOP_SEARCH ) {
write_result( stdout, LDAP_UNWILLING_TO_PERFORM, NULL, write_result( stdout, LDAP_UNWILLING_TO_PERFORM, NULL,
"Command Not Implemented" ); "Command Not Implemented" );
exit( 0 ); exit( EXIT_SUCCESS );
} }
#ifdef LDAP_DEBUG #ifdef LDAP_DEBUG
@ -91,7 +91,7 @@ main( int argc, char **argv )
pwdfile_search( &op, stdout ); pwdfile_search( &op, stdout );
exit( 0 ); exit( EXIT_SUCCESS );
} }

View file

@ -275,7 +275,7 @@ estrdup( char *s )
if (( p = strdup( s )) == NULL ) { if (( p = strdup( s )) == NULL ) {
debug_printf( "strdup failed\n" ); debug_printf( "strdup failed\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
return( p ); return( p );
@ -295,7 +295,7 @@ erealloc( void *s, unsigned size )
if ( p == NULL ) { if ( p == NULL ) {
debug_printf( "realloc( p, %d ) failed\n", size ); debug_printf( "realloc( p, %d ) failed\n", size );
exit( 1 ); exit( EXIT_FAILURE );
} }
return( p ); return( p );
@ -309,7 +309,7 @@ ecalloc( unsigned nelem, unsigned elsize )
if (( p = calloc( nelem, elsize )) == NULL ) { if (( p = calloc( nelem, elsize )) == NULL ) {
debug_printf( "calloc( %d, %d ) failed\n", nelem, elsize ); debug_printf( "calloc( %d, %d ) failed\n", nelem, elsize );
exit( 1 ); exit( EXIT_FAILURE );
} }
return( p ); return( p );

View file

@ -20,10 +20,8 @@
#include "ldap_log.h" #include "ldap_log.h"
#include "lber.h" #include <ldap.h>
#include "ldap.h" #include <ldap_schema.h>
#include "ldap_schema.h"
#include "ldap_pvt_thread.h" #include "ldap_pvt_thread.h"
#include "ldif.h" #include "ldif.h"

View file

@ -167,7 +167,7 @@ main( int argc, char **argv )
} else { } else {
fprintf( stderr, "%s: unknown auth method\n", optarg ); fprintf( stderr, "%s: unknown auth method\n", optarg );
fputs( "expecting \"simple\" or \"kerberos\"\n", stderr ); fputs( "expecting \"simple\" or \"kerberos\"\n", stderr );
exit( 1 ); exit( EXIT_FAILURE );
} }
break; break;
@ -179,7 +179,7 @@ main( int argc, char **argv )
} else { } else {
fprintf( stderr, "%s: unknown auth method\n", optarg ); fprintf( stderr, "%s: unknown auth method\n", optarg );
fputs( "expecting \"simple\" or \"kerberos\"\n", stderr ); fputs( "expecting \"simple\" or \"kerberos\"\n", stderr );
exit( 1 ); exit( EXIT_FAILURE );
} }
break; break;
@ -197,12 +197,12 @@ main( int argc, char **argv )
default: default:
usage( argv[0] ); usage( argv[0] );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
if ( optind == argc || ldapsrcurl == NULL || ldapdesturl == NULL ) { if ( optind == argc || ldapsrcurl == NULL || ldapdesturl == NULL ) {
usage( argv[0] ); usage( argv[0] );
exit( 1 ); exit( EXIT_FAILURE );
} }
attrs = &argv[optind]; attrs = &argv[optind];
@ -213,12 +213,12 @@ main( int argc, char **argv )
if ( (ld = start_ldap_search( ldapsrcurl, ldapfilter, attrs )) == NULL ) { if ( (ld = start_ldap_search( ldapsrcurl, ldapfilter, attrs )) == NULL ) {
fprintf( stderr, "could not initiate ldap search\n" ); fprintf( stderr, "could not initiate ldap search\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( create_tmp_files( attrs, &tmpfile, &ldbm ) != 0 ) { if ( create_tmp_files( attrs, &tmpfile, &ldbm ) != 0 ) {
fprintf( stderr, "could not create temp files\n" ); fprintf( stderr, "could not create temp files\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
/* /*
@ -229,10 +229,10 @@ main( int argc, char **argv )
if ( (count = generate_new_centroids( ld, attrs, ldbm )) < 1 ) { if ( (count = generate_new_centroids( ld, attrs, ldbm )) < 1 ) {
if ( count == 0 ) { if ( count == 0 ) {
fprintf( stderr, "no entries matched\n" ); fprintf( stderr, "no entries matched\n" );
exit( 0 ); exit( EXIT_SUCCESS );
} else { } else {
fprintf( stderr, "could not generate new centroid\n" ); fprintf( stderr, "could not generate new centroid\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
@ -246,7 +246,7 @@ main( int argc, char **argv )
if ( (ld = bind_to_destination_ldap( ldapsrcurl, ldapdesturl )) == NULL ) { if ( (ld = bind_to_destination_ldap( ldapsrcurl, ldapdesturl )) == NULL ) {
fprintf( stderr, fprintf( stderr,
"could not bind to index server, or could not create index entry\n" ); "could not bind to index server, or could not create index entry\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
for ( i = 0; ldbm[i] != NULL; i++ ) { for ( i = 0; ldbm[i] != NULL; i++ ) {
@ -338,7 +338,7 @@ main( int argc, char **argv )
free( ldbm ); free( ldbm );
free( tmpfile ); free( tmpfile );
exit( 0 ); exit( EXIT_SUCCESS );
} }
/* /*
@ -591,7 +591,7 @@ diff_centroids(
(vals[0] = (char *) malloc( 20 )) == NULL ) (vals[0] = (char *) malloc( 20 )) == NULL )
{ {
perror( "malloc" ); perror( "malloc" );
exit( -1 ); exit( EXIT_FAILURE );
} }
/* add values in mods[0] */ /* add values in mods[0] */
mods[0]->mod_op = LDAP_MOD_ADD; mods[0]->mod_op = LDAP_MOD_ADD;
@ -855,7 +855,7 @@ full_centroid(
(vals[0] = (char *) malloc( 20 )) == NULL ) (vals[0] = (char *) malloc( 20 )) == NULL )
{ {
perror( "malloc" ); perror( "malloc" );
exit( -1 ); exit( EXIT_FAILURE );
} }
mods[0]->mod_op = LDAP_MOD_REPLACE; mods[0]->mod_op = LDAP_MOD_REPLACE;
mods[0]->mod_type = attr; mods[0]->mod_type = attr;

View file

@ -473,13 +473,13 @@ main( int argc, char **argv )
break; break;
default: default:
usage( progname ); usage( progname );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
if (( dn_suffix == NULL ) || ( nreplicas == 0 )) { if (( dn_suffix == NULL ) || ( nreplicas == 0 )) {
usage( progname ); usage( progname );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( ofile == NULL ) { if ( ofile == NULL ) {
@ -494,12 +494,12 @@ main( int argc, char **argv )
if (( std_ps = ps_alloc( std_open )) == NULLPS || if (( std_ps = ps_alloc( std_open )) == NULLPS ||
std_setup( std_ps, ofp ) != OK ) { std_setup( std_ps, ofp ) != OK ) {
fprintf( stderr, "std_ps setup failed - help!\n" ); fprintf( stderr, "std_ps setup failed - help!\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if (( rps = ps_alloc( str_open )) == NULLPS || if (( rps = ps_alloc( str_open )) == NULLPS ||
str_setup( rps, NULLCP, 0, 0 ) != OK ) { str_setup( rps, NULLCP, 0, 0 ) != OK ) {
fprintf( stderr, "rps setup failed - help!\n" ); fprintf( stderr, "rps setup failed - help!\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
@ -569,7 +569,7 @@ main( int argc, char **argv )
if ( ofile != NULL ) { if ( ofile != NULL ) {
if (( ofp = lock_fopen( ofile, "a", &lfp )) == NULL ) { if (( ofp = lock_fopen( ofile, "a", &lfp )) == NULL ) {
perror( "open" ); perror( "open" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
/* /*
@ -697,5 +697,5 @@ main( int argc, char **argv )
sprintf( nbuf, "%s.lock", ofile ); sprintf( nbuf, "%s.lock", ofile );
(void) unlink( nbuf ); (void) unlink( nbuf );
} }
exit( 0 ); exit( EXIT_SUCCESS );
} }

View file

@ -137,7 +137,7 @@ main( int argc, char **argv )
} else if (( always_addvals = read_file( optarg, &always_addlen )) } else if (( always_addvals = read_file( optarg, &always_addlen ))
== NULL ) { == NULL ) {
print_err( optarg ); print_err( optarg );
exit( 1 ); exit( EXIT_FAILURE );
} }
break; break;
@ -161,7 +161,7 @@ main( int argc, char **argv )
} }
if ( file_attr_directory == NULL ) { if ( file_attr_directory == NULL ) {
print_err( "malloc" ); print_err( "malloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
#else /* HAVE_FILE_ATTR_DIR */ #else /* HAVE_FILE_ATTR_DIR */
fprintf( stderr, "Ignoring -f: this option requires a newer version of ISODE.\n" ); fprintf( stderr, "Ignoring -f: this option requires a newer version of ISODE.\n" );
@ -181,7 +181,7 @@ main( int argc, char **argv )
} }
if ( ignore_attr == NULL ) { if ( ignore_attr == NULL ) {
print_err( "malloc/realloc" ); print_err( "malloc/realloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
ignore_attr[ ignore_count ] = optarg; ignore_attr[ ignore_count ] = optarg;
ignore_attr[ ++ignore_count ] = NULL; ignore_attr[ ++ignore_count ] = NULL;
@ -194,7 +194,7 @@ main( int argc, char **argv )
if ( errflg ) { if ( errflg ) {
fprintf( stderr, usage, progname ); fprintf( stderr, usage, progname );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( basedn == NULL ) { if ( basedn == NULL ) {
@ -213,7 +213,7 @@ main( int argc, char **argv )
if ( init_syntaxes() < 0 ) { if ( init_syntaxes() < 0 ) {
fprintf( stderr, "%s: init_syntaxes failed -- check your oid tables \n", fprintf( stderr, "%s: init_syntaxes failed -- check your oid tables \n",
progname ); progname );
exit( 1 ); exit( EXIT_FAILURE );
} }
@ -242,7 +242,7 @@ main( int argc, char **argv )
fprintf( stderr, "edb2ldif: exit( %d )\n", ( rc < 0 ) ? 1 : 0 ); fprintf( stderr, "edb2ldif: exit( %d )\n", ( rc < 0 ) ? 1 : 0 );
#endif #endif
exit( ( rc < 0 ) ? 1 : 0 ); exit( ( rc < 0 ) ? EXIT_FAILURE : EXIT_SUCCESS );
} }

View file

@ -24,8 +24,8 @@
/* #include <quipu/dap2.h> */ /* #include <quipu/dap2.h> */
#include <quipu/dua.h> #include <quipu/dua.h>
#include "lber.h" #include <ldap.h>
#include "ldap.h"
#include "ldif.h" #include "ldif.h"
#include "ldapsyntax.h" #include "ldapsyntax.h"

View file

@ -77,8 +77,7 @@ main( int argc, char **argv )
fprintf( stderr, fprintf( stderr,
"usage: %s [-d level] [-f slapdconfigfile]\n", "usage: %s [-d level] [-f slapdconfigfile]\n",
argv[0] ); argv[0] );
exit( -1 ); exit( EXIT_FAILURE );
break;
} }
} }
@ -294,7 +293,7 @@ main( int argc, char **argv )
printf( "suffix: " ); printf( "suffix: " );
fflush( stdout ); fflush( stdout );
if ( fgets( buf, sizeof(buf), stdin ) == NULL ) { if ( fgets( buf, sizeof(buf), stdin ) == NULL ) {
exit( 0 ); exit( EXIT_SUCCESS );
} else { } else {
buf[strlen( buf ) - 1] = '\0'; buf[strlen( buf ) - 1] = '\0';
} }
@ -542,7 +541,7 @@ edit_entry( char c, Datum *data )
} }
execl( editor, editor, tmpname, NULL ); execl( editor, editor, tmpname, NULL );
perror( "execl" ); perror( "execl" );
exit( 1 ); exit( EXIT_FAILURE );
} }
fclose( fp ); fclose( fp );
@ -579,12 +578,12 @@ openfile( char *name, int namesiz, int mode, int verbose, char c )
if ( c == 'f' ) { if ( c == 'f' ) {
printf( " file: " ); printf( " file: " );
if ( fgets( name, namesiz, stdin ) == NULL ) if ( fgets( name, namesiz, stdin ) == NULL )
exit( 0 ); exit( EXIT_SUCCESS );
name[strlen( name ) - 1] = '\0'; name[strlen( name ) - 1] = '\0';
} else { } else {
printf( " attr: " ); printf( " attr: " );
if ( fgets( name, namesiz, stdin ) == NULL ) if ( fgets( name, namesiz, stdin ) == NULL )
exit( 0 ); exit( EXIT_SUCCESS );
name[strlen( name ) - 1] = '\0'; name[strlen( name ) - 1] = '\0';
} }
} }
@ -744,7 +743,7 @@ get_keydata( FILE *fp, char c, Datum *key, Datum *data )
if ( tty ) if ( tty )
printf( " dn: " ); printf( " dn: " );
if ( fgets( kbuf, sizeof(kbuf), fp ) == NULL ) { if ( fgets( kbuf, sizeof(kbuf), fp ) == NULL ) {
exit( 0 ); exit( EXIT_SUCCESS );
} }
kbuf[strlen( kbuf ) - 1] = '\0'; kbuf[strlen( kbuf ) - 1] = '\0';
key->dptr = strdup( kbuf ); key->dptr = strdup( kbuf );
@ -755,7 +754,7 @@ get_keydata( FILE *fp, char c, Datum *key, Datum *data )
if ( tty ) if ( tty )
printf( " dnid: " ); printf( " dnid: " );
if ( fgets( dbuf, sizeof(dbuf), fp ) == NULL ) { if ( fgets( dbuf, sizeof(dbuf), fp ) == NULL ) {
exit( 0 ); exit( EXIT_SUCCESS );
} }
n = atol( dbuf ); n = atol( dbuf );
data->dptr = (char *) malloc( sizeof(n) ); data->dptr = (char *) malloc( sizeof(n) );
@ -769,7 +768,7 @@ get_keydata( FILE *fp, char c, Datum *key, Datum *data )
if ( tty ) if ( tty )
printf( " dnid: " ); printf( " dnid: " );
if ( fgets( kbuf, sizeof(kbuf), fp ) == NULL ) { if ( fgets( kbuf, sizeof(kbuf), fp ) == NULL ) {
exit( 0 ); exit( EXIT_SUCCESS );
} }
n = atol( kbuf ); n = atol( kbuf );
key->dptr = (char *) malloc( sizeof(n) ); key->dptr = (char *) malloc( sizeof(n) );
@ -788,7 +787,7 @@ get_keydata( FILE *fp, char c, Datum *key, Datum *data )
if ( tty ) if ( tty )
printf( " key: " ); printf( " key: " );
if ( fgets( kbuf, sizeof(kbuf), fp ) == NULL ) { if ( fgets( kbuf, sizeof(kbuf), fp ) == NULL ) {
exit( 0 ); exit( EXIT_SUCCESS );
} }
kbuf[strlen( kbuf ) - 1] = '\0'; kbuf[strlen( kbuf ) - 1] = '\0';
key->dptr = strdup( kbuf ); key->dptr = strdup( kbuf );

View file

@ -12,15 +12,15 @@
#include <io.h> #include <io.h>
#endif #endif
#include "lber.h" #include <ldap.h>
#include "ldap.h"
#include "ldif.h" #include "ldif.h"
static void static void
usage( char *name ) usage( char *name )
{ {
fprintf( stderr, "usage: %s [-b] <attrtype>\n", name ); fprintf( stderr, "usage: %s [-b] <attrtype>\n", name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -54,7 +54,7 @@ main( int argc, char **argv )
if (( val = (char *) malloc( BUFSIZ )) == NULL ) { if (( val = (char *) malloc( BUFSIZ )) == NULL ) {
perror( "malloc" ); perror( "malloc" );
exit( 1 ); return EXIT_FAILURE;
} }
max = BUFSIZ; max = BUFSIZ;
cur = 0; cur = 0;
@ -64,7 +64,7 @@ main( int argc, char **argv )
if (( val = (char *) realloc( val, max )) == if (( val = (char *) realloc( val, max )) ==
NULL ) { NULL ) {
perror( "realloc" ); perror( "realloc" );
exit( 1 ); return EXIT_FAILURE;
} }
} }
memcpy( val + cur, buf, nread ); memcpy( val + cur, buf, nread );
@ -73,13 +73,13 @@ main( int argc, char **argv )
if (( out = ldif_put( LDIF_PUT_BINARY, type, val, cur )) == NULL ) { if (( out = ldif_put( LDIF_PUT_BINARY, type, val, cur )) == NULL ) {
perror( "ldif_type_and_value" ); perror( "ldif_type_and_value" );
exit( 1 ); return EXIT_FAILURE;
} }
fputs( out, stdout ); fputs( out, stdout );
ber_memfree( out ); ber_memfree( out );
free( val ); free( val );
exit( 0 ); return EXIT_SUCCESS;
} }
/* not binary: one value per line... */ /* not binary: one value per line... */
@ -89,12 +89,11 @@ main( int argc, char **argv )
if (( out = ldif_put( LDIF_PUT_VALUE, type, buf, strlen( buf ) )) if (( out = ldif_put( LDIF_PUT_VALUE, type, buf, strlen( buf ) ))
== NULL ) { == NULL ) {
perror( "ldif_type_and_value" ); perror( "ldif_type_and_value" );
exit( 1 ); return EXIT_FAILURE;
} }
fputs( out, stdout ); fputs( out, stdout );
ber_memfree( out ); ber_memfree( out );
} }
exit( 0 ); return EXIT_SUCCESS;
return( 0 ); /* NOT REACHED */
} }

View file

@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 oldif32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\libraries\Release" # ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\libraries\Release"
!ELSEIF "$(CFG)" == "ldif - Win32 Debug" !ELSEIF "$(CFG)" == "ldif - Win32 Debug"
@ -77,7 +77,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 oldif32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug" # ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug"
!ELSEIF "$(CFG)" == "ldif - Win32 Single Debug" !ELSEIF "$(CFG)" == "ldif - Win32 Single Debug"
@ -102,7 +102,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 oldif32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug" # ADD BASE LINK32 oldif32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug"
# ADD LINK32 oldif32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug" # ADD LINK32 hs_regex.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug"
!ELSEIF "$(CFG)" == "ldif - Win32 Single Release" !ELSEIF "$(CFG)" == "ldif - Win32 Single Release"
@ -127,7 +127,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 oldif32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\libraries\Release" # ADD BASE LINK32 oldif32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\libraries\Release"
# ADD LINK32 oldif32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\libraries\Release" # ADD LINK32 hs_regex.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\libraries\Release"
!ENDIF !ENDIF

View file

@ -24,7 +24,7 @@ static void
usage( char *name ) usage( char *name )
{ {
fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-n databasenumber]\n", name ); fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-n databasenumber]\n", name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -73,7 +73,7 @@ main( int argc, char **argv )
} else { } else {
if ( freopen( inputfile, "r", stdin ) == NULL ) { if ( freopen( inputfile, "r", stdin ) == NULL ) {
perror( inputfile ); perror( inputfile );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
@ -93,15 +93,15 @@ main( int argc, char **argv )
} }
if ( dbnum == nbackends ) { if ( dbnum == nbackends ) {
fprintf( stderr, "No bdb2 database found in config file\n" ); fprintf( stderr, "No bdb2 database found in config file\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} else if ( dbnum < 0 || dbnum > (nbackends-1) ) { } else if ( dbnum < 0 || dbnum > (nbackends-1) ) {
fprintf( stderr, "Database number selected via -n is out of range\n" ); fprintf( stderr, "Database number selected via -n is out of range\n" );
fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends ); fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends );
exit( 1 ); exit( EXIT_FAILURE );
} else if ( strcasecmp( backends[dbnum].be_type, "bdb2" ) != 0 ) { } else if ( strcasecmp( backends[dbnum].be_type, "bdb2" ) != 0 ) {
fprintf( stderr, "Database number %d selected via -n is not an bdb2 database\n", dbnum ); fprintf( stderr, "Database number %d selected via -n is not an bdb2 database\n", dbnum );
exit( 1 ); exit( EXIT_FAILURE );
} }
slap_startup(dbnum); slap_startup(dbnum);
@ -118,7 +118,7 @@ main( int argc, char **argv )
if ( (db = bdb2i_cache_open( be, "dn2id", BDB2_SUFFIX, LDBM_NEWDB )) if ( (db = bdb2i_cache_open( be, "dn2id", BDB2_SUFFIX, LDBM_NEWDB ))
== NULL ) { == NULL ) {
perror( "dn2id file" ); perror( "dn2id file" );
exit( 1 ); exit( EXIT_FAILURE );
} }
id = 0; id = 0;
@ -185,7 +185,7 @@ main( int argc, char **argv )
if ( ldbm_store( db->dbc_db, key, data, if ( ldbm_store( db->dbc_db, key, data,
LDBM_REPLACE ) != 0 ) { LDBM_REPLACE ) != 0 ) {
perror( "dn2id ldbm_store..." ); perror( "dn2id ldbm_store..." );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
} }
@ -204,7 +204,7 @@ main( int argc, char **argv )
if ( (db2 = bdb2i_cache_open( be, "id2children", BDB2_SUFFIX, if ( (db2 = bdb2i_cache_open( be, "id2children", BDB2_SUFFIX,
LDBM_NEWDB )) == NULL ) { LDBM_NEWDB )) == NULL ) {
perror( "id2children file" ); perror( "id2children file" );
exit( 1 ); exit( EXIT_FAILURE );
} }
rewind( stdin ); rewind( stdin );
@ -297,7 +297,7 @@ main( int argc, char **argv )
if ( bdb2i_idl_insert_key( be, db2, key, id ) if ( bdb2i_idl_insert_key( be, db2, key, id )
!= 0 ) { != 0 ) {
perror( "bdb2i_idl_insert_key" ); perror( "bdb2i_idl_insert_key" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
} }
@ -315,5 +315,5 @@ main( int argc, char **argv )
slap_shutdown(dbnum); slap_shutdown(dbnum);
slap_destroy(); slap_destroy();
exit( 0 ); exit( EXIT_SUCCESS );
} }

View file

@ -24,7 +24,7 @@ static void
usage( char *name ) usage( char *name )
{ {
fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-n databasenumber]\n", name ); fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-n databasenumber]\n", name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -75,7 +75,7 @@ main( int argc, char **argv )
} else { } else {
if ( freopen( inputfile, "r", stdin ) == NULL ) { if ( freopen( inputfile, "r", stdin ) == NULL ) {
perror( inputfile ); perror( inputfile );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
@ -95,15 +95,15 @@ main( int argc, char **argv )
} }
if ( dbnum == nbackends ) { if ( dbnum == nbackends ) {
fprintf( stderr, "No ldbm database found in config file\n" ); fprintf( stderr, "No ldbm database found in config file\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} else if ( dbnum < 0 || dbnum > (nbackends-1) ) { } else if ( dbnum < 0 || dbnum > (nbackends-1) ) {
fprintf( stderr, "Database number selected via -n is out of range\n" ); fprintf( stderr, "Database number selected via -n is out of range\n" );
fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends ); fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends );
exit( 1 ); exit( EXIT_FAILURE );
} else if ( strcasecmp( backends[dbnum].be_type, "ldbm" ) != 0 ) { } else if ( strcasecmp( backends[dbnum].be_type, "ldbm" ) != 0 ) {
fprintf( stderr, "Database number %d selected via -n is not an ldbm database\n", dbnum ); fprintf( stderr, "Database number %d selected via -n is not an ldbm database\n", dbnum );
exit( 1 ); exit( EXIT_FAILURE );
} }
slap_startup(dbnum); slap_startup(dbnum);
@ -120,7 +120,7 @@ main( int argc, char **argv )
if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX, LDBM_NEWDB )) if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX, LDBM_NEWDB ))
== NULL ) { == NULL ) {
perror( "dn2id file" ); perror( "dn2id file" );
exit( 1 ); exit( EXIT_FAILURE );
} }
id = 0; id = 0;
@ -187,7 +187,7 @@ main( int argc, char **argv )
if ( ldbm_store( db->dbc_db, key, data, if ( ldbm_store( db->dbc_db, key, data,
LDBM_REPLACE ) != 0 ) { LDBM_REPLACE ) != 0 ) {
perror( "dn2id ldbm_store" ); perror( "dn2id ldbm_store" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
} }
@ -206,7 +206,7 @@ main( int argc, char **argv )
if ( (db2 = ldbm_cache_open( be, "id2children", LDBM_SUFFIX, if ( (db2 = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
LDBM_NEWDB )) == NULL ) { LDBM_NEWDB )) == NULL ) {
perror( "id2children file" ); perror( "id2children file" );
exit( 1 ); exit( EXIT_FAILURE );
} }
rewind( stdin ); rewind( stdin );
@ -299,7 +299,7 @@ main( int argc, char **argv )
if ( idl_insert_key( be, db2, key, id ) if ( idl_insert_key( be, db2, key, id )
!= 0 ) { != 0 ) {
perror( "idl_insert_key" ); perror( "idl_insert_key" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
} }

View file

@ -22,7 +22,7 @@ static void
usage( char *name ) usage( char *name )
{ {
fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-n databasenumber]\n", name ); fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-n databasenumber]\n", name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -72,7 +72,7 @@ main( int argc, char **argv )
} else { } else {
if ( freopen( inputfile, "r", stdin ) == NULL ) { if ( freopen( inputfile, "r", stdin ) == NULL ) {
perror( inputfile ); perror( inputfile );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
@ -92,15 +92,15 @@ main( int argc, char **argv )
} }
if ( dbnum == nbackends ) { if ( dbnum == nbackends ) {
fprintf( stderr, "No bdb2 database found in config file\n" ); fprintf( stderr, "No bdb2 database found in config file\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} else if ( dbnum < 0 || dbnum > (nbackends-1) ) { } else if ( dbnum < 0 || dbnum > (nbackends-1) ) {
fprintf( stderr, "Database number selected via -n is out of range\n" ); fprintf( stderr, "Database number selected via -n is out of range\n" );
fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends ); fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends );
exit( 1 ); exit( EXIT_FAILURE );
} else if ( strcasecmp( backends[dbnum].be_type, "bdb2" ) != 0 ) { } else if ( strcasecmp( backends[dbnum].be_type, "bdb2" ) != 0 ) {
fprintf( stderr, "Database number %d selected via -n is not an bdb2 database\n", dbnum ); fprintf( stderr, "Database number %d selected via -n is not an bdb2 database\n", dbnum );
exit( 1 ); exit( EXIT_FAILURE );
} }
slap_startup(dbnum); slap_startup(dbnum);
@ -114,7 +114,7 @@ main( int argc, char **argv )
if ( (db = bdb2i_cache_open( be, "id2entry", BDB2_SUFFIX, LDBM_NEWDB )) if ( (db = bdb2i_cache_open( be, "id2entry", BDB2_SUFFIX, LDBM_NEWDB ))
== NULL ) { == NULL ) {
perror( "id2entry file" ); perror( "id2entry file" );
exit( 1 ); exit( EXIT_FAILURE );
} }
id = 0; id = 0;
@ -178,7 +178,7 @@ main( int argc, char **argv )
LDBM_INSERT ) != 0 ) { LDBM_INSERT ) != 0 ) {
fputs("id2entry ldbm_store failed\n", fputs("id2entry ldbm_store failed\n",
stderr); stderr);
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
*buf = '\0'; *buf = '\0';
@ -198,5 +198,5 @@ main( int argc, char **argv )
slap_destroy(); slap_destroy();
exit( 0 ); exit( EXIT_SUCCESS );
} }

View file

@ -22,7 +22,7 @@ static void
usage( char *name ) usage( char *name )
{ {
fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-n databasenumber]\n", name ); fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-n databasenumber]\n", name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -74,7 +74,7 @@ main( int argc, char **argv )
} else { } else {
if ( freopen( inputfile, "r", stdin ) == NULL ) { if ( freopen( inputfile, "r", stdin ) == NULL ) {
perror( inputfile ); perror( inputfile );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
@ -94,15 +94,15 @@ main( int argc, char **argv )
} }
if ( dbnum == nbackends ) { if ( dbnum == nbackends ) {
fprintf( stderr, "No ldbm database found in config file\n" ); fprintf( stderr, "No ldbm database found in config file\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} else if ( dbnum < 0 || dbnum > (nbackends-1) ) { } else if ( dbnum < 0 || dbnum > (nbackends-1) ) {
fprintf( stderr, "Database number selected via -n is out of range\n" ); fprintf( stderr, "Database number selected via -n is out of range\n" );
fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends ); fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends );
exit( 1 ); exit( EXIT_FAILURE );
} else if ( strcasecmp( backends[dbnum].be_type, "ldbm" ) != 0 ) { } else if ( strcasecmp( backends[dbnum].be_type, "ldbm" ) != 0 ) {
fprintf( stderr, "Database number %d selected via -n is not an ldbm database\n", dbnum ); fprintf( stderr, "Database number %d selected via -n is not an ldbm database\n", dbnum );
exit( 1 ); exit( EXIT_FAILURE );
} }
slap_startup(dbnum); slap_startup(dbnum);
@ -116,7 +116,7 @@ main( int argc, char **argv )
if ( (db = ldbm_cache_open( be, "id2entry", LDBM_SUFFIX, LDBM_NEWDB )) if ( (db = ldbm_cache_open( be, "id2entry", LDBM_SUFFIX, LDBM_NEWDB ))
== NULL ) { == NULL ) {
perror( "id2entry file" ); perror( "id2entry file" );
exit( 1 ); exit( EXIT_FAILURE );
} }
id = 0; id = 0;
@ -180,7 +180,7 @@ main( int argc, char **argv )
LDBM_INSERT ) != 0 ) { LDBM_INSERT ) != 0 ) {
fputs("id2entry ldbm_store failed\n", fputs("id2entry ldbm_store failed\n",
stderr); stderr);
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
*buf = '\0'; *buf = '\0';

View file

@ -21,7 +21,7 @@ static void
usage( char *name ) usage( char *name )
{ {
fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-n databasenumber] attr\n", name ); fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-n databasenumber] attr\n", name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -72,7 +72,7 @@ main( int argc, char **argv )
} else { } else {
if ( freopen( inputfile, "r", stdin ) == NULL ) { if ( freopen( inputfile, "r", stdin ) == NULL ) {
perror( inputfile ); perror( inputfile );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
@ -88,15 +88,15 @@ main( int argc, char **argv )
} }
if ( dbnum == nbackends ) { if ( dbnum == nbackends ) {
fprintf( stderr, "No bdb2 database found in config file\n" ); fprintf( stderr, "No bdb2 database found in config file\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} else if ( dbnum < 0 || dbnum > (nbackends-1) ) { } else if ( dbnum < 0 || dbnum > (nbackends-1) ) {
fprintf( stderr, "Database number selected via -n is out of range\n" ); fprintf( stderr, "Database number selected via -n is out of range\n" );
fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends ); fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends );
exit( 1 ); exit( EXIT_FAILURE );
} else if ( strcasecmp( backends[dbnum].be_type, "bdb2" ) != 0 ) { } else if ( strcasecmp( backends[dbnum].be_type, "bdb2" ) != 0 ) {
fprintf( stderr, "Database number %d selected via -n is not an bdb2 database\n", dbnum ); fprintf( stderr, "Database number %d selected via -n is not an bdb2 database\n", dbnum );
exit( 1 ); exit( EXIT_FAILURE );
} }
slap_startup(dbnum); slap_startup(dbnum);
@ -109,7 +109,7 @@ main( int argc, char **argv )
bdb2i_attr_masks( be->be_private, attr, &indexmask, &syntaxmask ); bdb2i_attr_masks( be->be_private, attr, &indexmask, &syntaxmask );
if ( indexmask == 0 ) { if ( indexmask == 0 ) {
exit( 0 ); exit( EXIT_SUCCESS );
} }
id = 0; id = 0;
@ -172,5 +172,5 @@ main( int argc, char **argv )
slap_shutdown(dbnum); slap_shutdown(dbnum);
slap_destroy(); slap_destroy();
exit( 0 ); exit( EXIT_SUCCESS );
} }

View file

@ -21,7 +21,7 @@ static void
usage( char *name ) usage( char *name )
{ {
fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-n databasenumber] attr\n", name ); fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-n databasenumber] attr\n", name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -74,7 +74,7 @@ main( int argc, char **argv )
} else { } else {
if ( freopen( inputfile, "r", stdin ) == NULL ) { if ( freopen( inputfile, "r", stdin ) == NULL ) {
perror( inputfile ); perror( inputfile );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
@ -90,15 +90,15 @@ main( int argc, char **argv )
} }
if ( dbnum == nbackends ) { if ( dbnum == nbackends ) {
fprintf( stderr, "No ldbm database found in config file\n" ); fprintf( stderr, "No ldbm database found in config file\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} else if ( dbnum < 0 || dbnum > (nbackends-1) ) { } else if ( dbnum < 0 || dbnum > (nbackends-1) ) {
fprintf( stderr, "Database number selected via -n is out of range\n" ); fprintf( stderr, "Database number selected via -n is out of range\n" );
fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends ); fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends );
exit( 1 ); exit( EXIT_FAILURE );
} else if ( strcasecmp( backends[dbnum].be_type, "ldbm" ) != 0 ) { } else if ( strcasecmp( backends[dbnum].be_type, "ldbm" ) != 0 ) {
fprintf( stderr, "Database number %d selected via -n is not an ldbm database\n", dbnum ); fprintf( stderr, "Database number %d selected via -n is not an ldbm database\n", dbnum );
exit( 1 ); exit( EXIT_FAILURE );
} }
slap_startup(dbnum); slap_startup(dbnum);
@ -111,7 +111,7 @@ main( int argc, char **argv )
attr_masks( be->be_private, attr, &indexmask, &syntaxmask ); attr_masks( be->be_private, attr, &indexmask, &syntaxmask );
if ( indexmask == 0 ) { if ( indexmask == 0 ) {
exit( 0 ); exit( EXIT_SUCCESS );
} }
id = 0; id = 0;

View file

@ -32,7 +32,7 @@ static void
usage( char *name ) usage( char *name )
{ {
fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-j #jobs] [-n databasenumber] [-s sbindir]\n", name ); fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-j #jobs] [-n databasenumber] [-s sbindir]\n", name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -95,7 +95,7 @@ main( int argc, char **argv )
} else { } else {
if ( freopen( inputfile, "r", stdin ) == NULL ) { if ( freopen( inputfile, "r", stdin ) == NULL ) {
perror( inputfile ); perror( inputfile );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
@ -106,7 +106,7 @@ main( int argc, char **argv )
rc = slap_init(SLAP_TOOL_MODE, "ldif2ldbm"); rc = slap_init(SLAP_TOOL_MODE, "ldif2ldbm");
if (rc != 0 ) { if (rc != 0 ) {
fprintf( stderr, "ldif2ldbm: slap_init failed!\n"); fprintf( stderr, "ldif2ldbm: slap_init failed!\n");
exit(1); exit(EXIT_FAILURE);
} }
read_config( tailorfile ); read_config( tailorfile );
@ -120,15 +120,15 @@ main( int argc, char **argv )
} }
if ( dbnum == nbackends ) { if ( dbnum == nbackends ) {
fprintf( stderr, "No bdb2 database found in config file\n" ); fprintf( stderr, "No bdb2 database found in config file\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} else if ( dbnum < 0 || dbnum > (nbackends-1) ) { } else if ( dbnum < 0 || dbnum > (nbackends-1) ) {
fprintf( stderr, "Database number selected via -n is out of range\n" ); fprintf( stderr, "Database number selected via -n is out of range\n" );
fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends ); fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends );
exit( 1 ); exit( EXIT_FAILURE );
} else if ( strcasecmp( backends[dbnum].be_type, "bdb2" ) != 0 ) { } else if ( strcasecmp( backends[dbnum].be_type, "bdb2" ) != 0 ) {
fprintf( stderr, "Database number %d selected via -n is not an bdb2 database\n", dbnum ); fprintf( stderr, "Database number %d selected via -n is not an bdb2 database\n", dbnum );
exit( 1 ); exit( EXIT_FAILURE );
} }
slap_startup(dbnum); slap_startup(dbnum);
@ -272,7 +272,7 @@ main( int argc, char **argv )
slap_destroy(); slap_destroy();
exit( 0 ); exit( EXIT_SUCCESS );
} }
static void static void
@ -287,7 +287,7 @@ fork_child( char *prog, char *args[] )
execvp( prog, args ); execvp( prog, args );
fprintf( stderr, "%s: ", prog ); fprintf( stderr, "%s: ", prog );
perror( "execv" ); perror( "execv" );
exit( -1 ); exit( EXIT_FAILURE );
break; break;
case -1: /* trouble */ case -1: /* trouble */

View file

@ -35,7 +35,7 @@ static void
usage( char *name ) usage( char *name )
{ {
fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-j #jobs] [-n databasenumber] [-s sbindir]\n", name ); fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-j #jobs] [-n databasenumber] [-s sbindir]\n", name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -101,7 +101,7 @@ main( int argc, char **argv )
} else { } else {
if ( freopen( inputfile, "r", stdin ) == NULL ) { if ( freopen( inputfile, "r", stdin ) == NULL ) {
perror( inputfile ); perror( inputfile );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
@ -112,7 +112,7 @@ main( int argc, char **argv )
rc = slap_init(SLAP_TOOL_MODE, "ldif2ldbm"); rc = slap_init(SLAP_TOOL_MODE, "ldif2ldbm");
if (rc != 0 ) { if (rc != 0 ) {
fprintf( stderr, "ldif2ldbm: slap_init failed!\n"); fprintf( stderr, "ldif2ldbm: slap_init failed!\n");
exit(1); exit(EXIT_FAILURE);
} }
read_config( tailorfile ); read_config( tailorfile );
@ -126,15 +126,15 @@ main( int argc, char **argv )
} }
if ( dbnum == nbackends ) { if ( dbnum == nbackends ) {
fprintf( stderr, "No ldbm database found in config file\n" ); fprintf( stderr, "No ldbm database found in config file\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} else if ( dbnum < 0 || dbnum > (nbackends-1) ) { } else if ( dbnum < 0 || dbnum > (nbackends-1) ) {
fprintf( stderr, "Database number selected via -n is out of range\n" ); fprintf( stderr, "Database number selected via -n is out of range\n" );
fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends ); fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends );
exit( 1 ); exit( EXIT_FAILURE );
} else if ( strcasecmp( backends[dbnum].be_type, "ldbm" ) != 0 ) { } else if ( strcasecmp( backends[dbnum].be_type, "ldbm" ) != 0 ) {
fprintf( stderr, "Database number %d selected via -n is not an ldbm database\n", dbnum ); fprintf( stderr, "Database number %d selected via -n is not an ldbm database\n", dbnum );
exit( 1 ); exit( EXIT_FAILURE );
} }
slap_startup(dbnum); slap_startup(dbnum);
@ -315,7 +315,7 @@ fork_child( char *prog, char *args[] )
{ {
fprintf( stderr, "Could not create %s: ", prog ); fprintf( stderr, "Could not create %s: ", prog );
perror( "CreateProcess" ); perror( "CreateProcess" );
exit (-1); exit (EXIT_FAILURE);
} }
processes[nkids] = proc_info.hProcess; processes[nkids] = proc_info.hProcess;
@ -357,7 +357,7 @@ fork_child( char *prog, char *args[] )
execvp( prog, args ); execvp( prog, args );
fprintf( stderr, "%s: ", prog ); fprintf( stderr, "%s: ", prog );
perror( "execv" ); perror( "execv" );
exit( -1 ); exit( EXIT_FAILURE );
break; break;
case -1: /* trouble */ case -1: /* trouble */

View file

@ -48,13 +48,13 @@ main( int argc, char **argv )
*/ */
if ( (ld = ldap_init( "vertigo:5555", 0 )) == NULL ) { if ( (ld = ldap_init( "vertigo:5555", 0 )) == NULL ) {
perror( "ldap_init" ); perror( "ldap_init" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( ldap_search( ld, "cn=index", LDAP_SCOPE_ONELEVEL, "(objectclass=*)", if ( ldap_search( ld, "cn=index", LDAP_SCOPE_ONELEVEL, "(objectclass=*)",
attrs, 0 ) == -1 ) { attrs, 0 ) == -1 ) {
ldap_perror( ld, "ldap_search" ); ldap_perror( ld, "ldap_search" );
exit( 1 ); exit( EXIT_FAILURE );
} }
printf( "attr\tdn\tnentries\tvcount\tvsize\twcount\twsize\tpcount\tpsize\tscount\tssize\n" ); printf( "attr\tdn\tnentries\tvcount\tvsize\twcount\twsize\tpcount\tpsize\tscount\tssize\n" );
@ -82,7 +82,7 @@ main( int argc, char **argv )
DB_FLAGS, MODE, CACHE_SIZE )) == NULL || (sldbm = ldbm_open( DB_FLAGS, MODE, CACHE_SIZE )) == NULL || (sldbm = ldbm_open(
"scount.ldbm", DB_FLAGS, MODE, CACHE_SIZE )) == NULL ) { "scount.ldbm", DB_FLAGS, MODE, CACHE_SIZE )) == NULL ) {
perror( "ldbm_open" ); perror( "ldbm_open" );
exit( 1 ); exit( EXIT_FAILURE );
} }
vcount = 0; vsize = 0; vcount = 0; vsize = 0;
wcount = 0; wsize = 0; wcount = 0; wsize = 0;
@ -164,7 +164,7 @@ main( int argc, char **argv )
(void) unlink( "pcount.ldbm" ); (void) unlink( "pcount.ldbm" );
(void) unlink( "scount.ldbm" ); (void) unlink( "scount.ldbm" );
exit( 0 ); exit( EXIT_SUCCESS );
} }
static void static void

View file

@ -60,7 +60,7 @@ slap_init_user( char *user, char *group )
if ( pwd == NULL ) { if ( pwd == NULL ) {
Debug( LDAP_DEBUG_ANY, "No passwd entry for user %s\n", Debug( LDAP_DEBUG_ANY, "No passwd entry for user %s\n",
user, 0, 0 ); user, 0, 0 );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( got_uid ) { if ( got_uid ) {
free( user ); free( user );
@ -93,7 +93,7 @@ slap_init_user( char *user, char *group )
if ( grp == NULL ) { if ( grp == NULL ) {
Debug( LDAP_DEBUG_ANY, "No group entry for group %s\n", Debug( LDAP_DEBUG_ANY, "No group entry for group %s\n",
group, 0, 0 ); group, 0, 0 );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
free( group ); free( group );
@ -104,7 +104,7 @@ slap_init_user( char *user, char *group )
if ( getuid() == 0 && initgroups( user, gid ) != 0 ) { if ( getuid() == 0 && initgroups( user, gid ) != 0 ) {
Debug( LDAP_DEBUG_ANY, Debug( LDAP_DEBUG_ANY,
"Could not set the group access (gid) list\n", 0, 0, 0 ); "Could not set the group access (gid) list\n", 0, 0, 0 );
exit( 1 ); exit( EXIT_FAILURE );
} }
free( user ); free( user );
} }
@ -117,13 +117,13 @@ slap_init_user( char *user, char *group )
if ( setgid( gid ) != 0 ) { if ( setgid( gid ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "Could not set real group id to %d\n", Debug( LDAP_DEBUG_ANY, "Could not set real group id to %d\n",
gid, 0, 0 ); gid, 0, 0 );
exit( 1 ); exit( EXIT_FAILURE );
} }
#ifdef HAVE_SETEGID #ifdef HAVE_SETEGID
if ( setegid( gid ) != 0 ) { if ( setegid( gid ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "Could not set effective group id to %d\n", Debug( LDAP_DEBUG_ANY, "Could not set effective group id to %d\n",
gid, 0, 0 ); gid, 0, 0 );
exit( 1 ); exit( EXIT_FAILURE );
} }
#endif #endif
} }
@ -132,13 +132,13 @@ slap_init_user( char *user, char *group )
if ( setuid( uid ) != 0 ) { if ( setuid( uid ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "Could not set real user id to %d\n", Debug( LDAP_DEBUG_ANY, "Could not set real user id to %d\n",
uid, 0, 0 ); uid, 0, 0 );
exit( 1 ); exit( EXIT_FAILURE );
} }
#ifdef HAVE_SETEUID #ifdef HAVE_SETEUID
if ( seteuid( uid ) != 0 ) { if ( seteuid( uid ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "Could not set effective user id to %d\n", Debug( LDAP_DEBUG_ANY, "Could not set effective user id to %d\n",
uid, 0, 0 ); uid, 0, 0 );
exit( 1 ); exit( EXIT_FAILURE );
} }
#endif #endif
} }

View file

@ -39,7 +39,7 @@ ch_malloc(
if ( (new = (void *) ber_memalloc( size )) == NULL ) { if ( (new = (void *) ber_memalloc( size )) == NULL ) {
fprintf( stderr, "malloc of %lu bytes failed\n", fprintf( stderr, "malloc of %lu bytes failed\n",
(long) size ); (long) size );
exit( 1 ); exit( EXIT_FAILURE );
} }
return( new ); return( new );
@ -71,7 +71,7 @@ ch_realloc(
if ( (new = (void *) ber_memrealloc( block, size )) == NULL ) { if ( (new = (void *) ber_memrealloc( block, size )) == NULL ) {
fprintf( stderr, "realloc of %lu bytes failed\n", fprintf( stderr, "realloc of %lu bytes failed\n",
(long) size ); (long) size );
exit( 1 ); exit( EXIT_FAILURE );
} }
return( new ); return( new );
@ -95,7 +95,7 @@ ch_calloc(
if ( (new = (void *) ber_memcalloc( nelem, size )) == NULL ) { if ( (new = (void *) ber_memcalloc( nelem, size )) == NULL ) {
fprintf( stderr, "calloc of %lu elems of %lu bytes failed\n", fprintf( stderr, "calloc of %lu elems of %lu bytes failed\n",
(long) nelem, (long) size ); (long) nelem, (long) size );
exit( 1 ); exit( EXIT_FAILURE );
} }
return( new ); return( new );

View file

@ -64,7 +64,7 @@ slurpd_read_config(
if ( (fp = fopen( fname, "r" )) == NULL ) { if ( (fp = fopen( fname, "r" )) == NULL ) {
perror( fname ); perror( fname );
exit( 1 ); exit( EXIT_FAILURE );
} }
lineno = 0; lineno = 0;
@ -96,7 +96,7 @@ slurpd_read_config(
"line %d: missing filename in \"replogfile ", "line %d: missing filename in \"replogfile ",
lineno ); lineno );
fprintf( stderr, "<filename>\" line\n" ); fprintf( stderr, "<filename>\" line\n" );
exit( 1 ); exit( EXIT_FAILURE );
} else if ( cargc > 2 && *cargv[2] != '#' ) { } else if ( cargc > 2 && *cargv[2] != '#' ) {
fprintf( stderr, fprintf( stderr,
"line %d: extra cruft at the end of \"replogfile %s\"", "line %d: extra cruft at the end of \"replogfile %s\"",
@ -258,13 +258,13 @@ add_replica(
( nr + 1 ) * sizeof( Re * )); ( nr + 1 ) * sizeof( Re * ));
if ( sglob->replicas == NULL ) { if ( sglob->replicas == NULL ) {
fprintf( stderr, "out of memory, add_replica\n" ); fprintf( stderr, "out of memory, add_replica\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
sglob->replicas[ nr ] = NULL; sglob->replicas[ nr ] = NULL;
if ( Ri_init( &(sglob->replicas[ nr - 1 ])) < 0 ) { if ( Ri_init( &(sglob->replicas[ nr - 1 ])) < 0 ) {
fprintf( stderr, "out of memory, Ri_init\n" ); fprintf( stderr, "out of memory, Ri_init\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( parse_replica_line( cargv, cargc, if ( parse_replica_line( cargv, cargc,
sglob->replicas[ nr - 1] ) < 0 ) { sglob->replicas[ nr - 1] ) < 0 ) {
@ -287,7 +287,7 @@ add_replica(
sglob->replicas[ nr - 1 ] ); sglob->replicas[ nr - 1 ] );
if ( sglob->replicas[ nr - 1]->ri_stel == NULL ) { if ( sglob->replicas[ nr - 1]->ri_stel == NULL ) {
fprintf( stderr, "Failed to add status element structure\n" ); fprintf( stderr, "Failed to add status element structure\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
} }
@ -367,7 +367,7 @@ parse_replica_line(
fprintf( stderr, "You must rebuild the LDAP release with\n" ); fprintf( stderr, "You must rebuild the LDAP release with\n" );
fprintf( stderr, "kerberos support if you wish to use\n" ); fprintf( stderr, "kerberos support if you wish to use\n" );
fprintf( stderr, "bindmethod=kerberos\n" ); fprintf( stderr, "bindmethod=kerberos\n" );
exit( 1 ); exit( EXIT_FAILURE );
#endif /* HAVE_KERBEROS */ #endif /* HAVE_KERBEROS */
} else if ( !strcasecmp( val, SIMPLESTR )) { } else if ( !strcasecmp( val, SIMPLESTR )) {
ri->ri_bind_method = AUTH_SIMPLE; ri->ri_bind_method = AUTH_SIMPLE;

View file

@ -59,12 +59,12 @@ init_globals( void )
g->srpos = 0L; g->srpos = 0L;
if ( St_init( &(g->st)) < 0 ) { if ( St_init( &(g->st)) < 0 ) {
fprintf( stderr, "Cannot initialize status data\n" ); fprintf( stderr, "Cannot initialize status data\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
ldap_pvt_thread_mutex_init( &(g->rej_mutex) ); ldap_pvt_thread_mutex_init( &(g->rej_mutex) );
if ( Rq_init( &(g->rq)) < 0 ) { if ( Rq_init( &(g->rq)) < 0 ) {
fprintf( stderr, "Cannot initialize queue\n" ); fprintf( stderr, "Cannot initialize queue\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
#ifdef HAVE_KERBEROS #ifdef HAVE_KERBEROS
g->default_srvtab = SRVTAB; g->default_srvtab = SRVTAB;

View file

@ -47,14 +47,14 @@ main(
*/ */
if (( sglob = init_globals()) == NULL ) { if (( sglob = init_globals()) == NULL ) {
fprintf( stderr, "Out of memory initializing globals\n" ); fprintf( stderr, "Out of memory initializing globals\n" );
exit( 1 ); exit( EXIT_FAILURE );
} }
/* /*
* Process command-line args and fill in globals. * Process command-line args and fill in globals.
*/ */
if ( doargs( argc, argv, sglob ) < 0 ) { if ( doargs( argc, argv, sglob ) < 0 ) {
exit( 1 ); exit( EXIT_FAILURE );
} }
/* /*
@ -64,7 +64,7 @@ main(
fprintf( stderr, fprintf( stderr,
"Errors encountered while processing config file \"%s\"\n", "Errors encountered while processing config file \"%s\"\n",
sglob->slapd_configfile ); sglob->slapd_configfile );
exit( 1 ); exit( EXIT_FAILURE );
} }
/* /*
@ -73,7 +73,7 @@ main(
if ( sglob->st->st_read( sglob->st )) { if ( sglob->st->st_read( sglob->st )) {
fprintf( stderr, "Malformed slurpd status file \"%s\"\n", fprintf( stderr, "Malformed slurpd status file \"%s\"\n",
sglob->slurpd_status_file, 0, 0 ); sglob->slurpd_status_file, 0, 0 );
exit( 1 ); exit( EXIT_FAILURE );
} }
/* /*
@ -81,7 +81,7 @@ main(
* Check for any fatal error conditions before we get started * Check for any fatal error conditions before we get started
*/ */
if ( sanity() < 0 ) { if ( sanity() < 0 ) {
exit( 1 ); exit( EXIT_FAILURE );
} }
/* /*
@ -110,7 +110,7 @@ main(
{ {
Debug( LDAP_DEBUG_ANY, "file manager ldap_pvt_thread_create failed\n", Debug( LDAP_DEBUG_ANY, "file manager ldap_pvt_thread_create failed\n",
0, 0, 0 ); 0, 0, 0 );
exit( 1 ); exit( EXIT_FAILURE );
} }

View file

@ -29,8 +29,7 @@
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#include "lber.h" #include <ldap.h>
#include "ldap.h"
#define ldap_debug slurp_debug #define ldap_debug slurp_debug
#include "ldap_log.h" #include "ldap_log.h"

View file

@ -14,8 +14,7 @@
#include <sys/param.h> #include <sys/param.h>
#endif #endif
#include "lber.h" #include <ldap.h>
#include "ldap.h"
#define LOOPS 100 #define LOOPS 100
@ -31,7 +30,7 @@ usage( char *name )
{ {
fprintf( stderr, "usage: %s [-h <host>] -p port -D <managerDN> -w <passwd> -f <addfile> [-l <loops>]\n", fprintf( stderr, "usage: %s [-h <host>] -p port -D <managerDN> -w <passwd> -f <addfile> [-l <loops>]\n",
name ); name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -88,7 +87,7 @@ main( int argc, char **argv )
fprintf( stderr, "%s: invalid entry DN in file \"%s\".\n", fprintf( stderr, "%s: invalid entry DN in file \"%s\".\n",
argv[0], filename ); argv[0], filename );
exit( 1 ); exit( EXIT_FAILURE );
} }
@ -96,13 +95,13 @@ main( int argc, char **argv )
fprintf( stderr, "%s: invalid attrs in file \"%s\".\n", fprintf( stderr, "%s: invalid attrs in file \"%s\".\n",
argv[0], filename ); argv[0], filename );
exit( 1 ); exit( EXIT_FAILURE );
} }
do_addel( host, port, manager, passwd, entry, attrs, loops ); do_addel( host, port, manager, passwd, entry, attrs, loops );
exit( 0 ); exit( EXIT_SUCCESS );
} }
@ -130,19 +129,19 @@ addmodifyop( LDAPMod ***pmodsp, int modop, char *attr, char *value, int vlen )
if (( pmods = (LDAPMod **)realloc( pmods, (i + 2) * if (( pmods = (LDAPMod **)realloc( pmods, (i + 2) *
sizeof( LDAPMod * ))) == NULL ) { sizeof( LDAPMod * ))) == NULL ) {
perror( "realloc" ); perror( "realloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
*pmodsp = pmods; *pmodsp = pmods;
pmods[ i + 1 ] = NULL; pmods[ i + 1 ] = NULL;
if (( pmods[ i ] = (LDAPMod *)calloc( 1, sizeof( LDAPMod ))) if (( pmods[ i ] = (LDAPMod *)calloc( 1, sizeof( LDAPMod )))
== NULL ) { == NULL ) {
perror( "calloc" ); perror( "calloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
pmods[ i ]->mod_op = modop; pmods[ i ]->mod_op = modop;
if (( pmods[ i ]->mod_type = strdup( attr )) == NULL ) { if (( pmods[ i ]->mod_type = strdup( attr )) == NULL ) {
perror( "strdup" ); perror( "strdup" );
exit( 1 ); exit( EXIT_FAILURE );
} }
} }
@ -157,20 +156,20 @@ addmodifyop( LDAPMod ***pmodsp, int modop, char *attr, char *value, int vlen )
(struct berval **)ber_memrealloc( pmods[ i ]->mod_bvalues, (struct berval **)ber_memrealloc( pmods[ i ]->mod_bvalues,
(j + 2) * sizeof( struct berval * ))) == NULL ) { (j + 2) * sizeof( struct berval * ))) == NULL ) {
perror( "ber_realloc" ); perror( "ber_realloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
pmods[ i ]->mod_bvalues[ j + 1 ] = NULL; pmods[ i ]->mod_bvalues[ j + 1 ] = NULL;
if (( bvp = (struct berval *)ber_memalloc( sizeof( struct berval ))) if (( bvp = (struct berval *)ber_memalloc( sizeof( struct berval )))
== NULL ) { == NULL ) {
perror( "malloc" ); perror( "malloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
pmods[ i ]->mod_bvalues[ j ] = bvp; pmods[ i ]->mod_bvalues[ j ] = bvp;
bvp->bv_len = vlen; bvp->bv_len = vlen;
if (( bvp->bv_val = (char *)malloc( vlen + 1 )) == NULL ) { if (( bvp->bv_val = (char *)malloc( vlen + 1 )) == NULL ) {
perror( "malloc" ); perror( "malloc" );
exit( 1 ); exit( EXIT_FAILURE );
} }
SAFEMEMCPY( bvp->bv_val, value, vlen ); SAFEMEMCPY( bvp->bv_val, value, vlen );
bvp->bv_val[ vlen ] = '\0'; bvp->bv_val[ vlen ] = '\0';
@ -237,13 +236,13 @@ do_addel(
if (( ld = ldap_init( host, port )) == NULL ) { if (( ld = ldap_init( host, port )) == NULL ) {
perror( "ldap_init" ); perror( "ldap_init" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( ldap_bind_s( ld, manager, passwd, LDAP_AUTH_SIMPLE ) if ( ldap_bind_s( ld, manager, passwd, LDAP_AUTH_SIMPLE )
!= LDAP_SUCCESS ) { != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" ); ldap_perror( ld, "ldap_bind" );
exit( 1 ); exit( EXIT_FAILURE );
} }

View file

@ -14,8 +14,7 @@
#include <sys/param.h> #include <sys/param.h>
#endif #endif
#include "lber.h" #include <ldap.h>
#include "ldap.h"
#define LOOPS 100 #define LOOPS 100
@ -27,7 +26,7 @@ usage( char *name )
{ {
fprintf( stderr, "usage: %s [-h <host>] -p port -e <entry> [-l <loops>]\n", fprintf( stderr, "usage: %s [-h <host>] -p port -e <entry> [-l <loops>]\n",
name ); name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -70,13 +69,13 @@ main( int argc, char **argv )
fprintf( stderr, "%s: invalid EMPTY entry DN.\n", fprintf( stderr, "%s: invalid EMPTY entry DN.\n",
argv[0] ); argv[0] );
exit( 1 ); exit( EXIT_FAILURE );
} }
do_read( host, port, entry, ( 4 * loops )); do_read( host, port, entry, ( 4 * loops ));
exit( 0 ); exit( EXIT_SUCCESS );
} }
@ -91,12 +90,12 @@ do_read( char *host, int port, char *entry, int maxloop )
if (( ld = ldap_init( host, port )) == NULL ) { if (( ld = ldap_init( host, port )) == NULL ) {
perror( "ldap_init" ); perror( "ldap_init" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( ldap_bind_s( ld, NULL, NULL, LDAP_AUTH_SIMPLE ) != LDAP_SUCCESS ) { if ( ldap_bind_s( ld, NULL, NULL, LDAP_AUTH_SIMPLE ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" ); ldap_perror( ld, "ldap_bind" );
exit( 1 ); exit( EXIT_FAILURE );
} }

View file

@ -14,8 +14,7 @@
#include <sys/param.h> #include <sys/param.h>
#endif #endif
#include "lber.h" #include <ldap.h>
#include "ldap.h"
#define LOOPS 100 #define LOOPS 100
@ -27,7 +26,7 @@ usage( char *name )
{ {
fprintf( stderr, "usage: %s [-h <host>] -p port -b <searchbase> -f <searchfiter> [-l <loops>]\n", fprintf( stderr, "usage: %s [-h <host>] -p port -b <searchbase> -f <searchfiter> [-l <loops>]\n",
name ); name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -75,13 +74,13 @@ main( int argc, char **argv )
fprintf( stderr, "%s: invalid EMPTY search filter.\n", fprintf( stderr, "%s: invalid EMPTY search filter.\n",
argv[0] ); argv[0] );
exit( 1 ); exit( EXIT_FAILURE );
} }
do_search( host, port, sbase, filter, ( 4 * loops )); do_search( host, port, sbase, filter, ( 4 * loops ));
exit( 0 ); exit( EXIT_SUCCESS );
} }
@ -95,12 +94,12 @@ do_search( char *host, int port, char *sbase, char *filter, int maxloop )
if (( ld = ldap_init( host, port )) == NULL ) { if (( ld = ldap_init( host, port )) == NULL ) {
perror( "ldap_init" ); perror( "ldap_init" );
exit( 1 ); exit( EXIT_FAILURE );
} }
if ( ldap_bind_s( ld, NULL, NULL, LDAP_AUTH_SIMPLE ) != LDAP_SUCCESS ) { if ( ldap_bind_s( ld, NULL, NULL, LDAP_AUTH_SIMPLE ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" ); ldap_perror( ld, "ldap_bind" );
exit( 1 ); exit( EXIT_FAILURE );
} }

View file

@ -42,7 +42,7 @@ static void
usage( char *name ) usage( char *name )
{ {
fprintf( stderr, "usage: %s [-h <host>] -p <port> -D <manager> -w <passwd> -d <datadir> -b <baseDN> [-j <maxchild>] [-l <loops>] -P <progdir>\n", name ); fprintf( stderr, "usage: %s [-h <host>] -p <port> -D <manager> -w <passwd> -d <datadir> -b <baseDN> [-j <maxchild>] [-l <loops>] -P <progdir>\n", name );
exit( 1 ); exit( EXIT_FAILURE );
} }
int int
@ -130,7 +130,7 @@ main( int argc, char **argv )
fprintf( stderr, "%s: couldn't open data directory \"%s\".\n", fprintf( stderr, "%s: couldn't open data directory \"%s\".\n",
argv[0], dirname ); argv[0], dirname );
exit( 1 ); exit( EXIT_FAILURE );
} }
@ -246,7 +246,7 @@ main( int argc, char **argv )
wait4kids( -1 ); wait4kids( -1 );
exit( 0 ); exit( EXIT_SUCCESS );
} }
static char * static char *
@ -319,7 +319,7 @@ fork_child( char *prog, char *args[] )
execvp( prog, args ); execvp( prog, args );
fprintf( stderr, "%s: ", prog ); fprintf( stderr, "%s: ", prog );
perror( "execv" ); perror( "execv" );
exit( -1 ); exit( EXIT_FAILURE );
break; break;
case -1: /* trouble */ case -1: /* trouble */