Skip to content

Commit a4becf1

Browse files
author
Till Brehm
committed
Merge branch 'stable-3.0.5' of git.ispconfig.org:ispconfig/ispconfig3 into stable-3.0.5
2 parents a6a997e + 51569ed commit a4becf1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

server/plugins-available/mysql_clientdb_plugin.inc.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,14 @@ function process_host_list($action, $database_name, $database_user, $database_pa
8383
if(!is_array($host_list)) $host_list = explode(',', $host_list);
8484

8585
$success = true;
86-
86+
if(!preg_match('/\*[A-F0-9]{40}$/', $database_password)) {
87+
$result = $link->query("SELECT PASSWORD('" . $link->escape_string($database_password) . "') as `crypted`");
88+
if($result) {
89+
$row = $result->fetch_assoc();
90+
$database_password = $row['crypted'];
91+
$result->free();
92+
}
93+
}
8794
// loop through hostlist
8895
foreach($host_list as $db_host) {
8996
$db_host = trim($db_host);
@@ -270,7 +277,7 @@ function db_update($event_name, $data) {
270277
$old_host_list .= 'localhost';
271278

272279
// Create the database user if database was disabled before
273-
if($data['new']['active'] == 'y' && $data['old']['active'] == 'n') {
280+
if($data['new']['active'] == 'y') {
274281
if($db_user) {
275282
if($db_user['database_user'] == 'root') $app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
276283
else $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $host_list, $link);

0 commit comments

Comments
 (0)