Skip to content

Commit

Permalink
Added flag to disable server certificate validation via Mysql DSN arg…
Browse files Browse the repository at this point in the history
…ument (#6848)
  • Loading branch information
alecpl committed Jul 15, 2019
1 parent 6daefc3 commit a80c556
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -12,6 +12,7 @@ CHANGELOG Roundcube Webmail
- installto.sh: Add possibility to run the update even on the up-to-date installation (#6533)
- Plugin API: Add 'render_folder_selector' hook
- Added 'keyservers' option to define list of HKP servers for Enigma/Mailvelope (#6326)
- Added flag to disable server certificate validation via Mysql DSN argument (#6848)
- Changes in `display_next` setting (#6795):
- Move it to Preferences > User Interface > Main Options
- Make it apply to Contacts interface too
Expand Down
6 changes: 5 additions & 1 deletion config/defaults.inc.php
Expand Up @@ -27,8 +27,12 @@
// Format (compatible with PEAR MDB2): db_provider://user:password@host/database
// Currently supported db_providers: mysql, pgsql, sqlite, mssql, sqlsrv, oracle
// For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php
// NOTE: for SQLite use absolute path (Linux): 'sqlite:////full/path/to/sqlite.db?mode=0646'
// Note: for SQLite use absolute path (Linux): 'sqlite:////full/path/to/sqlite.db?mode=0646'
// or (Windows): 'sqlite:///C:/full/path/to/sqlite.db'
// Note: Various drivers support various additional arguments for connection,
// for Mysql: key, cipher, cert, capath, ca, verify_server_cert,
// for Postgres: application_name, sslmode, sslcert, sslkey, sslrootcert, sslcrl, sslcompression, service.
// e.g. 'mysql://roundcube:@localhost/roundcubemail?verify_server_cert=false'
$config['db_dsnw'] = 'mysql://roundcube:@localhost/roundcubemail';

// Database DSN for read-only operations (if empty write database will be used)
Expand Down
4 changes: 4 additions & 0 deletions program/lib/Roundcube/db/mysql.php
Expand Up @@ -141,6 +141,10 @@ protected function dsn_options($dsn)
$result[PDO::MYSQL_ATTR_SSL_CA] = $dsn['ca'];
}

if (isset($dsn['verify_server_cert'])) {
$result[PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = rcube_utils::get_boolean($dsn['verify_server_cert']);
}

// Always return matching (not affected only) rows count
$result[PDO::MYSQL_ATTR_FOUND_ROWS] = true;

Expand Down

0 comments on commit a80c556

Please sign in to comment.