diff options
author | luigi1111 <luigi1111w@gmail.com> | 2022-04-06 00:04:32 -0400 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2022-04-06 00:04:32 -0400 |
commit | dd1706cd690067198406bbcfccc5205cac62d2f5 (patch) | |
tree | f0d53c5230d8f678359a263d2779038f8a6d48fc | |
parent | Merge pull request #8190 (diff) | |
parent | support authentication in monero-wallet-rpc set_daemon (diff) | |
download | monero-dd1706cd690067198406bbcfccc5205cac62d2f5.tar.xz |
Merge pull request #8166
41b87b1 support authentication in monero-wallet-rpc set_daemon (woodser)
-rw-r--r-- | src/wallet/wallet_rpc_server.cpp | 6 | ||||
-rw-r--r-- | src/wallet/wallet_rpc_server_commands_defs.h | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index b1f2a3ca2..60375db25 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -4321,7 +4321,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 6d59ce966..f5d2fd4cd 100644 --- a/src/wallet/wallet_rpc_server_commands_defs.h +++ b/src/wallet/wallet_rpc_server_commands_defs.h @@ -48,6 +48,7 @@ // Don't go over 32767 for any of these #define WALLET_RPC_VERSION_MAJOR 1 #define WALLET_RPC_VERSION_MINOR 22 +#define WALLET_RPC_VERSION_MINOR 24 #define MAKE_WALLET_RPC_VERSION(major,minor) (((major)<<16)|(minor)) #define WALLET_RPC_VERSION MAKE_WALLET_RPC_VERSION(WALLET_RPC_VERSION_MAJOR, WALLET_RPC_VERSION_MINOR) namespace tools @@ -2612,6 +2613,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; @@ -2622,6 +2625,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) |