mirror of
https://github.com/NixOS/nix
synced 2024-10-18 00:16:11 -04:00
Fix "access to path is forbidden"
This commit is contained in:
parent
978b3648df
commit
b3a6b794b0
|
@ -15,6 +15,12 @@ bool FilteringInputAccessor::pathExists(const CanonPath & path)
|
|||
return isAllowed(path) && next->pathExists(prefix / path);
|
||||
}
|
||||
|
||||
SourceAccessor::Stat FilteringInputAccessor::lstat(const CanonPath & path)
|
||||
{
|
||||
checkAccess(path);
|
||||
return next->lstat(prefix / path);
|
||||
}
|
||||
|
||||
std::optional<InputAccessor::Stat> FilteringInputAccessor::maybeLstat(const CanonPath & path)
|
||||
{
|
||||
return isAllowed(path) ? next->maybeLstat(prefix / path) : std::nullopt;
|
||||
|
|
|
@ -33,6 +33,8 @@ struct FilteringInputAccessor : InputAccessor
|
|||
|
||||
bool pathExists(const CanonPath & path) override;
|
||||
|
||||
Stat lstat(const CanonPath & path) override;
|
||||
|
||||
std::optional<Stat> maybeLstat(const CanonPath & path) override;
|
||||
|
||||
DirEntries readDirectory(const CanonPath & path) override;
|
||||
|
|
|
@ -111,7 +111,7 @@ struct SourceAccessor
|
|||
std::optional<uint64_t> narOffset;
|
||||
};
|
||||
|
||||
Stat lstat(const CanonPath & path);
|
||||
virtual Stat lstat(const CanonPath & path);
|
||||
|
||||
virtual std::optional<Stat> maybeLstat(const CanonPath & path) = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue