Skip to content

Commit

Permalink
Support additional connect parameters in PostgreSQL database wrapper (#…
Browse files Browse the repository at this point in the history
…6071)

Most notably this change enables you to specify whether or with what
priority a secure SSL TCP/IP connection will be negotiated with the
database server.
  • Loading branch information
georgeto authored and alecpl committed Dec 6, 2017
1 parent 78aa0ef commit 161038e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================

- Support additional connect parameters in PostgreSQL database wrapper
- Use UI dialogs instead of confirm() and alert() where possible
- Display value of the SMTP message size limit in the error message (#6032)
- Skip redundant INSERT query on successful logon when using PHP7
Expand Down
9 changes: 9 additions & 0 deletions program/lib/Roundcube/rcube_db_pgsql.php
Expand Up @@ -28,6 +28,9 @@ class rcube_db_pgsql extends rcube_db
{
public $db_provider = 'postgres';

// See https://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS
private static $libpq_connect_params = array("application_name", "sslmode", "sslcert", "sslkey", "sslrootcert", "sslcrl", "sslcompression", "service");

/**
* Object constructor
*
Expand Down Expand Up @@ -256,6 +259,12 @@ protected function dsn_string($dsn)
$params[] = 'dbname=' . $dsn['database'];
}

foreach (self::$libpq_connect_params as $param) {
if ($dsn[$param]) {
$params[] = $param . '=' . $dsn[$param];
}
}

if (!empty($params)) {
$result .= implode(';', $params);
}
Expand Down

0 comments on commit 161038e

Please sign in to comment.