Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
0c249e61
Commit
0c249e61
authored
Oct 16, 2020
by
Zebediah Figura
Committed by
Alexandre Julliard
Oct 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Add more tests for passing short buffers to AcceptEx().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2aebe0b6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
7 deletions
+98
-7
sock.c
dlls/ws2_32/tests/sock.c
+98
-7
No files found.
dlls/ws2_32/tests/sock.c
View file @
0c249e61
...
@@ -7334,6 +7334,7 @@ static void test_AcceptEx(void)
...
@@ -7334,6 +7334,7 @@ static void test_AcceptEx(void)
DWORD
dwret
;
DWORD
dwret
;
memset
(
&
overlapped
,
0
,
sizeof
(
overlapped
));
memset
(
&
overlapped
,
0
,
sizeof
(
overlapped
));
overlapped
.
hEvent
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
listener
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
listener
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
ok
(
listener
!=
INVALID_SOCKET
,
"failed to create socket, error %u
\n
"
,
WSAGetLastError
());
ok
(
listener
!=
INVALID_SOCKET
,
"failed to create socket, error %u
\n
"
,
WSAGetLastError
());
...
@@ -7341,9 +7342,6 @@ static void test_AcceptEx(void)
...
@@ -7341,9 +7342,6 @@ static void test_AcceptEx(void)
acceptor
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
acceptor
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
ok
(
acceptor
!=
INVALID_SOCKET
,
"failed to create socket, error %u
\n
"
,
WSAGetLastError
());
ok
(
acceptor
!=
INVALID_SOCKET
,
"failed to create socket, error %u
\n
"
,
WSAGetLastError
());
connector
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
ok
(
connector
!=
INVALID_SOCKET
,
"failed to create socket, error %u
\n
"
,
WSAGetLastError
());
memset
(
&
bindAddress
,
0
,
sizeof
(
bindAddress
));
memset
(
&
bindAddress
,
0
,
sizeof
(
bindAddress
));
bindAddress
.
sin_family
=
AF_INET
;
bindAddress
.
sin_family
=
AF_INET
;
bindAddress
.
sin_addr
.
s_addr
=
inet_addr
(
"127.0.0.1"
);
bindAddress
.
sin_addr
.
s_addr
=
inet_addr
(
"127.0.0.1"
);
...
@@ -7408,8 +7406,101 @@ todo_wine
...
@@ -7408,8 +7406,101 @@ todo_wine
"AcceptEx on too small local address size returned %d + errno %d
\n
"
,
"AcceptEx on too small local address size returned %d + errno %d
\n
"
,
bret
,
WSAGetLastError
());
bret
,
WSAGetLastError
());
ok
(
overlapped
.
Internal
==
STATUS_PENDING
,
"got %08x
\n
"
,
(
ULONG
)
overlapped
.
Internal
);
ok
(
overlapped
.
Internal
==
STATUS_PENDING
,
"got %08x
\n
"
,
(
ULONG
)
overlapped
.
Internal
);
bret
=
CancelIo
((
HANDLE
)
listener
);
ok
(
bret
,
"Failed to cancel pending accept socket
\n
"
);
connector
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
ok
(
connector
!=
-
1
,
"failed to create socket, error %u
\n
"
,
WSAGetLastError
());
iret
=
connect
(
connector
,
(
struct
sockaddr
*
)
&
bindAddress
,
sizeof
(
bindAddress
));
ok
(
!
iret
,
"failed to connect, error %u
\n
"
,
WSAGetLastError
());
iret
=
getsockname
(
connector
,
(
struct
sockaddr
*
)
&
peerAddress
,
&
remoteSize
);
ok
(
!
iret
,
"getsockname failed, error %u
\n
"
,
WSAGetLastError
());
dwret
=
WaitForSingleObject
(
overlapped
.
hEvent
,
1000
);
ok
(
!
dwret
,
"wait failed
\n
"
);
bret
=
GetOverlappedResult
((
HANDLE
)
listener
,
&
overlapped
,
&
bytesReturned
,
FALSE
);
ok
(
bret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
!
(
NTSTATUS
)
overlapped
.
Internal
,
"got %#lx
\n
"
,
overlapped
.
Internal
);
ok
(
!
bytesReturned
,
"got size %u
\n
"
,
bytesReturned
);
readBindAddress
=
readRemoteAddress
=
(
struct
sockaddr_in
*
)
0xdeadbeef
;
localSize
=
remoteSize
=
0xdeadbeef
;
pGetAcceptExSockaddrs
(
buffer
,
0
,
0
,
sizeof
(
struct
sockaddr_in
)
+
16
,
(
struct
sockaddr
**
)
&
readBindAddress
,
&
localSize
,
(
struct
sockaddr
**
)
&
readRemoteAddress
,
&
remoteSize
);
todo_wine
ok
(
readBindAddress
==
(
struct
sockaddr_in
*
)
0xdeadbeef
,
"got local addr %p
\n
"
,
readBindAddress
);
ok
(
!
memcmp
(
readRemoteAddress
,
&
peerAddress
,
sizeof
(
peerAddress
)),
"remote addr didn't match
\n
"
);
todo_wine
ok
(
localSize
==
0xdeadbeef
,
"got local size %u
\n
"
,
localSize
);
ok
(
remoteSize
==
sizeof
(
struct
sockaddr_in
),
"got remote size %u
\n
"
,
remoteSize
);
closesocket
(
connector
);
closesocket
(
acceptor
);
acceptor
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
ok
(
acceptor
!=
-
1
,
"failed to create socket, error %u
\n
"
,
WSAGetLastError
());
overlapped
.
Internal
=
0xdeadbeef
;
bret
=
pAcceptEx
(
listener
,
acceptor
,
buffer
,
0
,
3
,
sizeof
(
struct
sockaddr_in
)
+
16
,
&
bytesReturned
,
&
overlapped
);
ok
(
!
bret
&&
WSAGetLastError
()
==
ERROR_IO_PENDING
,
"got %d, error %u
\n
"
,
bret
,
WSAGetLastError
());
ok
((
NTSTATUS
)
overlapped
.
Internal
==
STATUS_PENDING
,
"got %#lx
\n
"
,
overlapped
.
Internal
);
connector
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
ok
(
connector
!=
-
1
,
"failed to create socket, error %u
\n
"
,
WSAGetLastError
());
iret
=
connect
(
connector
,
(
struct
sockaddr
*
)
&
bindAddress
,
sizeof
(
bindAddress
));
ok
(
!
iret
,
"failed to connect, error %u
\n
"
,
WSAGetLastError
());
dwret
=
WaitForSingleObject
(
overlapped
.
hEvent
,
1000
);
ok
(
!
dwret
,
"wait failed
\n
"
);
bytesReturned
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
bret
=
GetOverlappedResult
((
HANDLE
)
listener
,
&
overlapped
,
&
bytesReturned
,
FALSE
);
todo_wine
ok
(
!
bret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"got error %u
\n
"
,
GetLastError
());
todo_wine
ok
((
NTSTATUS
)
overlapped
.
Internal
==
STATUS_BUFFER_TOO_SMALL
,
"got %#lx
\n
"
,
overlapped
.
Internal
);
ok
(
!
bytesReturned
,
"got size %u
\n
"
,
bytesReturned
);
closesocket
(
acceptor
);
/* The above connection request is not accepted. */
acceptor
=
accept
(
listener
,
NULL
,
NULL
);
todo_wine
ok
(
acceptor
!=
INVALID_SOCKET
,
"failed to accept, error %u
\n
"
,
WSAGetLastError
());
closesocket
(
acceptor
);
closesocket
(
connector
);
acceptor
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
ok
(
acceptor
!=
-
1
,
"failed to create socket, error %u
\n
"
,
WSAGetLastError
());
overlapped
.
Internal
=
0xdeadbeef
;
bret
=
pAcceptEx
(
listener
,
acceptor
,
buffer
,
0
,
sizeof
(
struct
sockaddr_in
)
+
4
,
sizeof
(
struct
sockaddr_in
)
+
16
,
&
bytesReturned
,
&
overlapped
);
ok
(
!
bret
&&
WSAGetLastError
()
==
ERROR_IO_PENDING
,
"got %d, error %u
\n
"
,
bret
,
WSAGetLastError
());
ok
((
NTSTATUS
)
overlapped
.
Internal
==
STATUS_PENDING
,
"got %#lx
\n
"
,
overlapped
.
Internal
);
connector
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
ok
(
connector
!=
-
1
,
"failed to create socket, error %u
\n
"
,
WSAGetLastError
());
iret
=
connect
(
connector
,
(
struct
sockaddr
*
)
&
bindAddress
,
sizeof
(
bindAddress
));
ok
(
!
iret
,
"failed to connect, error %u
\n
"
,
WSAGetLastError
());
dwret
=
WaitForSingleObject
(
overlapped
.
hEvent
,
1000
);
ok
(
!
dwret
,
"wait failed
\n
"
);
bytesReturned
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
bret
=
GetOverlappedResult
((
HANDLE
)
listener
,
&
overlapped
,
&
bytesReturned
,
FALSE
);
todo_wine
ok
(
!
bret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"got error %u
\n
"
,
GetLastError
());
todo_wine
ok
((
NTSTATUS
)
overlapped
.
Internal
==
STATUS_BUFFER_TOO_SMALL
,
"got %#lx
\n
"
,
overlapped
.
Internal
);
ok
(
!
bytesReturned
,
"got size %u
\n
"
,
bytesReturned
);
closesocket
(
acceptor
);
/* The above connection request is not accepted. */
acceptor
=
accept
(
listener
,
NULL
,
NULL
);
todo_wine
ok
(
acceptor
!=
INVALID_SOCKET
,
"failed to accept, error %u
\n
"
,
WSAGetLastError
());
closesocket
(
acceptor
);
closesocket
(
connector
);
acceptor
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
ok
(
acceptor
!=
-
1
,
"failed to create socket, error %u
\n
"
,
WSAGetLastError
());
overlapped
.
Internal
=
0xdeadbeef
;
overlapped
.
Internal
=
0xdeadbeef
;
bret
=
pAcceptEx
(
listener
,
acceptor
,
buffer
,
0
,
sizeof
(
struct
sockaddr_in
)
+
15
,
bret
=
pAcceptEx
(
listener
,
acceptor
,
buffer
,
0
,
sizeof
(
struct
sockaddr_in
)
+
15
,
...
@@ -7447,8 +7538,6 @@ todo_wine
...
@@ -7447,8 +7538,6 @@ todo_wine
ok
(
bret
==
FALSE
&&
WSAGetLastError
()
==
ERROR_INVALID_PARAMETER
,
"AcceptEx on a NULL overlapped "
ok
(
bret
==
FALSE
&&
WSAGetLastError
()
==
ERROR_INVALID_PARAMETER
,
"AcceptEx on a NULL overlapped "
"returned %d + errno %d
\n
"
,
bret
,
WSAGetLastError
());
"returned %d + errno %d
\n
"
,
bret
,
WSAGetLastError
());
overlapped
.
hEvent
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
overlapped
.
Internal
=
0xdeadbeef
;
overlapped
.
Internal
=
0xdeadbeef
;
bret
=
pAcceptEx
(
listener
,
acceptor
,
buffer
,
0
,
bret
=
pAcceptEx
(
listener
,
acceptor
,
buffer
,
0
,
sizeof
(
struct
sockaddr_in
)
+
16
,
sizeof
(
struct
sockaddr_in
)
+
16
,
sizeof
(
struct
sockaddr_in
)
+
16
,
sizeof
(
struct
sockaddr_in
)
+
16
,
...
@@ -7499,6 +7588,8 @@ todo_wine
...
@@ -7499,6 +7588,8 @@ todo_wine
ok
(
overlapped
.
Internal
==
STATUS_PENDING
,
"got %08x
\n
"
,
(
ULONG
)
overlapped
.
Internal
);
ok
(
overlapped
.
Internal
==
STATUS_PENDING
,
"got %08x
\n
"
,
(
ULONG
)
overlapped
.
Internal
);
}
}
connector
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
ok
(
connector
!=
-
1
,
"failed to create socket, error %u
\n
"
,
WSAGetLastError
());
overlapped
.
Internal
=
0xdeadbeef
;
overlapped
.
Internal
=
0xdeadbeef
;
iret
=
connect
(
connector
,
(
struct
sockaddr
*
)
&
bindAddress
,
sizeof
(
bindAddress
));
iret
=
connect
(
connector
,
(
struct
sockaddr
*
)
&
bindAddress
,
sizeof
(
bindAddress
));
ok
(
iret
==
0
,
"connecting to accepting socket failed, error %d
\n
"
,
WSAGetLastError
());
ok
(
iret
==
0
,
"connecting to accepting socket failed, error %d
\n
"
,
WSAGetLastError
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment