From 0a4fd5d87babd223df424f7be6fa02ed4cdb495c Mon Sep 17 00:00:00 2001 From: Deven Bansod Date: Thu, 26 Nov 2015 15:13:29 +0530 Subject: [PATCH 1/4] Fixes issue 11691 Signed-off-by: Deven Bansod --- libraries/server_privileges.lib.php | 62 +++++++++++++++-------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index e5a1d0f74b..c3ea19cf0b 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -5126,39 +5126,15 @@ function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password) $_REQUEST['authentication_plugin'] ); } - - // Use 'SET PASSWORD' for pre-5.7.6 MySQL versions - // and pre-5.2.0 MariaDB + // Use 'CREATE USER ... WITH ... AS ..' syntax for + // newer MySQL versions + // and 'CREATE USER ... USING .. VIA ..' syntax for + // newer MariaDB versions if (($serverType == 'MySQL' - && PMA_MYSQL_INT_VERSION < 50706) + && PMA_MYSQL_INT_VERSION >= 50706) || ($serverType == 'MariaDB' - && PMA_MYSQL_INT_VERSION < 50200) + && PMA_MYSQL_INT_VERSION >= 50200) ) { - - if ($_POST['pred_password'] == 'keep') { - $password_set_real = sprintf( - $password_set_stmt, - $slashedUsername, - $slashedHostname, - $slashedPassword - ); - } else if ($_POST['pred_password'] == 'none') { - $password_set_real = sprintf( - $password_set_stmt, - $slashedUsername, - $slashedHostname, - null - ); - } else { - $hashedPassword = PMA_getHashedPassword($_POST['pma_pw']); - $password_set_real = sprintf( - $password_set_stmt, - $slashedUsername, - $slashedHostname, - $hashedPassword - ); - } - } else { $password_set_real = null; // Required for binding '%' with '%s' @@ -5204,6 +5180,32 @@ function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password) '***' ); } + } else { + // Use 'SET PASSWORD' syntax for pre-5.7.6 MySQL versions + // and pre-5.2.0 MariaDB versions + if ($_POST['pred_password'] == 'keep') { + $password_set_real = sprintf( + $password_set_stmt, + $slashedUsername, + $slashedHostname, + $slashedPassword + ); + } else if ($_POST['pred_password'] == 'none') { + $password_set_real = sprintf( + $password_set_stmt, + $slashedUsername, + $slashedHostname, + null + ); + } else { + $hashedPassword = PMA_getHashedPassword($_POST['pma_pw']); + $password_set_real = sprintf( + $password_set_stmt, + $slashedUsername, + $slashedHostname, + $hashedPassword + ); + } } // add REQUIRE clause From 31001963d2a64c250dae6f2e400653d3efc0a8e8 Mon Sep 17 00:00:00 2001 From: Deven Bansod Date: Thu, 26 Nov 2015 19:20:04 +0530 Subject: [PATCH 2/4] Changelog entry for #11684 Signed-off-by: Deven Bansod --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 9dae02c1d3..8315631e02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ phpMyAdmin - ChangeLog - issue Incorrect script name in include - issue #11685 Warning: Invalid argument supplied for foreach() - issue #11687 Delimiter missing while exporting multiple db routines +- issue #11684 mysql_native_password with MariaDB bug 4.5.2.0 (2015-11-23) - issue #11589 Incorrect parameter in mysqli_fetch_fields() From 8eb712579d67ebcc31210aca7320279494d8e62a Mon Sep 17 00:00:00 2001 From: Deven Bansod Date: Thu, 26 Nov 2015 19:25:18 +0530 Subject: [PATCH 3/4] Fixes #11693 : Flush privileges overusage - related to issue 11597 Signed-off-by: Deven Bansod --- ChangeLog | 1 + libraries/check_user_privileges.lib.php | 15 +++++++++++---- .../plugins/auth/AuthenticationCookie.class.php | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8315631e02..e243b48b9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ phpMyAdmin - ChangeLog - issue #11685 Warning: Invalid argument supplied for foreach() - issue #11687 Delimiter missing while exporting multiple db routines - issue #11684 mysql_native_password with MariaDB bug +- issue #11693 Flush privileges overusage - related to #11597 4.5.2.0 (2015-11-23) - issue #11589 Incorrect parameter in mysqli_fetch_fields() diff --git a/libraries/check_user_privileges.lib.php b/libraries/check_user_privileges.lib.php index 5f2b437374..1f1dc46f86 100644 --- a/libraries/check_user_privileges.lib.php +++ b/libraries/check_user_privileges.lib.php @@ -22,13 +22,20 @@ $GLOBALS['is_superuser'] = $GLOBALS['dbi']->isSuperuser(); */ function PMA_checkRequiredPrivilegesForFlushing() { + if (PMA_Util::cacheExists('flush_priv')) { + $GLOBALS['flush_priv'] = PMA_Util::cacheGet( + 'flush_priv' + ); + return; + } - $res = $GLOBALS['dbi']->tryQuery( - 'FLUSH PRIVILEGES' + $GLOBALS['flush_priv'] = $GLOBALS['dbi']->tryQuery( + 'FLUSH PRIVILEGES' ); - // Save the value - $GLOBALS['flush_priv'] = $res; + // must also cacheUnset() them in + // libraries/plugins/auth/AuthenticationCookie.class.php + PMA_Util::cacheSet('flush_priv', $GLOBALS['flush_priv']); } /** diff --git a/libraries/plugins/auth/AuthenticationCookie.class.php b/libraries/plugins/auth/AuthenticationCookie.class.php index 4318502709..63e49f63d3 100644 --- a/libraries/plugins/auth/AuthenticationCookie.class.php +++ b/libraries/plugins/auth/AuthenticationCookie.class.php @@ -448,6 +448,7 @@ class AuthenticationCookie extends AuthenticationPlugin PMA_Util::cacheUnset('col_priv'); PMA_Util::cacheUnset('table_priv'); PMA_Util::cacheUnset('proc_priv'); + PMA_Util::cacheUnset('flush_priv'); $GLOBALS['no_activity'] = true; $this->authFails(); From 83672ac65cd91951cc743a0db5e17e8a7f9e03b9 Mon Sep 17 00:00:00 2001 From: Deven Bansod Date: Thu, 26 Nov 2015 19:43:21 +0530 Subject: [PATCH 4/4] Changelog entry for #11691 Signed-off-by: Deven Bansod --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index e243b48b9b..0d3c0b2362 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ phpMyAdmin - ChangeLog - issue #11687 Delimiter missing while exporting multiple db routines - issue #11684 mysql_native_password with MariaDB bug - issue #11693 Flush privileges overusage - related to #11597 +- issue #11691 Query was empty on creating User in 4.5.2 4.5.2.0 (2015-11-23) - issue #11589 Incorrect parameter in mysqli_fetch_fields()