Fixed some small certificate issues

This commit is contained in:
WolverinDEV 2019-11-22 21:31:58 +01:00
parent 47a8b537ca
commit 41fb8415cd
2 changed files with 5 additions and 2 deletions

View File

@ -167,11 +167,14 @@ bool SSLManager::unregister_context(const std::string &context) {
return true;
}
void SSLManager::unregister_web_contexts() {
void SSLManager::unregister_web_contexts(bool default_as_well) {
{
lock_guard lock{this->context_lock};
decltype(this->contexts) ctxs{this->contexts};
for(auto& [key, _] : ctxs) {
if(key == this->web_ctx_prefix + "default" && !default_as_well)
continue;
(void) _;
if(key.find(this->web_ctx_prefix) == 0) {
this->contexts.erase(key);

View File

@ -36,7 +36,7 @@ namespace ts::ssl {
bool unregister_context(const std::string& /* key */);
bool rename_context(const std::string& /* old key */, const std::string& /* new key */); /* if new already exists it will be dropped */
void unregister_web_contexts();
void unregister_web_contexts(bool /* default certificate as well */);
std::shared_ptr<SSLKeyPair> initializeSSLKey(const std::string &key, const std::string &rsaKey, std::string &error, bool raw = false);
std::shared_ptr<SSLContext> initializeContext(const std::string& key, std::string& privateKey, std::string& certificate, std::string& error, bool raw = false, const std::shared_ptr<SSLGenerator>& = nullptr);