From d6eb889df945bcc9381ad4154b4ec9db9aec0ec3 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 16 May 2014 06:41:33 -0400
Subject: [PATCH] Merge pull request #190 from simonpl/master

---
 plugins/password/drivers/vpopmaild.php |    2 ++
 plugins/password/README                |    3 +++
 plugins/password/config.inc.php.dist   |    3 +++
 3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/plugins/password/README b/plugins/password/README
index 262ebfd..c50eb0b 100644
--- a/plugins/password/README
+++ b/plugins/password/README
@@ -310,6 +310,9 @@
 
  Set $config['password_vpopmaild_port'] to the port of vpopmaild.
 
+ Set $config['password_vpopmaild_timeout'] to the timeout used for the TCP 
+ connection to vpopmaild (You may want to set it higher on busy servers).
+
 
  3. Driver API
  -------------
diff --git a/plugins/password/config.inc.php.dist b/plugins/password/config.inc.php.dist
index 8c83dd7..8f7a57f 100644
--- a/plugins/password/config.inc.php.dist
+++ b/plugins/password/config.inc.php.dist
@@ -256,6 +256,9 @@
 // TCP port used for vpopmaild connections
 $config['password_vpopmaild_port'] = 89;
 
+// Timout used for the connection to vpopmaild (in seconds)
+$config['password_vpopmaild_timeout'] = 10;
+
 
 // cPanel Driver options
 // --------------------------
diff --git a/plugins/password/drivers/vpopmaild.php b/plugins/password/drivers/vpopmaild.php
index 6c1a9ee..4073120 100644
--- a/plugins/password/drivers/vpopmaild.php
+++ b/plugins/password/drivers/vpopmaild.php
@@ -22,6 +22,8 @@
             $rcmail->config->get('password_vpopmaild_port'), null))) {
             return PASSWORD_CONNECT_ERROR;
         }
+	
+        $vpopmaild->setTimeout($rcmail->config->get('password_vpopmaild_timeout'),0);
 
         $result = $vpopmaild->readLine();
         if(!preg_match('/^\+OK/', $result)) {

--
Gitblit v1.9.1