Skip to content

Commit c9e586d

Browse files
Merge pull request hestiacp#619 from dpeca/patch-1
Update for Roundcube Password driver for Vesta
2 parents 9f0073a + 6fbc433 commit c9e586d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

install/debian/8/roundcube/vesta.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* @version 1.0
77
* @author Serghey Rodin <skid@vestacp.com>
88
*/
9-
10-
function password_save($curpass, $passwd)
9+
class rcube_vesta_password {
10+
function save($curpass, $passwd)
1111
{
1212
$rcmail = rcmail::get_instance();
1313
$vesta_host = $rcmail->config->get('password_vesta_host');
@@ -40,7 +40,16 @@ function password_save($curpass, $passwd)
4040
$send .= PHP_EOL;
4141
$send .= $postdata . PHP_EOL . PHP_EOL;
4242

43-
$fp = fsockopen('ssl://' . $vesta_host, $vesta_port);
43+
//$fp = fsockopen('ssl://' . $vesta_host, $vesta_port);
44+
$errno = "";
45+
$errstr = "";
46+
$context = stream_context_create();
47+
48+
$result = stream_context_set_option($context, 'ssl', 'verify_peer', false);
49+
$result = stream_context_set_option($context, 'ssl', 'verify_host', false);
50+
$result = stream_context_set_option($context, 'ssl', 'allow_self_signed', true);
51+
52+
$fp = stream_socket_client('ssl://' . $vesta_host . ':'.$vesta_port, $errno, $errstr, 60, STREAM_CLIENT_CONNECT, $context);
4453
fputs($fp, $send);
4554
$result = fread($fp, 2048);
4655
fclose($fp);
@@ -60,3 +69,4 @@ function password_save($curpass, $passwd)
6069
}
6170

6271
}
72+
}

0 commit comments

Comments
 (0)