diff options
author | Eduardo Chappa <chappa@washington.edu> | 2019-02-15 09:25:43 -0700 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2019-02-15 09:25:43 -0700 |
commit | 7da08008606c282cd08440d2f9310cc718c62946 (patch) | |
tree | b9b3b7f7908a10266c263e8d4cbc889f1c0a3053 /imap/src/c-client/pop3.c | |
parent | 8ee1778a57c78b88e203ba20291d61d3e7cd0507 (diff) | |
download | alpine-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/pop3.c')
-rw-r--r-- | imap/src/c-client/pop3.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/imap/src/c-client/pop3.c b/imap/src/c-client/pop3.c index 46c050ee..80f1858d 100644 --- a/imap/src/c-client/pop3.c +++ b/imap/src/c-client/pop3.c @@ -553,9 +553,9 @@ long pop3_capa (MAILSTREAM *stream,long flags) long pop3_auth (MAILSTREAM *stream,NETMBX *mb,char *pwd,char *usr) { - unsigned long i,trial,auths = 0; + unsigned long i,trial,auths = 0, authsaved; char *t; - AUTHENTICATOR *at; + AUTHENTICATOR *at, *atsaved; long ret = NIL; long flags = (stream->secure ? AU_SECURE : NIL) | (mb->authuser[0] ? AU_AUTHUSER : NIL); @@ -612,6 +612,15 @@ long pop3_auth (MAILSTREAM *stream,NETMBX *mb,char *pwd,char *usr) } for (t = NIL, LOCAL->saslcancel = NIL; !ret && LOCAL->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 (t) { /* previous authenticator failed? */ sprintf (pwd,"Retrying using %.80s authentication after %.80s", at->name,t); @@ -649,6 +658,12 @@ long pop3_auth (MAILSTREAM *stream,NETMBX *mb,char *pwd,char *usr) } fs_give ((void **) &t); } + if(mb && *mb->auth){ + if(!authsaved) sprintf (pwd,"Client does not support AUTH=%.80s authenticator",mb->auth); + else if (!atsaved) sprintf (pwd,"POP server does not support AUTH=%.80s authenticator",mb->auth); + if (!authsaved || !atsaved) mm_log (pwd,ERROR); + } + } else if (stream->secure) |