Merge #16839 - Fix password management for Percona Server lacking PASSWORD function.
This commit is contained in:
commit
9d166afd58
@ -1038,7 +1038,8 @@ class Privileges
|
|||||||
));
|
));
|
||||||
|
|
||||||
// Use 'ALTER USER ...' syntax for MySQL 5.7.6+
|
// Use 'ALTER USER ...' syntax for MySQL 5.7.6+
|
||||||
if ($serverType === 'MySQL'
|
if (
|
||||||
|
in_array($serverType, ['MySQL', 'Percona Server'], true)
|
||||||
&& $serverVersion >= 50706
|
&& $serverVersion >= 50706
|
||||||
) {
|
) {
|
||||||
if ($authentication_plugin !== 'mysql_old_password') {
|
if ($authentication_plugin !== 'mysql_old_password') {
|
||||||
|
|||||||
@ -7,6 +7,7 @@ namespace PhpMyAdmin;
|
|||||||
use PhpMyAdmin\Html\Generator;
|
use PhpMyAdmin\Html\Generator;
|
||||||
use PhpMyAdmin\Server\Privileges;
|
use PhpMyAdmin\Server\Privileges;
|
||||||
use function strlen;
|
use function strlen;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Functions for user password
|
* Functions for user password
|
||||||
@ -86,19 +87,18 @@ class UserPassword
|
|||||||
$sql_query = 'SET password = '
|
$sql_query = 'SET password = '
|
||||||
. ($password == '' ? '\'\'' : $hashing_function . '(\'***\')');
|
. ($password == '' ? '\'\'' : $hashing_function . '(\'***\')');
|
||||||
|
|
||||||
if ($serverType === 'MySQL'
|
$isPerconaOrMySql = in_array($serverType, ['MySQL', 'Percona Server'], true);
|
||||||
&& $serverVersion >= 50706
|
if ($isPerconaOrMySql && $serverVersion >= 50706
|
||||||
) {
|
) {
|
||||||
$sql_query = 'ALTER USER \'' . $dbi->escapeString($username)
|
$sql_query = 'ALTER USER \'' . $dbi->escapeString($username)
|
||||||
. '\'@\'' . $dbi->escapeString($hostname)
|
. '\'@\'' . $dbi->escapeString($hostname)
|
||||||
. '\' IDENTIFIED WITH ' . $orig_auth_plugin . ' BY '
|
. '\' IDENTIFIED WITH ' . $orig_auth_plugin . ' BY '
|
||||||
. ($password == '' ? '\'\'' : '\'***\'');
|
. ($password == '' ? '\'\'' : '\'***\'');
|
||||||
} elseif (($serverType === 'MySQL'
|
} elseif (
|
||||||
&& $serverVersion >= 50507)
|
($isPerconaOrMySql && $serverVersion >= 50507)
|
||||||
|| ($serverType === 'MariaDB'
|
|| ($serverType === 'MariaDB' && $serverVersion >= 50200)
|
||||||
&& $serverVersion >= 50200)
|
|
||||||
) {
|
) {
|
||||||
// For MySQL versions 5.5.7+ and MariaDB versions 5.2+,
|
// For MySQL and Percona versions 5.5.7+ and MariaDB versions 5.2+,
|
||||||
// explicitly set value of `old_passwords` so that
|
// explicitly set value of `old_passwords` so that
|
||||||
// it does not give an error while using
|
// it does not give an error while using
|
||||||
// the PASSWORD() function
|
// the PASSWORD() function
|
||||||
@ -171,7 +171,10 @@ class UserPassword
|
|||||||
$serverType = Util::getServerType();
|
$serverType = Util::getServerType();
|
||||||
$serverVersion = $dbi->getVersion();
|
$serverVersion = $dbi->getVersion();
|
||||||
|
|
||||||
if ($serverType === 'MySQL' && $serverVersion >= 50706) {
|
if (
|
||||||
|
in_array($serverType, ['MySQL', 'Percona Server'], true)
|
||||||
|
&& $serverVersion >= 50706
|
||||||
|
) {
|
||||||
$local_query = 'ALTER USER \'' . $dbi->escapeString($username)
|
$local_query = 'ALTER USER \'' . $dbi->escapeString($username)
|
||||||
. '\'@\'' . $dbi->escapeString($hostname) . '\''
|
. '\'@\'' . $dbi->escapeString($hostname) . '\''
|
||||||
. ' IDENTIFIED with ' . $orig_auth_plugin . ' BY '
|
. ' IDENTIFIED with ' . $orig_auth_plugin . ' BY '
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user