From fb15d6106a723b951c186a5af456adfaea5f5d57 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 18 Dec 2008 08:16:30 -0500
Subject: [PATCH] - Undone a change in modules.inc.php - Chnegd installer to allow access from the slave hostname and IP address to the master database.

---
 install/lib/installer_base.lib.php |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index d33b304..fb4cd70 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -227,19 +227,25 @@
 			
 			//* insert the ispconfig user in the remote server
 			$from_host = $conf['hostname'];
+			$from_ip = gethostbyname($conf['hostname']);
 			
 			//* username for the ispconfig user
 			$conf['mysql']['master_ispconfig_user'] = 'ispconfigserver'.$conf['server_id'];
 		
-			//* Delete ISPConfig user in the local database, in case that it exists
+			//* Delete ISPConfig user in the master database, in case that it exists
 			$this->dbmaster->query("DELETE FROM mysql.user WHERE User = '".$conf['mysql']['master_ispconfig_user']."' AND Host = '".$from_host."';");
 			$this->dbmaster->query("DELETE FROM mysql.db WHERE Db = '".$conf['mysql']['master_database']."' AND Host = '".$from_host."';");
+			$this->dbmaster->query("DELETE FROM mysql.user WHERE User = '".$conf['mysql']['master_ispconfig_user']."' AND Host = '".$from_ip."';");
+			$this->dbmaster->query("DELETE FROM mysql.db WHERE Db = '".$conf['mysql']['master_database']."' AND Host = '".$from_ip."';");
 			$this->dbmaster->query('FLUSH PRIVILEGES;');
 		
 			//* Create the ISPConfig database user in the local database
         	$query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON '.$conf['mysql']['master_database'].".* "
                 	."TO '".$conf['mysql']['master_ispconfig_user']."'@'".$from_host."' "
                 	."IDENTIFIED BY '".$conf['mysql']['master_ispconfig_password']."';";
+			$query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON '.$conf['mysql']['master_database'].".* "
+                	."TO '".$conf['mysql']['master_ispconfig_user']."'@'".$from_ip."' "
+                	."IDENTIFIED BY '".$conf['mysql']['master_ispconfig_password']."';";
 			if(!$this->dbmaster->query($query)) {
 				$this->error('Unable to create database user in master database: '.$conf['mysql']['master_ispconfig_user'].' Error: '.$this->dbmaster->errorMessage);
 			}

--
Gitblit v1.9.1