X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=clients%2Ftools%2Fldapdelete.c;h=f1db45eaa22396b7d06ad652e64373b6285f4f57;hb=0ba4206ed93215f2c5c2d12d16342d6a846c278a;hp=754d96aae421b732c63a9d9ea62753fadf369992;hpb=648fc5aabb08e5b4ca8c04e68e703efcee0ead7e;p=openldap diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c index 754d96aae4..f1db45eaa2 100644 --- a/clients/tools/ldapdelete.c +++ b/clients/tools/ldapdelete.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2008 The OpenLDAP Foundation. + * Copyright 1998-2011 The OpenLDAP Foundation. * Portions Copyright 1998-2003 Kurt D. Zeilenga. * All rights reserved. * @@ -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 ); @@ -78,7 +82,7 @@ usage( void ) const char options[] = "r" - "cd:D:e:f:h:H:IMnO:o:p:P:QR:U:vVw:WxX:y:Y:z:Z"; + "cd:D:e:f:h:H:IMnNO:o:p:P:QR:U:vVw:WxX:y:Y:z:Z"; int handle_private_option( int i ) @@ -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,23 +181,13 @@ 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 ); - if ( pw_file || want_bindpw ) { - if ( pw_file ) { - rc = lutil_get_filed_password( pw_file, &passwd ); - if( rc ) return EXIT_FAILURE; - } else { - passwd.bv_val = getpassphrase( _("Enter LDAP Password: ") ); - passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0; - } - } - tool_bind( ld ); tool_server_controls( ld, NULL, 0 ); @@ -222,6 +214,8 @@ main( int argc, char **argv ) retval = rc; } } + if ( fp != stdin ) + fclose( fp ); } tool_unbind( ld );