diff options
| author | look-was-here <look.was.here@outlook.com> | 2024-09-09 20:07:34 -0500 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2025-01-25 01:50:42 +0100 |
| commit | be251d3ff570110b13f6b9577a372c5898980e19 (patch) | |
| tree | dbb6e75782944089017fda9e861d1a30ebcd6bd2 | |
| parent | 5aecf85d10328fcad81cd45cd4b4551bd5429067 (diff) | |
| download | adodb-be251d3ff570110b13f6b9577a372c5898980e19.tar.gz adodb-be251d3ff570110b13f6b9577a372c5898980e19.tar.bz2 adodb-be251d3ff570110b13f6b9577a372c5898980e19.zip | |
mysql: SSL not working due to wrong socket/flags
- Remove inappropriate setting of socket.
- Updated to use appropriate bitwise operations to check for set SSL
client flags and update the default to not overwrite set user flags.
- Add friendly error to let user know they need to add a SSL client flag
when using certificates.
Fixes #919, #1043
Signed-off-by: Damien Regad <dregad@mantisbt.org>
| -rw-r--r-- | drivers/adodb-mysqli.inc.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/adodb-mysqli.inc.php b/drivers/adodb-mysqli.inc.php index 73632c28..7efd1878 100644 --- a/drivers/adodb-mysqli.inc.php +++ b/drivers/adodb-mysqli.inc.php @@ -233,9 +233,14 @@ class ADODB_mysqli extends ADOConnection { // SSL Connections for MySQLI if ($this->ssl_key || $this->ssl_cert || $this->ssl_ca || $this->ssl_capath || $this->ssl_cipher) { + mysqli_ssl_set($this->_connectionID, $this->ssl_key, $this->ssl_cert, $this->ssl_ca, $this->ssl_capath, $this->ssl_cipher); - $this->socket = MYSQLI_CLIENT_SSL; - $this->clientFlags = MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT; + + // Check for any SSL client flag set, NOTE: bitwise operation. + if (!($this->clientFlags & MYSQLI_CLIENT_SSL)) { + ADOConnection::outp('When using certificates, set the client flag MYSQLI_CLIENT_SSL_VERIFY_SERVER_CERT or MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT'); + return false; + } } #if (!empty($this->port)) $argHostname .= ":".$this->port; |
