all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tom Regner <tom@tomsdiner.org>
To: submit@emacsbugs.donarmstrong.com
Subject: bug#7304: [Patch] AUTHENTICATE PLAIN for imap.el
Date: Fri, 29 Oct 2010 21:50:15 +0200	[thread overview]
Message-ID: <858w1gixs8.fsf@joocom.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 848 bytes --]

Severity: wishlist
Package: emacs,gnus,imap

The main mailserver at my work only provides AUTH=PLAIN as
authentication capability. Gnus (imap.el) does not provide that.

I added the missing functionality to imap.el, taking imap-login-auth as
example (the methods are very similar).

Please find attached the simple patch.

I allready send this patch to bugs@gnus.org, but there was no reaction -
asking for directions in #emacs at irc.freenode.org, I was made aware of
this possibility (via EmacsWiki).

If there is a problem with this patch, I'd be happy to adjust it, so
that it might be applied to a future release.

I developed it with/against GNU Emacs 23.2.1 and testet it against a
Zimbra Mailserver (I don't know which IMAP-Server is used in this suite,
or if it's even another imeplementation) and Cyrus-IMAPD.

kind regards, 
Tom Regner


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: authenticate plain for imap.el / Gnus --]
[-- Type: text/x-patch, Size: 2544 bytes --]

*** imap.el.bak	2010-10-28 11:17:05.000000000 +0200
--- imap.el	2010-10-28 15:13:12.000000000 +0200
***************
*** 311,316 ****
--- 311,317 ----
  			      cram-md5
  			      ;;sasl
  			      login
+ 			      plain
  			      anonymous)
    "Priority of authenticators to consider when authenticating to server.")
  
***************
*** 320,325 ****
--- 321,327 ----
      (sasl	imap-sasl-auth-p      imap-sasl-auth)
      (cram-md5   imap-cram-md5-p       imap-cram-md5-auth)
      (login      imap-login-p          imap-login-auth)
+     (plain      imap-plain-p          imap-plain-auth)
      (anonymous  imap-anonymous-p      imap-anonymous-auth)
      (digest-md5 imap-digest-md5-p     imap-digest-md5-auth))
    "Definition of authenticators.
***************
*** 948,953 ****
--- 950,958 ----
    (and (not (imap-capability 'LOGINDISABLED buffer))
         (not (imap-capability 'X-LOGIN-CMD-DISABLED buffer))))
  
+ (defun imap-plain-p (buffer)
+   t)
+ 
  (defun imap-quote-specials (string)
    (with-temp-buffer
      (insert string)
***************
*** 970,975 ****
--- 975,993 ----
  						(imap-quote-specials passwd)
  						"\""))))))
  
+ (defun imap-plain-auth (buffer)
+   "Login to server using the PLAIN command."
+   (message "imap: Plaintext authentication PLAIN...")
+   (imap-interactive-login buffer
+ 			  (lambda (user passwd)
+ 			    (imap-ok-p (imap-send-command-wait
+ 					 (concat "AUTHENTICATE PLAIN "
+ 						  (base64-encode-string
+ 						    (concat "\000" (imap-quote-specials user)
+ 							    "\000"
+ 							    (imap-quote-specials passwd)
+ 							    ))))))))
+ 
  (defun imap-anonymous-p (buffer)
    t)
  
***************
*** 1236,1242 ****
  	      auth)
  	  (while (setq auth (pop auths))
  	    ;; OK to use authenticator?
! 	    (setq imap-last-authenticator
  		  (assq auth imap-authenticator-alist))
  	    (when (funcall (nth 1 imap-last-authenticator) (current-buffer))
  	      (message "imap: Authenticating to `%s' using `%s'..."
--- 1254,1260 ----
  	      auth)
  	  (while (setq auth (pop auths))
  	    ;; OK to use authenticator?
! 	    (setq imap-last-authenticator		  
  		  (assq auth imap-authenticator-alist))
  	    (when (funcall (nth 1 imap-last-authenticator) (current-buffer))
  	      (message "imap: Authenticating to `%s' using `%s'..."
***************
*** 3013,3018 ****
--- 3031,3038 ----
  	  imap-cram-md5-auth
  	  imap-login-p
  	  imap-login-auth
+ 	  imap-plain-p
+ 	  imap-plain-auth
  	  imap-anonymous-p
  	  imap-anonymous-auth
  	  imap-open-1

             reply	other threads:[~2010-10-29 19:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-29 19:50 Tom Regner [this message]
2010-10-29 22:05 ` bug#7304: [Patch] AUTHENTICATE PLAIN for imap.el Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=858w1gixs8.fsf@joocom.de \
    --to=tom@tomsdiner.org \
    --cc=submit@emacsbugs.donarmstrong.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.