mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-28 18:40:29 +00:00
e8a317023d
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.
40 lines
885 B
C++
40 lines
885 B
C++
/*
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/String.h>
|
|
#include <AK/Trie.h>
|
|
|
|
namespace Kernel {
|
|
|
|
enum UnveilAccess {
|
|
Read = 1,
|
|
Write = 2,
|
|
Execute = 4,
|
|
CreateOrRemove = 8,
|
|
Browse = 16,
|
|
|
|
None = 0,
|
|
};
|
|
|
|
struct UnveilNode;
|
|
|
|
struct UnveilMetadata {
|
|
String full_path;
|
|
UnveilAccess permissions { None };
|
|
bool explicitly_unveiled { false };
|
|
};
|
|
|
|
struct UnveilNode final : public Trie<String, UnveilMetadata, Traits<String>, UnveilNode> {
|
|
using Trie<String, UnveilMetadata, Traits<String>, UnveilNode>::Trie;
|
|
|
|
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; }
|
|
};
|
|
|
|
}
|