diff options
| author | Lars Magne Ingebrigtsen | 2011-07-07 17:14:17 +0200 |
|---|---|---|
| committer | Lars Magne Ingebrigtsen | 2011-07-07 17:14:17 +0200 |
| commit | 12b9eb35271db4602d6a5559a4554fdd68604b59 (patch) | |
| tree | 8e56e4c347d2edb2061ed5e0fca152688b4d42a1 | |
| parent | 5e94cadb8a190cc9f274a37600b30e16dd7634a3 (diff) | |
| download | emacs-12b9eb35271db4602d6a5559a4554fdd68604b59.tar.gz emacs-12b9eb35271db4602d6a5559a4554fdd68604b59.zip | |
Work around gnutls failures
* net/network-stream.el (network-stream-open-starttls): If gnutls
negotiation fails, then possibly try again with a non-encrypted
connection.
Fixes: debbugs:9017
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/net/network-stream.el | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 282035af2b9..9d80cd12ff7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2011-07-07 Lars Magne Ingebrigtsen <larsi@gnus.org> | 1 | 2011-07-07 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 2 | ||
| 3 | * net/network-stream.el (network-stream-open-starttls): If gnutls | ||
| 4 | negotiation fails, then possibly try again with a non-encrypted | ||
| 5 | connection (bug#9017). | ||
| 6 | |||
| 3 | * mail/smtpmail.el (smtpmail-stream-type): Note that `plain' can | 7 | * mail/smtpmail.el (smtpmail-stream-type): Note that `plain' can |
| 4 | be used. | 8 | be used. |
| 5 | 9 | ||
diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el index 038794e117d..bb09d8945c9 100644 --- a/lisp/net/network-stream.el +++ b/lisp/net/network-stream.el | |||
| @@ -263,8 +263,16 @@ functionality. | |||
| 263 | ;; The server said it was OK to begin STARTTLS negotiations. | 263 | ;; The server said it was OK to begin STARTTLS negotiations. |
| 264 | (if builtin-starttls | 264 | (if builtin-starttls |
| 265 | (let ((cert (network-stream-certificate host service parameters))) | 265 | (let ((cert (network-stream-certificate host service parameters))) |
| 266 | (gnutls-negotiate :process stream :hostname host | 266 | (condition-case nil |
| 267 | :keylist (and cert (list cert)))) | 267 | (gnutls-negotiate :process stream :hostname host |
| 268 | :keylist (and cert (list cert))) | ||
| 269 | ;; If we get a gnutls-specific error (for instance if | ||
| 270 | ;; the certificate the server gives us is completely | ||
| 271 | ;; syntactically invalid), then close the connection | ||
| 272 | ;; and possibly (further down) try to create a | ||
| 273 | ;; non-encrypted connection. | ||
| 274 | (gnutls-error | ||
| 275 | (delete-process stream)))) | ||
| 268 | (unless (starttls-negotiate stream) | 276 | (unless (starttls-negotiate stream) |
| 269 | (delete-process stream))) | 277 | (delete-process stream))) |
| 270 | (if (memq (process-status stream) '(open run)) | 278 | (if (memq (process-status stream) '(open run)) |