From d8a0051463c36e55bc2fb0bc3a551b0aa82b8868 Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Sun, 4 Jan 2009 13:46:47 -0800 Subject: [PATCH] SMTP: complain when authentication fails. Closes #2117. Now each failed attempt emits an error before mutt tries the next method. Possibly we should just fail immediately? --- ChangeLog | 18 ++++++++++++------ smtp.c | 25 ++++++++++++++----------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91aeb3e73..ceec28c00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,14 +1,20 @@ +2009-01-04 13:21 -0800 Brendan Cully (a1a675f88354) + + * parse.c, snprintf.c: Use ! instead of testing pointers against 0. + Closes #3125. + +2009-01-04 20:12 +0100 Rocco Rutte (33fa1ca4b6af) + + * doc/gen-map-doc, init.h: Documentation: Minor fixes and + improvements + 2009-01-03 21:02 -0800 Brendan Cully (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 (31d325e81dd0) - - * ChangeLog, imap/auth_gss.c: Guard against unused variable warning. - Thanks to Ingo Schwarze. - -2009-01-03 20:40 -0800 Brendan Cully (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 3e85a4ebb..a49d25cb9 100644 --- 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; } -- 2.50.0