summaryrefslogtreecommitdiffstats
path: root/lib/install.php
diff options
context:
space:
mode:
authordipsol <dipsol@ampache>2009-01-28 12:23:37 +0000
committerdipsol <dipsol@ampache>2009-01-28 12:23:37 +0000
commit8dc49610d636be1ec077de2bbdab23d8848763f2 (patch)
treed5233bf8fa08f4c9e39c3340bb04b1c0e49a006f /lib/install.php
parentdd4330e2af3ee716ba485329012eb9ec74eee24a (diff)
downloadampache-8dc49610d636be1ec077de2bbdab23d8848763f2.tar.gz
ampache-8dc49610d636be1ec077de2bbdab23d8848763f2.tar.bz2
ampache-8dc49610d636be1ec077de2bbdab23d8848763f2.zip
Ticket #387, added some checks during install for empty db passwords. Also added this to check when something goes wrong.
Diffstat (limited to 'lib/install.php')
-rw-r--r--lib/install.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/install.php b/lib/install.php
index 5602b348..5f45ffc7 100644
--- a/lib/install.php
+++ b/lib/install.php
@@ -117,7 +117,13 @@ function install_insert_db($username,$password,$hostname,$database) {
if (count($matches)) {
Error::add('general','Error: Database name invalid must not be a reserved word, and must be Alphanumeric');
return false;
- }
+ }
+
+ // Check if the password has been set
+ if (!$password) {
+ Error::add('general','Error: MySQL administrative password is empty. That is not allowed!');
+ return false;
+ }
$data['database_username'] = $username;
$data['database_password'] = $password;
@@ -132,7 +138,7 @@ function install_insert_db($username,$password,$hostname,$database) {
$dbh = Dba::dbh();
if (!is_resource($dbh)) {
- Error::add('general',_('Error: Unable to make Database Connection') . mysql_error());
+ Error::add('general',_('Error: Unable to make Database Connection') . "&nbsp;" . mysql_error());
return false;
}
@@ -172,6 +178,12 @@ function install_insert_db($username,$password,$hostname,$database) {
$sql = "GRANT ALL PRIVILEGES ON " . Dba::escape($database) . ".* TO " .
"'" . Dba::escape($db_user) . "'@'" . Dba::escape($hostname) . "' IDENTIFIED BY '" . Dba::escape($db_pass) . "' WITH GRANT OPTION";
+ // Check if the password has been set
+ if (!$password) {
+ Error::add('general','Error: Ampache database user password is empty. That is not allowed!');
+ return false;
+ }
+
if (!$db_results = @mysql_query($sql, $dbh)) {
Error::add('general',"Error: Unable to Insert $db_user with permissions to $database on $hostname " . mysql_error());
return false;