[gnus git] branch master updated: =1= (nnimap-login): Prefer AUTH=CRAM-MD5, if it's available.

Lars Magne Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  1809f181366e42a47ba94551b54fd0d56d7e8dee (commit)
      from  568f5b639f3650da336b51947eea41ddb3752965 (commit)


- Log -----------------------------------------------------------------
commit 1809f181366e42a47ba94551b54fd0d56d7e8dee
Author: Lars Magne Ingebrigtsen <[email protected]>
Date:   Sun Jan 2 23:28:40 2011 +0100

    (nnimap-login): Prefer AUTH=CRAM-MD5, if it's available.
    
    This avoids sending passwords in plain text over non-encrypted
    channels.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7e5abde..0fb65b8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
 2011-01-02  Lars Magne Ingebrigtsen  <[email protected]>
 
+	* nnimap.el (nnimap-login): Prefer AUTH=CRAM-MD5, if it's available.
+	This avoids sending passwords in plain text over non-encrypted
+	channels.
+
 	* shr.el (shr-rescale-image): Display all GIF images as animated images.
 
 	* nnimap.el (nnimap-login): Refactored out into own function, and
diff --git a/lisp/nnimap.el b/lisp/nnimap.el
index d316015..51fa532 100644
--- a/lisp/nnimap.el
+++ b/lisp/nnimap.el
@@ -411,15 +411,6 @@ textual parts.")
 
 (defun nnimap-login (user password)
   (cond
-   ((not (nnimap-capability "LOGINDISABLED"))
-    (nnimap-command "LOGIN %S %S" user password))
-   ((nnimap-capability "AUTH=PLAIN")
-    (nnimap-command
-     "AUTHENTICATE PLAIN %s"
-     (base64-encode-string
-      (format "\000%s\000%s"
-	      (nnimap-quote-specials user)
-	      (nnimap-quote-specials password)))))
    ((nnimap-capability "AUTH=CRAM-MD5")
     (erase-buffer)
     (let ((sequence (nnimap-send-command "AUTHENTICATE CRAM-MD5"))
@@ -432,7 +423,16 @@ textual parts.")
 		 (rfc2104-hash 'md5 64 16 password
 			       (base64-decode-string challenge))))
 	"\r\n"))
-      (nnimap-wait-for-response sequence)))))
+      (nnimap-wait-for-response sequence)))
+   ((not (nnimap-capability "LOGINDISABLED"))
+    (nnimap-command "LOGIN %S %S" user password))
+   ((nnimap-capability "AUTH=PLAIN")
+    (nnimap-command
+     "AUTHENTICATE PLAIN %s"
+     (base64-encode-string
+      (format "\000%s\000%s"
+	      (nnimap-quote-specials user)
+	      (nnimap-quote-specials password)))))))
 
 (defun nnimap-quote-specials (string)
   (with-temp-buffer

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog |    4 ++++
 lisp/nnimap.el |   20 ++++++++++----------
 2 files changed, 14 insertions(+), 10 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.