diff lisp/net/tls.el @ 110666:3b9bd3888ee9

nnimap.el (nnimap-request-accept-article): Get the Message-ID without the \r. nnimap.el (nnimap-find-article-by-message-id): Use EXAMINE instead of SELECT to get the message-id. gnus-art.el, gnus.el, nnimap.el: Fix up make-obsolete-variable declarations throughout. gnus.texi (Mail Source Specifiers): Remove webmail.el mentions. mail-source.el: Removed webmail support. nntp.el (nntp-server-list-active-group): Document. gnus.texi (NNTP): Document nntp-server-list-active-group. gnus.texi (Customizing the IMAP Connection): Remove extra quote. nnimap.el (nnimap-find-article-by-message-id): Really return the article number. nnimap.el: Add nnimap-split-fancy. netrc.el (netrc-credentials, netrc-machine): Return the value of the "default" entry. nnimap.el: Use tls.el exclusively, and not starttls.el at all. nnimap.el (nnimap-wait-for-connection): Accept the moronic openssl s_client -starttls output, too. nnrss.el (nnrss-use-local): Add documentation. message.el (message-ignored-supersedes-headers): Strip Injection-* headers before superseding. nnimap.el (nnimap-open-connection): Reinstate the auto-upgrade from unencrypted to STARTTLS, if possible. nnir.el: Use the server names without suffixes. gnus-sum.el (gnus-summary-show-thread): Skip past invisible text when expanding threads. gnus-registry.el: Don't follow nnmairix references. Install the nnregistry refer method. gnus.texi (Spam Package Configuration Examples, SpamOracle): Remove nnimap-split-rule from examples.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Fri, 01 Oct 2010 00:25:50 +0000
parents e474d7d76259
children 400dd9dfdb7b
line wrap: on
line diff
--- a/lisp/net/tls.el	Thu Sep 30 16:26:40 2010 -0700
+++ b/lisp/net/tls.el	Fri Oct 01 00:25:50 2010 +0000
@@ -75,9 +75,14 @@
   :type 'regexp
   :group 'tls)
 
-(defcustom tls-program '("gnutls-cli -p %p %h"
-			 "gnutls-cli -p %p %h --protocols ssl3"
-			 "openssl s_client -connect %h:%p -no_ssl2 -ign_eof")
+(defvar tls-starttls-switches
+  '(("gnutls-cli" "-s")
+    ("openssl" "-starttls imap"))
+  "Alist of programs and the switches necessary to get starttls behaviour.")
+
+(defcustom tls-program '("gnutls-cli %s -p %p %h"
+			 "gnutls-cli %s -p %p %h --protocols ssl3"
+			 "openssl s_client %s -connect %h:%p -no_ssl2 -ign_eof")
   "List of strings containing commands to start TLS stream to a host.
 Each entry in the list is tried until a connection is successful.
 %h is replaced with server hostname, %p with port to connect to.
@@ -199,7 +204,7 @@
 	    (push (cons (match-string 1) (match-string 2)) vals))
 	  (nreverse vals))))))
 
-(defun open-tls-stream (name buffer host port)
+(defun open-tls-stream (name buffer host port &optional starttlsp)
   "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.
@@ -229,6 +234,9 @@
 	       (format-spec
 		cmd
 		(format-spec-make
+		 ?s (if starttlsp
+			(tls-find-starttls-argument cmd)
+		      "")
 		 ?h host
 		 ?p (if (integerp port)
 			(int-to-string port)
@@ -300,6 +308,11 @@
       (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