Browse Source

Don't trip up when can't change parent directory's permissions to the ideal.

Don't show accounts that we don't have the keys for in AZ.
cl-refactor
Gav Wood 9 years ago
parent
commit
47cd2cfbfa
  1. 2
      alethzero/NatspecHandler.cpp
  2. 2
      libdevcore/CommonIO.cpp
  3. 2
      libdevcore/TransientDirectory.cpp
  4. 4
      libdevcrypto/SecretStore.cpp
  5. 3
      libdevcrypto/SecretStore.h
  6. 7
      libethcore/KeyManager.cpp
  7. 2
      libethereum/BlockChain.cpp
  8. 4
      libethereum/State.cpp
  9. 4
      libethereum/Utility.cpp
  10. 2
      libweb3jsonrpc/WebThreeStubServer.cpp
  11. 2
      libwhisper/WhisperDB.cpp

2
alethzero/NatspecHandler.cpp

@ -38,7 +38,7 @@ NatspecHandler::NatspecHandler()
{
string path = Defaults::dbPath();
fs::create_directories(path);
fs::permissions(path, fs::owner_all);
DEV_IGNORE_EXCEPTIONS(fs::permissions(path, fs::owner_all));
ldb::Options o;
o.create_if_missing = true;
ldb::DB::Open(o, path + "/natspec", &m_db);

2
libdevcore/CommonIO.cpp

@ -128,7 +128,7 @@ void dev::writeFile(std::string const& _file, bytesConstRef _data, bool _writeDe
s.write(reinterpret_cast<char const*>(_data.data()), _data.size());
if (!s)
BOOST_THROW_EXCEPTION(FileError() << errinfo_comment("Could not write to file: " + _file));
fs::permissions(_file, fs::owner_read|fs::owner_write);
DEV_IGNORE_EXCEPTIONS(fs::permissions(_file, fs::owner_read|fs::owner_write));
}
}

2
libdevcore/TransientDirectory.cpp

@ -41,7 +41,7 @@ TransientDirectory::TransientDirectory(std::string const& _path):
BOOST_THROW_EXCEPTION(FileError());
fs::create_directories(m_path);
fs::permissions(m_path, fs::owner_all);
DEV_IGNORE_EXCEPTIONS(fs::permissions(m_path, fs::owner_all));
}
TransientDirectory::~TransientDirectory()

4
libdevcrypto/SecretStore.cpp

