From c58b21f929308cf561d90060d0f8fc9db0b59c74 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Sat, 20 Sep 2003 14:49:16 +0000 Subject: [PATCH] Synch to Gnus 200309201434. --- contrib/starttls.el | 15 ++++++++++----- lisp/ChangeLog | 6 ++++++ lisp/imap.el | 2 ++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/contrib/starttls.el b/contrib/starttls.el index f7562aa..4ba0c4d 100644 --- a/contrib/starttls.el +++ b/contrib/starttls.el @@ -168,7 +168,9 @@ handshake, or NIL on failure." (if (or (and done-ok (not done-bad)) ;; prevent mitm that fake success msg after failure msg. (and done-ok done-bad (< done-ok done-bad))) - info)))))) + info + (message "STARTTLS negotiation failed: %s" info) + nil)))))) (defun open-starttls-stream (name buffer host service) "Open a TLS connection for a service to a host. @@ -179,13 +181,13 @@ NAME is name for process. It is modified if necessary to make it unique. BUFFER is the buffer (or buffer-name) to associate with the process. Process output goes at end of that buffer, unless you specify an output stream or filter function to handle the output. - BUFFER may be also nil, meaning that this process is not associated - with any buffer Third arg is name of the host to connect to, or its IP address. Fourth arg SERVICE is name of the service desired, or an integer specifying a port number to connect to." - (let ((cmds starttls-programs) cmd done) + (let ((cmds starttls-programs) cmd done old-max) (message "Opening STARTTLS connection to `%s'..." host) + (with-current-buffer buffer + (setq old-max (point-max))) (while (and (not done) (setq cmd (pop cmds))) (message "Opening STARTTLS connection with `%s'..." cmd) (let* ((process-connection-type starttls-process-connection-type) @@ -211,7 +213,10 @@ specifying a port number to connect to." (message "Opening STARTTLS connection with `%s'...%s" cmd (if done "done" "failed")) (if done - (setq done process) + (progn + (with-current-buffer buffer + (delete-region old-max (point-max))) + (setq done process)) (delete-process process)))) (message "Opening STARTTLS connection to `%s'...%s" host (if done "done" "failed")) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cac5bde..1215807 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2003-09-20 Simon Josefsson + + * imap.el (imap-starttls-open): Erase buffer and disable process + filter before invoking STARTTLS negotiation, to support new + starttls.el that uses GNUTLS. + 2003-09-18 Katsumi Yamaoka * gnus-art.el (gnus-treat-display-x-face): Use set-default instead diff --git a/lisp/imap.el b/lisp/imap.el index e4adc3a..6b856bb 100644 --- a/lisp/imap.el +++ b/lisp/imap.el @@ -756,8 +756,10 @@ sure of changing the value of `foo'." (unwind-protect (progn (set-process-filter imap-process 'imap-arrival-filter) + (erase-buffer) (when (and (eq imap-stream 'starttls) (imap-ok-p (imap-send-command-wait "STARTTLS"))) + (set-process-filter imap-process nil) (starttls-negotiate imap-process))) (set-process-filter imap-process nil))) (when (memq (process-status process) '(open run)) -- 1.7.10.4