diff options
| author | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-07-31 00:13:51 +0200 |
|---|---|---|
| committer | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-07-31 00:13:51 +0200 |
| commit | 3bfb95803ba25a04ddb57ebbc0f25e4dec29d7e0 (patch) | |
| tree | 94fc17899142c1631797b9b6257b04359282741b /Kernel/Sources/User.cxx | |
| parent | 659435af7da4ffb15a309063c892b518707fa9d0 (diff) | |
[IMP] Can now pass arguments to kernel via handover, new version 0x0113.
[IMP] Timeout functions for heap allocation.
[IMP] new mp_ and sched_ category of functions.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel/Sources/User.cxx')
| -rw-r--r-- | Kernel/Sources/User.cxx | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/Kernel/Sources/User.cxx b/Kernel/Sources/User.cxx index 92acba97..49c5cad9 100644 --- a/Kernel/Sources/User.cxx +++ b/Kernel/Sources/User.cxx @@ -15,6 +15,8 @@ #include <KernelKit/FileManager.hpp> #include <KernelKit/ProcessScheduler.hxx> +#include <KernelKit/Heap.hxx> + /// bugs 0 namespace Kernel @@ -77,18 +79,24 @@ namespace Kernel return view; } - Void UserView::LogIn(User* user, const Char* password) noexcept + Bool UserView::LogIn(User* user, const Char* password) noexcept { if (!password || !user) { ErrLocal() = kErrorInvalidData; - return; + kcout << "newoskrnl: Incorrect data given.\r"; + + return false; } FileStreamUTF8 file(kUsersFile, "rb"); + // ------------------------------------------ // + // Retrieve token from a specific file fork. + // ------------------------------------------ // + auto token = file.Read(password); if (!token) @@ -96,9 +104,25 @@ namespace Kernel ErrLocal() = kErrorInvalidCreds; kcout << "newoskrnl: Incorrect credentials.\r"; - return; + return false; + } + else + { + if (rt_string_cmp((Char*)token, const_cast<Char*>(password), rt_string_len(password))) + { + kcout << "newoskrnl: Incorrect credentials.\r"; + + mm_delete_ke_heap(token); + return false; + } + + kcout << "newoskrnl: Correct credentials, moving on.\r"; } + // ------------------------------------------ // + // This was successful, continue. + // ------------------------------------------ // + user->fUserToken = token; if (fCurrentUser) @@ -115,6 +139,8 @@ namespace Kernel fCurrentUser = user; Kernel::kcout << "newoskrnl: logged in as: " << fCurrentUser->Name().CData() << Kernel::endl; + + return true; } Void UserView::LogOff() noexcept |
