Skip to content

Commit 2c75b73

Browse files
author
Till Brehm
committed
Added check for empty passwords on update of MySQL users.
1 parent a632b0b commit 2c75b73

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server/plugins-available/mysql_clientdb_plugin.inc.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ function process_host_list($action, $database_name, $database_user, $database_pa
142142
} elseif($action == 'PASSWORD') {
143143
//if(!$link->query("SET PASSWORD FOR '".$link->escape_string($database_user)."'@'$db_host' = '".$link->escape_string($database_password)."'")) $success = false;
144144
// SET PASSWORD for already hashed passwords is not supported by latest MySQL 5.7 anymore, so we set it directly
145-
if(!$link->query("UPDATE mysql.user SET `Password` = '".$link->escape_string($database_password)."' WHERE `Host` = '".$db_host."' AND `User` = '".$link->escape_string($database_user)."'")) $success = false;
146-
if($success == true) $link->query("FLUSH PRIVILEGES");
145+
if(trim($database_password) != '') {
146+
if(!$link->query("UPDATE mysql.user SET `Password` = '".$link->escape_string($database_password)."' WHERE `Host` = '".$db_host."' AND `User` = '".$link->escape_string($database_user)."'")) $success = false;
147+
if($success == true) $link->query("FLUSH PRIVILEGES");
148+
}
147149
}
148150
}
149151

0 commit comments

Comments
 (0)