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 |= *trustErrorStatus |=
CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT; CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT;
} }
for (i = 0; i < nameConstraints->cPermittedSubtree; i++) if (nameConstraints->cPermittedSubtree)
{
BOOL match = FALSE;
for (i = 0; !match && i < nameConstraints->cPermittedSubtree; i++)
{ {
CERT_ALT_NAME_ENTRY *constraint = CERT_ALT_NAME_ENTRY *constraint =
&nameConstraints->rgPermittedSubtree[i].Base; &nameConstraints->rgPermittedSubtree[i].Base;
if (constraint->dwAltNameChoice == CERT_ALT_NAME_DIRECTORY_NAME) if (constraint->dwAltNameChoice == CERT_ALT_NAME_DIRECTORY_NAME)
{ match = directory_name_matches(&constraint->u.DirectoryName,
if (!directory_name_matches(&constraint->u.DirectoryName, subjectName);
subjectName))
*trustErrorStatus |=
CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT;
} }
if (!match)
*trustErrorStatus |= CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT;
} }
} }