X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=clients%2Ftools%2Fldapdelete.c;h=359a5c541d4571889a914152ccb338e72b504e6a;hb=ab82ec5fb4bd05fb064571bd34f9eaffc7524fa5;hp=5424758a6321aa8ee53fc97c3b3d4922d71a1469;hpb=fcf97e84486e1159c0f57114e3b130cf49d7f89d;p=openldap diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c index 5424758a63..359a5c541d 100644 --- a/clients/tools/ldapdelete.c +++ b/clients/tools/ldapdelete.c @@ -71,6 +71,10 @@ usage( void ) fprintf( stderr, _(" dn: list of DNs to delete. If not given, it will be readed from stdin\n")); fprintf( stderr, _(" or from the file specified with \"-f file\".\n")); fprintf( stderr, _("Delete Options:\n")); + fprintf( stderr, _(" -c continuous operation mode (do not stop on errors)\n")); + fprintf( stderr, _(" -f file read operations from `file'\n")); + fprintf( stderr, _(" -M enable Manage DSA IT control (-MM to make critical)\n")); + fprintf( stderr, _(" -P version protocol version (default: 3)\n")); fprintf( stderr, _(" -r delete recursively\n")); tool_common_usage(); exit( EXIT_FAILURE ); @@ -162,12 +166,10 @@ int main( int argc, char **argv ) { char buf[ 4096 ]; - FILE *fp; + FILE *fp = NULL; LDAP *ld; int rc, retval; - fp = NULL; - tool_init( TOOL_DELETE ); prog = lutil_progname( "ldapdelete", argc, argv ); @@ -179,9 +181,9 @@ main( int argc, char **argv ) exit( EXIT_FAILURE ); } } else { - if ( optind >= argc ) { - fp = stdin; - } + if ( optind >= argc ) { + fp = stdin; + } } ld = tool_conn_setup( 0, &private_conn_setup ); @@ -189,7 +191,11 @@ main( int argc, char **argv ) if ( pw_file || want_bindpw ) { if ( pw_file ) { rc = lutil_get_filed_password( pw_file, &passwd ); - if( rc ) return EXIT_FAILURE; + if( rc ) { + if ( fp && fp != stdin ) + fclose( fp ); + return EXIT_FAILURE; + } } else { passwd.bv_val = getpassphrase( _("Enter LDAP Password: ") ); passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0; @@ -222,6 +228,8 @@ main( int argc, char **argv ) retval = rc; } } + if ( fp != stdin ) + fclose( fp ); } tool_unbind( ld );