Browse Source

Merge pull request #431 from nextcloud/postgres-password-not-quoted

Prevent syntax error when creating user or changing password
tags/v10.0RC1
Roeland Douma 7 years ago
parent
commit
3e00edff99
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      lib/private/Setup/PostgreSQL.php

+ 3
- 3
lib/private/Setup/PostgreSQL.php View File

@@ -140,12 +140,12 @@ class PostgreSQL extends AbstractDatabase {

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) {

Loading…
Cancel
Save