From 7e1932d8408f018a73c30683f84d003826882057 Mon Sep 17 00:00:00 2001 From: xfwduke Date: Wed, 15 Jan 2025 12:21:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(mysql):=20mysql=E6=8E=88=E6=9D=83=E5=85=BC?= =?UTF-8?q?=E5=AE=B9spider4=20#9066?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pkg/core/staticembed/procedure.sql | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/dbm-services/mysql/db-tools/dbactuator/pkg/core/staticembed/procedure.sql b/dbm-services/mysql/db-tools/dbactuator/pkg/core/staticembed/procedure.sql index b3dac1d505..32e760c5a7 100644 --- a/dbm-services/mysql/db-tools/dbactuator/pkg/core/staticembed/procedure.sql +++ b/dbm-services/mysql/db-tools/dbactuator/pkg/core/staticembed/procedure.sql @@ -100,11 +100,8 @@ CREATE PROCEDURE infodba_schema.check_all( SQL SECURITY INVOKER BEGIN -- 全量检查入口 - SET @password_check = 0; - SET @db_check = 0; - CALL check_password(uuid, grant_time, username, ip_list, long_psw, short_psw, @password_check); - CALL check_db_conflict(uuid, grant_time, username, ip_list, db_list, @db_check); - SET is_check_failed = @password_check OR @db_check; + CALL check_password(uuid, grant_time, username, ip_list, long_psw, short_psw, is_check_failed); + CALL check_db_conflict(uuid, grant_time, username, ip_list, db_list, is_check_failed); END # @@ -133,14 +130,23 @@ BEGIN IF @user_host_exists THEN -- 用户存在, 检查密码 -- 5.6 及之前还有 old_password 函数, 也就是 < 5.7 可能有 old_password - IF SUBSTRING_INDEX(@@version, ".", 2) < 5.7 THEN - SELECT password = long_psw OR password = short_psw INTO @psw_match FROM mysql.user WHERE user = username AND host = @ip; + IF @@version LIKE '%tspider%' THEN + IF @@VERSION LIKE "%tspider-1%" OR @@VERSION LIKE "%tspider-2%" OR @@VERSION LIKE "%tspider-3%" OR @@VERSION LIKE "%tspider-4%" THEN + SELECT password = long_psw OR password = short_psw INTO @psw_match FROM mysql.user WHERE user = username AND host = @ip; + ELSE + SET @msg = CONCAT('not support spider version: ', @@version); + SIGNAL SQLSTATE '32401' SET MESSAGE_TEXT = @msg; + END IF; ELSE - SELECT authentication_string = long_psw INTO @psw_match FROM mysql.user WHERE user = username AND host =@ip; - END IF; + IF SUBSTRING_INDEX(@@version, ".", 2) < 5.7 THEN + SELECT password = long_psw OR password = short_psw INTO @psw_match FROM mysql.user WHERE user = username AND host = @ip; + ELSE + SELECT authentication_string = long_psw INTO @psw_match FROM mysql.user WHERE user = username AND host =@ip; + END IF; + END IF; IF NOT @psw_match THEN - SET is_check_failed = is_check_failed OR 1; + SET is_check_failed = NOT @psw_match; INSERT INTO dba_grant_result(id, grant_time, username, client_ip, long_psw, short_psw, msg) VALUES (uuid, grant_time, username, @ip, long_psw, short_psw, 'password not match'); END IF;