Skip to content

Commit

Permalink
Fix SAN failure in Daily build (#4201)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyashton authored Sep 7, 2022
1 parent 5389dd1 commit 910f89f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
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

0 comments on commit 910f89f

Please sign in to comment.