aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_messenger.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2019-07-21 21:12:00 +0200
committerMarc Alexander <admin@m-a-styles.de>2019-07-21 21:12:00 +0200
commit17c6cd3676fae4947d263fc2b80dde3a4e96f011 (patch)
treef9aedb97fb9f5e18ae1bd27b4e572c38d86096d6 /phpBB/includes/functions_messenger.php
parent9e9bdb69b5e00a4993b7ff9a6021044c9ec0c4dc (diff)
parent5262e3bb5569e0837361d6974df118f538c5bfa8 (diff)
downloadforums-17c6cd3676fae4947d263fc2b80dde3a4e96f011.tar
forums-17c6cd3676fae4947d263fc2b80dde3a4e96f011.tar.gz
forums-17c6cd3676fae4947d263fc2b80dde3a4e96f011.tar.bz2
forums-17c6cd3676fae4947d263fc2b80dde3a4e96f011.tar.xz
forums-17c6cd3676fae4947d263fc2b80dde3a4e96f011.zip
Merge pull request #5562 from senky/ticket/15961
[ticket/15961] Use newer TLS in SMTP
Diffstat (limited to 'phpBB/includes/functions_messenger.php')
-rw-r--r--phpBB/includes/functions_messenger.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index f44bcc6fb7..7f8238e1bf 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -1581,6 +1581,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;
@@ -1603,7 +1611,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']);
}