1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 07:36:44 +02:00

MySQL: Fix connecting with self-signed cert

This commit is contained in:
Jakub Vrana
2025-03-03 16:06:10 +01:00
parent 116827060f
commit 996b178406
2 changed files with 6 additions and 6 deletions

View File

@@ -27,7 +27,7 @@ if (!defined("DRIVER")) {
$database,
(is_numeric($port) ? $port : ini_get("mysqli.default_port")),
(!is_numeric($port) ? $port : $socket),
($ssl ? (empty($ssl['cert']) ? 2048 : 64) : 0) // 2048 - MYSQLI_CLIENT_SSL, 64 - MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT (not available before PHP 5.6.16)
($ssl ? ($ssl['verify'] !== false ? 2048 : 64) : 0) // 2048 - MYSQLI_CLIENT_SSL, 64 - MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT (not available before PHP 5.6.16)
);
$this->options(MYSQLI_OPT_LOCAL_INFILE, false);
return $return;
@@ -237,16 +237,16 @@ if (!defined("DRIVER")) {
$options = array(PDO::MYSQL_ATTR_LOCAL_INFILE => false);
$ssl = $adminer->connectSsl();
if ($ssl) {
if (!empty($ssl['key'])) {
if ($ssl['key']) {
$options[PDO::MYSQL_ATTR_SSL_KEY] = $ssl['key'];
}
if (!empty($ssl['cert'])) {
if ($ssl['cert']) {
$options[PDO::MYSQL_ATTR_SSL_CERT] = $ssl['cert'];
}
if (!empty($ssl['ca'])) {
if ($ssl['ca']) {
$options[PDO::MYSQL_ATTR_SSL_CA] = $ssl['ca'];
}
if (!empty($ssl['verify'])) {
if (isset($ssl['verify'])) {
$options[PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = $ssl['verify'];
}
}

View File

@@ -1,6 +1,6 @@
<?php
/** Connect to MySQL or PostgreSQL using SSL
/** Connect to MySQL, PostgreSQL or MS SQL using SSL
* @link https://www.adminer.org/plugins/#use
* @author Jakub Vrana, https://www.vrana.cz/
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0