emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/net/tls.el,v


From: Glenn Morris
Subject: [Emacs-diffs] Changes to emacs/lisp/net/tls.el,v
Date: Mon, 03 Mar 2008 02:10:50 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       08/03/03 02:10:50

Index: tls.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tls.el,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- tls.el      29 Feb 2008 04:02:43 -0000      1.30
+++ tls.el      3 Mar 2008 02:10:49 -0000       1.31
@@ -239,38 +239,55 @@
                      (memq (process-status process) '(open run))
                      (progn
                        (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)
              (sit-for 1)))
          (message "Opening TLS connection with `%s'...%s" cmd
                   (if done "done" "failed"))
-         (if done
-             (setq done process)
-           (delete-process process))))
-      (when done
+         (if (not done)
+             (delete-process process)
+           ;; advance point to after all informational messages that
+           ;; `openssl s_client' and `gnutls' print
+           (let ((start-of-data nil))
+             (while
+                  (not (setq start-of-data
+                             ;; the string matching `tls-end-of-info'
+                             ;; might come in separate chunks from
+                             ;; `accept-process-output', so start the
+                             ;; search where `tls-success' ended
        (save-excursion
-         (set-buffer buffer)
-         (when
+                               (if (re-search-forward tls-end-of-info nil t)
+                                   (match-end 0)))))
+               (accept-process-output process 1))
+             (if start-of-data
+                 ;; move point to start of client data
+                 (goto-char start-of-data)))
+         (setq done process))))
+      (when (and done
              (or
               (and tls-checktrust
-                   (progn
+                      (save-excursion
                      (goto-char (point-min))
                      (re-search-forward tls-untrusted nil t))
                    (or
                     (and (not (eq tls-checktrust 'ask))
-                         (message "The certificate presented by `%s' is NOT 
trusted." host))
+                            (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)))))
+                             (format "The certificate presented by `%s' is \
+NOT trusted. Accept anyway? " host)))))
               (and tls-hostmismatch
-                   (progn
+                      (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)))))
+                            (format "Host name in certificate doesn't \
+match `%s'. Connect anyway? " host))))))
            (setq done nil)
-           (delete-process process))))
+       (delete-process process)))
       (message "Opening TLS connection to `%s'...%s"
-              host (if done "done" "failed")))
+            host (if done "done" "failed"))
     (when use-temp-buffer
       (if done (set-process-buffer process nil))
       (kill-buffer buffer))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]