From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Regner Newsgroups: gmane.emacs.bugs Subject: bug#7304: [Patch] AUTHENTICATE PLAIN for imap.el Date: Fri, 29 Oct 2010 21:50:15 +0200 Message-ID: <858w1gixs8.fsf@joocom.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1288385023 30717 80.91.229.12 (29 Oct 2010 20:43:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 29 Oct 2010 20:43:43 +0000 (UTC) To: submit@emacsbugs.donarmstrong.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 29 22:43:41 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PBvnS-0003Dc-6J for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Oct 2010 22:43:34 +0200 Original-Received: from localhost ([127.0.0.1]:55616 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PBvnR-0002iI-Gn for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Oct 2010 16:43:33 -0400 Original-Received: from [140.186.70.92] (port=39025 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PBvnH-0002h5-Sr for bug-gnu-emacs@gnu.org; Fri, 29 Oct 2010 16:43:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PBvnC-0001RB-JR for bug-gnu-emacs@gnu.org; Fri, 29 Oct 2010 16:43:23 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33848) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PBvnC-0001R2-GX for bug-gnu-emacs@gnu.org; Fri, 29 Oct 2010 16:43:18 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PBvTa-0006Q0-Rx; Fri, 29 Oct 2010 16:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tom Regner Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Fri, 29 Oct 2010 20:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7304 X-GNU-PR-Package: emacs,gnus,imap X-GNU-PR-Keywords: patch Original-Received: via spool by submit@debbugs.gnu.org id=B.128838372724644 (code B ref -1); Fri, 29 Oct 2010 20:23:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Oct 2010 20:22:07 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PBvSe-0006PQ-Et for submit@debbugs.gnu.org; Fri, 29 Oct 2010 16:22:05 -0400 Original-Received: from p15120157.pureserver.info ([217.160.173.205] helo=mail.tomsdiner.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PBusO-000681-Sn for submit@emacsbugs.donarmstrong.com; Fri, 29 Oct 2010 15:44:38 -0400 Original-Received: from librics-tomte (unknown [195.135.150.69]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by mail.tomsdiner.org (Postfix) with ESMTP id 342853AC125 for ; Fri, 29 Oct 2010 21:48:50 +0200 (CEST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Mailman-Approved-At: Fri, 29 Oct 2010 16:22:03 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 29 Oct 2010 16:23:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:41253 Archived-At: --=-=-= 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=emacs-imap.el-auth_plain.patch Content-Description: authenticate plain for imap.el / Gnus *** 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 --=-=-=--