[geary/mjog/imap-connection-fixes: 32/34] Geary.Imap.Command: Handle how Y! reports login failures



commit b3376c167bdf4aaece07f5324a6203af7011bc94
Author: Michael Gratton <mike vee net>
Date:   Thu Mar 26 22:51:13 2020 +1100

    Geary.Imap.Command: Handle how Y! reports login failures

 src/engine/imap/command/imap-command.vala | 6 ++++--
 test/integration/imap/client-session.vala | 6 ------
 2 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/src/engine/imap/command/imap-command.vala b/src/engine/imap/command/imap-command.vala
index 322b18d2..67761a35 100644
--- a/src/engine/imap/command/imap-command.vala
+++ b/src/engine/imap/command/imap-command.vala
@@ -303,8 +303,10 @@ public abstract class Geary.Imap.Command : BaseObject {
                     );
 
                 case ResponseCodeType.AUTHORIZATIONFAILED:
-                    throw new ImapError.SERVER_ERROR(
-                        "%s: Not authorised: %s",
+                    // At least Yahoo uses this to indicate a login
+                    // failure
+                    throw new ImapError.UNAUTHENTICATED(
+                        "%s: Bad authorisation: %s",
                         to_brief_string(),
                         response.to_string()
                     );
diff --git a/test/integration/imap/client-session.vala b/test/integration/imap/client-session.vala
index f6221f63..341065a7 100644
--- a/test/integration/imap/client-session.vala
+++ b/test/integration/imap/client-session.vala
@@ -62,12 +62,6 @@ class Integration.Imap.ClientSession : TestCase {
             assert_not_reached();
         } catch (Geary.ImapError.UNAUTHENTICATED err) {
             // All good
-        } catch (Geary.ImapError.SERVER_ERROR err) {
-            // Some servers (Y!) return AUTHORIZATIONFAILED response
-            // code if the login (not password) is bad
-            if (!("AUTHORIZATIONFAILED" in err.message)) {
-                throw err;
-            }
         }
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]