From fc0edb2f00bcdc6baaaa29f9041e82f3003b9b44 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Sun, 07 Jun 2015 12:16:19 -0400
Subject: [PATCH] Merge branch 'master' into 'master'
---
server/plugins-available/mysql_clientdb_plugin.inc.php | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/server/plugins-available/mysql_clientdb_plugin.inc.php b/server/plugins-available/mysql_clientdb_plugin.inc.php
index cba977c..146e17a 100644
--- a/server/plugins-available/mysql_clientdb_plugin.inc.php
+++ b/server/plugins-available/mysql_clientdb_plugin.inc.php
@@ -83,7 +83,14 @@
if(!is_array($host_list)) $host_list = explode(',', $host_list);
$success = true;
-
+ if(!preg_match('/\*[A-F0-9]{40}$/', $database_password)) {
+ $result = $link->query("SELECT PASSWORD('" . $link->escape_string($database_password) . "') as `crypted`");
+ if($result) {
+ $row = $result->fetch_assoc();
+ $database_password = $row['crypted'];
+ $result->free();
+ }
+ }
// loop through hostlist
foreach($host_list as $db_host) {
$db_host = trim($db_host);
@@ -188,7 +195,7 @@
}
//* Create the new database
- if ($link->query('CREATE DATABASE '.$link->escape_string($data['new']['database_name']).$query_charset_table)) {
+ if ($link->query('CREATE DATABASE `'.$link->escape_string($data['new']['database_name']).'`'.$query_charset_table)) {
$app->log('Created MySQL database: '.$data['new']['database_name'], LOGLEVEL_DEBUG);
} else {
$app->log('Unable to create the database: '.$link->error, LOGLEVEL_WARNING);
@@ -270,7 +277,7 @@
$old_host_list .= 'localhost';
// Create the database user if database was disabled before
- if($data['new']['active'] == 'y' && $data['old']['active'] == 'n') {
+ if($data['new']['active'] == 'y') {
if($db_user) {
if($db_user['database_user'] == 'root') $app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
else $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $host_list, $link);
--
Gitblit v1.9.1