Merge pull request #5491

98fb98f9 wallet_rpc_server: adding missing return on error in set_daemon (moneromooo-monero)
9074c0d8 wallet_rpc_server: return false on error in set_log_categories (moneromooo-monero)
968848a7 wallet_rpc_server: fix crash in validate_address if no wallet is loaded (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2019-05-02 11:30:11 +02:00
commit 52eb454d7b
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD

View File

@ -4069,9 +4069,10 @@ namespace tools
{ cryptonote::TESTNET, "testnet" }, { cryptonote::TESTNET, "testnet" },
{ cryptonote::STAGENET, "stagenet" }, { cryptonote::STAGENET, "stagenet" },
}; };
if (!req.any_net_type && !m_wallet) return not_open(er);
for (const auto &net_type: net_types) for (const auto &net_type: net_types)
{ {
if (!req.any_net_type && net_type.type != m_wallet->nettype()) if (!req.any_net_type && (!m_wallet || net_type.type != m_wallet->nettype()))
continue; continue;
if (req.allow_openalias) if (req.allow_openalias)
{ {
@ -4153,6 +4154,7 @@ namespace tools
{ {
er.code = WALLET_RPC_ERROR_CODE_NO_DAEMON_CONNECTION; er.code = WALLET_RPC_ERROR_CODE_NO_DAEMON_CONNECTION;
er.message = "SSL is enabled but no user certificate or fingerprints were provided"; er.message = "SSL is enabled but no user certificate or fingerprints were provided";
return false;
} }
if (!m_wallet->set_daemon(req.address, boost::none, req.trusted, std::move(ssl_options))) if (!m_wallet->set_daemon(req.address, boost::none, req.trusted, std::move(ssl_options)))
@ -4177,7 +4179,7 @@ namespace tools
{ {
er.code = WALLET_RPC_ERROR_CODE_INVALID_LOG_LEVEL; er.code = WALLET_RPC_ERROR_CODE_INVALID_LOG_LEVEL;
er.message = "Error: log level not valid"; er.message = "Error: log level not valid";
return true; return false;
} }
mlog_set_log_level(req.level); mlog_set_log_level(req.level);
return true; return true;