[PATCH] minor cosmetical fix in correct_password.c

Tito farmatito at tiscali.it
Fri Dec 30 14:14:28 UTC 2005


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
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: correct_password_04.diff
Type: text/x-diff
Size: 771 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20051230/7826b592/attachment.bin 


More information about the busybox mailing list