From ec95643301517f8c66ade2421375cf53ed67acb7 Mon Sep 17 00:00:00 2001
From: "Alexander M. Turek"
Date: Fri, 31 Jan 2003 14:06:37 +0000
Subject: [PATCH] support for encrypted and compressed connections
---
ChangeLog | 5 ++++
Documentation.html | 33 +++++++++++++++++++++---
config.inc.php3 | 7 ++++++
libraries/common.lib.php3 | 43 ++++++++++++++++++++++++++------
libraries/config_import.lib.php3 | 8 ++++++
5 files changed, 84 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a5aac53a5..c48c3abf6 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,11 @@ phpMyAdmin - Changelog
$Id$
$Source$
+2003-01-31 Alexander M. Turek
+ * config.inc.php3, Documentation.html, libraries/common.lib.php3,
+ libraries/config_import.lib.php3: Added experimental support for encrypted
+ and compressed connections to the MySQL server.
+
2003-01-30 Marc Delisle
* db_details_structure.php3, libraries/fpdf/fpdf.php3: better browser
support, thanks to Jose Fandos (jose.fandos at sonnd.com)
diff --git a/Documentation.html b/Documentation.html
index 8ef4a77d5..eba655047 100755
--- a/Documentation.html
+++ b/Documentation.html
@@ -513,6 +513,22 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
+ $cfg['Servers'][$i]['ssl'] boolean
+
+ Wheather to use an SSL connection to the MySQL server or not
+ (experimental).
+ This feature requires PHP >= 4.3.0 and
+ MySQL >= 4.0.0 compiled --with-openssl.
+ Please also read this FAQ entry.
+
+
+ $cfg['Servers'][$i]['compress'] boolean
+
+ Wheather to use a compressed protocol for the MySQL server connection
+ or not (experimental).
+ This feature requires PHP >= 4.3.0.
+
+
$cfg['Servers'][$i]['controluser'] string
$cfg['Servers'][$i]['controlpass'] string
@@ -1840,9 +1856,9 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
- [1.26] I just installed phpMyAdmin in my document root of IIS but
- I get the error "No input file specified" when trying to
- run phpMyAdmin.
+ [1.26] I just installed phpMyAdmin in my document root of IIS but I get
+ the error "No input file specified" when trying to run
+ phpMyAdmin.
This is a permission problem. Right-click on the phpmyadmin folder
and choose properties. Under the tab Security, click on "Add"
@@ -1852,7 +1868,7 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
[1.27] I get empty page when I want to view huge page (eg.
- db_details_structure.php3 with plenty of dabases).
+ db_details_structure.php3 with plenty of dabases).
This is a PHP bug that occur when
GZIP output buffering enabled. If you turn it off (by $cfg['OBGzip']
@@ -1860,6 +1876,15 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
in PHP 5.0.0.
+
+
+ [1.28] On my Windows machine, I have enabled SSL my MySQL server
+ connection, but PHP tells me something about an undefined constant
+ MYSQL_CLIENT_SSL.
+
+ This seems to be a PHP bug.
+
+
[2. Configuration]
diff --git a/config.inc.php3 b/config.inc.php3
index 86181b943..06f1ebb33 100755
--- a/config.inc.php3
+++ b/config.inc.php3
@@ -64,6 +64,9 @@ $cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname
$cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port
$cfg['Servers'][$i]['socket'] = ''; // Path to the socket - leave blank for default socket
$cfg['Servers'][$i]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket')
+$cfg['Servers'][$i]['ssl'] = FALSE; // Use SSL for the MySQL connection (MySQL >= 4.0.0)
+$cfg['Servers'][$i]['compress'] = FALSE; // Use compressed protocol for the MySQL connection
+ // (Both are experimental and require PHP >= 4.3.0)
$cfg['Servers'][$i]['controluser'] = ''; // MySQL control user settings
// (this user must have read-only
$cfg['Servers'][$i]['controlpass'] = ''; // access to the "mysql/user"
@@ -103,6 +106,8 @@ $cfg['Servers'][$i]['host'] = '';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
+$cfg['Servers'][$i]['ssl'] = FALSE;
+$cfg['Servers'][$i]['compress'] = FALSE;
$cfg['Servers'][$i]['controluser'] = '';
$cfg['Servers'][$i]['controlpass'] = '';
$cfg['Servers'][$i]['auth_type'] = 'config';
@@ -127,6 +132,8 @@ $cfg['Servers'][$i]['host'] = '';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
+$cfg['Servers'][$i]['ssl'] = FALSE;
+$cfg['Servers'][$i]['compress'] = FALSE;
$cfg['Servers'][$i]['controluser'] = '';
$cfg['Servers'][$i]['controlpass'] = '';
$cfg['Servers'][$i]['auth_type'] = 'config';
diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3
index c595d5555..673208ae2 100644
--- a/libraries/common.lib.php3
+++ b/libraries/common.lib.php3
@@ -130,7 +130,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
* Includes compatibility code for older config.inc.php3 revisions
* if necessary
*/
- if (!isset($cfg['FileRevision']) || (int) substr($cfg['FileRevision'], 13, 3) < 144) {
+ if (!isset($cfg['FileRevision']) || (int) substr($cfg['FileRevision'], 13, 3) < 153) {
include('./libraries/config_import.lib.php3');
}
@@ -328,7 +328,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
$is_modify_link = TRUE, $back_url = '')
{
global $cfg;
-
+
if (empty($GLOBALS['is_header_sent'])) {
include('./header.inc.php3');
}
@@ -340,7 +340,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
$the_query = $GLOBALS['sql_query'];
}
- // --- Added to solve bug #641765
+ // --- Added to solve bug #641765
// Robbat2 - 12 January 2003, 9:46PM
// Revised, Robbat2 - 13 Janurary 2003, 2:59PM
if (PMA_SQP_isError()) {
@@ -355,7 +355,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
// respond, do not show the query that would reveal the
// username/password
if (!empty($the_query) && !strstr($the_query, 'connect')) {
- // --- Added to solve bug #641765
+ // --- Added to solve bug #641765
// Robbat2 - 12 January 2003, 9:46PM
// Revised, Robbat2 - 13 Janurary 2003, 2:59PM
if (PMA_SQP_isError()) {
@@ -385,7 +385,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
. $error_message . "\n"
. '' . "\n";
-
+
if (!empty($back_url)) {
echo '' . $GLOBALS['strBack'] . '';
}
@@ -607,6 +607,10 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
$server_socket = (empty($cfg['Server']['socket']) || PMA_PHP_INT_VERSION < 30010)
? ''
: ':' . $cfg['Server']['socket'];
+ if (PMA_PHP_INT_VERSION >= 40300) {
+ $client_flags = ($cfg['Server']['ssl'] ? MYSQL_CLIENT_SSL : 0)
+ & ($cfg['Server']['compress'] ? MYSQL_CLIENT_COMPRESS : 0);
+ }
// Gets the authentication library that fits the $cfg['Server'] settings
// and run authentication
@@ -676,11 +680,21 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
// must be open after this one so it would be default one for all the
// scripts)
if ($cfg['Server']['controluser'] != '') {
- $dbh = @$connect_func(
+ if (PMA_PHP_INT_VERSION >= 40300) {
+ $dbh = @$connect_func(
+ $cfg['Server']['host'] . $server_port . $server_socket,
+ $cfg['Server']['controluser'],
+ $cfg['Server']['controlpass'],
+ FALSE,
+ $client_flags
+ );
+ } else {
+ $dbh = @$connect_func(
$cfg['Server']['host'] . $server_port . $server_socket,
$cfg['Server']['controluser'],
$cfg['Server']['controlpass']
);
+ }
if ($dbh == FALSE) {
if (PMA_mysql_error()) {
$conn_error = PMA_mysql_error();
@@ -692,7 +706,9 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
$local_query = $connect_func . '('
. $cfg['Server']['host'] . $server_port . $server_socket . ', '
. $cfg['Server']['controluser'] . ', '
- . $cfg['Server']['controlpass'] . ')';
+ . $cfg['Server']['controlpass']
+ . (PMA_PHP_INT_VERSION >= 40300 ? ', FALSE, ' . $client_flags : '')
+ . ')';
if (empty($GLOBALS['is_header_sent'])) {
include('./header.inc.php3');
}
@@ -705,11 +721,22 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
// Robbat2 - May 11, 2002
// Connects to the server (validates user's login)
- $userlink = @$connect_func(
+ if (PMA_PHP_INT_VERSION >= 40300) {
+ $userlink = @$connect_func(
+ $cfg['Server']['host'] . $server_port . $server_socket,
+ $cfg['Server']['user'],
+ $cfg['Server']['password'],
+ FALSE,
+ $client_flags
+ );
+ } else {
+ $userlink = @$connect_func(
$cfg['Server']['host'] . $server_port . $server_socket,
$cfg['Server']['user'],
$cfg['Server']['password']
);
+
+ }
if ($userlink == FALSE) {
PMA_auth_fails();
} // end if
diff --git a/libraries/config_import.lib.php3 b/libraries/config_import.lib.php3
index f4a43d34d..d9a185172 100644
--- a/libraries/config_import.lib.php3
+++ b/libraries/config_import.lib.php3
@@ -62,6 +62,14 @@ if (!defined('PMA_CONFIG_IMPORT_LIB_INCLUDED')) {
unset($cfg['Servers'][$i]['adv_auth']);
}
+ if (!isset($cfg['Servers'][$i]['ssl'])) {
+ $cfg['Servers'][$i]['ssl'] = FALSE;
+ }
+
+ if (!isset($cfg['Servers'][$i]['compress'])) {
+ $cfg['Servers'][$i]['compress'] = FALSE;
+ }
+
if (!isset($cfg['Servers'][$i]['user'])) {
$cfg['Servers'][$i]['user'] = 'root';
}