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
7c44544a
Commit
7c44544a
authored
Nov 17, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Nov 18, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Use helper functions to match excluded and permitted subtrees of name constraints.
parent
9a40de08
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
39 deletions
+55
-39
chain.c
dlls/crypt32/chain.c
+55
-39
No files found.
dlls/crypt32/chain.c
View file @
7c44544a
...
...
@@ -720,47 +720,66 @@ static BOOL ip_address_matches(const CRYPT_DATA_BLOB *constraint,
return
match
;
}
static
BOOL
CRYPT_FindMatchingNameEntry
(
const
CERT_ALT_NAME_ENTRY
*
constraint
,
const
CERT_ALT_NAME_
INFO
*
subjectName
,
DWORD
*
trustErrorStatus
)
static
BOOL
alt_name_matches
(
const
CERT_ALT_NAME_ENTRY
*
name
,
const
CERT_ALT_NAME_
ENTRY
*
constraint
,
DWORD
*
trustErrorStatus
)
{
DWORD
i
;
BOOL
match
=
FALSE
;
for
(
i
=
0
;
i
<
subjectName
->
cAltEntry
;
i
++
)
if
(
name
->
dwAltNameChoice
==
constraint
->
dwAltNameChoice
)
{
if
(
subjectName
->
rgAltEntry
[
i
].
dwAltNameChoice
==
constraint
->
dwAltNameChoice
)
switch
(
constraint
->
dwAltNameChoice
)
{
switch
(
constraint
->
dwAltNameChoice
)
{
case
CERT_ALT_NAME_RFC822_NAME
:
match
=
rfc822_name_matches
(
constraint
->
u
.
pwszURL
,
subjectName
->
rgAltEntry
[
i
].
u
.
pwszURL
,
trustErrorStatus
);
break
;
case
CERT_ALT_NAME_DNS_NAME
:
match
=
dns_name_matches
(
constraint
->
u
.
pwszURL
,
subjectName
->
rgAltEntry
[
i
].
u
.
pwszURL
,
trustErrorStatus
);
break
;
case
CERT_ALT_NAME_URL
:
match
=
url_matches
(
constraint
->
u
.
pwszURL
,
subjectName
->
rgAltEntry
[
i
].
u
.
pwszURL
,
trustErrorStatus
);
break
;
case
CERT_ALT_NAME_IP_ADDRESS
:
match
=
ip_address_matches
(
&
constraint
->
u
.
IPAddress
,
&
subjectName
->
rgAltEntry
[
i
].
u
.
IPAddress
,
trustErrorStatus
);
break
;
case
CERT_ALT_NAME_DIRECTORY_NAME
:
default:
ERR
(
"name choice %d unsupported in this context
\n
"
,
constraint
->
dwAltNameChoice
);
*
trustErrorStatus
|=
CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT
;
}
case
CERT_ALT_NAME_RFC822_NAME
:
match
=
rfc822_name_matches
(
constraint
->
u
.
pwszURL
,
name
->
u
.
pwszURL
,
trustErrorStatus
);
break
;
case
CERT_ALT_NAME_DNS_NAME
:
match
=
dns_name_matches
(
constraint
->
u
.
pwszURL
,
name
->
u
.
pwszURL
,
trustErrorStatus
);
break
;
case
CERT_ALT_NAME_URL
:
match
=
url_matches
(
constraint
->
u
.
pwszURL
,
name
->
u
.
pwszURL
,
trustErrorStatus
);
break
;
case
CERT_ALT_NAME_IP_ADDRESS
:
match
=
ip_address_matches
(
&
constraint
->
u
.
IPAddress
,
&
name
->
u
.
IPAddress
,
trustErrorStatus
);
break
;
case
CERT_ALT_NAME_DIRECTORY_NAME
:
default:
ERR
(
"name choice %d unsupported in this context
\n
"
,
constraint
->
dwAltNameChoice
);
*
trustErrorStatus
|=
CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT
;
}
}
return
match
;
}
static
BOOL
alt_name_matches_excluded_name
(
const
CERT_ALT_NAME_ENTRY
*
name
,
const
CERT_NAME_CONSTRAINTS_INFO
*
nameConstraints
,
DWORD
*
trustErrorStatus
)
{
DWORD
i
;
BOOL
match
=
FALSE
;
for
(
i
=
0
;
!
match
&&
i
<
nameConstraints
->
cExcludedSubtree
;
i
++
)
match
=
alt_name_matches
(
name
,
&
nameConstraints
->
rgExcludedSubtree
[
i
].
Base
,
trustErrorStatus
);
return
match
;
}
static
BOOL
alt_name_matches_permitted_name
(
const
CERT_ALT_NAME_ENTRY
*
name
,
const
CERT_NAME_CONSTRAINTS_INFO
*
nameConstraints
,
DWORD
*
trustErrorStatus
)
{
DWORD
i
;
BOOL
match
=
FALSE
;
for
(
i
=
0
;
!
match
&&
i
<
nameConstraints
->
cPermittedSubtree
;
i
++
)
match
=
alt_name_matches
(
name
,
&
nameConstraints
->
rgPermittedSubtree
[
i
].
Base
,
trustErrorStatus
);
return
match
;
}
static
inline
PCERT_EXTENSION
get_subject_alt_name_ext
(
const
CERT_INFO
*
cert
)
{
PCERT_EXTENSION
ext
;
...
...
@@ -791,18 +810,15 @@ static void CRYPT_CheckNameConstraints(
{
DWORD
i
;
for
(
i
=
0
;
i
<
nameConstraints
->
cExcludedSubtree
;
i
++
)
for
(
i
=
0
;
i
<
subjectName
->
cAltEntry
;
i
++
)
{
if
(
CRYPT_FindMatchingNameEntry
(
&
nameConstraints
->
rgExcludedSubtree
[
i
].
Base
,
subjectName
,
if
(
alt_name_matches_excluded_name
(
&
subjectName
->
rgAltEntry
[
i
],
nameConstraints
,
trustErrorStatus
))
*
trustErrorStatus
|=
CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT
;
}
for
(
i
=
0
;
i
<
nameConstraints
->
cPermittedSubtree
;
i
++
)
{
if
(
!
CRYPT_FindMatchingNameEntry
(
&
nameConstraints
->
rgPermittedSubtree
[
i
].
Base
,
subjectName
,
if
(
!
alt_name_matches_permitted_name
(
&
subjectName
->
rgAltEntry
[
i
],
nameConstraints
,
trustErrorStatus
))
*
trustErrorStatus
|=
CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT
;
...
...
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