From cabf16e5f9e138d77e2800d753c7ce7c46a18104 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sun, 12 Sep 2021 22:15:34 -0600 Subject: * Additional code so that passwords are not deleted when connections are lost. --- imap/src/c-client/imap4r1.c | 3 ++- imap/src/c-client/nntp.c | 3 ++- imap/src/c-client/pop3.c | 3 ++- imap/src/c-client/smtp.c | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) (limited to 'imap') diff --git a/imap/src/c-client/imap4r1.c b/imap/src/c-client/imap4r1.c index b29d7201..85f3b2fc 100644 --- a/imap/src/c-client/imap4r1.c +++ b/imap/src/c-client/imap4r1.c @@ -1268,7 +1268,8 @@ long imap_auth (MAILSTREAM *stream,NETMBX *mb,char *tmp,char *usr) sprintf (tmp,"Can not authenticate to IMAP server: %.80s",lsterr); mm_log (tmp,ERROR); } - delete_password(mb, usr); + if(LOCAL->netstream && !LOCAL->byeseen) + delete_password(mb, usr); fs_give ((void **) &lsterr); } if(mb && *mb->auth){ diff --git a/imap/src/c-client/nntp.c b/imap/src/c-client/nntp.c index 3875b351..b44087ca 100644 --- a/imap/src/c-client/nntp.c +++ b/imap/src/c-client/nntp.c @@ -2098,7 +2098,8 @@ long nntp_send_auth_work (SENDSTREAM *stream,NETMBX *mb,char *pwd,long flags) sprintf (tmp,"Can not authenticate to NNTP server: %.80s",lsterr); mm_log (tmp,ERROR); } - delete_password(mb, mb ? mb->user : NULL); + if(!ret && stream->netstream) + delete_password(mb, mb ? mb->user : NULL); fs_give ((void **) &lsterr); } else if (mb->secflag) /* no SASL, can't do /secure */ diff --git a/imap/src/c-client/pop3.c b/imap/src/c-client/pop3.c index ea8a64f5..d982744c 100644 --- a/imap/src/c-client/pop3.c +++ b/imap/src/c-client/pop3.c @@ -666,7 +666,8 @@ long pop3_auth (MAILSTREAM *stream,NETMBX *mb,char *pwd,char *usr) sprintf (pwd,"Can not authenticate to POP3 server: %.80s",t); mm_log (pwd,ERROR); } - delete_password(mb, usr); + if(LOCAL->netstream && !ret) + delete_password(mb, usr); fs_give ((void **) &t); } if(mb && *mb->auth){ diff --git a/imap/src/c-client/smtp.c b/imap/src/c-client/smtp.c index 7c1f9936..ee225477 100644 --- a/imap/src/c-client/smtp.c +++ b/imap/src/c-client/smtp.c @@ -345,7 +345,8 @@ long smtp_auth (SENDSTREAM *stream,NETMBX *mb,char *tmp) sprintf (tmp,"Can not authenticate to SMTP server: %.80s",lsterr); mm_log (tmp,ERROR); } - delete_password(mb, usr); + if(!ret && stream->netstream) + delete_password(mb, usr); fs_give ((void **) &lsterr); } if(mb && *mb->auth){ -- cgit v1.2.3-70-g09d2