aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_messenger.php
diff options
context:
space:
mode:
authorrxu <rxu@mail.ru>2017-03-17 01:21:57 +0700
committerrxu <rxu@mail.ru>2017-03-17 01:21:57 +0700
commitac87784a113035416e137ffb588d18a5da7650ac (patch)
treeee2b446c20f647e1f11dac510ea281e3a76ed0cb /phpBB/includes/functions_messenger.php
parent9267235f30b3275b4b00f49f99c6ae259ce26a3f (diff)
downloadforums-ac87784a113035416e137ffb588d18a5da7650ac.tar
forums-ac87784a113035416e137ffb588d18a5da7650ac.tar.gz
forums-ac87784a113035416e137ffb588d18a5da7650ac.tar.bz2
forums-ac87784a113035416e137ffb588d18a5da7650ac.tar.xz
forums-ac87784a113035416e137ffb588d18a5da7650ac.zip
[ticket/13558] Add smtp SSL context configuration options
PHPBB3-13558
Diffstat (limited to 'phpBB/includes/functions_messenger.php')
-rw-r--r--phpBB/includes/functions_messenger.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index f141637fb9..8f9163f85f 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -1467,6 +1467,17 @@ class smtp_class
if (socket_set_blocking($this->socket, 1))
{
+ global $config;
+
+ $options = array();
+ $verify_peer = (bool) $config['ssl_verify_peer'];
+ $verify_peer_name = (bool) $config['ssl_verify_peer_name'];
+ $allow_self_signed = (bool) $config['ssl_allow_self_signed'];
+
+ // Set ssl context options, see http://php.net/manual/en/context.ssl.php
+ $options['ssl'] = array('verify_peer' => $verify_peer, 'verify_peer_name' => $verify_peer_name, 'allow_self_signed' => $allow_self_signed);
+ stream_context_set_option($this->socket, $options);
+
$result = stream_socket_enable_crypto($this->socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
socket_set_blocking($this->socket, (int) $stream_meta['blocked']);
}