[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] minor cosmetical fix in correct_password.c
From:       Tito <farmatito () tiscali ! it>
Date:       2005-12-30 14:14:28
Message-ID: 200512301514.28194.farmatito () tiscali ! it
[Download RAW message or body]

On Friday 30 December 2005 14:29, Tito wrote:
> Hi,
> this patch avoids a composed password prompt like the one used in vlock.c
> to be messed up by the error message when /etc/shadow is missing.
> 
> 		printf("Virtual Console%s locked.\n%s's ", (o_lock_all) ? "s" : "", pw->pw_name);
> 		fflush(stdout);
> 		if (correct_password (pw)) {
> 			break;
> 		}
> 
> The output is:
> 
> Virtual Console locked. root's Password:
> 
> if /etc/shadow is missing:
> 
> Virtual Console locked. root's no valid shadow password
> 
> Please apply if you think it is safe to do so and if you care about it.

Some alternative solutions as the first patch is not so good :-(

diff -uN libbb/correct_password_orig.c libbb/correct_password.c
--- libbb/correct_password_orig.c       2005-12-04 13:55:50.000000000 +0100
+++ libbb/correct_password.c    2005-12-30 15:01:37.000000000 +0100
@@ -55,7 +55,7 @@
                struct spwd *sp = getspnam ( pw-> pw_name );

                if ( !sp )
-                       bb_error_msg_and_die ( "no valid shadow password" );
+                       bb_error_msg_and_die ( "Password:\nno valid shadow password" );

                correct = sp-> sp_pwdp;
        }

or 
 
diff -uN libbb/correct_password_orig.c libbb/correct_password.c
--- libbb/correct_password_orig.c       2005-12-04 13:55:50.000000000 +0100
+++ libbb/correct_password.c    2005-12-30 15:03:22.000000000 +0100
@@ -55,7 +55,7 @@
                struct spwd *sp = getspnam ( pw-> pw_name );

                if ( !sp )
-                       bb_error_msg_and_die ( "no valid shadow password" );
+                       bb_error_msg_and_die ( "\nno valid shadow password" );

                correct = sp-> sp_pwdp;
        }

or this one (the one I like.....that's why it is the only attached)

 diff -uN libbb/correct_password_orig.c libbb/correct_password.c
--- libbb/correct_password_orig.c       2005-12-04 13:55:50.000000000 +0100
+++ libbb/correct_password.c    2005-12-30 15:06:32.000000000 +0100
@@ -50,12 +50,13 @@
 {
        char *unencrypted, *encrypted, *correct;

+       printf("Password: ");
 #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 )
-                       bb_error_msg_and_die ( "no valid shadow password" );
+                       bb_error_msg_and_die ( "\nno valid shadow password" );

                correct = sp-> sp_pwdp;
        }
@@ -66,7 +67,7 @@
        if ( correct == 0 || correct[0] == '\0' )
                return 1;

-       unencrypted = bb_askpass ( 0, "Password: " );
+       unencrypted = bb_askpass ( 0, "" );
        if ( !unencrypted )
        {
                return 0;

Ciao,
Tito
> Ciao,
> Tito
> 

["correct_password_04.diff" (text/x-diff)]

--- libbb/correct_password_orig.c	2005-12-04 13:55:50.000000000 +0100
+++ libbb/correct_password.c	2005-12-30 15:06:32.000000000 +0100
@@ -50,12 +50,13 @@
 {
 	char *unencrypted, *encrypted, *correct;
 
+	printf("Password: ");
 #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 )
-			bb_error_msg_and_die ( "no valid shadow password" );
+			bb_error_msg_and_die ( "\nno valid shadow password" );
 
 		correct = sp-> sp_pwdp;
 	}
@@ -66,7 +67,7 @@
 	if ( correct == 0 || correct[0] == '\0' )
 		return 1;
 
-	unencrypted = bb_askpass ( 0, "Password: " );
+	unencrypted = bb_askpass ( 0, "" );
 	if ( !unencrypted )
 	{
 		return 0;


_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic