From 135601589d7c498e689f6bf9e07eca7bff7b5154 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 10 Sep 2010 15:22:47 -0600 Subject: [PATCH] Fix setting password if no encryption key exists --- framework/Imap_Client/lib/Horde/Imap/Client/Base.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Base.php b/framework/Imap_Client/lib/Horde/Imap/Client/Base.php index 7a10b7fa8..bd1af0744 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client/Base.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client/Base.php @@ -145,11 +145,14 @@ abstract class Horde_Imap_Client_Base implements Serializable $this->_params = $params; // Encrypt password. - if (!is_null($this->_params['encryptKey'])) { - $secret = new Horde_Secret(); - $this->_params['password'] = $secret->write($this->_getEncryptKey(), $this->_params['password']); - $this->_params['_passencrypt'] = true; - } + try { + $encrypt_key = $this->_getEncryptKey(); + if (strlen($encrypt_key)) { + $secret = new Horde_Secret(); + $this->_params['password'] = $secret->write($encrypt_key, $this->_params['password']); + $this->_params['_passencrypt'] = true; + } + } catch (Horde_Imap_Client_Exception $e) {} $this->_init(); } -- 2.11.0