Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
6e2efe54
Commit
6e2efe54
authored
Apr 13, 2023
by
Francois Gouget
Committed by
Alexandre Julliard
Apr 13, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnsapi/tests: Test how DnsQuery() handles CNAMEs.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54819
parent
9a3c0082
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
1 deletion
+48
-1
query.c
dlls/dnsapi/tests/query.c
+48
-1
No files found.
dlls/dnsapi/tests/query.c
View file @
6e2efe54
...
@@ -36,8 +36,9 @@ static void test_DnsQuery(void)
...
@@ -36,8 +36,9 @@ static void test_DnsQuery(void)
WCHAR
domain
[
MAX_PATH
];
WCHAR
domain
[
MAX_PATH
];
WCHAR
name
[
NS_MAXDNAME
];
WCHAR
name
[
NS_MAXDNAME
];
DWORD
ret
,
size
;
DWORD
ret
,
size
;
DNS_RECORDW
*
rec
;
DNS_RECORDW
*
rec
,
*
ptr
;
DNS_STATUS
status
;
DNS_STATUS
status
;
WORD
type
;
rec
=
NULL
;
rec
=
NULL
;
status
=
DnsQuery_W
(
L"winehq.org"
,
DNS_TYPE_A
,
DNS_QUERY_STANDARD
,
NULL
,
&
rec
,
NULL
);
status
=
DnsQuery_W
(
L"winehq.org"
,
DNS_TYPE_A
,
DNS_QUERY_STANDARD
,
NULL
,
&
rec
,
NULL
);
...
@@ -49,6 +50,52 @@ static void test_DnsQuery(void)
...
@@ -49,6 +50,52 @@ static void test_DnsQuery(void)
ok
(
status
==
ERROR_SUCCESS
,
"got %ld
\n
"
,
status
);
ok
(
status
==
ERROR_SUCCESS
,
"got %ld
\n
"
,
status
);
DnsRecordListFree
(
rec
,
DnsFreeRecordList
);
DnsRecordListFree
(
rec
,
DnsFreeRecordList
);
/* Show that DNS_TYPE_A returns CNAMEs too */
rec
=
NULL
;
wcscpy
(
domain
,
L"test.winehq.org"
);
/* should be a CNAME */
status
=
DnsQuery_W
(
domain
,
DNS_TYPE_A
,
DNS_QUERY_STANDARD
,
NULL
,
&
rec
,
NULL
);
if
(
status
==
ERROR_TIMEOUT
)
{
skip
(
"query timed out
\n
"
);
return
;
}
ok
(
status
==
ERROR_SUCCESS
,
"got %ld
\n
"
,
status
);
type
=
DNS_TYPE_CNAME
;
/* CNAMEs come first */
for
(
ptr
=
rec
;
ptr
;
ptr
=
ptr
->
pNext
)
{
ok
(
!
wcscmp
(
domain
,
ptr
->
pName
),
"expected record name %s, got %s
\n
"
,
wine_dbgstr_w
(
domain
),
wine_dbgstr_w
(
ptr
->
pName
));
ok
(
type
==
ptr
->
wType
,
"expected record type %d, got %d
\n
"
,
type
,
ptr
->
wType
);
if
(
ptr
->
wType
==
DNS_TYPE_CNAME
)
{
/* CNAME chains are bad practice so assume A for the remainder */
type
=
DNS_TYPE_A
;
wcscpy
(
domain
,
L"winehq.org"
);
ok
(
!
wcscmp
(
domain
,
ptr
->
Data
.
CNAME
.
pNameHost
),
"expected CNAME target %s, got %s
\n
"
,
wine_dbgstr_w
(
domain
),
wine_dbgstr_w
(
ptr
->
Data
.
CNAME
.
pNameHost
));
}
}
DnsRecordListFree
(
rec
,
DnsFreeRecordList
);
/* But DNS_TYPE_CNAME does not return A records! */
rec
=
NULL
;
wcscpy
(
domain
,
L"test.winehq.org"
);
status
=
DnsQuery_W
(
L"test.winehq.org"
,
DNS_TYPE_CNAME
,
DNS_QUERY_STANDARD
,
NULL
,
&
rec
,
NULL
);
if
(
status
==
ERROR_TIMEOUT
)
{
skip
(
"query timed out
\n
"
);
return
;
}
ok
(
status
==
ERROR_SUCCESS
,
"got %ld
\n
"
,
status
);
ptr
=
rec
;
ok
(
!
wcscmp
(
domain
,
ptr
->
pName
),
"expected record name %s, got %s
\n
"
,
wine_dbgstr_w
(
domain
),
wine_dbgstr_w
(
ptr
->
pName
));
ok
(
DNS_TYPE_CNAME
==
ptr
->
wType
,
"expected record type %d, got %d
\n
"
,
DNS_TYPE_CNAME
,
ptr
->
wType
);
if
(
ptr
->
wType
==
DNS_TYPE_CNAME
)
{
wcscpy
(
domain
,
L"winehq.org"
);
ok
(
!
wcscmp
(
domain
,
ptr
->
Data
.
CNAME
.
pNameHost
),
"expected CNAME target %s, got %s
\n
"
,
wine_dbgstr_w
(
domain
),
wine_dbgstr_w
(
ptr
->
Data
.
CNAME
.
pNameHost
));
}
ok
(
ptr
->
pNext
==
NULL
,
"unexpected CNAME chain
\n
"
);
DnsRecordListFree
(
rec
,
DnsFreeRecordList
);
status
=
DnsQuery_W
(
L""
,
DNS_TYPE_SRV
,
DNS_QUERY_STANDARD
,
NULL
,
&
rec
,
NULL
);
status
=
DnsQuery_W
(
L""
,
DNS_TYPE_SRV
,
DNS_QUERY_STANDARD
,
NULL
,
&
rec
,
NULL
);
ok
(
status
==
DNS_ERROR_RCODE_NAME_ERROR
||
status
==
DNS_INFO_NO_RECORDS
||
status
==
ERROR_INVALID_NAME
/* XP */
,
ok
(
status
==
DNS_ERROR_RCODE_NAME_ERROR
||
status
==
DNS_INFO_NO_RECORDS
||
status
==
ERROR_INVALID_NAME
/* XP */
,
"got %ld
\n
"
,
status
);
"got %ld
\n
"
,
status
);
...
...
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