diff --git a/README.md b/README.md index 1eca2230..b6bb3016 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Wine. All those differences are also documented on the Included bug fixes and improvements ----------------------------------- -**Bug fixes and features included in the next upcoming release [16]:** +**Bug fixes and features included in the next upcoming release [17]:** * Add stub for dwmapi.DwmUpdateThumbnailProperties * Add stub for winspool.SetPrinterW level 8 ([Wine Bug #24645](https://bugs.winehq.org/show_bug.cgi?id=24645)) @@ -53,6 +53,7 @@ Included bug fixes and improvements * Implement a Courier New replacement font ([Wine Bug #20456](https://bugs.winehq.org/show_bug.cgi?id=20456)) * Implement a Times New Roman replacement font ([Wine Bug #32342](https://bugs.winehq.org/show_bug.cgi?id=32342)) * Map EXDEV error code to STATUS_NOT_SAME_DEVICE +* Properly close sockets when WSACleanup is called ([Wine Bug #18670](https://bugs.winehq.org/show_bug.cgi?id=18670)) * Return a dummy BIOS name in Win32_BIOS record * SHFileOperation with FO_MOVE should create new directory on Vista+ ([Wine Bug #25207](https://bugs.winehq.org/show_bug.cgi?id=25207)) * Translate flags in LaunchINFSectionW diff --git a/debian/changelog b/debian/changelog index e23fcb4f..373faf2d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -30,6 +30,7 @@ wine-staging (1.7.51) UNRELEASED; urgency=low * Added patch for stub of dwmapi.DwmUpdateThumbnailProperties. * Added patch to use proper glyph names in wineps driver (which fixes a bug related to copying text from generated PDF files). + * Added patch to properly close sockets when WSACleanup is called. * Removed patch to fix bug in wineserver debug_children inheritance (accepted upstream). * Removed patch to use helper function for NtWaitForMultipleObjects and diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 58b243a5..f40cc838 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -318,6 +318,7 @@ patch_enable_all () enable_ws2_32_APC_Performance="$1" enable_ws2_32_Connect_Time="$1" enable_ws2_32_TransmitFile="$1" + enable_ws2_32_WSACleanup="$1" enable_ws2_32_WSAPoll="$1" enable_ws2_32_WriteWatches="$1" enable_ws2_32_getaddrinfo="$1" @@ -1045,6 +1046,9 @@ patch_enable () ws2_32-TransmitFile) enable_ws2_32_TransmitFile="$2" ;; + ws2_32-WSACleanup) + enable_ws2_32_WSACleanup="$2" + ;; ws2_32-WSAPoll) enable_ws2_32_WSAPoll="$2" ;; @@ -6378,6 +6382,21 @@ if test "$enable_ws2_32_TransmitFile" -eq 1; then ) >> "$patchlist" fi +# Patchset ws2_32-WSACleanup +# | +# | This patchset fixes the following Wine bugs: +# | * [#18670] Properly close sockets when WSACleanup is called +# | +# | Modified files: +# | * dlls/ws2_32/socket.c, dlls/ws2_32/tests/sock.c, server/protocol.def, server/sock.c +# | +if test "$enable_ws2_32_WSACleanup" -eq 1; then + patch_apply ws2_32-WSACleanup/0001-ws2_32-Proper-WSACleanup-implementation-using-winese.patch + ( + echo '+ { "Matt Durgavich", "ws2_32: Proper WSACleanup implementation using wineserver function.", 2 },'; + ) >> "$patchlist" +fi + # Patchset ws2_32-WSAPoll # | # | This patchset fixes the following Wine bugs: diff --git a/patches/ws2_32-WSACleanup/0001-ws2_32-Proper-WSACleanup-implementation-using-winese.patch b/patches/ws2_32-WSACleanup/0001-ws2_32-Proper-WSACleanup-implementation-using-winese.patch new file mode 100644 index 00000000..0853aaeb --- /dev/null +++ b/patches/ws2_32-WSACleanup/0001-ws2_32-Proper-WSACleanup-implementation-using-winese.patch @@ -0,0 +1,108 @@ +From 0002cf1a076fddb1eecef95f1177ae6562cda785 Mon Sep 17 00:00:00 2001 +From: Matt Durgavich +Date: Sun, 30 Aug 2015 11:04:08 -0400 +Subject: ws2_32: Proper WSACleanup implementation using wineserver function + (try 2) + +--- + dlls/ws2_32/socket.c | 22 ++++++++++++++++------ + dlls/ws2_32/tests/sock.c | 5 ++--- + server/protocol.def | 3 +++ + server/sock.c | 9 +++++++++ + 4 files changed, 30 insertions(+), 9 deletions(-) + +diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c +index ca82ec9..f153de1 100644 +--- a/dlls/ws2_32/socket.c ++++ b/dlls/ws2_32/socket.c +@@ -1469,13 +1469,23 @@ int WINAPI WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData) + */ + INT WINAPI WSACleanup(void) + { +- if (num_startup) { +- num_startup--; +- TRACE("pending cleanups: %d\n", num_startup); +- return 0; ++ if (!num_startup) ++ { ++ SetLastError(WSANOTINITIALISED); ++ return SOCKET_ERROR; + } +- SetLastError(WSANOTINITIALISED); +- return SOCKET_ERROR; ++ ++ if (!--num_startup) ++ { ++ SERVER_START_REQ(socket_cleanup) ++ { ++ wine_server_call( req ); ++ } ++ SERVER_END_REQ; ++ } ++ ++ TRACE("pending cleanups: %d\n", num_startup); ++ return 0; + } + + +diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c +index 2d14496..204b852 100644 +--- a/dlls/ws2_32/tests/sock.c ++++ b/dlls/ws2_32/tests/sock.c +@@ -1119,20 +1119,19 @@ static void test_WithWSAStartup(void) + ok(res == 0, "WSAStartup() failed unexpectedly: %d\n", res); + + /* show that sockets are destroyed automatically after WSACleanup */ +- todo_wine { + SetLastError(0xdeadbeef); + res = send(src, "TEST", 4, 0); + error = WSAGetLastError(); + ok(res == SOCKET_ERROR, "send should have failed\n"); ++ todo_wine + ok(error == WSAENOTSOCK, "expected 10038, got %d\n", error); + + SetLastError(0xdeadbeef); + res = closesocket(dst); + error = WSAGetLastError(); + ok(res == SOCKET_ERROR, "closesocket should have failed\n"); ++ todo_wine + ok(error == WSAENOTSOCK, "expected 10038, got %d\n", error); +- } +- + closesocket(src); + closesocket(dst); + +diff --git a/server/protocol.def b/server/protocol.def +index c313006..2dccb9a 100644 +--- a/server/protocol.def ++++ b/server/protocol.def +@@ -942,6 +942,9 @@ struct rawinput_device + obj_handle_t handle; /* handle to close */ + @END + ++/* Close all sockets for the current process */ ++@REQ(socket_cleanup) ++@END + + /* Set a handle information */ + @REQ(set_handle_info) +diff --git a/server/sock.c b/server/sock.c +index 67d6416e..98f8176 100644 +--- a/server/sock.c ++++ b/server/sock.c +@@ -1383,3 +1383,12 @@ DECL_HANDLER(get_socket_info) + + release_object( &sock->obj ); + } ++ ++DECL_HANDLER(socket_cleanup) ++{ ++ unsigned int index = 0; ++ obj_handle_t sock; ++ ++ while ((sock = enumerate_handles(current->process, &sock_ops, &index))) ++ close_handle(current->process, sock); ++} +-- +2.5.1 + diff --git a/patches/ws2_32-WSACleanup/definition b/patches/ws2_32-WSACleanup/definition new file mode 100644 index 00000000..f3dfff71 --- /dev/null +++ b/patches/ws2_32-WSACleanup/definition @@ -0,0 +1 @@ +Fixes: [18670] Properly close sockets when WSACleanup is called