Improved error handling, especially for everyone whose CVS install just broke because...
authortassium <tassium@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 4 Jan 2003 06:21:06 +0000 (06:21 +0000)
committertassium <tassium@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 4 Jan 2003 06:21:06 +0000 (06:21 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4377 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_general.php

index bcf9b9f828b9109489ca82925cf2ade910ff37eb..17c15a467142248e434a8b815967dd2c03e5f6d1 100755 (executable)
@@ -279,8 +279,13 @@ function sqimap_login ($username, $password, $imap_server_address, $imap_port, $
          // Original IMAP login code
       $query = 'LOGIN "' . quoteIMAP($username) .  '" "' . quoteIMAP($password) . '"';
       $read = sqimap_run_command ($imap_stream, $query, false, $response, $message);
          // Original IMAP login code
       $query = 'LOGIN "' . quoteIMAP($username) .  '" "' . quoteIMAP($password) . '"';
       $read = sqimap_run_command ($imap_stream, $query, false, $response, $message);
-    } else {
-         // Insert SASL PLAIN code here, if it ever gets implemented
+    } elseif ($imap_auth_mech == 'plain') {
+               /* Replace this with SASL PLAIN if it ever gets implemented */
+               $response="BAD";
+               $message='SquirrelMail does not support SASL PLAIN yet. Rerun conf.pl and use login instead.';
+       } else {
+               $response="BAD";
+               $message="Internal SquirrelMail error - unknown IMAP authentication method chosen.  Please contact the developers.";
        }
     
        /* If the connection was not successful, lets see why */
        }
     
        /* If the connection was not successful, lets see why */
@@ -296,8 +301,8 @@ function sqimap_login ($username, $password, $imap_server_address, $imap_port, $
                 } else {
                    $string = sprintf (_("Unknown error: %s") . "<br>\n", $message);
                 }
                 } else {
                    $string = sprintf (_("Unknown error: %s") . "<br>\n", $message);
                 }
-                $string .= '<br>' . _("Read data:") . "<br>\n";
-                if (is_array($read)) {
+                if (isset($read) && is_array($read)) {
+                       $string .= '<br>' . _("Read data:") . "<br>\n";
                     foreach ($read as $line) {
                         $string .= htmlspecialchars($line) . "<br>\n";
                     }
                     foreach ($read as $line) {
                         $string .= htmlspecialchars($line) . "<br>\n";
                     }