Skip to content

Commit 84f51a6

Browse files
author
Venkatesh Prasad
authored
Merge pull request #268 from georgemesss/patch-1
PSQLADM-525: Fix escaping issues on passwords by converting to HEX
2 parents ebb064b + 0cbee67 commit 84f51a6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

proxysql-admin-common

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ function syncusers() {
605605
esac
606606

607607
# Filter out the internal system users
608-
mysql_users=$(mysql_exec "$LINENO" "SELECT User,${password_field} FROM mysql.user where ${password_field}!=''" "" "hide_output" |
608+
mysql_users=$(mysql_exec "$LINENO" "SELECT User,HEX(${password_field}) FROM mysql.user where ${password_field}!=''" "" "hide_output" |
609609
grep -E -v "^(mysql.sys|mysql.session|mysql.infoschema|mysql.pxc)" |
610610
sort |
611611
uniq )
@@ -714,7 +714,7 @@ function syncusers() {
714714
"INSERT INTO mysql_users
715715
(username, password, active, default_hostgroup)
716716
VALUES
717-
('${username}', '${password}', 1, $WRITER_HOSTGROUP_ID)"
717+
('${username}', UNHEX('${password}'), 1, $WRITER_HOSTGROUP_ID)"
718718
check_cmd $? "$LINENO" "Failed to add the user (${username}) from PXC to ProxySQL database."\
719719
"\n-- Please check the ProxySQL connection parameters and status."
720720
if [[ $ADD_QUERY_RULE -eq 1 ]];then
@@ -791,7 +791,7 @@ function syncusers() {
791791
function get_proxysql_users() {
792792
local proxysql_users
793793
proxysql_users=$(proxysql_exec "$LINENO" \
794-
"SELECT username,password
794+
"SELECT username,HEX(password)
795795
FROM mysql_users
796796
WHERE password!='' AND default_hostgroup=$WRITER_HOSTGROUP_ID" "" "hide_output")
797797
check_cmd $? "$LINENO" "Failed to load user list from ProxySQL database."\

0 commit comments

Comments
 (0)