GNU bug report logs - #36660
27.0.50; :nowait fails when failing over when using TLS

Previous Next

Package: emacs;

Reported by: Robert Pluim <rpluim <at> gmail.com>

Date: Mon, 15 Jul 2019 10:58:02 UTC

Severity: normal

Tags: fixed

Found in version 27.0.50

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36660 in the body.
You can then email your comments to 36660 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#36660; Package emacs. (Mon, 15 Jul 2019 10:58:02 GMT) Full text and rfc822 format available.

Message #3 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; :nowait fails when failing over when using TLS
Date: Mon, 15 Jul 2019 12:57:29 +0200
The long version of this is at

<https://lists.gnu.org/archive/html/emacs-devel/2019-02/msg00588.html>

Short version: when opening a network connection using :nowait t, and
using TLS, failing over from one IP address to a second one fails,
because by the time Emacs tries to make the second connection, itʼs
deleted the TLS boot parameters it needs, so attempts to make a TCP
connection but using the original TLS port number.

Patch to follow once I get the bug number.

In GNU Emacs 27.0.50 (build 12, x86_64-apple-darwin18.6.0, NS appkit-1671.50 Version 10.14.5 (Build 18F132))
 of 2019-07-04 built on rpluim-mac
Repository revision: 9c2b1935a316a3d628255f83b26c6605189d2f62
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1671
System Description:  Mac OS X 10.14.5




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36660; Package emacs. (Mon, 15 Jul 2019 11:11:02 GMT) Full text and rfc822 format available.

Message #6 received at 36660 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: 36660 <at> debbugs.gnu.org
Subject: Re: bug#36660: 27.0.50; :nowait fails when failing over when using TLS
Date: Mon, 15 Jul 2019 13:10:01 +0200
[Message part 1 (text/plain, inline)]
O frabjous day! What a bug number :-)

[0001-Don-t-delete-GnuTLS-boot-parameters-too-early.patch (text/x-patch, inline)]
From cfd2d8cbadc3c2b744e40c47cdce4344da1eef77 Mon Sep 17 00:00:00 2001
From: Robert Pluim <rpluim <at> gmail.com>
Date: Mon, 15 Jul 2019 13:04:59 +0200
Subject: [PATCH] Don't delete GnuTLS boot parameters too early
To: emacs-devel <at> gnu.org

When falling back from one IP address to another for the same host, we
need to keep the TLS boot parameters around until we've actually
managed to connect, otherwise the fallback connection(s) will use TCP
rather than TLS.  (Bug#36660)

* src/process.c (connect_network_socket): Don't delete the GnuTLS
boot parameters until after we've managed to connect at the IP
level.
---
 src/process.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/process.c b/src/process.c
index cab390c10c..23c9be2b7b 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3682,11 +3682,14 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
       Lisp_Object boot, params = p->gnutls_boot_parameters;
 
       boot = Fgnutls_boot (proc, XCAR (params), XCDR (params));
-      p->gnutls_boot_parameters = Qnil;
 
       if (p->gnutls_initstage == GNUTLS_STAGE_READY)
+        {
 	/* Run sentinels, etc. */
+          p->gnutls_boot_parameters = Qnil;
+
 	finish_after_tls_connection (proc);
+        }
       else if (p->gnutls_initstage != GNUTLS_STAGE_HANDSHAKE_TRIED)
 	{
 	  deactivate_process (proc);
-- 
2.21.0.419.gffac537e6c


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36660; Package emacs. (Mon, 15 Jul 2019 11:32:01 GMT) Full text and rfc822 format available.

Message #9 received at 36660 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 36660 <at> debbugs.gnu.org
Subject: Re: bug#36660: 27.0.50; :nowait fails when failing over when using TLS
Date: Mon, 15 Jul 2019 13:31:14 +0200
Robert Pluim <rpluim <at> gmail.com> writes:

> O frabjous day! What a bug number :-)

Positively devilish.

>        boot = Fgnutls_boot (proc, XCAR (params), XCDR (params));
> -      p->gnutls_boot_parameters = Qnil;
>
>        if (p->gnutls_initstage == GNUTLS_STAGE_READY)
> +        {
>  	/* Run sentinels, etc. */
> +          p->gnutls_boot_parameters = Qnil;
> +
>  	finish_after_tls_connection (proc);
> +        }

Makes perfect sense; I've now applied it to the trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 15 Jul 2019 11:32:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 36660 <at> debbugs.gnu.org and Robert Pluim <rpluim <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 15 Jul 2019 11:32:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36660; Package emacs. (Mon, 15 Jul 2019 14:40:04 GMT) Full text and rfc822 format available.

Message #16 received at 36660 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 36660 <at> debbugs.gnu.org
Subject: Re: bug#36660: 27.0.50; :nowait fails when failing over when using TLS
Date: Mon, 15 Jul 2019 16:39:19 +0200
>>>>> On Mon, 15 Jul 2019 13:31:14 +0200, Lars Ingebrigtsen <larsi <at> gnus.org> said:
    Lars> Makes perfect sense; I've now applied it to the trunk.

That was unexpectedly quick, but welcome (although you trimmed my
explanation of the cause of the bug when you committed the patch. Did
I offend 'git apply' somewhere?).

Thanks

Robert




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36660; Package emacs. (Mon, 15 Jul 2019 14:47:02 GMT) Full text and rfc822 format available.

Message #19 received at 36660 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 36660 <at> debbugs.gnu.org
Subject: Re: bug#36660: 27.0.50; :nowait fails when failing over when using TLS
Date: Mon, 15 Jul 2019 16:46:27 +0200
Robert Pluim <rpluim <at> gmail.com> writes:

> That was unexpectedly quick, but welcome (although you trimmed my
> explanation of the cause of the bug when you committed the patch. Did
> I offend 'git apply' somewhere?).

Oh, sorry.  I didn't use git apply; I used `M-m' in debbugs-gnu.  Looks
like it doesn't preserve all of the text before the patch -- needs some
tweaks.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 13 Aug 2019 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 251 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.