ws2_32: Manage shorter length for SO_OOBINLINE.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2022-03-09 11:59:43 +03:00 committed by Alexandre Julliard
parent 8a851dd75c
commit e60f009dc7
2 changed files with 11 additions and 2 deletions

View File

@ -1570,7 +1570,9 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl
return 0;
case SO_OOBINLINE:
return server_getsockopt( s, IOCTL_AFD_WINE_GET_SO_OOBINLINE, optval, optlen );
ret = server_getsockopt( s, IOCTL_AFD_WINE_GET_SO_OOBINLINE, optval, optlen );
if (!ret && *optlen < sizeof(DWORD)) *optlen = 1;
return ret;
/* SO_OPENTYPE does not require a valid socket handle. */
case SO_OPENTYPE:
@ -2851,7 +2853,13 @@ int WINAPI setsockopt( SOCKET s, int level, int optname, const char *optval, int
return server_setsockopt( s, IOCTL_AFD_WINE_SET_SO_LINGER, optval, optlen );
case SO_OOBINLINE:
return server_setsockopt( s, IOCTL_AFD_WINE_SET_SO_OOBINLINE, optval, optlen );
if (!optval)
{
SetLastError( WSAEFAULT );
return SOCKET_ERROR;
}
memcpy( &value, optval, min( optlen, sizeof(value) ));
return server_setsockopt( s, IOCTL_AFD_WINE_SET_SO_OOBINLINE, (char *)&value, sizeof(value) );
case SO_RCVBUF:
return server_setsockopt( s, IOCTL_AFD_WINE_SET_SO_RCVBUF, optval, optlen );

View File

@ -1172,6 +1172,7 @@ static void test_set_getsockopt(void)
{AF_INET, SOCK_DGRAM, SOL_SOCKET, SO_BROADCAST, TRUE, {1, 1, 4}, {0, 0xdead0001, 0}, TRUE, TRUE},
{AF_INET, SOCK_STREAM, SOL_SOCKET, SO_DONTLINGER, TRUE, {1, 1, 4}, {0, 0xdead0001, 0}, TRUE, TRUE},
{AF_INET, SOCK_STREAM, SOL_SOCKET, SO_LINGER, FALSE, {1, 2, 4}, {0xdeadbe00, 0xdead0000}, TRUE},
{AF_INET, SOCK_STREAM, SOL_SOCKET, SO_OOBINLINE, TRUE, {1, 1, 4}, {0, 0xdead0001, 0}, TRUE, TRUE},
{AF_INET, SOCK_STREAM, SOL_SOCKET, SO_KEEPALIVE, TRUE, {1, 1, 1}, {0}, TRUE},
{AF_INET, SOCK_STREAM, SOL_SOCKET, SO_DONTROUTE, TRUE, {1, 1, 1}, {0}, TRUE},
{AF_INET, SOCK_STREAM, SOL_SOCKET, SO_RCVTIMEO, FALSE, {1, 2, 4}, {0}, TRUE},