fix#864 fix using boolean

This commit is contained in:
guzzi_jones 2016-07-31 23:36:24 +00:00
commit c7920e1cf8
3 changed files with 19 additions and 8 deletions

View File

@ -60,6 +60,14 @@ namespace tools
} }
password_container::password_container(std::string&& password)
: m_empty(false)
, m_password(std::move(password))
, m_verify(false)
{
}
password_container::password_container(password_container&& rhs) password_container::password_container(password_container&& rhs)
: m_empty(std::move(rhs.m_empty)) : m_empty(std::move(rhs.m_empty))

View File

@ -41,6 +41,7 @@ namespace tools
static const size_t max_password_size = 1024; static const size_t max_password_size = 1024;
password_container(bool verify); password_container(bool verify);
password_container(password_container&& rhs); password_container(password_container&& rhs);
password_container(std::string&& password);
~password_container(); ~password_container();
void clear(); void clear();

View File

@ -468,6 +468,7 @@ bool simple_wallet::set_default_mixin(const std::vector<std::string> &args/* = s
verify=true; verify=true;
tools::password_container pwd_container(verify); tools::password_container pwd_container(verify);
success = pwd_container.read_password(); success = pwd_container.read_password();
if (!success) if (!success)
{ {
@ -882,7 +883,7 @@ bool simple_wallet::ask_wallet_create_if_needed()
bool r; bool r;
if(keys_file_exists) if(keys_file_exists)
{ {
m_wallet_file = wallet_path; m_wallet_file=wallet_path;
r = true; r = true;
}else }else
{ {
@ -1107,7 +1108,7 @@ bool simple_wallet::generate_from_json(const boost::program_options::variables_m
} }
} }
m_wallet_file = field_filename; m_wallet_file=field_filename;
bool was_deprecated_wallet = m_restore_deterministic_wallet && ((old_language == crypto::ElectrumWords::old_language_name) || bool was_deprecated_wallet = m_restore_deterministic_wallet && ((old_language == crypto::ElectrumWords::old_language_name) ||
crypto::ElectrumWords::get_is_old_style_seed(m_electrum_seed)); crypto::ElectrumWords::get_is_old_style_seed(m_electrum_seed));
@ -1335,7 +1336,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
} }
crypto::secret_key viewkey = *reinterpret_cast<const crypto::secret_key*>(viewkey_data.data()); crypto::secret_key viewkey = *reinterpret_cast<const crypto::secret_key*>(viewkey_data.data());
m_wallet_file = m_generate_from_view_key; m_wallet_file= m_generate_from_view_key;
// check the view key matches the given address // check the view key matches the given address
crypto::public_key pkey; crypto::public_key pkey;
@ -1402,7 +1403,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
} }
crypto::secret_key viewkey = *reinterpret_cast<const crypto::secret_key*>(viewkey_data.data()); crypto::secret_key viewkey = *reinterpret_cast<const crypto::secret_key*>(viewkey_data.data());
m_wallet_file = m_generate_from_keys; m_wallet_file=m_generate_from_keys;
// check the spend and view keys match the given address // check the spend and view keys match the given address
crypto::public_key pkey; crypto::public_key pkey;
@ -1564,7 +1565,8 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string
return false; return false;
} }
m_wallet_file = wallet_file;
m_wallet_file=wallet_file;
m_wallet.reset(new tools::wallet2(testnet)); m_wallet.reset(new tools::wallet2(testnet));
m_wallet->callback(this); m_wallet->callback(this);
@ -1623,7 +1625,7 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string
bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string& password, const cryptonote::account_public_address& address, bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string& password, const cryptonote::account_public_address& address,
const crypto::secret_key& viewkey, bool testnet) const crypto::secret_key& viewkey, bool testnet)
{ {
m_wallet_file = wallet_file; m_wallet_file=wallet_file;
m_wallet.reset(new tools::wallet2(testnet)); m_wallet.reset(new tools::wallet2(testnet));
m_wallet->callback(this); m_wallet->callback(this);
@ -1651,7 +1653,7 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string
bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string& password, const cryptonote::account_public_address& address, bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string& password, const cryptonote::account_public_address& address,
const crypto::secret_key& spendkey, const crypto::secret_key& viewkey, bool testnet) const crypto::secret_key& spendkey, const crypto::secret_key& viewkey, bool testnet)
{ {
m_wallet_file = wallet_file; m_wallet_file=wallet_file;
m_wallet.reset(new tools::wallet2(testnet)); m_wallet.reset(new tools::wallet2(testnet));
m_wallet->callback(this); m_wallet->callback(this);
@ -1683,7 +1685,7 @@ bool simple_wallet::open_wallet(const string &wallet_file, const std::string& pa
return false; return false;
} }
m_wallet_file = wallet_file; m_wallet_file=wallet_file;
m_wallet.reset(new tools::wallet2(testnet)); m_wallet.reset(new tools::wallet2(testnet));
m_wallet->callback(this); m_wallet->callback(this);