Commit f8044948 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Remove an unnecessary if.

parent 85852031
...@@ -778,50 +778,43 @@ static void CRYPT_CheckNameConstraints( ...@@ -778,50 +778,43 @@ static void CRYPT_CheckNameConstraints(
const CERT_NAME_CONSTRAINTS_INFO *nameConstraints, const CERT_INFO *cert, const CERT_NAME_CONSTRAINTS_INFO *nameConstraints, const CERT_INFO *cert,
DWORD *trustErrorStatus) DWORD *trustErrorStatus)
{ {
/* If there aren't any existing constraints, don't bother checking */ CERT_EXTENSION *ext = get_subject_alt_name_ext(cert);
if (nameConstraints->cPermittedSubtree || nameConstraints->cExcludedSubtree)
if (ext)
{ {
CERT_EXTENSION *ext = get_subject_alt_name_ext(cert); CERT_ALT_NAME_INFO *subjectName;
DWORD size;
if (ext) if (CryptDecodeObjectEx(X509_ASN_ENCODING, X509_ALTERNATE_NAME,
ext->Value.pbData, ext->Value.cbData,
CRYPT_DECODE_ALLOC_FLAG | CRYPT_DECODE_NOCOPY_FLAG, NULL,
&subjectName, &size))
{ {
CERT_ALT_NAME_INFO *subjectName; DWORD i;
DWORD size;
if (CryptDecodeObjectEx(X509_ASN_ENCODING, X509_ALTERNATE_NAME,
ext->Value.pbData, ext->Value.cbData,
CRYPT_DECODE_ALLOC_FLAG | CRYPT_DECODE_NOCOPY_FLAG, NULL,
&subjectName, &size))
{
DWORD i;
for (i = 0; i < nameConstraints->cExcludedSubtree; i++) for (i = 0; i < nameConstraints->cExcludedSubtree; i++)
CRYPT_FindMatchingNameEntry( CRYPT_FindMatchingNameEntry(
&nameConstraints->rgExcludedSubtree[i].Base, subjectName, &nameConstraints->rgExcludedSubtree[i].Base, subjectName,
trustErrorStatus, trustErrorStatus, CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT, 0);
CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT, 0); for (i = 0; i < nameConstraints->cPermittedSubtree; i++)
for (i = 0; i < nameConstraints->cPermittedSubtree; i++) CRYPT_FindMatchingNameEntry(
CRYPT_FindMatchingNameEntry( &nameConstraints->rgPermittedSubtree[i].Base, subjectName,
&nameConstraints->rgPermittedSubtree[i].Base, subjectName, trustErrorStatus, 0,
trustErrorStatus, 0, CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT);
CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT); LocalFree(subjectName);
LocalFree(subjectName);
}
else
*trustErrorStatus |=
CERT_TRUST_INVALID_EXTENSION |
CERT_TRUST_INVALID_NAME_CONSTRAINTS;
} }
else else
{ *trustErrorStatus |=
if (nameConstraints->cPermittedSubtree) CERT_TRUST_INVALID_EXTENSION | CERT_TRUST_INVALID_NAME_CONSTRAINTS;
*trustErrorStatus |= }
CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT | else
CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT; {
if (nameConstraints->cExcludedSubtree) if (nameConstraints->cPermittedSubtree)
*trustErrorStatus |= *trustErrorStatus |=
CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT; CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT |
} CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT;
if (nameConstraints->cExcludedSubtree)
*trustErrorStatus |= CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment