Partial support for IMAP LOgin Referrals: tell the user what's going on
authorkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 6 Apr 2005 21:47:06 +0000 (21:47 +0000)
committerkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 6 Apr 2005 21:47:06 +0000 (21:47 +0000)
and log him out (RFC 2221) (Patch #1006242).

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@9219 7612ce4b-ef26-0410-bec9-ea0150e637f0

ChangeLog
doc/rfc_documents.txt
functions/imap_general.php

index aae8443..9a50969 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -301,6 +301,9 @@ Version 1.5.1 -- CVS
   - src/delete_message.php script is disabled. It provided functions that
     could be implemented without playing with multiple redirects.
   - Remove lots of obsoleted code from left_main.php.
+  - Partial support of IMAP REFERRAL: do not fail on IMAP REFERRAL response
+    (RFC 2221) but log the user out with a hint. Patch by Ariel Arjona
+    (#1006242).
   
 Version 1.5.0 - 2 February 2004
 -------------------------------
index afb8075..fedc353 100644 (file)
@@ -14,6 +14,7 @@ RFC 1730   IMAP version 4
 RFC 2060   IMAP version 4rev1
 RFC 2183   Content-Disposition MIME header
 RFC 2195   IMAP/POP AUTHorize Extension for Simple Challenge/Response
+RFC 2221   IMAP4 Login Referrals
 RFC 2298   Details return receipts
 RFC 2342   The IMAP4 NAMESPACE command
 RFC 2616   HTTP/1.1
index f866d1a..319dcac 100755 (executable)
@@ -818,6 +818,23 @@ function sqimap_login ($username, $password, $imap_server_address, $imap_port, $
             exit;
         }
     }
+
+    /* Special error case:
+     * Login referrals. The server returns:
+        * ? OK [REFERRAL <imap url>]
+        * Check RFC 2221 for details. Since we do not support login referrals yet
+        * we log the user out.
+        */
+    if ( strpos($message, "REFERRAL") ) {
+        sqimap_logout($imap_stream);   
+        set_up_language($squirrelmail_language, true);
+        include_once(SM_PATH . 'functions/display_messages.php' );
+        sqsession_destroy();
+        logout_error( _("Your mailbox is not located on this server.<br>".
+                          "Try a different server or consult your Administrator") );
+        exit;
+    }
+    
     return $imap_stream;
 }