summaryrefslogtreecommitdiff
path: root/imap/src/c-client/smtp.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2019-02-15 09:25:43 -0700
committerEduardo Chappa <chappa@washington.edu>2019-02-15 09:25:43 -0700
commit7da08008606c282cd08440d2f9310cc718c62946 (patch)
treeb9b3b7f7908a10266c263e8d4cbc889f1c0a3053 /imap/src/c-client/smtp.c
parent8ee1778a57c78b88e203ba20291d61d3e7cd0507 (diff)
downloadalpine-7da08008606c282cd08440d2f9310cc718c62946.tar.xz
* Add /auth=XYZ to the way to define a server. This allows users to
select the method to authenticate to an IMAP, SMTP or POP3 server. Examples are /auth=plain, or /auth=gssapi, etc.
Diffstat (limited to 'imap/src/c-client/smtp.c')
-rw-r--r--imap/src/c-client/smtp.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/imap/src/c-client/smtp.c b/imap/src/c-client/smtp.c
index d614ef97..d1c9a7cb 100644
--- a/imap/src/c-client/smtp.c
+++ b/imap/src/c-client/smtp.c
@@ -281,14 +281,22 @@ SENDSTREAM *smtp_open_full (NETDRIVER *dv,char **hostlist,char *service,
long smtp_auth (SENDSTREAM *stream,NETMBX *mb,char *tmp)
{
- unsigned long trial,auths;
+ unsigned long trial,auths, authsaved;
char *lsterr = NIL;
char usr[MAILTMPLEN];
- AUTHENTICATOR *at;
+ AUTHENTICATOR *at, *atsaved;
long ret = NIL;
for (auths = ESMTP.auth, stream->saslcancel = NIL;
!ret && stream->netstream && auths &&
(at = mail_lookup_auth (find_rightmost_bit (&auths) + 1)); ) {
+ if(mb && *mb->auth){
+ if(!compare_cstring(at->name, mb->auth))
+ atsaved = at;
+ else{
+ authsaved = auths;
+ continue;
+ }
+ }
if (lsterr) { /* previous authenticator failed? */
sprintf (tmp,"Retrying using %s authentication after %.80s",
at->name,lsterr);
@@ -330,6 +338,11 @@ long smtp_auth (SENDSTREAM *stream,NETMBX *mb,char *tmp)
}
fs_give ((void **) &lsterr);
}
+ if(mb && *mb->auth){
+ if(!authsaved) sprintf (tmp, "Client does not support AUTH=%.80s authenticator",mb->auth);
+ else if (!atsaved) sprintf (tmp,"SMTP server does not support AUTH=%.80s authenticator",mb->auth);
+ if (!authsaved || !atsaved) mm_log (tmp,ERROR);
+ }
return ret; /* authentication failed */
}