From 3353fdcbb4b1e82269d532fb230d7a1d807b092e Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Tue, 26 Oct 2010 04:30:50 -0400
Subject: [PATCH] - Fix auth capabilty checks ignore welcome banner CAPABILITY string (#1487081)

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

diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php
index d51b8cf..82018c9 100644
--- a/program/include/rcube_imap_generic.php
+++ b/program/include/rcube_imap_generic.php
@@ -747,6 +747,7 @@
 	    // RFC3501 [7.1] optional CAPABILITY response
 	    if (preg_match('/\[CAPABILITY ([^]]+)\]/i', $line, $matches)) {
 		    $this->parseCapability($matches[1]);
+            $this->capability_readed = true;
 	    }
 
 	    $this->message .= $line;
@@ -765,7 +766,7 @@
 				    return false;
 			    }
 
-			    // Now we're authenticated, capabilities need to be reread
+			    // Now we're secure, capabilities need to be reread
 			    $this->clearCapability();
         	}
 	    }
@@ -817,7 +818,11 @@
         // Connected and authenticated
 	    if (is_resource($result)) {
             if ($this->prefs['force_caps']) {
+                // forget current capabilities
 			    $this->clearCapability();
+            } else {
+                // pre-login capabilities can be not complete
+                $this->capability_readed = false;
             }
 		    $this->getRootDir();
             $this->logged = true;

--
Gitblit v1.9.1