aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2022-03-02 18:53:34 -0500
committerluigi1111 <luigi1111w@gmail.com>2022-03-02 18:53:34 -0500
commit27f1d43547f09eb806cdc50ec01d2c3b35d19496 (patch)
treea7f80dada3ead0fc3273c1f84ec91afa85b382ef /src
parentMerge pull request #8052 (diff)
parentsupport authentication in monero-wallet-rpc set_daemon (diff)
downloadmonero-27f1d43547f09eb806cdc50ec01d2c3b35d19496.tar.xz
Merge pull request #8145
fb5b2b3 support authentication in monero-wallet-rpc set_daemon (woodser)
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet_rpc_server.cpp6
-rw-r--r--src/wallet/wallet_rpc_server_commands_defs.h4
2 files changed, 9 insertions, 1 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index c3e8166b7..a173b5a50 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -4380,7 +4380,11 @@ namespace tools
return false;
}
- if (!m_wallet->set_daemon(req.address, boost::none, req.trusted, std::move(ssl_options)))
+ boost::optional<epee::net_utils::http::login> daemon_login{};
+ if (!req.username.empty() || !req.password.empty())
+ daemon_login.emplace(req.username, req.password);
+
+ if (!m_wallet->set_daemon(req.address, daemon_login, req.trusted, std::move(ssl_options)))
{
er.code = WALLET_RPC_ERROR_CODE_NO_DAEMON_CONNECTION;
er.message = std::string("Unable to set daemon");
diff --git a/src/wallet/wallet_rpc_server_commands_defs.h b/src/wallet/wallet_rpc_server_commands_defs.h
index 40bcb2c49..867ea54bd 100644
--- a/src/wallet/wallet_rpc_server_commands_defs.h
+++ b/src/wallet/wallet_rpc_server_commands_defs.h
@@ -2657,6 +2657,8 @@ namespace wallet_rpc
struct request_t
{
std::string address;
+ std::string username;
+ std::string password;
bool trusted;
std::string ssl_support; // disabled, enabled, autodetect
std::string ssl_private_key_path;
@@ -2667,6 +2669,8 @@ namespace wallet_rpc
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(address)
+ KV_SERIALIZE(username)
+ KV_SERIALIZE(password)
KV_SERIALIZE_OPT(trusted, false)
KV_SERIALIZE_OPT(ssl_support, (std::string)"autodetect")
KV_SERIALIZE(ssl_private_key_path)