]> git.joonet.de Git - adminer.git/commitdiff
MySQL: Fix connecting with self-signed cert
authorJakub Vrana <jakub@vrana.cz>
Mon, 3 Mar 2025 15:06:10 +0000 (16:06 +0100)
committerJakub Vrana <jakub@vrana.cz>
Mon, 3 Mar 2025 15:06:10 +0000 (16:06 +0100)
adminer/drivers/mysql.inc.php
plugins/login-ssl.php

index ab0fd55cb1b8be71f7ded4417e1603d4626d3ade..21b304f5fa542a2f20fa2f0b9067036d4b1c6ed6 100644 (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'];
                                        }
                                }
index 0909cbe3cda4c24611dd8c53bd864d1e4a096cc5..38324d64b39911ce40926ee3dab86c98335ecbf5 100644 (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