Просмотр исходного кода

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 лет назад
Родитель
Сommit
3e00edff99
1 измененных файлов: 3 добавлений и 3 удалений
  1. 3
    3
      lib/private/Setup/PostgreSQL.php

+ 3
- 3
lib/private/Setup/PostgreSQL.php Просмотреть файл



private function createDBUser(IDBConnection $connection) { private function createDBUser(IDBConnection $connection) {
try { try {
if ($this->userExists($connection, $this->dbUser)) {
if ($this->userExists($connection)) {
// change the password // 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 { } else {
// create the user // 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(); $query->execute();
} catch (DatabaseException $e) { } catch (DatabaseException $e) {

Загрузка…
Отмена
Сохранить