[Pkg-shadow-devel] Bug#245332: Patch for "should not 'forget' login name when password mismatch"

Christian Perrier Christian Perrier <bubulle@debian.org>, 245332@bugs.debian.org
Tue, 26 Apr 2005 22:16:02 +0200


--qlTNgmc+xy1dBmNv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

The attached patch to the config script of passwd shoul avoid
"forgetting" the login name of the first created user when going back
because the password confirmation does not match the password.

(this is of course about the special case where a normal user is to be
created, that is usually during the initial system install)


-- 



--qlTNgmc+xy1dBmNv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

--- passwd.config	2005-04-26 20:21:02.000000000 +0200
+++ passwd.config.new	2005-04-26 20:17:00.000000000 +0200
@@ -103,7 +103,7 @@
 # Main loop starts here. Use a state machine to allow jumping back to
 # previous questions.
 STATE=0
-while [ "$STATE" != '9' -a "$STATE" != '-1' ]; do
+while [ "$STATE" != '10' -a "$STATE" != '-1' ]; do
 	case "$STATE" in
 	0)
 		# Ask how the password files should be set up.
@@ -226,13 +226,20 @@
 				fi
 			fi
 			db_input critical passwd/username || true
+		fi
+	;;
+	8)
+		# Prompt for password
+		db_get passwd/make-user
+		if [ "$RET" = true ] && ! is_system_user; then
+			LOOP=""
 			db_input critical passwd/user-password || true
 			COMPARE_PW=''
 			db_input high passwd/user-password-again \
 				&& COMPARE_PW=1 || true
 		fi
 	;;
-	8)
+	9)
 		# Verify and make user.
 		db_get passwd/make-user
 		if [ "$RET" = true ] && ! is_system_user; then
@@ -259,7 +266,7 @@
 				db_input critical passwd/password-mismatch
 				db_fset passwd/user-password seen false
 				db_fset passwd/user-password-again seen false
-				STATE=5
+				STATE=8
 				continue
 			fi
 			if [ -z "$USER_PW" ]; then
@@ -269,7 +276,7 @@
 				db_input critical passwd/password-empty
 				db_fset passwd/user-password seen false
 				db_fset passwd/user-password-again seen false
-				STATE=5
+				STATE=8
 				continue
 			fi
 			

--qlTNgmc+xy1dBmNv--