Rip the STARTTLS stuff out of tls.el again, and just bind it directly from nnimap.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Wed, 13 Oct 2010 18:51:57 +0000 (20:51 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Wed, 13 Oct 2010 18:51:57 +0000 (20:51 +0200)
lisp/ChangeLog
lisp/nnimap.el
lisp/tls.el

index bdf679b..2fb550f 100644 (file)
@@ -1,3 +1,12 @@
+2010-10-13  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * nnimap.el (nnimap-extend-tls-programs): Removed.
+       (nnimap-open-connection): Bind STARTTLS to openssl explicitly.
+
+       * tls.el (tls-starttls-switches): Remove starttls hack.
+       (open-tls-stream): Ditto.
+       (tls-find-starttls-argument): Ditto.
+
 2010-10-13  Julien Danjou  <julien@danjou.info>
 
        * nnimap.el (nnimap-parse-flags): Be more strict when looking for FETCH
 2010-10-13  Julien Danjou  <julien@danjou.info>
 
        * nnimap.el (nnimap-parse-flags): Be more strict when looking for FETCH
index 5dfda91..1109f1e 100644 (file)
@@ -318,7 +318,7 @@ textual parts.")
                 (setq port (or nnimap-server-port "imap")))
                '("imap"))
               ((eq nnimap-stream 'starttls)
                 (setq port (or nnimap-server-port "imap")))
                '("imap"))
               ((eq nnimap-stream 'starttls)
-               (let ((tls-program (nnimap-extend-tls-programs)))
+               (let ((tls-program "openssl s_client %s -connect %h:%p -no_ssl2 -ign_eof -starttls imap"))
                  (open-tls-stream
                   "*nnimap*" (current-buffer) nnimap-address
                   (setq port (or nnimap-server-port "imap"))
                  (open-tls-stream
                   "*nnimap*" (current-buffer) nnimap-address
                   (setq port (or nnimap-server-port "imap"))
@@ -419,19 +419,6 @@ textual parts.")
                (nnimap-command "ENABLE QRESYNC"))
              (nnimap-process nnimap-object))))))))
 
                (nnimap-command "ENABLE QRESYNC"))
              (nnimap-process nnimap-object))))))))
 
-(defun nnimap-extend-tls-programs ()
-  (let ((programs tls-program)
-       result)
-    (unless (consp programs)
-      (setq programs (list programs)))
-    (dolist (program programs)
-      (when (assoc (car (split-string program)) tls-starttls-switches)
-       (push (if (not (string-match "%s" program))
-                 (concat program " " "%s")
-               program)
-             result)))
-    (nreverse result)))
-
 (defun nnimap-find-parameter (parameter elems)
   (let (result)
     (dolist (elem elems)
 (defun nnimap-find-parameter (parameter elems)
   (let (result)
     (dolist (elem elems)
index daa1c18..275e10e 100644 (file)
@@ -75,10 +75,6 @@ and `gnutls-cli' (version 2.0.1) output."
   :type 'regexp
   :group 'tls)
 
   :type 'regexp
   :group 'tls)
 
-(defvar tls-starttls-switches
-  '(("openssl" "-starttls imap"))
-  "Alist of programs and the switches necessary to get starttls behaviour.")
-
 (defcustom tls-program '("gnutls-cli --insecure -p %p %h"
                         "gnutls-cli --insecure -p %p %h --protocols ssl3"
                         "openssl s_client %s -connect %h:%p -no_ssl2 -ign_eof")
 (defcustom tls-program '("gnutls-cli --insecure -p %p %h"
                         "gnutls-cli --insecure -p %p %h --protocols ssl3"
                         "openssl s_client %s -connect %h:%p -no_ssl2 -ign_eof")
@@ -203,7 +199,7 @@ Used by `tls-certificate-information'."
            (push (cons (match-string 1) (match-string 2)) vals))
          (nreverse vals))))))
 
            (push (cons (match-string 1) (match-string 2)) vals))
          (nreverse vals))))))
 
-(defun open-tls-stream (name buffer host port &optional starttlsp)
+(defun open-tls-stream (name buffer host port)
   "Open a TLS connection for a port to a host.
 Returns a subprocess-object to represent the connection.
 Input and output work as for subprocesses; `delete-process' closes it.
   "Open a TLS connection for a port to a host.
 Returns a subprocess-object to represent the connection.
 Input and output work as for subprocesses; `delete-process' closes it.
@@ -233,9 +229,6 @@ Fourth arg PORT is an integer specifying a port to connect to."
               (format-spec
                cmd
                (format-spec-make
               (format-spec
                cmd
                (format-spec-make
-                ?s (if starttlsp
-                       (tls-find-starttls-argument cmd)
-                     "")
                 ?h host
                 ?p (if (integerp port)
                        (int-to-string port)
                 ?h host
                 ?p (if (integerp port)
                        (int-to-string port)
@@ -307,11 +300,6 @@ match `%s'. Connect anyway? " host))))))
       (kill-buffer buffer))
     done))
 
       (kill-buffer buffer))
     done))
 
-(defun tls-find-starttls-argument (command)
-  (let ((command (car (split-string command))))
-    (or (cadr (assoc command tls-starttls-switches))
-       "")))
-
 (provide 'tls)
 
 ;;; tls.el ends here
 (provide 'tls)
 
 ;;; tls.el ends here