-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Safer way to handle unlock command of cli_wallet #1171 #82
Conversation
Please bump editline to latest upstream master. Note: we previously didn't use an editline release version either. Should be ok. |
ok sure ! going to bump now ! Thanks ! |
tested all after bump and it works as expected on my side |
1e4a19c
to
e14b7c6
Compare
src/rpc/cli.cpp
Outdated
namespace fc { namespace rpc { | ||
|
||
static std::string& cli_regex_secret() | ||
{ | ||
static std::string* regex_secret = new std::string(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to use new
operator here. Just let regex_secret be a std::string
and return that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok ! Thanks !
src/rpc/cli.cpp
Outdated
@@ -87,9 +100,11 @@ void cli::run() | |||
{ | |||
break; | |||
} | |||
std::cout << line << "\n"; | |||
|
|||
std::cout << "\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should also be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok ! Thanks !
src/rpc/cli.cpp
Outdated
*/ | ||
static int cli_check_secret(const char *source) | ||
{ | ||
boost::regex expr{cli_regex_secret()}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will re-parse the regex on every invocation. This is inefficient, it should only be parsed once when set_regex_secret
is called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok sure ! Thanks !
a022923
to
4489648
Compare
src/rpc/cli.cpp
Outdated
{ | ||
static std::string* regex_secret = new std::string(); | ||
return *regex_secret; | ||
static boost::regex* regex_expr = new boost::regex(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You still use new
operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boost::regex
must be initialized, it cannot be null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without new
operator we will have SEGFAULT
./programs/cli_wallet/cli_wallet --server-rpc-endpoint=wss://node.bitshares.eu
Logging RPC to file: logs/rpc/rpc.log
687810ms th_a main.cpp:147 main ] key_to_wif( committee_private_key ): 5KCBDTcyDqzsqehcb52tW5nU6pXife6V2rX9Yf7c3saYSzbDZ5W
687811ms th_a main.cpp:151 main ] nathan_pub_key: BTS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
687811ms th_a main.cpp:152 main ] key_to_wif( nathan_private_key ): 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
687814ms th_a main.cpp:199 main ] wdata.ws_server: wss://node.bitshares.eu
688461ms th_a main.cpp:204 main ] wdata.ws_user: wdata.ws_password:
Segmentation fault (core dumped)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to remove the *
as well of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok sure, I will not use pointer
, will fix it now. Thanks !
Thank you ! |
Safer way to handle unlock command of cli_wallet #1171
While issue bitshares/bitshares-core#1171 is hold on and open we need to revert these both PRs to avoid compilation errors
PR for bitshares/bitshares-core#1171