Skip to content

Commit

Permalink
Safer way to handle unlock command of cli_wallet bitshares#1171
Browse files Browse the repository at this point in the history
  • Loading branch information
cogutvalera committed Oct 16, 2018
1 parent c532298 commit 83b6fe2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ LIST(APPEND BOOST_COMPONENTS thread
chrono
unit_test_framework
context
locale)
locale
regex)
SET( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )

IF( WIN32 )
Expand Down
9 changes: 9 additions & 0 deletions programs/cli_wallet/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ int main( int argc, char** argv )
{
try {

const char* regex_secret_name = "regex-secret";
const string regex_secret = "^(unlock|set_password)\\s.*";

boost::program_options::options_description opts;
opts.add_options()
("help,h", "Print this help message and exit.")
Expand All @@ -86,6 +89,7 @@ int main( int argc, char** argv )
("wallet-file,w", bpo::value<string>()->implicit_value("wallet.json"), "wallet to load")
("chain-id", bpo::value<string>(), "chain ID to connect to")
("suggest-brain-key", "Suggest a safe brain key to use for creating your account")
(regex_secret_name, bpo::value<string>()->implicit_value(regex_secret), "Regex to hide secret information")
("version,v", "Display version information");


Expand Down Expand Up @@ -275,6 +279,11 @@ int main( int argc, char** argv )
} );
}

if ( options.count(regex_secret_name) )
wallet_cli->set_regex_secret(options.at(regex_secret_name).as<std::string>());
else
wallet_cli->set_regex_secret(regex_secret);

if( !options.count( "daemon" ) )
{
wallet_cli->register_api( wapi );
Expand Down

0 comments on commit 83b6fe2

Please sign in to comment.