Continue without client authentication if no matching certificate found

This commit is contained in:
Martin Willi
2011-04-14 20:02:12 +02:00
parent 6a8f1a578f
commit 2db8b58f62
+6 -3
View File
@@ -817,13 +817,15 @@ 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);
if (this->peer)
{
cert = this->peer_auth->get(this->peer_auth, AUTH_RULE_SUBJECT_CERT); cert = this->peer_auth->get(this->peer_auth, AUTH_RULE_SUBJECT_CERT);
if (cert) if (cert)
{ {
@@ -850,6 +852,7 @@ static status_t send_certificate(private_tls_peer_t *this,
} }
} }
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);