From 84b22909c5e07d95f692bd64f114f8784985c94c Mon Sep 17 00:00:00 2001 From: kkigomi Date: Sun, 15 Oct 2023 20:39:44 +0900 Subject: [PATCH] =?UTF-8?q?sql=5Fpassword()=20=ED=95=A8=EC=88=98=EB=A5=BC?= =?UTF-8?q?=20=EC=82=AC=EC=9A=A9=ED=95=98=EB=8A=94=20=EA=B2=83=EC=9D=84=20?= =?UTF-8?q?=EA=B6=8C=EC=9E=A5=ED=95=98=EC=A7=80=20=EC=95=8A=EC=9D=8C?= =?UTF-8?q?=EC=9D=84=20=ED=91=9C=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/gnuboard/gnuboard5/issues/247 --- lib/common.lib.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/common.lib.php b/lib/common.lib.php index a0f4960f1..ed91b53b8 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -1843,11 +1843,22 @@ function sql_free_result($result) } +/** + * MySQL PASSWORD() 함수로 생성된 비밀번호의 hash 값을 반환 + * + * MySQL 버전에 따라 결과가 다르게 나올 수 있음. + * MySQL 8.0.11 버전 이상에서는 오류 발생(PASSWORD 함수가 제거됨)으로 사용할 수 없음. + * + * @deprecated 이 함수는 안전하지 않으므로 사용하지 않는 것을 권장 함 + * @see get_encrypt_string() and check_password() + * @param string $value + * @return string + */ function sql_password($value) { // mysql 4.0x 이하 버전에서는 password() 함수의 결과가 16bytes // mysql 4.1x 이상 버전에서는 password() 함수의 결과가 41bytes - $row = sql_fetch(" select password('$value') as pass "); + $row = sql_fetch(" SELECT password('{$value}') as pass "); return $row['pass']; }