ladybird/Kernel/FileSystem/InodeMetadata.cpp
Andreas Kling c3351d4b9f Kernel: Make VirtualFileSystem functions take credentials as input
Instead of getting credentials from Process::current(), we now require
that they be provided as input to the various VFS functions.

This ensures that an atomic set of credentials is used throughout an
entire VFS operation.
2022-08-21 16:02:24 +02:00

27 lines
693 B
C++

/*
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/FileSystem/InodeMetadata.h>
#include <Kernel/Process.h>
namespace Kernel {
bool InodeMetadata::may_read(Credentials const& credentials) const
{
return may_read(credentials.euid(), credentials.egid(), credentials.extra_gids());
}
bool InodeMetadata::may_write(Credentials const& credentials) const
{
return may_write(credentials.euid(), credentials.egid(), credentials.extra_gids());
}
bool InodeMetadata::may_execute(Credentials const& credentials) const
{
return may_execute(credentials.euid(), credentials.egid(), credentials.extra_gids());
}
}