]> granicus.if.org Git - neomutt/commitdiff
SMTP: complain when authentication fails. Closes #2117.
authorBrendan Cully <brendan@kublai.com>
Sun, 4 Jan 2009 21:46:47 +0000 (13:46 -0800)
committerBrendan Cully <brendan@kublai.com>
Sun, 4 Jan 2009 21:46:47 +0000 (13:46 -0800)
Now each failed attempt emits an error before mutt tries the next
method. Possibly we should just fail immediately?

ChangeLog
smtp.c

index 91aeb3e7301a36ecad798f89d7ecadf9e8fd339e..ceec28c004e5ff2a85815319e307df47d7a099a6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,14 +1,20 @@
+2009-01-04 13:21 -0800  Brendan Cully  <brendan@kublai.com>  (a1a675f88354)
+
+       * parse.c, snprintf.c: Use ! instead of testing pointers against 0.
+       Closes #3125.
+
+2009-01-04 20:12 +0100  Rocco Rutte  <pdmef@gmx.net>  (33fa1ca4b6af)
+
+       * doc/gen-map-doc, init.h: Documentation: Minor fixes and
+       improvements
+
 2009-01-03 21:02 -0800  Brendan Cully  <brendan@kublai.com>  (5a80ee54a05f)
 
        * imap/command.c, imap/imap.c, init.c, muttlib.c, postpone.c: Raise
        debug level for several messages
 
-2009-01-03 20:45 -0800  Brendan Cully  <brendan@kublai.com>  (31d325e81dd0)
-
-       * ChangeLog, imap/auth_gss.c: Guard against unused variable warning.
-       Thanks to Ingo Schwarze.
-
-2009-01-03 20:40 -0800  Brendan Cully  <brendan@kublai.com>  (990da2bd329a)
+       * imap/auth_gss.c: Guard against unused variable warning.  Thanks
+       to Ingo Schwarze.
 
        * doc/Makefile.am: Remove obsolete reference to ChangeLog.old. Thanks
        to Ingo Schwarze.
diff --git a/smtp.c b/smtp.c
index 3e85a4ebb45967b29be0a9b56430219f9fc34834..a49d25cb9f2d728031ec9aa504b8fd75f1e0d391 100644 (file)
--- a/smtp.c
+++ b/smtp.c
@@ -454,7 +454,14 @@ static int smtp_auth (CONNECTION* conn)
 
       dprint (2, (debugfile, "smtp_authenticate: Trying method %s\n", method));
 
-      if ((r = smtp_auth_sasl (conn, method)) != SMTP_AUTH_UNAVAIL)
+      r = smtp_auth_sasl (conn, method);
+      
+      if (r == SMTP_AUTH_FAIL && delim)
+      {
+        mutt_error (_("%s authentication failed, trying next method"), method);
+        mutt_sleep (1);
+      }
+      else if (r != SMTP_AUTH_UNAVAIL)
         break;
     }
 
@@ -466,7 +473,12 @@ static int smtp_auth (CONNECTION* conn)
   if (r != SMTP_AUTH_SUCCESS)
     mutt_account_unsetpass (&conn->account);
 
-  if (r == SMTP_AUTH_UNAVAIL)
+  if (r == SMTP_AUTH_FAIL)
+  {
+    mutt_error (_("SASL authentication failed"));
+    mutt_sleep (1);
+  }
+  else if (r == SMTP_AUTH_UNAVAIL)
   {
     mutt_error (_("No authenticators available"));
     mutt_sleep (1);
@@ -559,17 +571,8 @@ static int smtp_auth_sasl (CONNECTION* conn, const char* mechlist)
     mutt_sasl_setup_conn (conn, saslconn);
     return SMTP_AUTH_SUCCESS;
   }
-  else if (SmtpAuthenticators && *SmtpAuthenticators)
-  {
-    /* if we're given a mech list to attempt, failure means try the next */
-    dprint (2, (debugfile, "smtp_auth_sasl: %s failed\n", mech));
-    sasl_dispose (&saslconn);
-    return SMTP_AUTH_UNAVAIL;
-  }
 
 fail:
-  mutt_error (_("SASL authentication failed"));
-  mutt_sleep (1);
   sasl_dispose (&saslconn);
   return SMTP_AUTH_FAIL;
 }