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
590c9080
Commit
590c9080
authored
Nov 29, 2016
by
Bruno Jesus
Committed by
Alexandre Julliard
Nov 29, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Add IDN resolution tests for GetAddrInfoW.
Signed-off-by:
Bruno Jesus
<
00cpxxx@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d684831f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
0 deletions
+79
-0
sock.c
dlls/ws2_32/tests/sock.c
+77
-0
ws2tcpip.h
include/ws2tcpip.h
+2
-0
No files found.
dlls/ws2_32/tests/sock.c
View file @
590c9080
...
...
@@ -6811,6 +6811,11 @@ static void test_GetAddrInfoW(void)
ADDRINFOW
*
result
,
*
result2
,
*
p
,
hint
;
WCHAR
name
[
256
];
DWORD
size
=
sizeof
(
name
)
/
sizeof
(
WCHAR
);
/* te su to.winehq.org written in katakana */
static
const
WCHAR
idn_domain
[]
=
{
0x30C6
,
0x30B9
,
0x30C8
,
'.'
,
'w'
,
'i'
,
'n'
,
'e'
,
'h'
,
'q'
,
'.'
,
'o'
,
'r'
,
'g'
,
0
};
static
const
WCHAR
idn_punycode
[]
=
{
'x'
,
'n'
,
'-'
,
'-'
,
'z'
,
'c'
,
'k'
,
'z'
,
'a'
,
'h'
,
'.'
,
'w'
,
'i'
,
'n'
,
'e'
,
'h'
,
'q'
,
'.'
,
'o'
,
'r'
,
'g'
,
0
};
if
(
!
pGetAddrInfoW
||
!
pFreeAddrInfoW
)
{
...
...
@@ -6993,6 +6998,78 @@ static void test_GetAddrInfoW(void)
ok
(
0
,
"test %d: GetAddrInfoW failed with %d (err %d)
\n
"
,
i
,
ret
,
err
);
}
}
/* Test IDN resolution (Internationalized Domain Names) present since Windows 8 */
trace
(
"Testing punycode IDN %s
\n
"
,
wine_dbgstr_w
(
idn_punycode
));
result
=
NULL
;
ret
=
pGetAddrInfoW
(
idn_punycode
,
NULL
,
NULL
,
&
result
);
ok
(
!
ret
,
"got %d expected success
\n
"
,
ret
);
ok
(
result
!=
NULL
,
"got %p
\n
"
,
result
);
pFreeAddrInfoW
(
result
);
hint
.
ai_family
=
AF_INET
;
hint
.
ai_socktype
=
0
;
hint
.
ai_protocol
=
0
;
hint
.
ai_flags
=
0
;
result
=
NULL
;
ret
=
pGetAddrInfoW
(
idn_punycode
,
NULL
,
&
hint
,
&
result
);
ok
(
!
ret
,
"got %d expected success
\n
"
,
ret
);
ok
(
result
!=
NULL
,
"got %p
\n
"
,
result
);
trace
(
"Testing unicode IDN %s
\n
"
,
wine_dbgstr_w
(
idn_domain
));
result2
=
NULL
;
ret
=
pGetAddrInfoW
(
idn_domain
,
NULL
,
NULL
,
&
result2
);
if
(
ret
==
WSAHOST_NOT_FOUND
&&
broken
(
1
))
{
pFreeAddrInfoW
(
result
);
win_skip
(
"IDN resolution not supported in Win <= 7
\n
"
);
return
;
}
todo_wine
{
ok
(
!
ret
,
"got %d expected success
\n
"
,
ret
);
ok
(
result2
!=
NULL
,
"got %p
\n
"
,
result2
);
pFreeAddrInfoW
(
result2
);
hint
.
ai_family
=
AF_INET
;
hint
.
ai_socktype
=
0
;
hint
.
ai_protocol
=
0
;
hint
.
ai_flags
=
0
;
result2
=
NULL
;
ret
=
pGetAddrInfoW
(
idn_domain
,
NULL
,
&
hint
,
&
result2
);
ok
(
!
ret
,
"got %d expected success
\n
"
,
ret
);
ok
(
result2
!=
NULL
,
"got %p
\n
"
,
result2
);
/* ensure manually resolved punycode and unicode hosts result in same data */
compare_addrinfow
(
result
,
result2
);
pFreeAddrInfoW
(
result
);
pFreeAddrInfoW
(
result2
);
hint
.
ai_family
=
AF_INET
;
hint
.
ai_socktype
=
0
;
hint
.
ai_protocol
=
0
;
hint
.
ai_flags
=
0
;
result2
=
NULL
;
ret
=
pGetAddrInfoW
(
idn_domain
,
NULL
,
&
hint
,
&
result2
);
ok
(
!
ret
,
"got %d expected success
\n
"
,
ret
);
ok
(
result2
!=
NULL
,
"got %p
\n
"
,
result2
);
pFreeAddrInfoW
(
result2
);
}
/* Disable IDN resolution and test again*/
hint
.
ai_family
=
AF_INET
;
hint
.
ai_socktype
=
0
;
hint
.
ai_protocol
=
0
;
hint
.
ai_flags
=
AI_DISABLE_IDN_ENCODING
;
SetLastError
(
0xdeadbeef
);
result2
=
NULL
;
ret
=
pGetAddrInfoW
(
idn_domain
,
NULL
,
&
hint
,
&
result2
);
ok
(
ret
==
WSAHOST_NOT_FOUND
,
"got %d expected WSAHOST_NOT_FOUND
\n
"
,
ret
);
ok
(
WSAGetLastError
()
==
WSAHOST_NOT_FOUND
,
"expected 11001, got %d
\n
"
,
WSAGetLastError
());
ok
(
result2
==
NULL
,
"got %p
\n
"
,
result2
);
}
static
void
test_getaddrinfo
(
void
)
...
...
include/ws2tcpip.h
View file @
590c9080
...
...
@@ -69,6 +69,7 @@ typedef ADDRINFOA ADDRINFO, *LPADDRINFO;
# define AI_NON_AUTHORITATIVE 0x00004000
# define AI_SECURE 0x00008000
# define AI_RETURN_PREFERRED_NAMES 0x00010000
# define AI_DISABLE_IDN_ENCODING 0x00080000
/* getaddrinfo error codes */
# define EAI_AGAIN WSATRY_AGAIN
# define EAI_BADFLAGS WSAEINVAL
...
...
@@ -89,6 +90,7 @@ typedef ADDRINFOA ADDRINFO, *LPADDRINFO;
# define WS_AI_NON_AUTHORITATIVE 0x00004000
# define WS_AI_SECURE 0x00008000
# define WS_AI_RETURN_PREFERRED_NAMES 0x00010000
# define WS_AI_DISABLE_IDN_ENCODING 0x00080000
/* getaddrinfo error codes */
# define WS_EAI_AGAIN WSATRY_AGAIN
# define WS_EAI_BADFLAGS WSAEINVAL
...
...
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