瀏覽代碼

Partial support for IMAP LOgin Referrals: tell the user what's going on
and log him out (RFC 2221) (Patch #1006242).

Thijs Kinkhorst 20 年之前
父節點
當前提交
3e6df95c87
共有 3 個文件被更改,包括 21 次插入0 次删除
  1. 3 0
      ChangeLog
  2. 1 0
      doc/rfc_documents.txt
  3. 17 0
      functions/imap_general.php

+ 3 - 0
ChangeLog

@@ -301,6 +301,9 @@ Version 1.5.1 -- CVS
   - src/delete_message.php script is disabled. It provided functions that
   - src/delete_message.php script is disabled. It provided functions that
     could be implemented without playing with multiple redirects.
     could be implemented without playing with multiple redirects.
   - Remove lots of obsoleted code from left_main.php.
   - 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
 Version 1.5.0 - 2 February 2004
 -------------------------------
 -------------------------------

+ 1 - 0
doc/rfc_documents.txt

@@ -14,6 +14,7 @@ RFC 1730   IMAP version 4
 RFC 2060   IMAP version 4rev1
 RFC 2060   IMAP version 4rev1
 RFC 2183   Content-Disposition MIME header
 RFC 2183   Content-Disposition MIME header
 RFC 2195   IMAP/POP AUTHorize Extension for Simple Challenge/Response
 RFC 2195   IMAP/POP AUTHorize Extension for Simple Challenge/Response
+RFC 2221   IMAP4 Login Referrals
 RFC 2298   Details return receipts
 RFC 2298   Details return receipts
 RFC 2342   The IMAP4 NAMESPACE command
 RFC 2342   The IMAP4 NAMESPACE command
 RFC 2616   HTTP/1.1
 RFC 2616   HTTP/1.1

+ 17 - 0
functions/imap_general.php

@@ -818,6 +818,23 @@ function sqimap_login ($username, $password, $imap_server_address, $imap_port, $
             exit;
             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;
     return $imap_stream;
 }
 }