Denis,

Maybe you missed this while you were away so I send again.

Adduser fails to create the user when ENABLE_FEATURE_CLEAN_UP is
disabled.

The reason is that adduser will exec passwd without first flushing the
previously written /etc/passwd (and /etc/shadow). passwd will fail
because the user does not exist until files are flushed. But the flush
never comes because the buffered file handles are lost in the exec
operation.

Attatched patch fixes this by flushing all file handles before exiting.

Alternative fix would be to close the files regardless FEATURE_CLEAN_UP
but we save a few bytes with one fflush(NULL) over 2 fclose() (in case
shadow passwords are enabled)

Please add this to 1.6.1 fixes.

Natanael Copa

--- busybox-1.6.1/loginutils/adduser.c.orig	2007-07-09 10:44:58 +0000
+++ busybox-1.6.1/loginutils/adduser.c	2007-07-09 10:48:06 +0000
@@ -82,6 +82,11 @@
 static void passwd_wrapper(const char *login)
 {
 	static const char prog[] = "passwd";
+
+	/* make sure /etc/passwd and /etc/shadow is updated */
+	if (!ENABLE_FEATURE_CLEAN_UP)
+		fflush(NULL);
+
 	BB_EXECLP(prog, prog, login, NULL);
 	bb_error_msg_and_die("failed to execute '%s', you must set the password for '%s' manually", prog, login);
 }
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to