[debian-mysql] Bug#471887: mySQL password asks only once

Nicolas Valcárcel nvalcarcel at ubuntu-pe.org
Thu Mar 20 20:46:37 UTC 2008


Package: mysql-dfsg-5.0
Version: 5.0.51a-3
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch hardy

When installing mysql-server it promts for the database root-password, but it does it only once without asking for confirmation.
Here is a patch that enables the confirmation:

diff -u mysql-dfsg-5.0-5.0.51a/debian/mysql-server-5.0.config mysql-dfsg-5.0-5.0.51a/debian/mysql-server-5.0.config
--- mysql-dfsg-5.0-5.0.51a/debian/mysql-server-5.0.config
+++ mysql-dfsg-5.0-5.0.51a/debian/mysql-server-5.0.config
@@ -17,8 +17,31 @@
 # there is also an additional check for empty root passwords in the
 # postinst script when the tools are available for us to use.
 if [ "$1" = "configure" ] && [ -z "$2" ] || [ "$1" = "reconfigure" ]; then
-	db_input high mysql-server/root_password || true
-	db_go
+	while :; do
+		RET=""
+        	db_input medium mysql-server/root_password || true
+		db_go
+                db_get mysql-server/root_password
+                # if password isn't empty we ask for password verification
+                if [ -z "$RET" ]; then
+                        db_fset mysql-server/root_password seen false
+                        db_fset mysql-server/root_password_again seen false
+			break
+		fi
+		ROOT_PW="$RET"
+                db_input medium mysql-server/root_password_again || true
+		db_go
+                db_get mysql-server/root_password_again
+                if [ "$RET" == "$ROOT_PW" ]; then
+			ROOT_PW=''
+			break
+                fi
+		db_fset mysql-server/password_mismatch seen false
+		db_input critical mysql-server/password_mismatch
+		db_set mysql-server/root_password "" 
+                db_set mysql-server/root_password_again ""
+		db_go
+	done
 fi
 
 # If this is an upgrade of an already existing installation ask the user if

--- mysql-dfsg-5.0-5.0.51a/debian/mysql-server-5.0.templates
+++ mysql-dfsg-5.0-5.0.51a/debian/mysql-server-5.0.templates
@@ -60,6 +60,11 @@
  .
  If that field is left blank, the password will not be changed.
 
+Template: mysql-server/root_password_again
+Type: password
+_Description: Repeat password for the MySQL "root" user:
+
+
 Template: mysql-server/error_setting_password
 Type: error
 _Description: Unable to set password for the MySQL "root" user
@@ -73,6 +78,11 @@
  Please read the /usr/share/doc/mysql-server-5.0/README.Debian file
  for more information.
 
+Template: mysql-server/password_mismatch
+Type: error
+_Description: Password input error
+ The two passwords you entered were not the same. Please try again.
+
 Template: mysql-server-5.0/need_sarge_compat
 Type: boolean
 Default: false


-- 
aka nxvl
Peruvian LoCo Team
Key fingerprint = 8104 21CE A580 7EB7 5184  8DFF 6A3A D5DA 24DC 6AF5
gpg --keyserver keyserver.ubuntu.com --recv-keys 24DC6AF5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/pkg-mysql-maint/attachments/20080320/700f46e1/attachment-0001.pgp 


More information about the pkg-mysql-maint mailing list