From e9a458f0f737829c8c43ed1cbd4b4dcf0f833852 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Wed, 13 Oct 2010 20:51:57 +0200 Subject: [PATCH 1/1] Rip the STARTTLS stuff out of tls.el again, and just bind it directly from nnimap. --- lisp/ChangeLog | 9 +++++++++ lisp/nnimap.el | 15 +-------------- lisp/tls.el | 14 +------------- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bdf679b69..2fb550fe8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2010-10-13 Lars Magne Ingebrigtsen + + * 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 * nnimap.el (nnimap-parse-flags): Be more strict when looking for FETCH diff --git a/lisp/nnimap.el b/lisp/nnimap.el index 5dfda9151..1109f1e89 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -318,7 +318,7 @@ textual parts.") (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")) @@ -419,19 +419,6 @@ textual parts.") (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) diff --git a/lisp/tls.el b/lisp/tls.el index daa1c18c8..275e10e0f 100644 --- a/lisp/tls.el +++ b/lisp/tls.el @@ -75,10 +75,6 @@ and `gnutls-cli' (version 2.0.1) output." :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") @@ -203,7 +199,7 @@ Used by `tls-certificate-information'." (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. @@ -233,9 +229,6 @@ Fourth arg PORT is an integer specifying a port to connect to." (format-spec cmd (format-spec-make - ?s (if starttlsp - (tls-find-starttls-argument cmd) - "") ?h host ?p (if (integerp port) (int-to-string port) @@ -307,11 +300,6 @@ match `%s'. Connect anyway? " host)))))) (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 -- 2.25.1