MCPcopy Create free account
hub / github.com/apache/trafficserver / _prep_ssl_ctx

Method _prep_ssl_ctx

src/iocore/net/SSLUtils.cc:1618–1649  ·  view source on GitHub ↗

* Common name resolution and cert validation */

Source from the content-addressed store, hash-verified

1616 * Common name resolution and cert validation
1617 */
1618bool
1619SSLMultiCertConfigLoader::_prep_ssl_ctx(const shared_SSLMultiCertConfigParams &sslMultCertSettings,
1620 SSLMultiCertConfigLoader::CertLoadData &data, std::set<std::string> &common_names,
1621 std::unordered_map<int, std::set<std::string>> &unique_names)
1622{
1623 std::vector<X509 *> cert_list;
1624 const SSLConfigParams *params = this->_params;
1625
1626 SSLCertContextType cert_type;
1627 if (!this->load_certs_and_cross_reference_names(cert_list, data, params, sslMultCertSettings.get(), common_names, unique_names,
1628 &cert_type)) {
1629 return false;
1630 }
1631
1632 int i = 0;
1633 bool good_certs = true;
1634 for (auto const &cert : cert_list) {
1635 const char *current_cert_name = data.cert_names_list[i].c_str();
1636 if (0 > SSLMultiCertConfigLoader::check_server_cert_now(cert, current_cert_name)) {
1637 /* At this point, we know cert is bad, and we've already printed a
1638 descriptive reason as to why cert is bad to the log file */
1639 Dbg(this->_dbg_ctl(), "Marking certificate as NOT VALID: %s", current_cert_name);
1640 good_certs = false;
1641 }
1642 i++;
1643 }
1644
1645 for (auto &cert : cert_list) {
1646 X509_free(cert);
1647 }
1648 return good_certs;
1649}
1650
1651/**
1652 Insert SSLCertContext (SSL_CTX and options) into SSLCertLookup with key.

Callers 2

_store_ssl_ctxMethod · 0.95
update_ssl_ctxMethod · 0.95

Calls 3

getMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected