Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SAN failure in Daily build #4201

Merged
merged 3 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .daily_canary
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Canary.
Canary!
43 changes: 24 additions & 19 deletions src/tls/ca.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,34 @@ namespace tls
std::vector<Unique_X509> cas;
bool partial_ok = false;

public:
CA(const std::string& ca_ = "", bool partial_ok = false) :
CA(std::vector<std::string>({ca_}), partial_ok)
{}

CA(
const std::vector<std::string>& ca_strings = {},
bool partial_ok = false) :
partial_ok(partial_ok)
void append_cert(const std::string& ca_string)
{
for (const auto& ca_string : ca_strings)
if (!ca_string.empty())
{
if (!ca_string.empty())
Unique_BIO bio(ca_string.data(), ca_string.size());
Unique_X509 ca;
if (!(ca = Unique_X509(bio, true)))
{
Unique_BIO bio(ca_string.data(), ca_string.size());
Unique_X509 ca;
if (!(ca = Unique_X509(bio, true)))
{
throw std::logic_error(
"Could not parse CA: " + error_string(ERR_get_error()));
}
cas.push_back(std::move(ca));
throw std::logic_error(
"Could not parse CA: " + error_string(ERR_get_error()));
}
cas.push_back(std::move(ca));
}
}

public:
CA(const std::string& ca, bool partial_ok_ = false) :
partial_ok(partial_ok_)
{
append_cert(ca);
}

CA(const std::vector<std::string>& ca_strings, bool partial_ok_ = false) :
partial_ok(partial_ok_)
{
for (const auto& ca_string : ca_strings)
{
append_cert(ca_string);
}
}

Expand Down