Continue without client authentication if no matching certificate found
This commit is contained in:
+22
-19
@@ -817,39 +817,42 @@ static status_t send_certificate(private_tls_peer_t *this,
|
|||||||
this->private = find_private_key(this);
|
this->private = find_private_key(this);
|
||||||
if (!this->private)
|
if (!this->private)
|
||||||
{
|
{
|
||||||
DBG1(DBG_TLS, "no TLS peer certificate found for '%Y'", this->peer);
|
DBG1(DBG_TLS, "no TLS peer certificate found for '%Y', "
|
||||||
this->alert->add(this->alert, TLS_FATAL, TLS_INTERNAL_ERROR);
|
"skipping client authentication", this->peer);
|
||||||
return NEED_MORE;
|
this->peer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* generate certificate payload */
|
/* generate certificate payload */
|
||||||
certs = tls_writer_create(256);
|
certs = tls_writer_create(256);
|
||||||
cert = this->peer_auth->get(this->peer_auth, AUTH_RULE_SUBJECT_CERT);
|
if (this->peer)
|
||||||
if (cert)
|
|
||||||
{
|
{
|
||||||
if (cert->get_encoding(cert, CERT_ASN1_DER, &data))
|
cert = this->peer_auth->get(this->peer_auth, AUTH_RULE_SUBJECT_CERT);
|
||||||
{
|
if (cert)
|
||||||
DBG1(DBG_TLS, "sending TLS peer certificate '%Y'",
|
|
||||||
cert->get_subject(cert));
|
|
||||||
certs->write_data24(certs, data);
|
|
||||||
free(data.ptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
enumerator = this->peer_auth->create_enumerator(this->peer_auth);
|
|
||||||
while (enumerator->enumerate(enumerator, &rule, &cert))
|
|
||||||
{
|
|
||||||
if (rule == AUTH_RULE_IM_CERT)
|
|
||||||
{
|
{
|
||||||
if (cert->get_encoding(cert, CERT_ASN1_DER, &data))
|
if (cert->get_encoding(cert, CERT_ASN1_DER, &data))
|
||||||
{
|
{
|
||||||
DBG1(DBG_TLS, "sending TLS intermediate certificate '%Y'",
|
DBG1(DBG_TLS, "sending TLS peer certificate '%Y'",
|
||||||
cert->get_subject(cert));
|
cert->get_subject(cert));
|
||||||
certs->write_data24(certs, data);
|
certs->write_data24(certs, data);
|
||||||
free(data.ptr);
|
free(data.ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
enumerator = this->peer_auth->create_enumerator(this->peer_auth);
|
||||||
|
while (enumerator->enumerate(enumerator, &rule, &cert))
|
||||||
|
{
|
||||||
|
if (rule == AUTH_RULE_IM_CERT)
|
||||||
|
{
|
||||||
|
if (cert->get_encoding(cert, CERT_ASN1_DER, &data))
|
||||||
|
{
|
||||||
|
DBG1(DBG_TLS, "sending TLS intermediate certificate '%Y'",
|
||||||
|
cert->get_subject(cert));
|
||||||
|
certs->write_data24(certs, data);
|
||||||
|
free(data.ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
enumerator->destroy(enumerator);
|
||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
|
||||||
|
|
||||||
writer->write_data24(writer, certs->get_buf(certs));
|
writer->write_data24(writer, certs->get_buf(certs));
|
||||||
certs->destroy(certs);
|
certs->destroy(certs);
|
||||||
|
|||||||
Reference in New Issue
Block a user