self-signed certificates were not marked by x509_cert.c

This commit is contained in:
Andreas Steffen
2008-03-21 19:07:12 +00:00
parent c081a9bfe6
commit ffce5db1b7
+22 -14
View File
@@ -940,22 +940,27 @@ static bool issued_by(private_x509_cert_t *this, certificate_t *issuer,
bool valid;
x509_t *x509 = (x509_t*)issuer;
if (&this->public.interface.interface == issuer &&
(this->flags & X509_SELF_SIGNED))
if (&this->public.interface.interface == issuer)
{
return TRUE;
if (this->flags & X509_SELF_SIGNED)
{
return TRUE;
}
}
if (issuer->get_type(issuer) != CERT_X509)
else
{
return FALSE;
}
if (!this->issuer->equals(this->issuer, issuer->get_subject(issuer)))
{
return FALSE;
}
if (!(x509->get_flags(x509) & X509_CA))
{
return FALSE;
if (issuer->get_type(issuer) != CERT_X509)
{
return FALSE;
}
if (!this->issuer->equals(this->issuer, issuer->get_subject(issuer)))
{
return FALSE;
}
if (!(x509->get_flags(x509) & X509_CA))
{
return FALSE;
}
}
if (!sigcheck)
{
@@ -1202,7 +1207,10 @@ static private_x509_cert_t *load(chunk_t chunk)
destroy(this);
return NULL;
}
if (issued_by(this, &this->public.interface.interface, FALSE))
/* check if the certificate self-signed */
if (this->subject->equals(this->subject, this->issuer) &&
issued_by(this, &this->public.interface.interface, TRUE))
{
this->flags |= X509_SELF_SIGNED;
}