'passwd' does not enable password in /etc/passwd ':x:'

Tito farmatito at tiscali.it
Sun Apr 3 21:25:55 UTC 2011


On Saturday 02 April 2011 23:06:11 Tomasz Czapiewski wrote:
> I've encountered problem that BusyBox 1.18.4 'passwd' module does 
> create/update passwords in /etc/shadow file but does not put 'x' in 
> /etc/passwd after login name to be able to login using this password if 
> there was no password before ('login::..').
> 
> 'passwd' command on Debian or Ubuntu does handle it this way that does not 
> update /etc/shadow but writes encrypted password into /etc/passwd in such 
> case, althrough IMO it's not good either when the /etc/shadow file exists.
> 
> Regards,
> Tomasz Czapiewski

Hi,
could you please test this patch.
It is only compile tested but should fix the problem you report.

-----------------------------------------------------------------------------------------------------------------------------------------------

Signed-off by: Tito Ragusa <farmatito at tiscali.it>

--- loginutils/passwd.c.orig	2011-04-03 22:58:24.000000000 +0200
+++ loginutils/passwd.c	2011-04-03 23:18:32.000000000 +0200
@@ -201,7 +201,12 @@
 #if ENABLE_FEATURE_SHADOWPASSWDS
 	filename = bb_path_shadow_file;
 	rc = update_passwd(bb_path_shadow_file, name, newp, NULL);
-	if (rc == 0) /* no lines updated, no errors detected */
+	if (rc == 1) {
+		/* a password in /etc/shadow was updated */
+		//newp = xstrdup("x");
+		newp = (char*)"x";
+	}
+	if (rc >= 0) /* 0 = /etc/shadow missing (not an error), 1 = passwd changed in /etc/shadow */
 #endif
 	{
 		filename = bb_path_passwd_file;
------------------------------------------------------------------------------------------------------------------------------------------------ 

Ciao,
Tito
-------------- next part --------------
A non-text attachment was scrubbed...
Name: passwd.patch
Type: text/x-diff
Size: 642 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20110403/989fe01b/attachment.bin>


More information about the busybox mailing list