From a1fe6bd11d7afb8ddd42d1fe465a6d2d93b51592 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 22 Oct 2010 15:25:00 -0400
Subject: [PATCH] - Add support for IMAP proxy authentication (#1486690)

---
 program/include/rcube_imap_generic.php |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php
index 67d71f6..4211cca 100644
--- a/program/include/rcube_imap_generic.php
+++ b/program/include/rcube_imap_generic.php
@@ -420,7 +420,16 @@
             }
         }
         else { // PLAIN
-            $reply = base64_encode($user . chr(0) . $user . chr(0) . $pass);
+            // proxy authentication
+            if (!empty($this->prefs['auth_cid'])) {
+                $authc = $this->prefs['auth_cid'];
+                $pass  = $this->prefs['auth_pw'];
+            }
+            else {
+                $authc = $user;
+            }
+
+            $reply = base64_encode($user . chr(0) . $authc . chr(0) . $pass);
 
             // RFC 4959 (SASL-IR): save one round trip
             if ($this->getCapability('SASL-IR')) {

--
Gitblit v1.9.1