aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-04-13 15:42:35 +0200
committerEelco Dolstra <edolstra@gmail.com>2018-04-13 15:42:35 +0200
commitd34fa2bcc3572fafc893755cee19d97aed7ec649 (patch)
tree3e26bf914dcf666546316602f2b4e8ac56c4890c /src/libstore/local-store.cc
parent4fd28bee89a91230ed00fbe842ed51c289f89bd0 (diff)
Fix #1921
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index acc0002ac..b63584f28 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -53,7 +53,6 @@ LocalStore::LocalStore(const Params & params)
, trashDir(realStoreDir + "/trash")
, tempRootsDir(stateDir + "/temproots")
, fnTempRoots(fmt("%s/%d", tempRootsDir, getpid()))
- , publicKeys(getDefaultPublicKeys())
{
auto state(_state.lock());
@@ -964,12 +963,21 @@ void LocalStore::invalidatePath(State & state, const Path & path)
}
+const PublicKeys & LocalStore::getPublicKeys()
+{
+ auto state(_state.lock());
+ if (!state->publicKeys)
+ state->publicKeys = std::make_unique<PublicKeys>(getDefaultPublicKeys());
+ return *state->publicKeys;
+}
+
+
void LocalStore::addToStore(const ValidPathInfo & info, Source & source,
RepairFlag repair, CheckSigsFlag checkSigs, std::shared_ptr<FSAccessor> accessor)
{
assert(info.narHash);
- if (requireSigs && checkSigs && !info.checkSignatures(*this, publicKeys))
+ if (requireSigs && checkSigs && !info.checkSignatures(*this, getPublicKeys()))
throw Error("cannot add path '%s' because it lacks a valid signature", info.path);
addTempRoot(info.path);