GNU bug report logs - #22789
25.1.50; In last master build https connections stop working

Previous Next

Package: emacs;

Reported by: José L. Doménech <j_l_domenech <at> yahoo.com>

Date: Wed, 24 Feb 2016 10:29:02 UTC

Severity: normal

Found in version 25.1.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alain Schneble <a.s <at> realize.ch>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: larsi <at> gnus.org, j_l_domenech <at> yahoo.com, 22789 <at> debbugs.gnu.org
Subject: bug#22789: 25.1.50; In last master build https connections stop working
Date: Mon, 7 Mar 2016 00:24:35 +0100
[Message part 1 (text/plain, inline)]
Alain Schneble <a.s <at> realize.ch> writes:

> I'll send a patch for further discussions shortly.

And here it is.  The fix is quite simple.  It ensures that sys_write
exits before touching the socket if it is not connected yet.
Unfortunately I didn't find any documentation on winsock ioctlsocket
that would prove that this is indeed required.  But it seems not wrong
to me anyway.  (I'll try to search the wisock documentation tomorrow to
find some hints that lead in this direction, or maybe you know?)

[0001-Solve-async-GnuTLS-handshake-issue-on-w32.patch (text/x-patch, inline)]
From 01a475ea41265929951e6d14f6dd216671b63331 Mon Sep 17 00:00:00 2001
From: Alain Schneble <a.s <at> realize.ch>
Date: Mon, 7 Mar 2016 00:00:57 +0100
Subject: [PATCH] Solve async GnuTLS handshake issue on w32

* src/w32.c (sys_write): For non-blocking sockets, return immediately
with EWOULDBLOCK.  This ensures we do not temporarily turn the socket
into blocking mode for the pfn_send call if the socket is not (yet)
connected.  It turned out that doing so causes arbitrary GnuTLS
handshake failures on MS-Windows.  (bug#22789)
---
 src/w32.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/w32.c b/src/w32.c
index 998f696..ee8cf6c 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -8647,6 +8647,12 @@ sys_write (int fd, const void * buffer, unsigned int count)
       unsigned long nblock = 0;
       if (winsock_lib == NULL) emacs_abort ();
 
+      if ((fd_info[fd].flags & FILE_CONNECT) != 0)
+	{
+	  errno = EWOULDBLOCK;
+	  return -1;
+	}
+
       /* TODO: implement select() properly so non-blocking I/O works. */
       /* For now, make sure the write blocks.  */
       if (fd_info[fd].flags & FILE_NDELAY)
-- 
2.6.2.windows.1


This bug report was last modified 9 years and 132 days ago.

Previous Next


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