mirror of
https://github.com/monero-project/monero.git
synced 2026-04-28 11:53:17 -07:00
Merge pull request #10432
3d2eb0e wallet_rpc_server: fix ssl_allowed_fingerprints hex parsing (selsta)
This commit is contained in:
@@ -4777,10 +4777,25 @@ namespace tools
|
|||||||
ssl_allowed_fingerprints.reserve(req.ssl_allowed_fingerprints.size());
|
ssl_allowed_fingerprints.reserve(req.ssl_allowed_fingerprints.size());
|
||||||
for (const std::string &fp: req.ssl_allowed_fingerprints)
|
for (const std::string &fp: req.ssl_allowed_fingerprints)
|
||||||
{
|
{
|
||||||
ssl_allowed_fingerprints.push_back({});
|
std::vector<uint8_t> decoded;
|
||||||
std::vector<uint8_t> &v = ssl_allowed_fingerprints.back();
|
try
|
||||||
for (auto c: fp)
|
{
|
||||||
v.push_back(c);
|
decoded = epee::from_hex_locale::to_vector(fp);
|
||||||
|
}
|
||||||
|
catch (const std::exception &)
|
||||||
|
{
|
||||||
|
er.code = WALLET_RPC_ERROR_CODE_NO_DAEMON_CONNECTION;
|
||||||
|
er.message = "ssl_allowed_fingerprints[] entries must be hex-encoded SHA-256 values";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (decoded.size() != SSL_FINGERPRINT_SIZE)
|
||||||
|
{
|
||||||
|
er.code = WALLET_RPC_ERROR_CODE_NO_DAEMON_CONNECTION;
|
||||||
|
er.message = "Each ssl_allowed_fingerprints[] entry must decode to exactly " BOOST_PP_STRINGIZE(SSL_FINGERPRINT_SIZE) " bytes";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ssl_allowed_fingerprints.emplace_back(std::move(decoded));
|
||||||
}
|
}
|
||||||
|
|
||||||
epee::net_utils::ssl_options_t ssl_options = epee::net_utils::ssl_support_t::e_ssl_support_enabled;
|
epee::net_utils::ssl_options_t ssl_options = epee::net_utils::ssl_support_t::e_ssl_support_enabled;
|
||||||
|
|||||||
Reference in New Issue
Block a user