]> git.sur5r.net Git - openldap/commitdiff
fix handling of -y
authorKurt Zeilenga <kurt@openldap.org>
Mon, 15 Sep 2003 19:07:15 +0000 (19:07 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 15 Sep 2003 19:07:15 +0000 (19:07 +0000)
clients/tools/ldappasswd.c

index b6a1ec3168691d164fd5386c021d0934e3dd5e77..a84e46795666270264ff52daaa16ff2d7678499f 100644 (file)
@@ -168,7 +168,7 @@ main( int argc, char *argv[] )
        }
 
        if( oldpwfile ) {
-               rc = lutil_get_filed_password( prog, &oldpw );
+               rc = lutil_get_filed_password( oldpwfile, &oldpw );
                if( rc ) return EXIT_FAILURE;
        }
 
@@ -189,7 +189,7 @@ main( int argc, char *argv[] )
        }
 
        if( newpwfile ) {
-               rc = lutil_get_filed_password( prog, &newpw );
+               rc = lutil_get_filed_password( newpwfile, &newpw );
                if( rc ) return EXIT_FAILURE;
        }
 
@@ -209,23 +209,22 @@ main( int argc, char *argv[] )
                newpw.bv_len = strlen( newpw.bv_val );
        }
 
-       if( want_bindpw && passwd.bv_val == NULL ) {
-               /* handle bind password */
-               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;
-               }
+       if ( pw_file ) {
+               rc = lutil_get_filed_password( pw_file, &passwd );
+               if( rc ) return EXIT_FAILURE;
+
+       } else if ( want_bindpw ) {
+               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 );
 
-       if ( authzid || manageDSAit || noop )
+       if ( authzid || manageDSAit || noop ) {
                tool_server_controls( ld, NULL, 0 );
+       }
 
        if( user != NULL || oldpw.bv_val != NULL || newpw.bv_val != NULL ) {
                /* build change password control */