diff options
| author | Amlal <amlal.elmahrouss@icloud.com> | 2024-11-02 07:46:45 +0100 |
|---|---|---|
| committer | Amlal <amlal.elmahrouss@icloud.com> | 2024-11-02 07:49:04 +0100 |
| commit | f5e656424dc41ff93c67bcc8139a76d40f525efc (patch) | |
| tree | f701847fb8d2bec8a31c1f24f86afc5f2f338e64 /dev/ZKAKit/src/User.cc | |
| parent | 358379efc79bdda8b5742b82b95c45063184d76f (diff) | |
IMP: minOSKrnl commit 1039.
- KernelKit: New allocation limit in Heap.cc
- KernelKit: Add Matches method for password validation.
- KernelKit: Scheduler and Thread have been improved with new validations on frame.
- META: Ran format command.
- NewKit: Add new Ptr8 type for UInt8* types.
- MBCI: Fix codestyle.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKAKit/src/User.cc')
| -rw-r--r-- | dev/ZKAKit/src/User.cc | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/dev/ZKAKit/src/User.cc b/dev/ZKAKit/src/User.cc index 189d80cf..9ac154f1 100644 --- a/dev/ZKAKit/src/User.cc +++ b/dev/ZKAKit/src/User.cc @@ -17,8 +17,8 @@ #include <KernelKit/UserProcessScheduler.h> #include <KernelKit/Heap.h> -#define kStdUserType (0xCEEF) -#define kSuperUserType (0xECCF) +#define kStdUserType (0xCE) +#define kSuperUserType (0xEC) /// BUGS: 0 @@ -43,7 +43,7 @@ namespace Kernel if (cur_chr == 0) break; - password[i_pass] = cur_chr + (user->IsStdUser() ? kStdUserType : kSuperUserType); + password[i_pass] = cur_chr | (user->IsStdUser() ? kStdUserType : kSuperUserType); } kcout << "Done hashing password!\r"; @@ -67,7 +67,7 @@ namespace Kernel User::~User() = default; - Bool User::TrySave(const UserPublicKey password_to_fill) noexcept + Bool User::Save(const UserPublicKey password_to_fill) noexcept { if (!password_to_fill || *password_to_fill == 0) @@ -103,6 +103,30 @@ namespace Kernel return Yes; } + Bool User::Matches(const UserPublicKey password_to_fill) noexcept + { + Char* password = new Char[len]; + MUST_PASS(password); + + // fill data first, generate hash. + // return false on error. + + rt_copy_memory((VoidPtr)password_to_fill, password, len); + + if (!Detail::cred_construct_token(password, password_to_fill, this, len)) + { + delete[] password; + password = nullptr; + + return No; + } + + kcout << "Validating hashed passwords...\r"; + + // now check if the password matches. + return rt_string_cmp(password, this->fUserToken, rt_string_len(this->fUserToken)) == 0; + } + Bool User::operator==(const User& lhs) { return lhs.fRing == this->fRing; |
