Skip to content

Commit 49a1416

Browse files
committed
修复 ProxyAuthenticator 中的日志记录,使用 mb_strlen 替代 strlen 以支持多字节字符长度计算,增强对代理账号验证的调试信息。
1 parent 306baf6 commit 49a1416

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

app/Proxy/Auth/ProxyAuthenticator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public function authenticate(
5555
$this->logger->debug('开始验证代理账号', [
5656
'username' => $username,
5757
'database' => $database,
58-
'auth_response_length' => strlen($authResponse),
59-
'auth_plugin_data_length' => strlen($authPluginData),
58+
'auth_response_length' => mb_strlen($authResponse),
59+
'auth_plugin_data_length' => mb_strlen($authPluginData),
6060
]);
6161

6262
// 查找匹配的代理账号
@@ -73,7 +73,7 @@ public function authenticate(
7373
// 验证密码
7474
$isValid = $this->verifyPassword($authResponse, $account['password'], $authPluginData);
7575

76-
$this->logger->info('代理账号验证结果', [
76+
$this->logger->info('代理账号验证结果,密码错误', [
7777
'username' => $username,
7878
'database' => $database,
7979
'is_valid' => $isValid,
@@ -122,8 +122,8 @@ private function verifyPassword(string $clientAuthResponse, string $storedPasswo
122122
$isValid = hash_equals($expectedResponse, $clientAuthResponse);
123123

124124
$this->logger->debug('密码验证详情', [
125-
'client_response_length' => strlen($clientAuthResponse),
126-
'expected_response_length' => strlen($expectedResponse),
125+
'client_response_length' => mb_strlen($clientAuthResponse),
126+
'expected_response_length' => mb_strlen($expectedResponse),
127127
'responses_match' => $isValid,
128128
]);
129129

0 commit comments

Comments
 (0)