@ -148,7 +148,7 @@ void SecretStore::save(string const& _keysPath)
{
fs::path p(_keysPath);
fs::create_directories(p);
fs::permissions(p, fs::owner_all);
DEV_IGNORE_EXCEPTIONS(fs::permissions(p, fs::owner_all));
for (auto& k: m_keys)
{
string uuid = toUUID(k.first);
@ -170,7 +170,7 @@ void SecretStore::load(string const& _keysPath)
{
fs::path p(_keysPath);
fs::create_directories(p);
fs::permissions(p, fs::owner_all);
DEV_IGNORE_EXCEPTIONS(fs::permissions(p, fs::owner_all));
for (fs::directory_iterator it(p); it != fs::directory_iterator(); ++it)
if (fs::is_regular_file(it->path()))
readKey(it->path().string(), true);

3
libdevcrypto/SecretStore.h

@ -70,6 +70,9 @@ public:
/// Returns the uuids of all stored keys.
std::vector<h128> keys() const { return keysOf(m_keys); }
/// @returns true iff we have the given key stored.
bool contains(h128 const& _k) const { return m_keys.count(_k); }
/// Clears all cached decrypted keys. The passwords have to be supplied in order to retrieve
/// secrets again after calling this function.
void clearCache() const;

7
libethcore/KeyManager.cpp

@ -95,8 +95,11 @@ bool KeyManager::load(string const& _pass)
{
h128 uuid(i[1]);
Address addr(i[0]);
m_addrLookup[addr] = uuid;
m_keyInfo[uuid] = KeyInfo(h256(i[2]), string(i[3]));
if (m_store.contains(uuid))
{
m_addrLookup[addr] = uuid;
m_keyInfo[uuid] = KeyInfo(h256(i[2]), string(i[3]));
}
// cdebug << toString(addr) << toString(uuid) << toString((h256)i[2]) << (string)i[3];
}

2
libethereum/BlockChain.cpp

@ -180,7 +180,7 @@ unsigned BlockChain::openDatabase(std::string const& _path, WithExisting _we)
string extrasPath = chainPath + "/" + toString(c_databaseVersion);
fs::create_directories(extrasPath);
fs::permissions(extrasPath, fs::owner_all);
DEV_IGNORE_EXCEPTIONS(fs::permissions(extrasPath, fs::owner_all));
bytes status = contents(extrasPath + "/minor");
unsigned lastMinor = c_minorProtocolVersion;

4
libethereum/State.cpp

@ -47,8 +47,6 @@ namespace fs = boost::filesystem;
#define ctrace clog(StateTrace)
#define ETH_TIMED_ENACTMENTS 0
static const unsigned c_maxSyncTransactions = 256;
const char* StateSafeExceptions::name() { return EthViolet "" EthBlue ""; }
const char* StateDetail::name() { return EthViolet "" EthWhite ""; }
const char* StateTrace::name() { return EthViolet "" EthGray ""; }
@ -85,7 +83,7 @@ OverlayDB State::openDB(std::string const& _basePath, h256 const& _genesisHash,
path += "/" + toHex(_genesisHash.ref().cropped(0, 4)) + "/" + toString(c_databaseVersion);
boost::filesystem::create_directories(path);
fs::permissions(path, fs::owner_all);
DEV_IGNORE_EXCEPTIONS(fs::permissions(path, fs::owner_all));
ldb::Options o;
o.max_open_files = 256;

4
libethereum/Utility.cpp

@ -114,13 +114,13 @@ void dev::eth::upgradeDatabase(std::string const& _basePath, h256 const& _genesi
if (!fs::exists(chainPath + "/blocks"))
{
fs::create_directories(chainPath);
fs::permissions(chainPath, fs::owner_all);
DEV_IGNORE_EXCEPTIONS(fs::permissions(chainPath, fs::owner_all));
fs::rename(path + "/blocks", chainPath + "/blocks");
if (!fs::exists(extrasPath + "/extras"))
{
fs::create_directories(extrasPath);
fs::permissions(extrasPath, fs::owner_all);
DEV_IGNORE_EXCEPTIONS(fs::permissions(extrasPath, fs::owner_all));
fs::rename(path + "/details", extrasPath + "/extras");
fs::rename(path + "/state", extrasPath + "/state");
writeFile(extrasPath + "/minor", rlp(minorProtocolVersion));

2
libweb3jsonrpc/WebThreeStubServer.cpp

@ -59,7 +59,7 @@ WebThreeStubServer::WebThreeStubServer(jsonrpc::AbstractServerConnector& _conn,
{
auto path = getDataDir() + "/.web3";
fs::create_directories(path);
fs::permissions(path, fs::owner_all);
DEV_IGNORE_EXCEPTIONS(fs::permissions(path, fs::owner_all));
ldb::Options o;
o.create_if_missing = true;
ldb::DB::Open(o, path, &m_db);

2
libwhisper/WhisperDB.cpp

@ -34,7 +34,7 @@ WhisperDB::WhisperDB(string const& _type)
m_readOptions.verify_checksums = true;
string path = dev::getDataDir("shh");
fs::create_directories(path);
fs::permissions(path, fs::owner_all);
DEV_IGNORE_EXCEPTIONS(fs::permissions(path, fs::owner_all));
path += "/" + _type;
leveldb::Options op;
op.create_if_missing = true;

Loading…
Cancel
Save