From 8c3536bce197c6d17a8a2a7d15cb00923e5dd77e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Fri, 24 Jul 2020 22:36:45 -0300 Subject: [PATCH] Move password truncation to AuthenticationCookie MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- libraries/classes/Plugins/Auth/AuthenticationCookie.php | 8 +++++++- libraries/common.inc.php | 4 ---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libraries/classes/Plugins/Auth/AuthenticationCookie.php b/libraries/classes/Plugins/Auth/AuthenticationCookie.php index 0a8000c948..f3f1e3a5a5 100644 --- a/libraries/classes/Plugins/Auth/AuthenticationCookie.php +++ b/libraries/classes/Plugins/Auth/AuthenticationCookie.php @@ -331,7 +331,13 @@ class AuthenticationCookie extends AuthenticationPlugin // The user just logged in $this->user = Core::sanitizeMySQLUser($_POST['pma_username']); - $this->password = $_POST['pma_password'] ?? ''; + + $password = $_POST['pma_password'] ?? ''; + if (strlen($password) > 256) { + $password = substr($password, 0, 256); + } + $this->password = $password; + if ($GLOBALS['cfg']['AllowArbitraryServer'] && isset($_REQUEST['pma_servername']) ) { diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 06884a61a1..eba4e33809 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -264,10 +264,6 @@ if (! defined('PMA_MINIMUM_COMMON')) { } unset($cache_key); - if (isset($_POST['pma_password']) && strlen($_POST['pma_password']) > 256) { - $_POST['pma_password'] = substr($_POST['pma_password'], 0, 256); - } - $auth_plugin = Plugins::getAuthPlugin(); $auth_plugin->authenticate();