diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 2c80231f18a..34ecfb040ec 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -15357,7 +15357,7 @@ symbols in @code{imap-stream-alist}. Right now, this means Which authenticator to use for authenticating to the server, this is one of the symbols in @code{imap-authenticator-alist}. Right now, this means @samp{gssapi}, @samp{kerberos4}, @samp{digest-md5}, -@samp{cram-md5}, @samp{anonymous} or the default @samp{login}. +@samp{cram-md5}, @samp{plain}, @samp{anonymous} or the default @samp{login}. @item :program When using the @samp{shell} :stream, the contents of this variable is @@ -27096,14 +27096,15 @@ Gnus supports both encoding and decoding. @item S/MIME---RFC 2633 RFC 2633 describes the @acronym{S/MIME} format. -@item IMAP---RFC 1730/2060, RFC 2195, RFC 2086, RFC 2359, RFC 2595, RFC 1731 +@item IMAP---RFC 1730/2060, RFC 2195/4616, RFC 2086, RFC 2359, RFC 2595, RFC 1731 RFC 1730 is @acronym{IMAP} version 4, updated somewhat by RFC 2060 (@acronym{IMAP} 4 revision 1). RFC 2195 describes CRAM-MD5 authentication for @acronym{IMAP}. RFC 2086 describes access control lists (ACLs) for @acronym{IMAP}. RFC 2359 describes a @acronym{IMAP} protocol enhancement. RFC 2595 describes the proper @acronym{TLS} integration (STARTTLS) with @acronym{IMAP}. RFC 1731 describes the -GSSAPI/Kerberos4 mechanisms for @acronym{IMAP}. +GSSAPI/Kerberos4 mechanisms for @acronym{IMAP}. RFC 4616 describes +AUTH=PLAIN authentication for @acronym{IMAP}. @end table diff --git a/etc/NEWS b/etc/NEWS index 7b2d2626d8d..b790c7e318c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1336,6 +1336,14 @@ This contains the list of regular expressions used to match "Re:" and international variants of it when modifying the Subject field in replies. +** Imap + +--- +*** 'imap-authenticate' can now use PLAIN authentication. +"AUTH=PLAIN" support is auto-enabled if the IMAP server supports it. Pass +a specific authentication type to 'imap-authenticate' or remove 'plain' +from 'imap-authenticators' if you do not wish to use "AUTH=PLAIN". + ** Rmail +++ diff --git a/lisp/net/imap.el b/lisp/net/imap.el index 17f54e8d519..f705da317e5 100644 --- a/lisp/net/imap.el +++ b/lisp/net/imap.el @@ -275,6 +275,7 @@ stream.") digest-md5 cram-md5 ;;sasl + plain login anonymous) "Priority of authenticators to consider when authenticating to server.") @@ -284,6 +285,7 @@ stream.") (kerberos4 imap-kerberos4-auth-p imap-kerberos4-auth) (sasl imap-sasl-auth-p imap-sasl-auth) (cram-md5 imap-cram-md5-p imap-cram-md5-auth) + (plain imap-plain-p imap-plain-auth) (login imap-login-p imap-login-auth) (anonymous imap-anonymous-p imap-anonymous-auth) (digest-md5 imap-digest-md5-p imap-digest-md5-auth)) @@ -853,6 +855,23 @@ t if it successfully authenticates, nil otherwise." (imap-quote-specials passwd) "\"")))))) +(defun imap-plain-p (buffer) + (imap-capability 'AUTH=PLAIN buffer)) + +(defun imap-plain-auth (buffer) + "Login to server using the AUTH=PLAIN command." + (message "imap: PLAIN authentication...") + (imap-interactive-login + buffer + (lambda (user passwd) + (imap-ok-p + (imap-send-command-wait + (concat "AUTHENTICATE PLAIN " + (base64-encode-string + (format "\000%s\000%s" + (imap-quote-specials user) + (imap-quote-specials passwd))))))))) + (defun imap-anonymous-p (_buffer) t)