diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php index 3f4852a2..1f922216 100644 --- a/adminer/drivers/pgsql.inc.php +++ b/adminer/drivers/pgsql.inc.php @@ -20,6 +20,10 @@ if (isset($_GET["pgsql"])) { $db = $adminer->database(); set_error_handler(array($this, '_error')); $this->_string = "host='" . str_replace(":", "' port='", addcslashes($server, "'\\")) . "' user='" . addcslashes($username, "'\\") . "' password='" . addcslashes($password, "'\\") . "'"; + $ssl = $adminer->connectSsl(); + if (isset($ssl["mode"])) { + $this->_string .= " sslmode='" . $ssl["mode"] . "'"; + } $this->_link = @pg_connect("$this->_string dbname='" . ($db != "" ? addcslashes($db, "'\\") : "postgres") . "'", PGSQL_CONNECT_FORCE_NEW); if (!$this->_link && $db != "") { // try to connect directly with database for performance @@ -149,8 +153,13 @@ if (isset($_GET["pgsql"])) { function connect($server, $username, $password) { global $adminer; $db = $adminer->database(); - $this->dsn("pgsql:host='" . str_replace(":", "' port='", addcslashes($server, "'\\")) . "' client_encoding=utf8 dbname='" . ($db != "" ? addcslashes($db, "'\\") : "postgres") . "'", $username, $password); //! client_encoding is supported since 9.1 but we can't yet use min_version here - //! connect without DB in case of an error + //! client_encoding is supported since 9.1, but we can't yet use min_version here + $dsn = "pgsql:host='" . str_replace(":", "' port='", addcslashes($server, "'\\")) . "' client_encoding=utf8 dbname='" . ($db != "" ? addcslashes($db, "'\\") : "postgres") . "'"; + $ssl = $adminer->connectSsl(); + if (isset($ssl["mode"])) { + $dsn .= " sslmode='" . $ssl["mode"] . "'"; + } + $this->dsn($dsn, $username, $password); return true; } diff --git a/changes.txt b/changes.txt index 7e5f3af1..072f0525 100644 --- a/changes.txt +++ b/changes.txt @@ -1,6 +1,7 @@ Adminer 4.16.0-dev: MySQL: Fix saving bit(64) values (bug #839) PostgreSQL: Preserve whitespace in EXPLAIN (bug #827) +PostgreSQL: Support SSL SQLite: Fix altering forign keys (bug #841) MS SQL: Foreign keys in non-default schema (bug #833) Oracle: Include tables granted by other user diff --git a/plugins/login-ssl.php b/plugins/login-ssl.php index 0114965f..294b5dbf 100644 --- a/plugins/login-ssl.php +++ b/plugins/login-ssl.php @@ -1,6 +1,6 @@ filename, "cert" => filename, "ca" => filename) + + /** + * @param array MySQL: ["key" => filename, "cert" => filename, "ca" => filename], PostgresSQL: ["mode" => sslmode] */ function __construct($ssl) { $this->ssl = $ssl; } - + function connectSsl() { return $this->ssl; }