Default is allow SSL connections.
Requires config version bump.
Verified on 8.1 running linux and 8.1 Win32 w/ SSL required connections.
/**
* Class to hold various commonly used functions
*
- * $Id: Misc.php,v 1.126 2006/04/21 03:31:25 chriskl Exp $
+ * $Id: Misc.php,v 1.127 2006/05/22 17:31:22 xzilla Exp $
*/
class Misc {
$_connection = new Connection(
$server_info['host'],
$server_info['port'],
+ $server_info['sslmode'],
$server_info['username'],
$server_info['password'],
$database
$srvs = isset($_SESSION['webdbLogin']) && is_array($_SESSION['webdbLogin']) ? $_SESSION['webdbLogin'] : array();
foreach($conf['servers'] as $idx => $info) {
- $server_id = $info['host'].':'.$info['port'];
+ $server_id = $info['host'].':'.$info['port'].':'.$info['sslmode'];
if (!isset($srvs[$server_id])) {
$srvs[$server_id] = $info;
// Otherwise, look for it in the conf file
foreach($conf['servers'] as $idx => $info) {
- if ($server_id == $info['host'].':'.$info['port']) {
+ if ($server_id == $info['host'].':'.$info['port'].':'.$info['sslmode']) {
// Automatically use shared credentials if available
if (!isset($info['username']) && isset($_SESSION['sharedUsername'])) {
$info['username'] = $_SESSION['sharedUsername'];
/**
* Class to represent a database connection
*
- * $Id: Connection.php,v 1.12 2005/11/08 02:24:31 chriskl Exp $
+ * $Id: Connection.php,v 1.13 2006/05/22 17:31:23 xzilla Exp $
*/
include_once('./classes/database/ADODB_base.php');
* Creates a new connection. Will actually make a database connection.
* @param $fetchMode Defaults to associative. Override for different behaviour
*/
- function Connection($host, $port, $user, $password, $database, $fetchMode = ADODB_FETCH_ASSOC) {
+ function Connection($host, $port, $sslmode, $user, $password, $database, $fetchMode = ADODB_FETCH_ASSOC) {
$this->conn = &ADONewConnection('postgres7');
$this->conn->setFetchMode($fetchMode);
else
$pghost = "{$host}:{$port}";
+ // Add sslmode to $pghost if set
+ if ($sslmode !== null && $sslmode != '')
+ $pghost .= ':'.$sslmode;
+
$this->conn->connect($pghost, $user, $password, $database);
}
* Central phpPgAdmin configuration. As a user you may modify the
* settings here for your particular configuration.
*
- * $Id: config.inc.php-dist,v 1.47 2005/11/18 04:45:52 chriskl Exp $
+ * $Id: config.inc.php-dist,v 1.48 2006/05/22 17:31:23 xzilla Exp $
*/
// An example server. Create as many of these as you wish,
// Database port on server (5432 is the PostgreSQL default)
$conf['servers'][0]['port'] = 5432;
+ // Database SSL mode
+ // Possible options: disable, allow, prefer, require
+ $conf['servers'][0]['sslmode'] = 'allow';
+
// Change the default database only if you cannot connect to template1.
// For a PostgreSQL 8.1 server, you need to set this to 'postgres'.
$conf['servers'][0]['defaultdb'] = 'template1';
//$conf['servers'][1]['desc'] = 'Test Server';
//$conf['servers'][1]['host'] = '127.0.0.1';
//$conf['servers'][1]['port'] = 5432;
+ //$conf['servers'][1]['sslmode'] = 'allow';
//$conf['servers'][1]['defaultdb'] = 'template1';
//$conf['servers'][1]['pg_dump_path'] = 'C:\\Program Files\\PostgreSQL\\8.0\\bin\\pg_dump.exe';
//$conf['servers'][1]['pg_dumpall_path'] = 'C:\\Program Files\\PostgreSQL\\8.0\\bin\\pg_dumpall.exe';
* Don't modify anything below this line *
*****************************************/
- $conf['version'] = 15;
+ $conf['version'] = 16;
?>
else $str = '';\r
if (isset($host[1])) $str .= " port=$host[1]";\r
else if (!empty($this->port)) $str .= " port=".$this->port;\r
+ if (isset($host[2])) $str .= " sslmode=".adodb_addslashes($host[2]);\r
+ else if (!empty($this->sslmode)) $str .= " sslmode=".$this->sslmode;\r
}\r
if ($user) $str .= " user=".$user;\r
if ($pwd) $str .= " password=".$pwd;\r
/**
* Function library read in upon startup
*
- * $Id: lib.inc.php,v 1.109 2005/12/07 01:31:28 chriskl Exp $
+ * $Id: lib.inc.php,v 1.110 2006/05/22 17:31:23 xzilla Exp $
*/
include_once('./libraries/decorator.inc.php');
include_once('./lang/translations.php');
// Configuration file version. If this is greater than that in config.inc.php, then
// the app will refuse to run. This and $conf['version'] should be incremented whenever
// backwards incompatible changes are made to config.inc.php-dist.
- $conf['base_version'] = 15;
+ $conf['base_version'] = 16;
// Always include english.php, since it's the master language file
if (!isset($conf['default_lang'])) $conf['default_lang'] = 'english';