From 17dd2ac12495e7dc7d75a79ea7355fb3cd63963d Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Mon, 10 Jun 2019 14:36:49 -0400 Subject: [PATCH] Bug 23090: Add some special characters TEST PLAN --------- $ sudo mysql -u root > CREATE USER 'bug23090_test1'@'localhost' IDENTIFIED BY 'badpassword'; [Magical MySQL Error] > CREATE USER 'bug23090_test1'@'localhost' IDENTIFIED BY 'GoodP@ssw0rd'; [Should be okay] > DROP USER 'bug23090_test1'@'localhost'; > QUIT $ sudo koha-create --create-db fail23090 [Magical MySQL Error] [Apply this patch and put it (debian/scripts/koha-create) into place in /usr/sbin/koha-create] $ sudo koha-create --create-db pass23090 (Clean up and databases made) Signed-off-by: Chris Cormack Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize (cherry picked from commit f56bba9297087eaeaeefb2aba546c9f107bfad6e) Signed-off-by: Fridolin Somers (cherry picked from commit b68f2aab6e7c33a26cf9568cca3b75ea30f0a014) Signed-off-by: Lucas Gass --- debian/scripts/koha-create | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index 5e60f7cd77..35572f223c 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -579,7 +579,10 @@ if [ "$op" = create ] || [ "$op" = request ] || [ "$op" = use ] then if [ "$mysqlpwd" = "" ] then - mysqlpwd="$(pwgen -s 16 1)" + # over-size, so when problematic chars are removed, + # still likely 16 characters left. + mysqlpwd="$(pwgen -s -y 32 1)" + mysqlpwd="$(echo $mysqlpwd | tr -d :\'\\\<\>\/ | cut -c1-16)" fi else mysqlpwd="$(getinstancemysqlpassword $name)" -- 2.39.5