emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r104668: Set :use-starttls-if-possibl


From: Lars Magne Ingebrigtsen
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104668: Set :use-starttls-if-possible so that we always use STARTTLS if the server supports it.
Date: Wed, 22 Jun 2011 00:55:52 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104668
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Wed 2011-06-22 00:55:52 +0200
message:
  Set :use-starttls-if-possible so that we always use STARTTLS if the server 
supports it.
  
  SMTP servers that support STARTTLS commonly require it.
modified:
  lisp/ChangeLog
  lisp/mail/smtpmail.el
  lisp/net/network-stream.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-06-21 22:33:44 +0000
+++ b/lisp/ChangeLog    2011-06-21 22:55:52 +0000
@@ -1,5 +1,14 @@
 2011-06-21  Lars Magne Ingebrigtsen  <address@hidden>
 
+       * mail/smtpmail.el (smtpmail-via-smtp): Set
+       :use-starttls-if-possible so that we always use STARTTLS if the
+       server supports it.  SMTP servers that support STARTTLS commonly
+       require it.
+
+       * net/network-stream.el (network-stream-open-starttls): Support
+       upgrading to STARTTLS always, even if we don't have built-in support.
+       (open-network-stream): Add the :always-query-capabilies keyword.
+
        * mail/smtpmail.el: Rewritten to do opportunistic STARTTLS
        upgrades with `open-network-stream', and rely solely on
        auth-source for all credentials.  Big changes throughout the file,

=== modified file 'lisp/mail/smtpmail.el'
--- a/lisp/mail/smtpmail.el     2011-06-21 22:33:44 +0000
+++ b/lisp/mail/smtpmail.el     2011-06-21 22:55:52 +0000
@@ -627,7 +627,8 @@
                 (lambda (capabilities)
                   (and (string-match "-STARTTLS" capabilities)
                        "STARTTLS\r\n"))
-                :client-certificate t))
+                :client-certificate t
+                :use-starttls-if-possible t))
 
          ;; If we couldn't access the server at all, we give up.
          (unless (setq process (car result))

=== modified file 'lisp/net/network-stream.el'
--- a/lisp/net/network-stream.el        2011-06-21 21:00:45 +0000
+++ b/lisp/net/network-stream.el        2011-06-21 22:55:52 +0000
@@ -120,6 +120,10 @@
   certificate.  This parameter will only be used when doing TLS
   or STARTTLS connections.
 
+If :use-starttls-if-possible is non-nil, do opportunistic
+STARTTLS upgrades even if Emacs doesn't have built-in TLS
+functionality.
+
 :nowait is a boolean that says the connection should be made
   asynchronously, if possible."
   (unless (featurep 'make-network-process)
@@ -208,7 +212,8 @@
     ;; If we have built-in STARTTLS support, try to upgrade the
     ;; connection.
     (when (and (or (fboundp 'open-gnutls-stream)
-                  (and require-tls
+                  (and (or require-tls
+                           (plist-get parameters :use-starttls-if-possible))
                        (executable-find "gnutls-cli")))
               capabilities success-string starttls-function
               (setq starttls-command
@@ -236,6 +241,10 @@
                         starttls-extra-arguments)))
          (setq stream (starttls-open-stream name buffer host service)))
        (network-stream-get-response stream start eoc))
+      ;; Requery capabilities for protocols that require it; i.e.,
+      ;; EHLO for SMTP.
+      (when (plist-get parameters :always-query-capabilities)
+       (network-stream-command stream capability-command eoc))
       (when (string-match success-string
                          (network-stream-command stream starttls-command eoc))
        ;; The server said it was OK to begin STARTTLS negotiations.


reply via email to

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