diff options
author | Jakub Senko <jakubsenko@gmail.com> | 2019-04-08 14:36:26 +0200 |
---|---|---|
committer | Jakub Senko <jakubsenko@gmail.com> | 2019-04-08 14:37:42 +0200 |
commit | fe22deb5d5e301ffad51be06000effcbbcd1d11c (patch) | |
tree | cfd074b46f762bf8689f72c014eded5bb08ebce0 /phpBB/includes | |
parent | cc7c1c8447496f1d34721442505481d7883668c2 (diff) | |
download | forums-fe22deb5d5e301ffad51be06000effcbbcd1d11c.tar forums-fe22deb5d5e301ffad51be06000effcbbcd1d11c.tar.gz forums-fe22deb5d5e301ffad51be06000effcbbcd1d11c.tar.bz2 forums-fe22deb5d5e301ffad51be06000effcbbcd1d11c.tar.xz forums-fe22deb5d5e301ffad51be06000effcbbcd1d11c.zip |
[ticket/15961] Use newer TLS in SMTP
PHPBB3-15961
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions_messenger.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 4f0d40031d..f89637e286 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -1582,6 +1582,14 @@ class smtp_class */ protected function starttls() { + global $config; + + // allow SMTPS (what was used by phpBB 3.0) if hostname is prefixed with tls:// or ssl:// + if (strpos($config['smtp_host'], 'tls://') === 0 || strpos($config['smtp_host'], 'ssl://') === 0) + { + return true; + } + if (!function_exists('stream_socket_enable_crypto')) { return false; @@ -1604,7 +1612,9 @@ class smtp_class if (socket_set_blocking($this->socket, 1)) { - $result = stream_socket_enable_crypto($this->socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); + // https://secure.php.net/manual/en/function.stream-socket-enable-crypto.php#119122 + $crypto = (phpbb_version_compare(PHP_VERSION, '5.6.7', '<')) ? STREAM_CRYPTO_METHOD_TLS_CLIENT : STREAM_CRYPTO_METHOD_SSLv23_CLIENT; + $result = stream_socket_enable_crypto($this->socket, true, $crypto); socket_set_blocking($this->socket, (int) $stream_meta['blocked']); } |