| 939 | } |
| 940 | |
| 941 | void |
| 942 | SSLConfigParams::updateCTX(const std::string &cert_secret_name) const |
| 943 | { |
| 944 | Dbg(dbg_ctl_ssl_config_updateCTX, "Update cert %s, %p", cert_secret_name.c_str(), this); |
| 945 | |
| 946 | // Instances of SSLConfigParams should access by one thread at a time only. secret_for_updateCTX is accessed |
| 947 | // atomically as a fail-safe. |
| 948 | // |
| 949 | char const *expected = nullptr; |
| 950 | if (!secret_for_updateCTX.compare_exchange_strong(expected, cert_secret_name.c_str())) { |
| 951 | if (dbg_ctl_ssl_config_updateCTX.on()) { |
| 952 | // As a fail-safe, handle it if secret_for_updateCTX doesn't or no longer points to a null-terminated string. |
| 953 | // |
| 954 | char const *s{expected}; |
| 955 | for (; *s && (static_cast<std::size_t>(s - expected) < cert_secret_name.size()); ++s) {} |
| 956 | DbgPrint(dbg_ctl_ssl_config_updateCTX, "Update cert, indirect recusive call caused by call for %.*s", int(s - expected), |
| 957 | expected); |
| 958 | } |
| 959 | return; |
| 960 | } |
| 961 | |
| 962 | // Clear the corresponding client CTXs. They will be lazy loaded later |
| 963 | Dbg(dbg_ctl_ssl_load, "Update cert %s", cert_secret_name.c_str()); |
| 964 | this->clearCTX(cert_secret_name); |
| 965 | |
| 966 | // Update the server cert |
| 967 | SSLMultiCertConfigLoader loader(this); |
| 968 | loader.update_ssl_ctx(cert_secret_name); |
| 969 | |
| 970 | secret_for_updateCTX = nullptr; |
| 971 | } |
| 972 | |
| 973 | void |
| 974 | SSLConfigParams::clearCTX(const std::string &client_cert) const |
no test coverage detected