diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-07-07 11:29:46 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2016-07-07 11:29:46 +0200 |
commit | ba16fd0d337fa26114f55086198979d147a298c1 (patch) | |
tree | 39111cec77d17d5eeb60bd1b609e7a8419310459 /lib/private/Setup/PostgreSQL.php | |
parent | 5ace43f43895cba4b398367e10731f92450d7da2 (diff) | |
parent | ed28885d73181e61c06802639910014e8a265e42 (diff) | |
download | nextcloud-server-ba16fd0d337fa26114f55086198979d147a298c1.tar.gz nextcloud-server-ba16fd0d337fa26114f55086198979d147a298c1.zip |
Merge branch 'master' into sync-master
Diffstat (limited to 'lib/private/Setup/PostgreSQL.php')
-rw-r--r-- | lib/private/Setup/PostgreSQL.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/private/Setup/PostgreSQL.php b/lib/private/Setup/PostgreSQL.php index 702227ef3ff..464d1e02e21 100644 --- a/lib/private/Setup/PostgreSQL.php +++ b/lib/private/Setup/PostgreSQL.php @@ -34,8 +34,11 @@ class PostgreSQL extends AbstractDatabase { $e_user = addslashes($this->dbUser); $e_password = addslashes($this->dbPassword); - // Fix database with port connection - if(strpos($e_host, ':')) { + // adding port support through installer + if(!empty($this->dbPort)) { + // casting to int to avoid malicious input + $port = (int)$this->dbPort; + } else if(strpos($e_host, ':')) { list($e_host, $port)=explode(':', $e_host, 2); } else { $port=false; @@ -51,8 +54,8 @@ class PostgreSQL extends AbstractDatabase { $connection = @pg_connect($connection_string); if(!$connection) - throw new \OC\DatabaseSetupException($this->trans->t('PostgreSQL username and/or password not valid'), - $this->trans->t('You need to enter either an existing account or the administrator.')); + throw new \OC\DatabaseSetupException($this->trans->t('PostgreSQL connection failed'), + $this->trans->t('Please check your connection details.')); } $e_user = pg_escape_string($this->dbUser); //check for roles creation rights in postgresql |