Commit ec5c990d authored by Chong Yidong's avatar Chong Yidong
Browse files

* net/network-stream.el (network-stream-open-starttls): Improve failure detection

for lack of TLS capability.
parent 41859241
2011-10-15 Chong Yidong <cyd@stupidchicken.com> 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, * mail/sendmail.el (sendmail-query-once): Tweak prompt message,
putting the input text in front and in bold. putting the input text in front and in bold.
......
...@@ -218,7 +218,7 @@ functionality. ...@@ -218,7 +218,7 @@ functionality.
(resulting-type 'plain) (resulting-type 'plain)
(builtin-starttls (and (fboundp 'gnutls-available-p) (builtin-starttls (and (fboundp 'gnutls-available-p)
(gnutls-available-p))) (gnutls-available-p)))
starttls-command error) starttls-available starttls-command error)
;; First check whether the server supports STARTTLS at all. ;; First check whether the server supports STARTTLS at all.
(when (and capabilities success-string starttls-function) (when (and capabilities success-string starttls-function)
...@@ -227,10 +227,11 @@ functionality. ...@@ -227,10 +227,11 @@ functionality.
;; If we have built-in STARTTLS support, try to upgrade the ;; If we have built-in STARTTLS support, try to upgrade the
;; connection. ;; connection.
(when (and starttls-command (when (and starttls-command
(setq starttls-available
(or builtin-starttls (or builtin-starttls
(and (or require-tls (and (or require-tls
(plist-get parameters :use-starttls-if-possible)) (plist-get parameters :use-starttls-if-possible))
(starttls-available-p))) (starttls-available-p))))
(not (eq (plist-get parameters :type) 'plain))) (not (eq (plist-get parameters :type) 'plain)))
;; If using external STARTTLS, drop this connection and start ;; If using external STARTTLS, drop this connection and start
;; anew with `starttls-open-stream'. ;; anew with `starttls-open-stream'.
...@@ -298,9 +299,13 @@ functionality. ...@@ -298,9 +299,13 @@ functionality.
;; support, or no gnutls-cli installed. ;; support, or no gnutls-cli installed.
(eq resulting-type 'plain)) (eq resulting-type 'plain))
(setq error (setq error
(if require-tls (if starttls-available
"Server does not support TLS" "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) (delete-process stream)
(setq stream nil)) (setq stream nil))
;; Return value: ;; Return value:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment