1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

Kernel: Allow unveiling subfolders regardless of parent's permissions

This fixes a bug where unveiling a subdirectory of an already unveiled
path would sometimes be allowed and sometimes not (depending on what
other unveil calls have been made).

Now, it is always allowed to unveil a subdirectory of an already
unveiled directory, even if it has higher permissions.

This removes the need for the permissions_inherited_from_root flag in
UnveilMetadata, so it has been removed.
This commit is contained in:
Max Wipfli 2021-06-06 21:03:19 +02:00 committed by Andreas Kling
parent 9d41dd2ed0
commit e8a317023d
3 changed files with 8 additions and 10 deletions

View file

@ -27,13 +27,11 @@ struct UnveilMetadata {
String full_path;
UnveilAccess permissions { None };
bool explicitly_unveiled { false };
bool unveil_inherited_from_root { false }; // true if permissions are inherited from the tree root (/).
};
struct UnveilNode final : public Trie<String, UnveilMetadata, Traits<String>, UnveilNode> {
using Trie<String, UnveilMetadata, Traits<String>, UnveilNode>::Trie;
bool permissions_inherited_from_root() const { return this->metadata_value().unveil_inherited_from_root; }
bool was_explicitly_unveiled() const { return this->metadata_value().explicitly_unveiled; }
UnveilAccess permissions() const { return this->metadata_value().permissions; }
const String& path() const { return this->metadata_value().full_path; }