N°1260 MySQL TLS connection : apply Hardis patch (many thanks !)

SVN:trunk[5306]
This commit is contained in:
Pierre Goiffon
2018-02-08 14:20:58 +00:00
parent 0254a75c95
commit 08d9d58894
6 changed files with 140 additions and 14 deletions

View File

@@ -1026,13 +1026,13 @@ EOF
*
* @return mixed false if the connection failed or array('checks' => Array of CheckResult, 'databases' => Array of database names (as strings) or null if not allowed)
*/
static function CheckDbServer($sDBServer, $sDBUser, $sDBPwd)
static function CheckDbServer($sDBServer, $sDBUser, $sDBPwd, $sSSLKey = NULL, $sSSLCert = NULL, $sSSLCA = NULL, $sSSLCipher = NULL)
{
$aResult = array('checks' => array(), 'databases' => null);
try
{
$oDBSource = new CMDBSource;
$oDBSource->Init($sDBServer, $sDBUser, $sDBPwd);
$oDBSource->Init($sDBServer, $sDBUser, $sDBPwd, '', $sSSLKey, $sSSLCert, $sSSLCA, $sSSLCipher);
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "Connection to '$sDBServer' as '$sDBUser' successful.");
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "Info - User privileges: ".($oDBSource->GetRawPrivileges()));
@@ -1112,10 +1112,10 @@ EOF
return false;
}
static public function GetMySQLVersion($sDBServer, $sDBUser, $sDBPwd)
static public function GetMySQLVersion($sDBServer, $sDBUser, $sDBPwd, $sSSLKey = NULL, $sSSLCert = NULL, $sSSLCA = NULL, $sSSLCipher = NULL )
{
$oDBSource = new CMDBSource;
$oDBSource->Init($sDBServer, $sDBUser, $sDBPwd);
$oDBSource->Init($sDBServer, $sDBUser, $sDBPwd, '', $sSSLKey, $sSSLCert, $sSSLCA, $sSSLCipher);
$sDBVersion = $oDBSource->GetDBVersion();
return $sDBVersion;
}
@@ -1126,10 +1126,15 @@ EOF
$sDBUser = $aParameters['db_user'];
$sDBPwd = $aParameters['db_pwd'];
$sDBName = $aParameters['db_name'];
$sSSLKey = $aParameters['db_ssl_key'];
$sSSLCert = $aParameters['db_ssl_cert'];
$sSSLCA = $aParameters['db_ssl_ca'];
$sSSLCipher = $aParameters['db_ssl_cipher'];
$oPage->add_ready_script('oXHRCheckDB = null;');
$checks = SetupUtils::CheckDbServer($sDBServer, $sDBUser, $sDBPwd);
$checks = SetupUtils::CheckDbServer($sDBServer, $sDBUser, $sDBPwd, $sSSLKey, $sSSLCert, $sSSLCA, $sSSLCipher);
if ($checks === false)
{
// Connection failed, disable the "Next" button