Prefer plain LOGIN if it's enabled and we're using an encrypted connection.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 25 Jan 2011 21:58:22 +0000 (13:58 -0800)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 25 Jan 2011 21:58:22 +0000 (13:58 -0800)
It requires fewer round trips than CRAM-MD5, and it's less likely to
be buggy,

lisp/ChangeLog
lisp/nnimap.el

index 1a9aa01..bf8eec5 100644 (file)
@@ -2,6 +2,9 @@
 
        * nnimap.el (nnimap-open-connection-1): Store the actual stream type
        used.
+       (nnimap-login): Prefer plain LOGIN if it's enabled (since it requires
+       fewer round trips than CRAM-MD5, and it's less likely to be buggy), and
+       we're using an encrypted connection.
 
        * proto-stream.el: Alter the interface functions to also return the
        actual stream type used: network or tls.
index 06a2868..6f73830 100644 (file)
@@ -412,6 +412,12 @@ textual parts.")
 
 (defun nnimap-login (user password)
   (cond
+   ;; Prefer plain LOGIN if it's enabled (since it requires fewer
+   ;; round trips than CRAM-MD5, and it's less likely to be buggy),
+   ;; and we're using an encrypted connection.
+   ((and (not (nnimap-capability "LOGINDISABLED"))
+        (eq (nnimap-stream-type nnimap-object) 'tls))
+    (nnimap-command "LOGIN %S %S" user password))
    ((nnimap-capability "AUTH=CRAM-MD5")
     (erase-buffer)
     (let ((sequence (nnimap-send-command "AUTHENTICATE CRAM-MD5"))