1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-24 14:30:43 -08:00

(open-tls-stream): Restore the 2007-11-04 change accidentally removed

by the 2007-12-05 merge from Gnus.
This commit is contained in:
Glenn Morris 2008-03-03 02:11:04 +00:00
parent 09fe06b74c
commit 0a4d4654f9
2 changed files with 50 additions and 28 deletions

View file

@ -1,3 +1,8 @@
2008-03-03 Glenn Morris <rgm@gnu.org>
* net/tls.el (open-tls-stream): Restore the 2007-11-04 change
accidentally removed by the 2007-12-05 merge from Gnus.
2008-03-02 Dan Nicolaescu <dann@ics.uci.edu> 2008-03-02 Dan Nicolaescu <dann@ics.uci.edu>
* progmodes/compile.el (compilation-menu-map): Add menu entries * progmodes/compile.el (compilation-menu-map): Add menu entries

View file

@ -239,38 +239,55 @@ Fourth arg PORT is an integer specifying a port to connect to."
(memq (process-status process) '(open run)) (memq (process-status process) '(open run))
(progn (progn
(goto-char (point-min)) (goto-char (point-min))
(not (setq done (re-search-forward tls-success nil t))))) (not (setq done (re-search-forward
tls-success nil t)))))
(unless (accept-process-output process 1) (unless (accept-process-output process 1)
(sit-for 1))) (sit-for 1)))
(message "Opening TLS connection with `%s'...%s" cmd (message "Opening TLS connection with `%s'...%s" cmd
(if done "done" "failed")) (if done "done" "failed"))
(if done (if (not done)
(setq done process) (delete-process process)
(delete-process process)))) ;; advance point to after all informational messages that
(when done ;; `openssl s_client' and `gnutls' print
(save-excursion (let ((start-of-data nil))
(set-buffer buffer) (while
(when (not (setq start-of-data
(or ;; the string matching `tls-end-of-info'
(and tls-checktrust ;; might come in separate chunks from
(progn ;; `accept-process-output', so start the
(goto-char (point-min)) ;; search where `tls-success' ended
(re-search-forward tls-untrusted nil t)) (save-excursion
(or (if (re-search-forward tls-end-of-info nil t)
(and (not (eq tls-checktrust 'ask)) (match-end 0)))))
(message "The certificate presented by `%s' is NOT trusted." host)) (accept-process-output process 1))
(not (yes-or-no-p (if start-of-data
(format "The certificate presented by `%s' is NOT trusted. Accept anyway? " host))))) ;; move point to start of client data
(and tls-hostmismatch (goto-char start-of-data)))
(progn (setq done process))))
(goto-char (point-min)) (when (and done
(re-search-forward tls-hostmismatch nil t)) (or
(not (yes-or-no-p (and tls-checktrust
(format "Host name in certificate doesn't match `%s'. Connect anyway? " host))))) (save-excursion
(setq done nil) (goto-char (point-min))
(delete-process process)))) (re-search-forward tls-untrusted nil t))
(message "Opening TLS connection to `%s'...%s" (or
host (if done "done" "failed"))) (and (not (eq tls-checktrust 'ask))
(message "The certificate presented by `%s' is \
NOT trusted." host))
(not (yes-or-no-p
(format "The certificate presented by `%s' is \
NOT trusted. Accept anyway? " host)))))
(and tls-hostmismatch
(save-excursion
(goto-char (point-min))
(re-search-forward tls-hostmismatch nil t))
(not (yes-or-no-p
(format "Host name in certificate doesn't \
match `%s'. Connect anyway? " host))))))
(setq done nil)
(delete-process process)))
(message "Opening TLS connection to `%s'...%s"
host (if done "done" "failed"))
(when use-temp-buffer (when use-temp-buffer
(if done (set-process-buffer process nil)) (if done (set-process-buffer process nil))
(kill-buffer buffer)) (kill-buffer buffer))