Commit 12b60492 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

server: Make SO_REUSEADDR and SO_EXCLUSIVEADDRUSE mutually exclusive.

parent d656cb20
......@@ -2353,7 +2353,7 @@ static void test_reuseaddr(void)
value = 1;
rc = setsockopt(s1, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char*)&value, sizeof(value));
todo_wine ok(rc == SOCKET_ERROR && WSAGetLastError() == WSAEINVAL, "got rc %d, error %d.\n", rc, WSAGetLastError());
ok(rc == SOCKET_ERROR && WSAGetLastError() == WSAEINVAL, "got rc %d, error %d.\n", rc, WSAGetLastError());
value = 0;
rc = setsockopt(s1, SOL_SOCKET, SO_REUSEADDR, (char*)&value, sizeof(value));
......@@ -2364,7 +2364,7 @@ static void test_reuseaddr(void)
value = 1;
rc = setsockopt(s1, SOL_SOCKET, SO_REUSEADDR, (char*)&value, sizeof(value));
todo_wine ok(rc == SOCKET_ERROR && WSAGetLastError() == WSAEINVAL, "got rc %d, error %d.\n", rc, WSAGetLastError());
ok(rc == SOCKET_ERROR && WSAGetLastError() == WSAEINVAL, "got rc %d, error %d.\n", rc, WSAGetLastError());
closesocket(s1);
......
......@@ -3091,6 +3091,13 @@ static void sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
}
reuse = *(int *)get_req_data();
if (reuse && sock->exclusiveaddruse)
{
set_error( STATUS_INVALID_PARAMETER );
return;
}
if (is_tcp_socket( sock ))
ret = 0;
else
......@@ -3116,6 +3123,11 @@ static void sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
}
exclusive = *(int *)get_req_data();
if (exclusive && sock->reuseaddr)
{
set_error( STATUS_INVALID_PARAMETER );
return;
}
sock->exclusiveaddruse = !!exclusive;
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment