mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-22 07:39:35 -05:00
Add warnings if ldap_set_option() fails.
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.
This commit is contained in:
parent
2f969f8552
commit
16366cff99
5 changed files with 177 additions and 125 deletions
|
|
@ -45,6 +45,8 @@ main( int argc, char **argv )
|
||||||
authmethod = LDAP_AUTH_KRBV4;
|
authmethod = LDAP_AUTH_KRBV4;
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
||||||
|
fprintf( stderr, usage, argv[0] );
|
||||||
|
return( EXIT_FAILURE );
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'K': /* kerberos bind, part one only */
|
case 'K': /* kerberos bind, part one only */
|
||||||
|
|
@ -52,6 +54,8 @@ main( int argc, char **argv )
|
||||||
authmethod = LDAP_AUTH_KRBV41;
|
authmethod = LDAP_AUTH_KRBV41;
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
||||||
|
fprintf( stderr, usage, argv[0] );
|
||||||
|
return( EXIT_FAILURE );
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'c': /* continuous operation mode */
|
case 'c': /* continuous operation mode */
|
||||||
|
|
@ -88,19 +92,23 @@ main( int argc, char **argv )
|
||||||
want_bindpw++;
|
want_bindpw++;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
switch(optarg[0])
|
switch( atoi(optarg) )
|
||||||
{
|
{
|
||||||
case '2':
|
case 2:
|
||||||
version = LDAP_VERSION2;
|
version = LDAP_VERSION2;
|
||||||
break;
|
break;
|
||||||
case '3':
|
case 3:
|
||||||
version = LDAP_VERSION3;
|
version = LDAP_VERSION3;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
fprintf( stderr, "protocol version should be 2 or 3\n" );
|
||||||
|
fprintf( stderr, usage, argv[0] );
|
||||||
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf( stderr, usage, argv[0] );
|
fprintf( stderr, usage, argv[0] );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,8 +119,12 @@ main( int argc, char **argv )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( debug ) {
|
if ( debug ) {
|
||||||
ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
|
if( ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ) != LBER_OPT_ERROR ) {
|
||||||
ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug );
|
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
|
#ifdef SIGPIPE
|
||||||
|
|
@ -121,7 +133,7 @@ main( int argc, char **argv )
|
||||||
|
|
||||||
if (( ld = ldap_init( ldaphost, ldapport )) == NULL ) {
|
if (( ld = ldap_init( ldaphost, ldapport )) == NULL ) {
|
||||||
perror( "ldap_init" );
|
perror( "ldap_init" );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -133,13 +145,15 @@ main( int argc, char **argv )
|
||||||
if (want_bindpw)
|
if (want_bindpw)
|
||||||
passwd = getpass("Enter LDAP Password: ");
|
passwd = getpass("Enter LDAP Password: ");
|
||||||
|
|
||||||
if( version != -1 ) {
|
if (version != -1 &&
|
||||||
ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version );
|
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 ) {
|
if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) {
|
||||||
ldap_perror( ld, "ldap_bind" );
|
ldap_perror( ld, "ldap_bind" );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fp == NULL ) {
|
if ( fp == NULL ) {
|
||||||
|
|
@ -158,10 +172,7 @@ main( int argc, char **argv )
|
||||||
|
|
||||||
ldap_unbind( ld );
|
ldap_unbind( ld );
|
||||||
|
|
||||||
exit( rc );
|
return( rc );
|
||||||
|
|
||||||
/* UNREACHABLE */
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ usage( const char *prog )
|
||||||
" v - verbose mode\n"
|
" v - verbose mode\n"
|
||||||
" w - password\n"
|
" w - password\n"
|
||||||
, prog, (strcmp( prog, "ldapadd" ) ? " is to replace" : "") );
|
, prog, (strcmp( prog, "ldapadd" ) ? " is to replace" : "") );
|
||||||
exit( 1 );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -96,8 +96,7 @@ main( int argc, char **argv )
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int rc, i, use_ldif, authmethod, version, want_bindpw, debug;
|
int rc, i, use_ldif, authmethod, version, want_bindpw, debug;
|
||||||
|
|
||||||
if (( prog = strrchr( argv[ 0 ], '/' )) == NULL &&
|
if (( prog = strrchr( argv[ 0 ], *DIRSEP )) == NULL ) {
|
||||||
( prog = strrchr( argv[ 0 ], '\\' )) == NULL ) { /*for Windows/DOS*/
|
|
||||||
prog = argv[ 0 ];
|
prog = argv[ 0 ];
|
||||||
} else {
|
} else {
|
||||||
++prog;
|
++prog;
|
||||||
|
|
@ -133,6 +132,8 @@ main( int argc, char **argv )
|
||||||
authmethod = LDAP_AUTH_KRBV4;
|
authmethod = LDAP_AUTH_KRBV4;
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
||||||
|
usage( argv[0] );
|
||||||
|
return( EXIT_FAILURE );
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'K': /* kerberos bind, part 1 only */
|
case 'K': /* kerberos bind, part 1 only */
|
||||||
|
|
@ -140,6 +141,8 @@ main( int argc, char **argv )
|
||||||
authmethod = LDAP_AUTH_KRBV41;
|
authmethod = LDAP_AUTH_KRBV41;
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
||||||
|
usage( argv[0] );
|
||||||
|
return( EXIT_FAILURE );
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'F': /* force all changes records to be used */
|
case 'F': /* force all changes records to be used */
|
||||||
|
|
@ -173,14 +176,17 @@ main( int argc, char **argv )
|
||||||
want_bindpw++;
|
want_bindpw++;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
switch(optarg[0])
|
switch( atoi(optarg) )
|
||||||
{
|
{
|
||||||
case '2':
|
case 2:
|
||||||
version = LDAP_VERSION2;
|
version = LDAP_VERSION2;
|
||||||
break;
|
break;
|
||||||
case '3':
|
case 3:
|
||||||
version = LDAP_VERSION3;
|
version = LDAP_VERSION3;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
fprintf( stderr, "protocol version should be 2 or 3\n" );
|
||||||
|
usage( argv[0] );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -194,15 +200,19 @@ main( int argc, char **argv )
|
||||||
if ( infile != NULL ) {
|
if ( infile != NULL ) {
|
||||||
if (( fp = fopen( infile, "r" )) == NULL ) {
|
if (( fp = fopen( infile, "r" )) == NULL ) {
|
||||||
perror( infile );
|
perror( infile );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fp = stdin;
|
fp = stdin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( debug ) {
|
if ( debug ) {
|
||||||
ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
|
if( ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ) != LBER_OPT_ERROR ) {
|
||||||
ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug );
|
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;
|
ldif_debug = debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -213,7 +223,7 @@ main( int argc, char **argv )
|
||||||
if ( !not ) {
|
if ( !not ) {
|
||||||
if (( ld = ldap_init( ldaphost, ldapport )) == NULL ) {
|
if (( ld = ldap_init( ldaphost, ldapport )) == NULL ) {
|
||||||
perror( "ldap_init" );
|
perror( "ldap_init" );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this seems prudent */
|
/* this seems prudent */
|
||||||
|
|
@ -225,13 +235,15 @@ main( int argc, char **argv )
|
||||||
if (want_bindpw)
|
if (want_bindpw)
|
||||||
passwd = getpass("Enter LDAP Password: ");
|
passwd = getpass("Enter LDAP Password: ");
|
||||||
|
|
||||||
if( version != -1 ) {
|
if (version != -1 &&
|
||||||
ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version );
|
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 ) {
|
if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) {
|
||||||
ldap_perror( ld, "ldap_bind" );
|
ldap_perror( ld, "ldap_bind" );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -279,10 +291,7 @@ main( int argc, char **argv )
|
||||||
ldap_unbind( ld );
|
ldap_unbind( ld );
|
||||||
}
|
}
|
||||||
|
|
||||||
exit( rc );
|
return( rc );
|
||||||
|
|
||||||
/* UNREACHABLE */
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ main(int argc, char **argv)
|
||||||
authmethod = LDAP_AUTH_KRBV4;
|
authmethod = LDAP_AUTH_KRBV4;
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
||||||
|
return( EXIT_FAILURE );
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'K': /* kerberos bind, part one only */
|
case 'K': /* kerberos bind, part one only */
|
||||||
|
|
@ -70,6 +71,7 @@ main(int argc, char **argv)
|
||||||
authmethod = LDAP_AUTH_KRBV41;
|
authmethod = LDAP_AUTH_KRBV41;
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
||||||
|
return( EXIT_FAILURE );
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'c': /* continuous operation mode */
|
case 'c': /* continuous operation mode */
|
||||||
|
|
@ -110,60 +112,72 @@ main(int argc, char **argv)
|
||||||
want_bindpw++;
|
want_bindpw++;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
switch(optarg[0])
|
switch( atoi(optarg) )
|
||||||
{
|
{
|
||||||
case '2':
|
case 2:
|
||||||
version = LDAP_VERSION2;
|
version = LDAP_VERSION2;
|
||||||
break;
|
break;
|
||||||
case '3':
|
case 3:
|
||||||
version = LDAP_VERSION3;
|
version = LDAP_VERSION3;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
fprintf( stderr, "protocol version should be 2 or 3\n" );
|
||||||
|
fprintf( stderr, usage, argv[0] );
|
||||||
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf( stderr, usage, argv[0] );
|
fprintf( stderr, usage, argv[0] );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((newSuperior != NULL) && (version != LDAP_VERSION3))
|
if (newSuperior != NULL) {
|
||||||
{
|
if (version == LDAP_VERSION2) {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"%s: version conflict!, -s newSuperior requires LDAP v3\n",
|
"%s: version conflict!, -s newSuperior requires LDAPv3\n",
|
||||||
myname);
|
myname);
|
||||||
fprintf( stderr, usage, argv[0] );
|
fprintf( stderr, usage, argv[0] );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* promote to LDAPv3 */
|
||||||
|
version = LDAP_VERSION3;
|
||||||
}
|
}
|
||||||
|
|
||||||
havedn = 0;
|
havedn = 0;
|
||||||
if (argc - optind == 2) {
|
if (argc - optind == 2) {
|
||||||
if (( rdn = strdup( argv[argc - 1] )) == NULL ) {
|
if (( rdn = strdup( argv[argc - 1] )) == NULL ) {
|
||||||
perror( "strdup" );
|
perror( "strdup" );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
if (( entrydn = strdup( argv[argc - 2] )) == NULL ) {
|
if (( entrydn = strdup( argv[argc - 2] )) == NULL ) {
|
||||||
perror( "strdup" );
|
perror( "strdup" );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
++havedn;
|
++havedn;
|
||||||
} else if ( argc - optind != 0 ) {
|
} else if ( argc - optind != 0 ) {
|
||||||
fprintf( stderr, "%s: invalid number of arguments, only two allowed\n", myname);
|
fprintf( stderr, "%s: invalid number of arguments, only two allowed\n", myname);
|
||||||
fprintf( stderr, usage, argv[0] );
|
fprintf( stderr, usage, argv[0] );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( infile != NULL ) {
|
if ( infile != NULL ) {
|
||||||
if (( fp = fopen( infile, "r" )) == NULL ) {
|
if (( fp = fopen( infile, "r" )) == NULL ) {
|
||||||
perror( infile );
|
perror( infile );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fp = stdin;
|
fp = stdin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( debug ) {
|
if ( debug ) {
|
||||||
ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
|
if( ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ) != LBER_OPT_ERROR ) {
|
||||||
ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug );
|
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
|
#ifdef SIGPIPE
|
||||||
|
|
@ -172,7 +186,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
if (( ld = ldap_init( ldaphost, ldapport )) == NULL ) {
|
if (( ld = ldap_init( ldaphost, ldapport )) == NULL ) {
|
||||||
perror( "ldap_init" );
|
perror( "ldap_init" );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this seems prudent */
|
/* this seems prudent */
|
||||||
|
|
@ -184,13 +198,15 @@ main(int argc, char **argv)
|
||||||
if (want_bindpw)
|
if (want_bindpw)
|
||||||
passwd = getpass("Enter LDAP Password: ");
|
passwd = getpass("Enter LDAP Password: ");
|
||||||
|
|
||||||
if( version != -1) {
|
if (version != -1 &&
|
||||||
ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version );
|
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 ) {
|
if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) {
|
||||||
ldap_perror( ld, "ldap_bind" );
|
ldap_perror( ld, "ldap_bind" );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
@ -203,14 +219,14 @@ main(int argc, char **argv)
|
||||||
if ( havedn ) { /* have DN, get RDN */
|
if ( havedn ) { /* have DN, get RDN */
|
||||||
if (( rdn = strdup( buf )) == NULL ) {
|
if (( rdn = strdup( buf )) == NULL ) {
|
||||||
perror( "strdup" );
|
perror( "strdup" );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
rc = domodrdn(ld, entrydn, rdn, remove, newSuperior);
|
rc = domodrdn(ld, entrydn, rdn, remove, newSuperior);
|
||||||
havedn = 0;
|
havedn = 0;
|
||||||
} else if ( !havedn ) { /* don't have DN yet */
|
} else if ( !havedn ) { /* don't have DN yet */
|
||||||
if (( entrydn = strdup( buf )) == NULL ) {
|
if (( entrydn = strdup( buf )) == NULL ) {
|
||||||
perror( "strdup" );
|
perror( "strdup" );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
++havedn;
|
++havedn;
|
||||||
}
|
}
|
||||||
|
|
@ -219,10 +235,8 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
ldap_unbind( ld );
|
ldap_unbind( ld );
|
||||||
|
|
||||||
exit( rc );
|
|
||||||
|
|
||||||
/* UNREACHABLE */
|
/* UNREACHABLE */
|
||||||
return(0);
|
return( rc );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int domodrdn(
|
static int domodrdn(
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,9 @@
|
||||||
|
|
||||||
/* local macros */
|
/* local macros */
|
||||||
#define CEILING(x) ((double)(x) > (int)(x) ? (int)(x) + 1 : (int)(x))
|
#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_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_NONE 0
|
||||||
#define HS_PLAIN 1
|
#define HS_PLAIN 1
|
||||||
|
|
@ -159,7 +158,7 @@ gen_pass (unsigned int len)
|
||||||
char *
|
char *
|
||||||
hash_none (const char *pw_in, Salt * salt)
|
hash_none (const char *pw_in, Salt * salt)
|
||||||
{
|
{
|
||||||
return (STRDUP (pw_in));
|
return (strdup (pw_in));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -390,11 +389,11 @@ main (int argc, char *argv[])
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case 'a': /* password attribute */
|
case 'a': /* password attribute */
|
||||||
pwattr = STRDUP (optarg);
|
pwattr = strdup (optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b': /* base search dn */
|
case 'b': /* base search dn */
|
||||||
base = STRDUP (optarg);
|
base = strdup (optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
|
|
@ -402,7 +401,7 @@ main (int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'D': /* bind distinguished name */
|
case 'D': /* bind distinguished name */
|
||||||
binddn = STRDUP (optarg);
|
binddn = strdup (optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd': /* debugging option */
|
case 'd': /* debugging option */
|
||||||
|
|
@ -414,7 +413,7 @@ main (int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'e': /* new password */
|
case 'e': /* new password */
|
||||||
newpw = STRDUP (optarg);
|
newpw = strdup (optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'g':
|
case 'g':
|
||||||
|
|
@ -439,7 +438,7 @@ main (int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h': /* ldap host */
|
case 'h': /* ldap host */
|
||||||
ldaphost = STRDUP (optarg);
|
ldaphost = strdup (optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'K': /* use kerberos bind, 1st part only */
|
case 'K': /* use kerberos bind, 1st part only */
|
||||||
|
|
@ -447,6 +446,7 @@ main (int argc, char *argv[])
|
||||||
authmethod = LDAP_AUTH_KRBV41;
|
authmethod = LDAP_AUTH_KRBV41;
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
||||||
|
usage (argv[0]);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -455,6 +455,7 @@ main (int argc, char *argv[])
|
||||||
authmethod = LDAP_AUTH_KRBV4;
|
authmethod = LDAP_AUTH_KRBV4;
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
|
||||||
|
usage (argv[0]);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -467,14 +468,16 @@ main (int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
switch(optarg[0])
|
switch( atoi( optarg ) ) {
|
||||||
{
|
case 2:
|
||||||
case '2':
|
|
||||||
version = LDAP_VERSION2;
|
version = LDAP_VERSION2;
|
||||||
break;
|
break;
|
||||||
case '3':
|
case 3:
|
||||||
version = LDAP_VERSION3;
|
version = LDAP_VERSION3;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
fprintf( stderr, "protocol version should be 2 or 3\n" );
|
||||||
|
usage( argv[0] );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -483,11 +486,11 @@ main (int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's': /* scope */
|
case 's': /* scope */
|
||||||
if (strncasecmp (optarg, "base", 4) == 0)
|
if (strcasecmp (optarg, "base") == 0)
|
||||||
scope = LDAP_SCOPE_BASE;
|
scope = LDAP_SCOPE_BASE;
|
||||||
else if (strncasecmp (optarg, "one", 3) == 0)
|
else if (strcasecmp (optarg, "one") == 0)
|
||||||
scope = LDAP_SCOPE_ONELEVEL;
|
scope = LDAP_SCOPE_ONELEVEL;
|
||||||
else if (strncasecmp (optarg, "sub", 3) == 0)
|
else if (strcasecmp (optarg, "sub") == 0)
|
||||||
scope = LDAP_SCOPE_SUBTREE;
|
scope = LDAP_SCOPE_SUBTREE;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -497,7 +500,7 @@ main (int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 't': /* target dn */
|
case 't': /* target dn */
|
||||||
targetdn = STRDUP (optarg);
|
targetdn = strdup (optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'v': /* verbose */
|
case 'v': /* verbose */
|
||||||
|
|
@ -509,7 +512,7 @@ main (int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'w': /* bind password */
|
case 'w': /* bind password */
|
||||||
bindpw = STRDUP (optarg);
|
bindpw = strdup (optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Y': /* salt length */
|
case 'Y': /* salt length */
|
||||||
|
|
@ -518,7 +521,7 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
case 'y': /* user specified salt */
|
case 'y': /* user specified salt */
|
||||||
salt.len = strlen (optarg);
|
salt.len = strlen (optarg);
|
||||||
salt.salt = (unsigned char *)STRDUP (optarg);
|
salt.salt = (unsigned char *)strdup (optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'z': /* time limit */
|
case 'z': /* time limit */
|
||||||
|
|
@ -532,7 +535,7 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
/* grab filter */
|
/* grab filter */
|
||||||
if (!(argc - optind < 1))
|
if (!(argc - optind < 1))
|
||||||
filtpattern = STRDUP (argv[optind]);
|
filtpattern = strdup (argv[optind]);
|
||||||
|
|
||||||
/* check for target(s) */
|
/* check for target(s) */
|
||||||
if (!filtpattern && !targetdn)
|
if (!filtpattern && !targetdn)
|
||||||
|
|
@ -552,13 +555,17 @@ main (int argc, char *argv[])
|
||||||
if (strncmp (newpw, cknewpw, strlen (newpw)))
|
if (strncmp (newpw, cknewpw, strlen (newpw)))
|
||||||
{
|
{
|
||||||
fprintf (stderr, "passwords do not match\n");
|
fprintf (stderr, "passwords do not match\n");
|
||||||
exit (1);
|
return ( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( debug ) {
|
if ( debug ) {
|
||||||
ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
|
if( ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ) != LBER_OPT_ERROR ) {
|
||||||
ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug );
|
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
|
#ifdef SIGPIPE
|
||||||
|
|
@ -584,15 +591,19 @@ main (int argc, char *argv[])
|
||||||
if ((ld = ldap_init (ldaphost, ldapport)) == NULL)
|
if ((ld = ldap_init (ldaphost, ldapport)) == NULL)
|
||||||
{
|
{
|
||||||
perror ("ldap_init");
|
perror ("ldap_init");
|
||||||
exit (1);
|
return ( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set options */
|
/* set options */
|
||||||
if( timelimit != -1 ) {
|
if (timelimit != -1 &&
|
||||||
ldap_set_option (ld, LDAP_OPT_TIMELIMIT, (void *)&timelimit);
|
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 ) {
|
if (sizelimit != -1 &&
|
||||||
ldap_set_option (ld, LDAP_OPT_SIZELIMIT, (void *)&sizelimit);
|
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 */
|
/* this seems prudent */
|
||||||
|
|
@ -601,15 +612,17 @@ main (int argc, char *argv[])
|
||||||
ldap_set_option( ld, LDAP_OPT_DEREF, &deref);
|
ldap_set_option( ld, LDAP_OPT_DEREF, &deref);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( version != -1 ) {
|
if (version != -1 &&
|
||||||
ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version );
|
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 */
|
/* authenticate to server */
|
||||||
if (ldap_bind_s (ld, binddn, bindpw, authmethod) != LDAP_SUCCESS)
|
if (ldap_bind_s (ld, binddn, bindpw, authmethod) != LDAP_SUCCESS)
|
||||||
{
|
{
|
||||||
ldap_perror (ld, "ldap_bind");
|
ldap_perror (ld, "ldap_bind");
|
||||||
exit (1);
|
return ( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetdn)
|
if (targetdn)
|
||||||
|
|
@ -639,7 +652,7 @@ main (int argc, char *argv[])
|
||||||
i != LDAP_SIZELIMIT_EXCEEDED)
|
i != LDAP_SIZELIMIT_EXCEEDED)
|
||||||
{
|
{
|
||||||
ldap_perror (ld, "ldap_search");
|
ldap_perror (ld, "ldap_search");
|
||||||
exit (1);
|
return ( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
for (e = ldap_first_entry (ld, result); e; e = ldap_next_entry (ld, e))
|
for (e = ldap_first_entry (ld, result); e; e = ldap_next_entry (ld, e))
|
||||||
|
|
@ -658,8 +671,6 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
/* disconnect from server */
|
/* disconnect from server */
|
||||||
ldap_unbind (ld);
|
ldap_unbind (ld);
|
||||||
exit(0);
|
|
||||||
|
|
||||||
/* unreached */
|
return ( EXIT_SUCCESS );
|
||||||
return (0);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ usage( char *s )
|
||||||
fprintf( stderr, " -h host\tldap server\n" );
|
fprintf( stderr, " -h host\tldap server\n" );
|
||||||
fprintf( stderr, " -p port\tport on ldap server\n" );
|
fprintf( stderr, " -p port\tport on ldap server\n" );
|
||||||
fprintf( stderr, " -P version\tprocotol version (2 or 3)\n" );
|
fprintf( stderr, " -P version\tprocotol version (2 or 3)\n" );
|
||||||
exit( 1 );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_entry LDAP_P((
|
static void print_entry LDAP_P((
|
||||||
|
|
@ -146,11 +146,11 @@ main( int argc, char **argv )
|
||||||
++allow_binary;
|
++allow_binary;
|
||||||
break;
|
break;
|
||||||
case 's': /* search scope */
|
case 's': /* search scope */
|
||||||
if ( strncasecmp( optarg, "base", 4 ) == 0 ) {
|
if ( strcasecmp( optarg, "base" ) == 0 ) {
|
||||||
scope = LDAP_SCOPE_BASE;
|
scope = LDAP_SCOPE_BASE;
|
||||||
} else if ( strncasecmp( optarg, "one", 3 ) == 0 ) {
|
} else if ( strcasecmp( optarg, "one" ) == 0 ) {
|
||||||
scope = LDAP_SCOPE_ONELEVEL;
|
scope = LDAP_SCOPE_ONELEVEL;
|
||||||
} else if ( strncasecmp( optarg, "sub", 3 ) == 0 ) {
|
} else if ( strcasecmp( optarg, "sub" ) == 0 ) {
|
||||||
scope = LDAP_SCOPE_SUBTREE;
|
scope = LDAP_SCOPE_SUBTREE;
|
||||||
} else {
|
} else {
|
||||||
fprintf( stderr, "scope should be base, one, or sub\n" );
|
fprintf( stderr, "scope should be base, one, or sub\n" );
|
||||||
|
|
@ -159,13 +159,13 @@ main( int argc, char **argv )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'a': /* set alias deref option */
|
case 'a': /* set alias deref option */
|
||||||
if ( strncasecmp( optarg, "never", 5 ) == 0 ) {
|
if ( strcasecmp( optarg, "never" ) == 0 ) {
|
||||||
deref = LDAP_DEREF_NEVER;
|
deref = LDAP_DEREF_NEVER;
|
||||||
} else if ( strncasecmp( optarg, "search", 5 ) == 0 ) {
|
} else if ( strcasecmp( optarg, "search" ) == 0 ) {
|
||||||
deref = LDAP_DEREF_SEARCHING;
|
deref = LDAP_DEREF_SEARCHING;
|
||||||
} else if ( strncasecmp( optarg, "find", 4 ) == 0 ) {
|
} else if ( strcasecmp( optarg, "find" ) == 0 ) {
|
||||||
deref = LDAP_DEREF_FINDING;
|
deref = LDAP_DEREF_FINDING;
|
||||||
} else if ( strncasecmp( optarg, "always", 6 ) == 0 ) {
|
} else if ( strcasecmp( optarg, "always" ) == 0 ) {
|
||||||
deref = LDAP_DEREF_ALWAYS;
|
deref = LDAP_DEREF_ALWAYS;
|
||||||
} else {
|
} else {
|
||||||
fprintf( stderr, "alias deref should be never, search, find, or always\n" );
|
fprintf( stderr, "alias deref should be never, search, find, or always\n" );
|
||||||
|
|
@ -207,14 +207,17 @@ main( int argc, char **argv )
|
||||||
want_bindpw++;
|
want_bindpw++;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
switch(optarg[0])
|
switch( atoi( optarg ) )
|
||||||
{
|
{
|
||||||
case '2':
|
case 2:
|
||||||
version = LDAP_VERSION2;
|
version = LDAP_VERSION2;
|
||||||
break;
|
break;
|
||||||
case '3':
|
case 3:
|
||||||
version = LDAP_VERSION3;
|
version = LDAP_VERSION3;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
fprintf( stderr, "protocol version should be 2 or 3\n" );
|
||||||
|
usage( argv[0] );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -250,13 +253,17 @@ main( int argc, char **argv )
|
||||||
fp = stdin;
|
fp = stdin;
|
||||||
} else if (( fp = fopen( infile, "r" )) == NULL ) {
|
} else if (( fp = fopen( infile, "r" )) == NULL ) {
|
||||||
perror( infile );
|
perror( infile );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( debug ) {
|
if ( debug ) {
|
||||||
ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
|
if( ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ) != LBER_OPT_ERROR ) {
|
||||||
ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug );
|
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;
|
ldif_debug = debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -265,42 +272,43 @@ main( int argc, char **argv )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( verbose ) {
|
if ( verbose ) {
|
||||||
printf( "ldap_init( %s, %d )\n",
|
fprintf( stderr, "ldap_init( %s, %d )\n",
|
||||||
(ldaphost != NULL) ? ldaphost : "<DEFAULT>",
|
(ldaphost != NULL) ? ldaphost : "<DEFAULT>",
|
||||||
ldapport );
|
ldapport );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (( ld = ldap_init( ldaphost, ldapport )) == NULL ) {
|
if (( ld = ldap_init( ldaphost, ldapport )) == NULL ) {
|
||||||
perror( "ldap_init" );
|
perror( "ldap_init" );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deref != -1 &&
|
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 &&
|
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 &&
|
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 &&
|
if (referrals != -1 &&
|
||||||
ldap_set_option( ld, LDAP_OPT_REFERRALS,
|
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 &&
|
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 (want_bindpw)
|
||||||
|
|
@ -308,19 +316,19 @@ main( int argc, char **argv )
|
||||||
|
|
||||||
if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) {
|
if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) {
|
||||||
ldap_perror( ld, "ldap_bind" );
|
ldap_perror( ld, "ldap_bind" );
|
||||||
exit( 1 );
|
return( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( verbose ) {
|
if ( verbose ) {
|
||||||
printf( "filter pattern: %s\nreturning: ", filtpattern );
|
fprintf( stderr, "filter pattern: %s\nreturning: ", filtpattern );
|
||||||
if ( attrs == NULL ) {
|
if ( attrs == NULL ) {
|
||||||
printf( "ALL" );
|
printf( "ALL" );
|
||||||
} else {
|
} else {
|
||||||
for ( i = 0; attrs[ i ] != NULL; ++i ) {
|
for ( i = 0; attrs[ i ] != NULL; ++i ) {
|
||||||
printf( "%s ", attrs[ i ] );
|
fprintf( stderr, "%s ", attrs[ i ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
putchar( '\n' );
|
fprintf( stderr, "\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( infile == NULL ) {
|
if ( infile == NULL ) {
|
||||||
|
|
@ -344,10 +352,9 @@ main( int argc, char **argv )
|
||||||
}
|
}
|
||||||
|
|
||||||
ldap_unbind( ld );
|
ldap_unbind( ld );
|
||||||
exit( rc );
|
|
||||||
|
|
||||||
/* UNREACHABLE */
|
|
||||||
return(0);
|
return( rc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -367,7 +374,7 @@ static int dosearch(
|
||||||
sprintf( filter, filtpatt, value );
|
sprintf( filter, filtpatt, value );
|
||||||
|
|
||||||
if ( verbose ) {
|
if ( verbose ) {
|
||||||
printf( "filter is: (%s)\n", filter );
|
fprintf( stderr, "filter is: (%s)\n", filter );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( not ) {
|
if ( not ) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue