Check for ldap_set_option() error using LDAP_OPT_ERROR, not -1.
(probably should check != LDAP_OPT_SUCCESS instead).
Added additional usage errors.
Used return(EXIT_FAILURE) instead of exit(1).
Used DIRSEP instead of '/' && '\\'
Moved verbose output to stderr.
authmethod = LDAP_AUTH_KRBV4;
#else
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
+ fprintf( stderr, usage, argv[0] );
+ return( EXIT_FAILURE );
#endif
break;
case 'K': /* kerberos bind, part one only */
authmethod = LDAP_AUTH_KRBV41;
#else
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
+ fprintf( stderr, usage, argv[0] );
+ return( EXIT_FAILURE );
#endif
break;
case 'c': /* continuous operation mode */
want_bindpw++;
break;
case 'P':
- switch(optarg[0])
+ switch( atoi(optarg) )
{
- case '2':
+ case 2:
version = LDAP_VERSION2;
break;
- case '3':
+ case 3:
version = LDAP_VERSION3;
break;
+ default:
+ fprintf( stderr, "protocol version should be 2 or 3\n" );
+ fprintf( stderr, usage, argv[0] );
+ return( EXIT_FAILURE );
}
break;
default:
fprintf( stderr, usage, argv[0] );
- exit( 1 );
+ return( EXIT_FAILURE );
}
}
}
if ( debug ) {
- ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
- ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug );
+ if( ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ) != LBER_OPT_ERROR ) {
+ fprintf( stderr, "Could not set LBER_OPT_DEBUG_LEVEL %d\n", debug );
+ }
+ if( ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug ) != LDAP_OPT_ERROR ) {
+ fprintf( stderr, "Could not set LDAP_OPT_DEBUG_LEVEL %d\n", debug );
+ }
}
#ifdef SIGPIPE
if (( ld = ldap_init( ldaphost, ldapport )) == NULL ) {
perror( "ldap_init" );
- exit( 1 );
+ return( EXIT_FAILURE );
}
{
if (want_bindpw)
passwd = getpass("Enter LDAP Password: ");
- if( version != -1 ) {
- ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version );
+ if (version != -1 &&
+ ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version ) == LDAP_OPT_ERROR)
+ {
+ fprintf( stderr, "Could not set LDAP_OPT_PROTOCOL_VERSION %d\n", version );
}
if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" );
- exit( 1 );
+ return( EXIT_FAILURE );
}
if ( fp == NULL ) {
ldap_unbind( ld );
- exit( rc );
-
- /* UNREACHABLE */
- return(0);
+ return( rc );
}
" v - verbose mode\n"
" w - password\n"
, prog, (strcmp( prog, "ldapadd" ) ? " is to replace" : "") );
- exit( 1 );
+ exit( EXIT_FAILURE );
}
FILE *fp;
int rc, i, use_ldif, authmethod, version, want_bindpw, debug;
- if (( prog = strrchr( argv[ 0 ], '/' )) == NULL &&
- ( prog = strrchr( argv[ 0 ], '\\' )) == NULL ) { /*for Windows/DOS*/
+ if (( prog = strrchr( argv[ 0 ], *DIRSEP )) == NULL ) {
prog = argv[ 0 ];
} else {
++prog;
authmethod = LDAP_AUTH_KRBV4;
#else
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
+ usage( argv[0] );
+ return( EXIT_FAILURE );
#endif
break;
case 'K': /* kerberos bind, part 1 only */
authmethod = LDAP_AUTH_KRBV41;
#else
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
+ usage( argv[0] );
+ return( EXIT_FAILURE );
#endif
break;
case 'F': /* force all changes records to be used */
want_bindpw++;
break;
case 'P':
- switch(optarg[0])
+ switch( atoi(optarg) )
{
- case '2':
+ case 2:
version = LDAP_VERSION2;
break;
- case '3':
+ case 3:
version = LDAP_VERSION3;
break;
+ default:
+ fprintf( stderr, "protocol version should be 2 or 3\n" );
+ usage( argv[0] );
}
break;
default:
if ( infile != NULL ) {
if (( fp = fopen( infile, "r" )) == NULL ) {
perror( infile );
- exit( 1 );
+ return( EXIT_FAILURE );
}
} else {
fp = stdin;
}
if ( debug ) {
- ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
- ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug );
+ if( ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ) != LBER_OPT_ERROR ) {
+ fprintf( stderr, "Could not set LBER_OPT_DEBUG_LEVEL %d\n", debug );
+ }
+ if( ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug ) != LDAP_OPT_ERROR ) {
+ fprintf( stderr, "Could not set LDAP_OPT_DEBUG_LEVEL %d\n", debug );
+ }
ldif_debug = debug;
}
if ( !not ) {
if (( ld = ldap_init( ldaphost, ldapport )) == NULL ) {
perror( "ldap_init" );
- exit( 1 );
+ return( EXIT_FAILURE );
}
/* this seems prudent */
if (want_bindpw)
passwd = getpass("Enter LDAP Password: ");
- if( version != -1 ) {
- ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version );
+ if (version != -1 &&
+ ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version ) == LDAP_OPT_ERROR)
+ {
+ fprintf( stderr, "Could not set LDAP_OPT_PROTOCOL_VERSION %d\n", version );
}
if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" );
- exit( 1 );
+ return( EXIT_FAILURE );
}
}
ldap_unbind( ld );
}
- exit( rc );
-
- /* UNREACHABLE */
- return(0);
+ return( rc );
}
authmethod = LDAP_AUTH_KRBV4;
#else
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
+ return( EXIT_FAILURE );
#endif
break;
case 'K': /* kerberos bind, part one only */
authmethod = LDAP_AUTH_KRBV41;
#else
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
+ return( EXIT_FAILURE );
#endif
break;
case 'c': /* continuous operation mode */
want_bindpw++;
break;
case 'P':
- switch(optarg[0])
+ switch( atoi(optarg) )
{
- case '2':
+ case 2:
version = LDAP_VERSION2;
break;
- case '3':
+ case 3:
version = LDAP_VERSION3;
break;
+ default:
+ fprintf( stderr, "protocol version should be 2 or 3\n" );
+ fprintf( stderr, usage, argv[0] );
+ return( EXIT_FAILURE );
}
break;
default:
fprintf( stderr, usage, argv[0] );
- exit( 1 );
+ return( EXIT_FAILURE );
}
}
- if ((newSuperior != NULL) && (version != LDAP_VERSION3))
- {
- fprintf( stderr,
- "%s: version conflict!, -s newSuperior requires LDAP v3\n",
- myname);
- fprintf( stderr, usage, argv[0] );
- exit( 1 );
+ if (newSuperior != NULL) {
+ if (version == LDAP_VERSION2) {
+ fprintf( stderr,
+ "%s: version conflict!, -s newSuperior requires LDAPv3\n",
+ myname);
+ fprintf( stderr, usage, argv[0] );
+ return( EXIT_FAILURE );
+ }
+
+ /* promote to LDAPv3 */
+ version = LDAP_VERSION3;
}
havedn = 0;
if (argc - optind == 2) {
if (( rdn = strdup( argv[argc - 1] )) == NULL ) {
perror( "strdup" );
- exit( 1 );
+ return( EXIT_FAILURE );
}
if (( entrydn = strdup( argv[argc - 2] )) == NULL ) {
perror( "strdup" );
- exit( 1 );
+ return( EXIT_FAILURE );
}
++havedn;
} else if ( argc - optind != 0 ) {
fprintf( stderr, "%s: invalid number of arguments, only two allowed\n", myname);
fprintf( stderr, usage, argv[0] );
- exit( 1 );
+ return( EXIT_FAILURE );
}
if ( infile != NULL ) {
if (( fp = fopen( infile, "r" )) == NULL ) {
perror( infile );
- exit( 1 );
+ return( EXIT_FAILURE );
}
} else {
fp = stdin;
}
if ( debug ) {
- ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
- ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug );
+ if( ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ) != LBER_OPT_ERROR ) {
+ fprintf( stderr, "Could not set LBER_OPT_DEBUG_LEVEL %d\n", debug );
+ }
+ if( ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug ) != LDAP_OPT_ERROR ) {
+ fprintf( stderr, "Could not set LDAP_OPT_DEBUG_LEVEL %d\n", debug );
+ }
}
#ifdef SIGPIPE
if (( ld = ldap_init( ldaphost, ldapport )) == NULL ) {
perror( "ldap_init" );
- exit( 1 );
+ return( EXIT_FAILURE );
}
/* this seems prudent */
if (want_bindpw)
passwd = getpass("Enter LDAP Password: ");
- if( version != -1) {
- ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version );
+ if (version != -1 &&
+ ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version ) == LDAP_OPT_ERROR)
+ {
+ fprintf( stderr, "Could not set LDAP_OPT_PROTOCOL_VERSION %d\n", version );
}
if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" );
- exit( 1 );
+ return( EXIT_FAILURE );
}
rc = 0;
if ( havedn ) { /* have DN, get RDN */
if (( rdn = strdup( buf )) == NULL ) {
perror( "strdup" );
- exit( 1 );
+ return( EXIT_FAILURE );
}
rc = domodrdn(ld, entrydn, rdn, remove, newSuperior);
havedn = 0;
} else if ( !havedn ) { /* don't have DN yet */
if (( entrydn = strdup( buf )) == NULL ) {
perror( "strdup" );
- exit( 1 );
+ return( EXIT_FAILURE );
}
++havedn;
}
ldap_unbind( ld );
- exit( rc );
-
/* UNREACHABLE */
- return(0);
+ return( rc );
}
static int domodrdn(
/* local macros */
#define CEILING(x) ((double)(x) > (int)(x) ? (int)(x) + 1 : (int)(x))
-#define STRDUP(x) ((x) ? strcpy(malloc(strlen(x) + 1), x) : NULL)
#define LDAP_PASSWD_ATTRIB "userPassword"
-#define LDAP_PASSWD_CONF DEFAULT_SYSCONFDIR"/passwd.conf"
+#define LDAP_PASSWD_CONF DEFAULT_SYSCONFDIR DIRSEP "passwd.conf"
#define HS_NONE 0
#define HS_PLAIN 1
char *
hash_none (const char *pw_in, Salt * salt)
{
- return (STRDUP (pw_in));
+ return (strdup (pw_in));
}
#endif
switch (i)
{
case 'a': /* password attribute */
- pwattr = STRDUP (optarg);
+ pwattr = strdup (optarg);
break;
case 'b': /* base search dn */
- base = STRDUP (optarg);
+ base = strdup (optarg);
break;
case 'C':
break;
case 'D': /* bind distinguished name */
- binddn = STRDUP (optarg);
+ binddn = strdup (optarg);
break;
case 'd': /* debugging option */
break;
case 'e': /* new password */
- newpw = STRDUP (optarg);
+ newpw = strdup (optarg);
break;
case 'g':
break;
case 'h': /* ldap host */
- ldaphost = STRDUP (optarg);
+ ldaphost = strdup (optarg);
break;
case 'K': /* use kerberos bind, 1st part only */
authmethod = LDAP_AUTH_KRBV41;
#else
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
+ usage (argv[0]);
#endif
break;
authmethod = LDAP_AUTH_KRBV4;
#else
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
+ usage (argv[0]);
#endif
break;
break;
case 'P':
- switch(optarg[0])
- {
- case '2':
+ switch( atoi( optarg ) ) {
+ case 2:
version = LDAP_VERSION2;
break;
- case '3':
+ case 3:
version = LDAP_VERSION3;
break;
+ default:
+ fprintf( stderr, "protocol version should be 2 or 3\n" );
+ usage( argv[0] );
}
break;
break;
case 's': /* scope */
- if (strncasecmp (optarg, "base", 4) == 0)
+ if (strcasecmp (optarg, "base") == 0)
scope = LDAP_SCOPE_BASE;
- else if (strncasecmp (optarg, "one", 3) == 0)
+ else if (strcasecmp (optarg, "one") == 0)
scope = LDAP_SCOPE_ONELEVEL;
- else if (strncasecmp (optarg, "sub", 3) == 0)
+ else if (strcasecmp (optarg, "sub") == 0)
scope = LDAP_SCOPE_SUBTREE;
else
{
break;
case 't': /* target dn */
- targetdn = STRDUP (optarg);
+ targetdn = strdup (optarg);
break;
case 'v': /* verbose */
break;
case 'w': /* bind password */
- bindpw = STRDUP (optarg);
+ bindpw = strdup (optarg);
break;
case 'Y': /* salt length */
case 'y': /* user specified salt */
salt.len = strlen (optarg);
- salt.salt = (unsigned char *)STRDUP (optarg);
+ salt.salt = (unsigned char *)strdup (optarg);
break;
case 'z': /* time limit */
/* grab filter */
if (!(argc - optind < 1))
- filtpattern = STRDUP (argv[optind]);
+ filtpattern = strdup (argv[optind]);
/* check for target(s) */
if (!filtpattern && !targetdn)
if (strncmp (newpw, cknewpw, strlen (newpw)))
{
fprintf (stderr, "passwords do not match\n");
- exit (1);
+ return ( EXIT_FAILURE );
}
}
if ( debug ) {
- ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
- ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug );
+ if( ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ) != LBER_OPT_ERROR ) {
+ fprintf( stderr, "Could not set LBER_OPT_DEBUG_LEVEL %d\n", debug );
+ }
+ if( ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug ) != LDAP_OPT_ERROR ) {
+ fprintf( stderr, "Could not set LDAP_OPT_DEBUG_LEVEL %d\n", debug );
+ }
}
#ifdef SIGPIPE
if ((ld = ldap_init (ldaphost, ldapport)) == NULL)
{
perror ("ldap_init");
- exit (1);
+ return ( EXIT_FAILURE );
}
/* set options */
- if( timelimit != -1 ) {
- ldap_set_option (ld, LDAP_OPT_TIMELIMIT, (void *)&timelimit);
+ if (timelimit != -1 &&
+ ldap_set_option( ld, LDAP_OPT_TIMELIMIT, (void *) &timelimit ) == LDAP_OPT_ERROR )
+ {
+ fprintf( stderr, "Could not set LDAP_OPT_TIMELIMIT %d\n", timelimit );
}
- if( sizelimit != -1 ) {
- ldap_set_option (ld, LDAP_OPT_SIZELIMIT, (void *)&sizelimit);
+ if (sizelimit != -1 &&
+ ldap_set_option( ld, LDAP_OPT_SIZELIMIT, (void *) &sizelimit ) == LDAP_OPT_ERROR )
+ {
+ fprintf( stderr, "Could not set LDAP_OPT_SIZELIMIT %d\n", sizelimit );
}
/* this seems prudent */
ldap_set_option( ld, LDAP_OPT_DEREF, &deref);
}
- if( version != -1 ) {
- ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version );
+ if (version != -1 &&
+ ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version ) == LDAP_OPT_ERROR)
+ {
+ fprintf( stderr, "Could not set LDAP_OPT_PROTOCOL_VERSION %d\n", version );
}
/* authenticate to server */
if (ldap_bind_s (ld, binddn, bindpw, authmethod) != LDAP_SUCCESS)
{
ldap_perror (ld, "ldap_bind");
- exit (1);
+ return ( EXIT_FAILURE );
}
if (targetdn)
i != LDAP_SIZELIMIT_EXCEEDED)
{
ldap_perror (ld, "ldap_search");
- exit (1);
+ return ( EXIT_FAILURE );
}
for (e = ldap_first_entry (ld, result); e; e = ldap_next_entry (ld, e))
/* disconnect from server */
ldap_unbind (ld);
- exit(0);
- /* unreached */
- return (0);
+ return ( EXIT_SUCCESS );
}
fprintf( stderr, " -h host\tldap server\n" );
fprintf( stderr, " -p port\tport on ldap server\n" );
fprintf( stderr, " -P version\tprocotol version (2 or 3)\n" );
- exit( 1 );
+ exit( EXIT_FAILURE );
}
static void print_entry LDAP_P((
++allow_binary;
break;
case 's': /* search scope */
- if ( strncasecmp( optarg, "base", 4 ) == 0 ) {
+ if ( strcasecmp( optarg, "base" ) == 0 ) {
scope = LDAP_SCOPE_BASE;
- } else if ( strncasecmp( optarg, "one", 3 ) == 0 ) {
+ } else if ( strcasecmp( optarg, "one" ) == 0 ) {
scope = LDAP_SCOPE_ONELEVEL;
- } else if ( strncasecmp( optarg, "sub", 3 ) == 0 ) {
+ } else if ( strcasecmp( optarg, "sub" ) == 0 ) {
scope = LDAP_SCOPE_SUBTREE;
} else {
fprintf( stderr, "scope should be base, one, or sub\n" );
break;
case 'a': /* set alias deref option */
- if ( strncasecmp( optarg, "never", 5 ) == 0 ) {
+ if ( strcasecmp( optarg, "never" ) == 0 ) {
deref = LDAP_DEREF_NEVER;
- } else if ( strncasecmp( optarg, "search", 5 ) == 0 ) {
+ } else if ( strcasecmp( optarg, "search" ) == 0 ) {
deref = LDAP_DEREF_SEARCHING;
- } else if ( strncasecmp( optarg, "find", 4 ) == 0 ) {
+ } else if ( strcasecmp( optarg, "find" ) == 0 ) {
deref = LDAP_DEREF_FINDING;
- } else if ( strncasecmp( optarg, "always", 6 ) == 0 ) {
+ } else if ( strcasecmp( optarg, "always" ) == 0 ) {
deref = LDAP_DEREF_ALWAYS;
} else {
fprintf( stderr, "alias deref should be never, search, find, or always\n" );
want_bindpw++;
break;
case 'P':
- switch(optarg[0])
+ switch( atoi( optarg ) )
{
- case '2':
+ case 2:
version = LDAP_VERSION2;
break;
- case '3':
+ case 3:
version = LDAP_VERSION3;
break;
+ default:
+ fprintf( stderr, "protocol version should be 2 or 3\n" );
+ usage( argv[0] );
}
break;
default:
fp = stdin;
} else if (( fp = fopen( infile, "r" )) == NULL ) {
perror( infile );
- exit( 1 );
+ return( EXIT_FAILURE );
}
}
if ( debug ) {
- ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
- ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug );
+ if( ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ) != LBER_OPT_ERROR ) {
+ fprintf( stderr, "Could not set LBER_OPT_DEBUG_LEVEL %d\n", debug );
+ }
+ if( ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug ) != LDAP_OPT_ERROR ) {
+ fprintf( stderr, "Could not set LDAP_OPT_DEBUG_LEVEL %d\n", debug );
+ }
ldif_debug = debug;
}
#endif
if ( verbose ) {
- printf( "ldap_init( %s, %d )\n",
+ fprintf( stderr, "ldap_init( %s, %d )\n",
(ldaphost != NULL) ? ldaphost : "<DEFAULT>",
ldapport );
}
if (( ld = ldap_init( ldaphost, ldapport )) == NULL ) {
perror( "ldap_init" );
- exit( 1 );
+ return( EXIT_FAILURE );
}
if (deref != -1 &&
- ldap_set_option( ld, LDAP_OPT_DEREF, (void *) &deref ) == -1 )
+ ldap_set_option( ld, LDAP_OPT_DEREF, (void *) &deref ) == LDAP_OPT_ERROR )
{
- /* set option error */
+ fprintf( stderr, "Could not set LDAP_OPT_DEREF %d\n", deref );
}
if (timelimit != -1 &&
- ldap_set_option( ld, LDAP_OPT_TIMELIMIT, (void *) &timelimit ) == -1 )
+ ldap_set_option( ld, LDAP_OPT_TIMELIMIT, (void *) &timelimit ) == LDAP_OPT_ERROR )
{
- /* set option error */
+ fprintf( stderr, "Could not set LDAP_OPT_TIMELIMIT %d\n", timelimit );
}
if (sizelimit != -1 &&
- ldap_set_option( ld, LDAP_OPT_SIZELIMIT, (void *) &sizelimit ) == -1 )
+ ldap_set_option( ld, LDAP_OPT_SIZELIMIT, (void *) &sizelimit ) == LDAP_OPT_ERROR )
{
- /* set option error */
+ fprintf( stderr, "Could not set LDAP_OPT_SIZELIMIT %d\n", sizelimit );
}
if (referrals != -1 &&
ldap_set_option( ld, LDAP_OPT_REFERRALS,
- (referrals ? LDAP_OPT_ON : LDAP_OPT_OFF) ) == -1 )
+ (referrals ? LDAP_OPT_ON : LDAP_OPT_OFF) ) == LDAP_OPT_ERROR )
{
- /* set option error */
+ fprintf( stderr, "Could not set LDAP_OPT_REFERRALS %s\n",
+ referrals ? "on" : "off" );
}
if (version != -1 &&
- ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version ) == -1)
+ ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version ) == LDAP_OPT_ERROR)
{
- /* set option error */
+ fprintf( stderr, "Could not set LDAP_OPT_PROTOCOL_VERSION %d\n", version );
}
if (want_bindpw)
if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" );
- exit( 1 );
+ return( EXIT_FAILURE );
}
if ( verbose ) {
- printf( "filter pattern: %s\nreturning: ", filtpattern );
+ fprintf( stderr, "filter pattern: %s\nreturning: ", filtpattern );
if ( attrs == NULL ) {
printf( "ALL" );
} else {
for ( i = 0; attrs[ i ] != NULL; ++i ) {
- printf( "%s ", attrs[ i ] );
+ fprintf( stderr, "%s ", attrs[ i ] );
}
}
- putchar( '\n' );
+ fprintf( stderr, "\n" );
}
if ( infile == NULL ) {
}
ldap_unbind( ld );
- exit( rc );
- /* UNREACHABLE */
- return(0);
+
+ return( rc );
}
sprintf( filter, filtpatt, value );
if ( verbose ) {
- printf( "filter is: (%s)\n", filter );
+ fprintf( stderr, "filter is: (%s)\n", filter );
}
if ( not ) {