From: Mehdi Abaakouk Date: Sun, 21 Apr 2019 13:43:03 +0000 (+0200) Subject: imap: fix oauth X-Git-Tag: 2019-10-25~251 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=423d76ea27f61c930081213e415567571d6c0c90;p=neomutt imap: fix oauth Currently when oauth success, we got this and neomutt UI got stuck: [2019-04-21 15:35:38]<5> mutt_socket_readln_d() 5< a0001 OK xxxxxxxxxxxxx@xxxxxxxxx authenticated (Success) [2019-04-21 15:35:38]<2> mutt_socket_write_d() 5> [2019-04-21 15:35:38]<2> imap_login() Communication encrypted at 256 bits [2019-04-21 15:35:38]<3> imap_mdata_new() hcache uidvalidity 1, uidnext 228, modseq 0 [2019-04-21 15:35:38] mx_mbox_open() Reading imaps://imap.gmail.com/INBOX... [2019-04-21 15:35:38] imap_mbox_open() Selecting INBOX... [2019-04-21 15:35:38]<2> mutt_socket_write_d() 5> a0002 SELECT "INBOX" [2019-04-21 15:35:38]<5> mutt_socket_readln_d() 5< * BAD [CLIENTBUG] Invalid tag In fact neomutt send ^A to the server, but this should occurs only if the authentication fails. This changes fixes that. --- diff --git a/imap/auth_oauth.c b/imap/auth_oauth.c index f147d4494..1a33bbfb6 100644 --- a/imap/auth_oauth.c +++ b/imap/auth_oauth.c @@ -79,7 +79,7 @@ enum ImapAuthRes imap_auth_oauth(struct ImapAccountData *adata, const char *meth FREE(&oauthbearer); FREE(&ibuf); - if (rc == IMAP_EXEC_SUCCESS) + if (rc != IMAP_EXEC_SUCCESS) { /* The error response was in SASL continuation, so continue the SASL * to cause a failure and exit SASL input. See RFC 7628 3.2.3 */ @@ -87,7 +87,7 @@ enum ImapAuthRes imap_auth_oauth(struct ImapAccountData *adata, const char *meth rc = imap_exec(adata, ibuf, IMAP_CMD_NO_FLAGS); } - if (rc != IMAP_EXEC_SUCCESS) + if (rc == IMAP_EXEC_SUCCESS) { mutt_clear_error(); return IMAP_AUTH_SUCCESS;