From 6d3e9961fce17ec04598fda3bb2893e2dcacfc1c Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Sat, 27 Nov 2010 19:22:08 +0100 Subject: [PATCH] (proto-stream-open-network): Fix typo in the gnutls path. --- lisp/ChangeLog | 2 ++ lisp/proto-stream.el | 43 ++++++++++++++++--------------------------- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 656b2cc7b..b2e9d5d47 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,8 @@ * proto-stream.el (proto-stream-always-use-starttls): New variable. (proto-stream-open-starttls): De-duplicate the starttls code. + (proto-stream-open-starttls): Folded back into the main function. + (proto-stream-open-network): Fix typo in the gnutls path. * nntp.el (nntp-open-connection): Fix the STARTTLS command syntax. diff --git a/lisp/proto-stream.el b/lisp/proto-stream.el index dc67a72a6..a81b9750f 100644 --- a/lisp/proto-stream.el +++ b/lisp/proto-stream.el @@ -108,13 +108,12 @@ command to switch on STARTTLS otherwise." (let* ((start (with-current-buffer buffer (point))) (stream (open-network-stream name buffer host service)) (capability-command (cadr (memq :capability-command parameters))) - (greeting (proto-stream-get-response - stream start (proto-stream-eoc parameters)))) + (eoc (proto-stream-eoc parameters)) + (greeting (proto-stream-get-response stream start eoc))) (if (not capability-command) (list stream greeting nil) (let* ((capabilities - (proto-stream-capabilities stream capability-command - (proto-stream-eoc parameters))) + (proto-stream-capabilities stream capability-command eoc)) (starttls-command (funcall (cadr (memq :starttls-function parameters)) capabilities))) @@ -134,10 +133,19 @@ command to switch on STARTTLS otherwise." (executable-find "gnutls-cli")) (unless (fboundp 'open-gnutls-stream) (delete-process stream) - (setq stream nil)) - (proto-stream-open-starttls name buffer host service - stream capabilities starttls-command - greeting (proto-stream-eoc parameters))) + (setq stream (starttls-open-stream name buffer host service)) + (proto-stream-get-response stream start eoc)) + (setq start (with-current-buffer buffer (point-max))) + (process-send-string stream starttls-command) + (proto-stream-get-response stream start eoc) + (if (fboundp 'open-gnutls-stream) + (gnutls-negotiate stream nil) + (starttls-negotiate stream)) + ;; Re-get the capabilities, since they may have changed + ;; after switching to TLS. + (setq start (with-current-buffer buffer (point-max))) + (process-send-string stream capability-command) + (list stream greeting (proto-stream-get-response stream start eoc))) ((eq (cadr (memq :type parameters)) 'starttls) (delete-process stream) nil) @@ -149,25 +157,6 @@ command to switch on STARTTLS otherwise." (process-send-string stream command) (proto-stream-get-response stream start end-of-command))) -(defun proto-stream-open-starttls (name buffer host service stream - capabilities starttls-command - greeting eoc) - (let ((start (with-current-buffer buffer (point-max)))) - (unless stream - (setq stream (starttls-open-stream name buffer host service)) - (proto-stream-get-response stream start eoc) - (setq start (with-current-buffer buffer (point-max)))) - (process-send-string stream starttls-command) - (proto-stream-get-response stream start eoc) - (if (fboundp 'open-gnutls-stream) - (gnutls-negotiate stream nil) - (starttls-negotiate stream)) - ;; Re-get the capabilities, since they may have changed - ;; after switching to TLS. - (setq start (with-current-buffer buffer (point-max))) - (process-send-string stream capability-command) - (list stream greeting (proto-stream-get-response stream start eoc)))) - (defun proto-stream-get-response (stream start end-of-command) (with-current-buffer (process-buffer stream) (save-excursion -- 2.25.1