ws2_32: Fix the error returned for denied SOCK_RAW attempts.
This commit is contained in:
parent
5762067b20
commit
29aab5df59
|
@ -5937,7 +5937,6 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol,
|
||||||
ERR_(winediag)("Failed to create a socket of type SOCK_RAW, this requires special permissions.\n");
|
ERR_(winediag)("Failed to create a socket of type SOCK_RAW, this requires special permissions.\n");
|
||||||
else
|
else
|
||||||
ERR_(winediag)("Failed to create socket, this requires special permissions.\n");
|
ERR_(winediag)("Failed to create socket, this requires special permissions.\n");
|
||||||
err = WSAESOCKTNOSUPPORT;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -2050,6 +2050,53 @@ todo_wine
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, pi);
|
HeapFree(GetProcessHeap(), 0, pi);
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
/* starting on vista the socket function returns error during the socket
|
||||||
|
creation and no longer in the socket operations (sendto, readfrom) */
|
||||||
|
sock = WSASocketA(AF_INET, SOCK_RAW, IPPROTO_ICMP, NULL, 0, 0);
|
||||||
|
if (sock == INVALID_SOCKET)
|
||||||
|
{
|
||||||
|
err = WSAGetLastError();
|
||||||
|
ok(err == WSAEACCES, "Expected 10013, received %d\n", err);
|
||||||
|
skip("SOCK_RAW is not supported\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trace("SOCK_RAW is supported\n");
|
||||||
|
|
||||||
|
size = sizeof(socktype);
|
||||||
|
socktype = 0xdead;
|
||||||
|
err = getsockopt(sock, SOL_SOCKET, SO_TYPE, (char *) &socktype, &size);
|
||||||
|
ok(!err, "getsockopt failed with %d\n", WSAGetLastError());
|
||||||
|
ok(socktype == SOCK_RAW, "Wrong socket type, expected %d received %d\n",
|
||||||
|
SOCK_RAW, socktype);
|
||||||
|
closesocket(sock);
|
||||||
|
|
||||||
|
todo_wine {
|
||||||
|
sock = WSASocketA(0, 0, IPPROTO_RAW, NULL, 0, 0);
|
||||||
|
ok(sock != INVALID_SOCKET, "Failed to create socket: %d\n",
|
||||||
|
WSAGetLastError());
|
||||||
|
size = sizeof(socktype);
|
||||||
|
socktype = 0xdead;
|
||||||
|
err = getsockopt(sock, SOL_SOCKET, SO_TYPE, (char *) &socktype, &size);
|
||||||
|
ok(!err, "getsockopt failed with %d\n", WSAGetLastError());
|
||||||
|
ok(socktype == SOCK_RAW, "Wrong socket type, expected %d received %d\n",
|
||||||
|
SOCK_RAW, socktype);
|
||||||
|
closesocket(sock);
|
||||||
|
}
|
||||||
|
|
||||||
|
sock = WSASocketA(AF_INET, SOCK_RAW, IPPROTO_TCP, NULL, 0, 0);
|
||||||
|
ok(sock != INVALID_SOCKET, "Failed to create socket: %d\n",
|
||||||
|
WSAGetLastError());
|
||||||
|
size = sizeof(socktype);
|
||||||
|
socktype = 0xdead;
|
||||||
|
err = getsockopt(sock, SOL_SOCKET, SO_TYPE, (char *) &socktype, &size);
|
||||||
|
ok(!err, "getsockopt failed with %d\n", WSAGetLastError());
|
||||||
|
ok(socktype == SOCK_RAW, "Wrong socket type, expected %d received %d\n",
|
||||||
|
SOCK_RAW, socktype);
|
||||||
|
closesocket(sock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_WSADuplicateSocket(void)
|
static void test_WSADuplicateSocket(void)
|
||||||
|
|
Loading…
Reference in New Issue