Skip to content

Commit

Permalink
Merge pull request #431 from nextcloud/postgres-password-not-quoted
Browse files Browse the repository at this point in the history
Prevent syntax error when creating user or changing password
  • Loading branch information
rullzer authored Jul 18, 2016
2 parents 89a32a2 + 9781312 commit 3e00edf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/private/Setup/PostgreSQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ private function databaseExists(IDBConnection $connection) {

private function createDBUser(IDBConnection $connection) {
try {
if ($this->userExists($connection, $this->dbUser)) {
if ($this->userExists($connection)) {
// change the password
$query = $connection->prepare("ALTER ROLE " . addslashes($this->dbUser) . " CREATEDB WITH PASSWORD " . addslashes($this->dbPassword));
$query = $connection->prepare("ALTER ROLE " . addslashes($this->dbUser) . " CREATEDB WITH PASSWORD '" . addslashes($this->dbPassword) . "'");
} else {
// create the user
$query = $connection->prepare("CREATE USER " . addslashes($this->dbUser) . " CREATEDB PASSWORD " . addslashes($this->dbPassword));
$query = $connection->prepare("CREATE USER " . addslashes($this->dbUser) . " CREATEDB PASSWORD '" . addslashes($this->dbPassword) . "'");
}
$query->execute();
} catch (DatabaseException $e) {
Expand Down

0 comments on commit 3e00edf

Please sign in to comment.