]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/network-stream.el (network-stream-open-starttls): Improve failure detection
authorChong Yidong <cyd@gnu.org>
Sat, 15 Oct 2011 16:57:38 +0000 (12:57 -0400)
committerChong Yidong <cyd@gnu.org>
Sat, 15 Oct 2011 16:57:38 +0000 (12:57 -0400)
for lack of TLS capability.

lisp/ChangeLog
lisp/net/network-stream.el

index 63f199304a6f8fa67dbe77e8422420167bcec9a1..006c82a316648c2112900ff95fcc49fda2ed73dc 100644 (file)
@@ -1,5 +1,8 @@
 2011-10-15  Chong Yidong  <cyd@stupidchicken.com>
 
+       * net/network-stream.el (network-stream-open-starttls): Improve
+       detection of failure due to lack of TLS support.
+
        * mail/sendmail.el (sendmail-query-once): Tweak prompt message,
        putting the input text in front and in bold.
 
index 0c3d0285f91cd30b8fa112f26e94e69dc8ec4a7c..e27b4541ab5ca097576e6f1dae1f34ade664bf21 100644 (file)
@@ -218,7 +218,7 @@ functionality.
         (resulting-type 'plain)
         (builtin-starttls (and (fboundp 'gnutls-available-p)
                                (gnutls-available-p)))
-        starttls-command error)
+        starttls-available starttls-command error)
 
     ;; First check whether the server supports STARTTLS at all.
     (when (and capabilities success-string starttls-function)
@@ -227,10 +227,11 @@ functionality.
     ;; If we have built-in STARTTLS support, try to upgrade the
     ;; connection.
     (when (and starttls-command
-              (or builtin-starttls
-                  (and (or require-tls
-                           (plist-get parameters :use-starttls-if-possible))
-                       (starttls-available-p)))
+              (setq starttls-available
+                    (or builtin-starttls
+                        (and (or require-tls
+                                 (plist-get parameters :use-starttls-if-possible))
+                             (starttls-available-p))))
               (not (eq (plist-get parameters :type) 'plain)))
       ;; If using external STARTTLS, drop this connection and start
       ;; anew with `starttls-open-stream'.
@@ -298,9 +299,13 @@ functionality.
               ;; support, or no gnutls-cli installed.
               (eq resulting-type 'plain))
       (setq error
-           (if require-tls
+           (if starttls-available
                "Server does not support TLS"
-             "Server supports STARTTLS, but Emacs does not have support for it"))
+             (concat "Emacs does not support TLS, and no external `"
+                     (if starttls-use-gnutls
+                         starttls-gnutls-program
+                       starttls-program)
+                     "' program was found")))
       (delete-process stream)
       (setq stream nil))
     ;; Return value: