aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
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
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')
-rw-r--r--phpBB/includes/acp/acp_board.php3
-rw-r--r--phpBB/includes/functions_messenger.php11
2 files changed, 14 insertions, 0 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index c8f6f426c6..b31799ef07 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -454,6 +454,9 @@ class acp_board
'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true),
'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true),
'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true),
+ 'ssl_verify_peer' => array('lang' => 'SSL_VERIFY_PEER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'ssl_verify_peer_name' => array('lang' => 'SSL_VERIFY_PEER_NAME', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'ssl_allow_self_signed' => array('lang' => 'SSL_ALLOW_SELF_SIGNED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'legend3' => 'ACP_SUBMIT_CHANGES',
)
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']);
}