]> git.sur5r.net Git - openldap/blobdiff - clients/tools/ldapexop.c
Plug one-time LDAPMessage leak
[openldap] / clients / tools / ldapexop.c
index ac8f9be5aaf8a2b1247b32631fdd8bf2b84647c6..b259bef03cbab993b5c4eef9ff83e14955987682 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2005-2008 The OpenLDAP Foundation.
+ * Copyright 2005-2010 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,9 @@ usage( void )
 {
        fprintf( stderr, _("Issue LDAP extended operations\n\n"));
        fprintf( stderr, _("usage: %s [options] <oid|oid:data|oid::b64data>\n"), prog);
+       fprintf( stderr, _("       %s [options] whoami\n"), prog);
+       fprintf( stderr, _("       %s [options] cancel <id>\n"), prog);
+       fprintf( stderr, _("       %s [options] refresh <DN> [<ttl>]\n"), prog);
        tool_common_usage();
        exit( EXIT_FAILURE );
 }
@@ -72,7 +75,7 @@ main( int argc, char *argv[] )
        char            *matcheddn = NULL, *text = NULL, **refs = NULL;
        LDAPControl **ctrls = NULL;
        int             id, code;
-       LDAPMessage     *res;
+       LDAPMessage     *res = NULL;
 
        tool_init( TOOL_EXOP );
        prog = lutil_progname( "ldapexop", argc, argv );
@@ -86,16 +89,6 @@ main( int argc, char *argv[] )
                usage();
        }
 
-       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;
-               }
-       }
-
        ld = tool_conn_setup( 0, 0 );
 
        tool_bind( ld );
@@ -152,8 +145,6 @@ main( int argc, char *argv[] )
                case 2:
                        dn.bv_val = argv[ 1 ];
                        dn.bv_len = strlen( dn.bv_val );
-
-               case 1:
                        break;
 
                default:
@@ -357,6 +348,8 @@ main( int argc, char *argv[] )
 
 skip:
        /* disconnect from server */
+       if ( res )
+               ldap_msgfree( res );
        tool_unbind( ld );
        tool_destroy();