Merge pull request #97 from cogutvalera/issue_1171_hiding_secret

Safer way to handle secret information of cli_wallet #1171
This commit is contained in:
Peter Conrad 2019-06-05 12:57:54 +02:00 committed by GitHub
commit e2c5160eba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -326,6 +326,15 @@ void cli::getline( const std::string& prompt, std::string& line)
FC_THROW_EXCEPTION( fc::eof_exception, "" );
line = line_read;
// we don't need here to add line in editline's history, cause it will be doubled
if (cli_check_secret(line_read)) {
free(line_read);
el_no_echo = 1;
line_read = readline("Enter password: ");
el_no_echo = 0;
if( line_read == nullptr )
FC_THROW_EXCEPTION( fc::eof_exception, "" );
line = line + ' ' + line_read;
}
free(line_read);
}).wait();
}