Zebediah Figura : server: Return STATUS_ADDRESS_ALREADY_ASSOCIATED from IOCTL_AFD_BIND if the socket is already bound.

Alexandre Julliard julliard at winehq.org
Wed Jun 16 16:26:23 CDT 2021


Module: wine
Branch: master
Commit: a997c3980f053159cac5a57e26a1df1a97a1f8c7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a997c3980f053159cac5a57e26a1df1a97a1f8c7

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Tue Jun 15 23:13:31 2021 -0500

server: Return STATUS_ADDRESS_ALREADY_ASSOCIATED from IOCTL_AFD_BIND if the socket is already bound.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ws2_32/tests/afd.c | 2 +-
 server/sock.c           | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/ws2_32/tests/afd.c b/dlls/ws2_32/tests/afd.c
index d4633f7a8bb..eb4f0a42f8d 100644
--- a/dlls/ws2_32/tests/afd.c
+++ b/dlls/ws2_32/tests/afd.c
@@ -1407,7 +1407,7 @@ static void test_bind(void)
 
     ret = NtDeviceIoControlFile((HANDLE)s, event, NULL, NULL, &io, IOCTL_AFD_BIND,
             &params, sizeof(params), &addr, sizeof(addr));
-    todo_wine ok(ret == STATUS_ADDRESS_ALREADY_ASSOCIATED, "got %#x\n", ret);
+    ok(ret == STATUS_ADDRESS_ALREADY_ASSOCIATED, "got %#x\n", ret);
 
     s2 = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
 
diff --git a/server/sock.c b/server/sock.c
index 8cd3475d7b2..6b0c4af6b11 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -2405,6 +2405,12 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
             return 0;
         }
 
+        if (sock->bound)
+        {
+            set_error( STATUS_ADDRESS_ALREADY_ASSOCIATED );
+            return 0;
+        }
+
         unix_len = sockaddr_to_unix( &params->addr, in_size - sizeof(int), &unix_addr );
         if (!unix_len)
         {




More information about the wine-cvs mailing list