Skip to content

Commit

Permalink
webui: webui login problem with tls enabled
Browse files Browse the repository at this point in the history
STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT was introduced with PHP version
5.6.0. We need to care that calling stream_socket_enable_crypto method works
with versions < 5.6.0 as well.

Fixes #1045: webui login problem
  • Loading branch information
fbergkemper authored and franku committed Feb 11, 2019
1 parent d99f612 commit 570d124
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion webui/vendor/Bareos/library/Bareos/BSock/BareosBSock.php
Expand Up @@ -535,7 +535,17 @@ private function connect()
if (($this->config['server_can_do_tls'] || $this->config['server_requires_tls']) &&
($this->config['client_can_do_tls'] || $this->config['client_requires_tls'])) {

$crypto_method = STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
/*
* STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT was introduced with PHP version
* 5.6.0. We need to care that calling stream_socket_enable_crypto method
* works with versions < 5.6.0 as well.
*/
$crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;

if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
}

$result = stream_socket_enable_crypto($this->socket, true, $crypto_method);

if (!$result) {
Expand Down

0 comments on commit 570d124

Please sign in to comment.