crypt32: Accept a certificate if its name matches any permitted subtree of a name constraint.

This commit is contained in:
Juan Lang 2009-11-17 13:57:25 -08:00 committed by Alexandre Julliard
parent d6f7d06cad
commit c464875a6d
1 changed files with 11 additions and 8 deletions

View File

@ -987,18 +987,21 @@ static void compare_subject_with_constraints(const CERT_NAME_BLOB *subjectName,
*trustErrorStatus |=
CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT;
}
for (i = 0; i < nameConstraints->cPermittedSubtree; i++)
if (nameConstraints->cPermittedSubtree)
{
CERT_ALT_NAME_ENTRY *constraint =
&nameConstraints->rgPermittedSubtree[i].Base;
BOOL match = FALSE;
if (constraint->dwAltNameChoice == CERT_ALT_NAME_DIRECTORY_NAME)
for (i = 0; !match && i < nameConstraints->cPermittedSubtree; i++)
{
if (!directory_name_matches(&constraint->u.DirectoryName,
subjectName))
*trustErrorStatus |=
CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT;
CERT_ALT_NAME_ENTRY *constraint =
&nameConstraints->rgPermittedSubtree[i].Base;
if (constraint->dwAltNameChoice == CERT_ALT_NAME_DIRECTORY_NAME)
match = directory_name_matches(&constraint->u.DirectoryName,
subjectName);
}
if (!match)
*trustErrorStatus |= CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT;
}
}