Commit 745a6bd6 authored by Florian Schaal's avatar Florian Schaal
Browse files

FS#3923 - ISPConfig can not create a database if the name consists only of numbers.

parent 09106652
...@@ -114,10 +114,10 @@ class mysql_clientdb_plugin { ...@@ -114,10 +114,10 @@ class mysql_clientdb_plugin {
if($valid == false) continue; if($valid == false) continue;
if($action == 'GRANT') { if($action == 'GRANT') {
if(!$link->query("GRANT " . ($user_read_only ? "SELECT" : "ALL") . " ON ".$link->escape_string($database_name).".* TO '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."';")) $success = false; if(!$link->query("GRANT " . ($user_read_only ? "SELECT" : "ALL") . " ON `".$link->escape_string($database_name)."`.* TO '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."';")) $success = false;
$app->log("GRANT " . ($user_read_only ? "SELECT" : "ALL") . " ON ".$link->escape_string($database_name).".* TO '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."'; success? " . ($success ? 'yes' : 'no'), LOGLEVEL_DEBUG); $app->log("GRANT " . ($user_read_only ? "SELECT" : "ALL") . " ON `".$link->escape_string($database_name)."`.* TO '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."'; success? " . ($success ? 'yes' : 'no'), LOGLEVEL_DEBUG);
} elseif($action == 'REVOKE') { } elseif($action == 'REVOKE') {
if(!$link->query("REVOKE ALL PRIVILEGES ON ".$link->escape_string($database_name).".* FROM '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."';")) $success = false; if(!$link->query("REVOKE ALL PRIVILEGES ON `".$link->escape_string($database_name)."`.* FROM '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."';")) $success = false;
} elseif($action == 'DROP') { } elseif($action == 'DROP') {
if(!$link->query("DROP USER '".$link->escape_string($database_user)."'@'$db_host';")) $success = false; if(!$link->query("DROP USER '".$link->escape_string($database_user)."'@'$db_host';")) $success = false;
} elseif($action == 'RENAME') { } elseif($action == 'RENAME') {
...@@ -497,7 +497,7 @@ class mysql_clientdb_plugin { ...@@ -497,7 +497,7 @@ class mysql_clientdb_plugin {
} }
if($link->query('DROP DATABASE '.$link->escape_string($data['old']['database_name']))) { if($link->query('DROP DATABASE `'.$link->escape_string($data['old']['database_name'].'`'))) {
$app->log('Dropping MySQL database: '.$data['old']['database_name'], LOGLEVEL_DEBUG); $app->log('Dropping MySQL database: '.$data['old']['database_name'], LOGLEVEL_DEBUG);
} else { } else {
$app->log('Error while dropping MySQL database: '.$data['old']['database_name'].' '.$link->error, LOGLEVEL_WARNING); $app->log('Error while dropping MySQL database: '.$data['old']['database_name'].' '.$link->error, LOGLEVEL_WARNING);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment