Sfoglia il codice sorgente

Merge pull request #619 from dpeca/patch-1

Update for Roundcube Password driver for Vesta
Serghey Rodin 9 anni fa
parent
commit
c9e586d9eb
1 ha cambiato i file con 13 aggiunte e 3 eliminazioni
  1. 13 3
      install/debian/8/roundcube/vesta.php

+ 13 - 3
install/debian/8/roundcube/vesta.php

@@ -6,8 +6,8 @@
  * @version 1.0
  * @author Serghey Rodin <skid@vestacp.com>
  */
-
-    function password_save($curpass, $passwd)
+class rcube_vesta_password {
+    function save($curpass, $passwd)
     {
         $rcmail = rcmail::get_instance();
         $vesta_host = $rcmail->config->get('password_vesta_host');
@@ -40,7 +40,16 @@
         $send .= PHP_EOL;
         $send .= $postdata . PHP_EOL . PHP_EOL;
 
-        $fp = fsockopen('ssl://' . $vesta_host, $vesta_port);
+        //$fp = fsockopen('ssl://' . $vesta_host, $vesta_port);
+        $errno = "";
+        $errstr = "";
+        $context = stream_context_create();
+
+        $result = stream_context_set_option($context, 'ssl', 'verify_peer', false);
+        $result = stream_context_set_option($context, 'ssl', 'verify_host', false);
+        $result = stream_context_set_option($context, 'ssl', 'allow_self_signed', true);
+
+        $fp = stream_socket_client('ssl://' . $vesta_host . ':'.$vesta_port, $errno, $errstr, 60, STREAM_CLIENT_CONNECT, $context);
         fputs($fp, $send);
         $result = fread($fp, 2048);
         fclose($fp);
@@ -60,3 +69,4 @@
         }
 
     }
+}