diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-22 17:22:16 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-22 17:22:16 +0100 |
| commit | 12b2e32abf385b3feb697c442ee79ed8b71d450b (patch) | |
| tree | 608342ff1203d2c1d4e5828846ae13011f9c2373 /src/kernel/KernelKit/UserMgr+User.h | |
| parent | bc8b05bce61b16daa03a6c4dd0e87f65c608dba3 (diff) | |
[FEAT] Kernel: Hybrid kernel harderning.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/kernel/KernelKit/UserMgr+User.h')
| -rw-r--r-- | src/kernel/KernelKit/UserMgr+User.h | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/src/kernel/KernelKit/UserMgr+User.h b/src/kernel/KernelKit/UserMgr+User.h deleted file mode 100644 index bae51180..00000000 --- a/src/kernel/KernelKit/UserMgr+User.h +++ /dev/null @@ -1,102 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) -// Licensed under the Apache License, Version 2.0 (see LICENSE file) -// Official repository: https://github.com/ne-foss-org/nekernel - -#ifndef KERNELKIT_USERMGR_USER_H -#define KERNELKIT_USERMGR_USER_H - -/* ======================================== - - Revision History: - - 04/03/25: Set users directory as /users/ instead of /usr/ - - ======================================== */ - -#include <CompilerKit/CompilerKit.h> -#include <KernelKit/KPC.h> -#include <NeKit/Config.h> -#include <NeKit/KString.h> - -///! We got the MGMT, STD (%s format) and GUEST users, -///! all are used to make authorized operations. -#define kMgmtUser "NEKERNEL/MGMT/%s" -#define kGuestUser "NEKERNEL/GUEST/%s" -#define kStdUser "NEKERNEL/STD/%s" - -#define kUsersDir "/users/" - -#define kMaxUserNameLen (256U) -#define kMaxUserTokenLen (256U) - -namespace Kernel { - -class User; - -enum struct UserRingKind : Int32 { - kRingInvalid = 0, - kRingStdUser = 444, - kRingSuperUser = 666, - kRingGuestUser = 777, - kRingCount = 3, -}; - -using UserPublicKey = Char*; -using UserPublicKeyType = Char; - -/// @brief System User class. -class User final { - public: - User() = delete; - - User(const Int32& sel, const Char* username); - User(const UserRingKind& kind, const Char* username); - - ~User(); - - public: - NE_COPY_DEFAULT(User) - - public: - bool operator==(const User& lhs); - bool operator!=(const User& lhs); - - public: - /// @brief Get software ring - const UserRingKind& Ring(); - - /// @brief Get user name - Char* Name(); - - /// @brief Is he a standard user? - Bool IsStdUser(); - - /// @brief Is she a super user? - Bool IsSuperUser(); - - /// @brief Saves a password from the public key. - Bool Save(const UserPublicKey password); - - /// @brief Checks if a password matches the **password**. - /// @param password the password to check. - Bool Login(const UserPublicKey password); - - private: - UserRingKind mUserRing{UserRingKind::kRingStdUser}; - Char mUserName[kMaxUserNameLen] = {0}; - UInt64 mUserFNV{0UL}; -}; - -/// \brief Alias for user ptr. -using UserPtr = User*; - -/// \brief Current user pointer. -inline UserPtr kCurrentUser = nullptr; - -/// \brief Supervisor pointer. -inline UserPtr kRootUser = nullptr; - -} // namespace Kernel - -#endif /* ifndef KERNELKIT_USERMGR_USER_H */ |
