Updated ws2_32-connect-already-connected patchset

This commit is contained in:
Alistair Leslie-Hughes 2021-07-03 17:19:37 +10:00
parent f5fe9c0c89
commit f18cff9e7a
2 changed files with 3 additions and 46 deletions

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "52ba1b498a9694daf804c9aea99c788bb4e753a3"
echo "12d33d21d33788fd46898ea42e9592d33b6e7c8e"
}
# Show version information
@ -4210,10 +4210,10 @@ fi
# | * [#51381] ws2_32: return correct error code when already connected.
# |
# | Modified files:
# | * dlls/ws2_32/socket.c, server/sock.c
# | * server/sock.c
# |
if test "$enable_ws2_32_connect_already_connected" -eq 1; then
patch_apply ws2_32-connect-already-connected/0001-ws2_32-Return-STATUS_ADDRESS_ALREADY_ASSOCIATED-for-.patch
patch_apply ws2_32-connect-already-connected/0001-server-Explicitly-forbid-connecting-a-listening-or-c.patch
fi
# Patchset wscript-support-d-u-switches

View File

@ -1,43 +0,0 @@
From 3cc8df69a7e3037530910dc1dbb310488b4c2d19 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 2 Jul 2021 13:07:26 +1000
Subject: [PATCH] ws2_32: Return STATUS_ADDRESS_ALREADY_ASSOCIATED for
connected sockets
---
dlls/ws2_32/socket.c | 5 +++++
server/sock.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 87966545bb8..aab338b3fad 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -1867,6 +1867,11 @@ int WINAPI WS_connect( SOCKET s, const struct WS_sockaddr *addr, int len )
if (WaitForSingleObject( sync_event, INFINITE ) == WAIT_FAILED) return -1;
status = io.u.Status;
}
+ if (status == STATUS_ADDRESS_ALREADY_ASSOCIATED)
+ {
+ SetLastError( WSAEALREADY );
+ return -1;
+ }
if (status)
{
/* NtStatusToWSAError() has no mapping for WSAEALREADY */
diff --git a/server/sock.c b/server/sock.c
index 65489c183ac..1de234d7eb5 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -1928,7 +1928,7 @@ static int sock_get_ntstatus( int err )
case EMFILE: return STATUS_TOO_MANY_OPENED_FILES;
case EINPROGRESS:
case EWOULDBLOCK: return STATUS_DEVICE_NOT_READY;
- case EALREADY: return STATUS_NETWORK_BUSY;
+ case EALREADY: return STATUS_ADDRESS_ALREADY_ASSOCIATED;
case ENOTSOCK: return STATUS_OBJECT_TYPE_MISMATCH;
case EDESTADDRREQ: return STATUS_INVALID_PARAMETER;
case EMSGSIZE: return STATUS_BUFFER_OVERFLOW;
--
2.30.2