Tito writes:
[oweals/busybox.git] / libbb / correct_password.c
index 758b89eed79069e2eb24048e063e9ccaf6f2be8d..570aa7e86fca02d7323da1b2903c1ccce54446b4 100644 (file)
 int correct_password ( const struct passwd *pw )
 {
        char *unencrypted, *encrypted, *correct;
-       
+
 #ifdef CONFIG_FEATURE_SHADOWPASSWDS
        if (( strcmp ( pw-> pw_passwd, "x" ) == 0 ) || ( strcmp ( pw-> pw_passwd, "*" ) == 0 )) {
                struct spwd *sp = getspnam ( pw-> pw_name );
-               
+
                if ( !sp )
-                       error_msg_and_die ( "no valid shadow password" );
-               
+                       bb_error_msg_and_die ( "no valid shadow password" );
+
                correct = sp-> sp_pwdp;
        }
        else
@@ -66,13 +66,12 @@ int correct_password ( const struct passwd *pw )
        if ( correct == 0 || correct[0] == '\0' )
                return 1;
 
-       unencrypted = getpass ( "Password: " );
+       unencrypted = bb_askpass ( 0, "Password: " );
        if ( !unencrypted )
        {
-               fputs ( "getpass: cannot open /dev/tty\n", stderr );
                return 0;
        }
        encrypted = crypt ( unencrypted, correct );
-       memset ( unencrypted, 0, xstrlen ( unencrypted ));
+       memset ( unencrypted, 0, bb_strlen ( unencrypted ));
        return ( strcmp ( encrypted, correct ) == 0 ) ? 1 : 0;
 }