diff options
-rw-r--r-- | alpine/imap.c | 22 | ||||
-rw-r--r-- | pith/mailcmd.c | 14 | ||||
-rw-r--r-- | pith/pine.hlp | 2 | ||||
-rw-r--r-- | pith/state.h | 2 |
4 files changed, 35 insertions, 5 deletions
diff --git a/alpine/imap.c b/alpine/imap.c index a6a54dec..4957111f 100644 --- a/alpine/imap.c +++ b/alpine/imap.c @@ -363,6 +363,8 @@ oauth2_set_device_info(OAUTH2_S *oa2, char *method) OAUTH2_DEVICECODE_S *deviceinfo = &oa2->devicecode; OAUTH2_DEVICEPROC_S aux_value; + dprint((2, "-- oauth2_set_device_info\n")); + ps_global->in_xoauth2_auth = 1; if(ps_global->ttyo){ SCROLL_S sargs; STORE_S *in_store, *out_store; @@ -531,6 +533,8 @@ oauth2_get_access_code(unsigned char *url, char *method, OAUTH2_S *oauth2, int * char tmp[MAILTMPLEN]; char *code = NULL; + dprint((2, "-- oauth2_get_access_code\n")); + ps_global->in_xoauth2_auth = 1; if(ps_global->ttyo){ SCROLL_S sargs; STORE_S *in_store, *out_store; @@ -787,7 +791,6 @@ mm_login_oauth2(NETMBX *mb, char *user, char *method, int ChangeAccessToken, ChangeRefreshToken, ChangeExpirationTime; OAUTH2_S *oa2list, *oa2; XOAUTH2_INFO_S *x; - unsigned long OldExpirationTime, NewExpirationTime, SaveExpirationTime; #if defined(_WINDOWS) || defined(LOCAL_PASSWD_CACHE) int preserve_password = -1; @@ -1340,6 +1343,10 @@ mm_log(char *string, long int errflg) */ return; + /* if we took too long to authenticate, ignore this error */ + if(ps_global->in_xoauth2_auth && strstr(string, "[CLOSED]")) + return; + strncpy(message, string, sizeof(message)); message[sizeof(message) - 1] = '\0'; @@ -4091,6 +4098,7 @@ preserve_prompt(char *pinerc) int preserve_prompt_auth(char *pinerc, char *authtype) { + ps_global->preserve_password = 0; #ifdef WINCRED # if (WINCRED > 0) #define PROMPT_PWD _("Preserve password for next login") @@ -4107,8 +4115,10 @@ preserve_prompt_auth(char *pinerc, char *authtype) ? (strcmp(authtype, OA2NAME) ? PROMPT_PWD : PROMPT_OA2) : PROMPT_PWD, 'y', 'x', NO_HELP, WT_NORM) - == 'y')) + == 'y')){ + ps_global->preserve_password = 1; return(1); + } else return(0); # else @@ -4125,6 +4135,7 @@ preserve_prompt_auth(char *pinerc, char *authtype) ? (strcmp(authtype, OA2NAME) ? PROMPT_PWD : PROMPT_OA2) : PROMPT_PWD, 'y', 'x', NO_HELP, WT_NORM) == 'y'){ + ps_global->preserve_password = 1; if(rc == -1){ macos_set_store_pass_prompt(1); q_status_message(SM_ORDER, 4, 4, @@ -4151,10 +4162,13 @@ preserve_prompt_auth(char *pinerc, char *authtype) return 0; if(F_OFF(F_DISABLE_PASSWORD_FILE_SAVING,ps_global)) - return(want_to(authtype + if(want_to(authtype ? (strcmp(authtype, OA2NAME) ? PROMPT_PWD : PROMPT_OA2) : PROMPT_PWD, 'y', 'x', NO_HELP, WT_NORM) - == 'y'); + == 'y'){ + ps_global->preserve_password = 1; + return 1; + } return(0); #endif /* PASSFILE */ } diff --git a/pith/mailcmd.c b/pith/mailcmd.c index e5e70e02..c53afeb4 100644 --- a/pith/mailcmd.c +++ b/pith/mailcmd.c @@ -786,12 +786,26 @@ do_broach_folder(char *newfolder, CONTEXT_S *new_context, MAILSTREAM **streamp, openmode | (open_inbox ? SP_INBOX : 0), &rflags); + if(m == NULL + && ps_global->in_xoauth2_auth + && ps_global->preserve_password){ + ps_global->in_xoauth2_auth = ps_global->user_says_cancel = ps_global->preserve_password = 0; + m = context_open((new_context && !open_inbox) ? new_context : NULL, + stream, + open_inbox ? ps_global->VAR_INBOX_PATH : expanded_file, + openmode | (open_inbox ? SP_INBOX : 0), + &rflags); + } + /* * We aren't in a situation where we want a single cancel to * apply to multiple opens. */ ps_global->user_says_cancel = 0; + /* we are not in authentication mode anymore */ + ps_global->preserve_password = ps_global->in_xoauth2_auth = 0; + if(streamp) *streamp = m; diff --git a/pith/pine.hlp b/pith/pine.hlp index ca3580c0..ed65de81 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 605 2021-10-22 17:11:47 +Alpine Commit 606 2021-10-23 17:48:46 ============= h_news ================= <HTML> <HEAD> diff --git a/pith/state.h b/pith/state.h index 9c6e66d1..12c5989e 100644 --- a/pith/state.h +++ b/pith/state.h @@ -145,6 +145,8 @@ struct pine { unsigned fix_fixed_warning:1; /* offer to fix it */ unsigned user_says_cancel:1; /* user typed ^C to abort open */ + unsigned in_xoauth2_auth:1; /* user is attempting xoauth2 authentication */ + unsigned preserve_password:1; /* user is saving the password */ unsigned unseen_in_view:1; unsigned start_in_context:1; /* start fldr_scrn in current cntxt */ |