https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e25cbeba2f4664360374eee78e49871f0e53191e

commit e25cbeba2f4664360374eee78e49871f0e53191e
Author:     Eric Kohl <[email protected]>
AuthorDate: Tue Sep 4 22:42:07 2018 +0200
Commit:     Eric Kohl <[email protected]>
CommitDate: Tue Sep 4 22:42:49 2018 +0200

    [IDL] Implement parts of SamrSetInformationUser.UserInternal2Information
---
 dll/win32/samsrv/samrpc.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/dll/win32/samsrv/samrpc.c b/dll/win32/samsrv/samrpc.c
index 114532cdb6..45c550c499 100644
--- a/dll/win32/samsrv/samrpc.c
+++ b/dll/win32/samsrv/samrpc.c
@@ -7810,6 +7810,59 @@ done:
 }
 
 
+static NTSTATUS
+SampSetUserInternal2(PSAM_DB_OBJECT UserObject,
+                     PSAMPR_USER_INFO_BUFFER Buffer)
+{
+    SAM_USER_FIXED_DATA FixedData;
+    ULONG Length = 0;
+    NTSTATUS Status = STATUS_SUCCESS;
+
+    /* Get the fixed user attributes */
+    Length = sizeof(SAM_USER_FIXED_DATA);
+    Status = SampGetObjectAttribute(UserObject,
+                                    L"F",
+                                    NULL,
+                                    (PVOID)&FixedData,
+                                    &Length);
+    if (!NT_SUCCESS(Status))
+        goto done;
+
+    if ((Buffer->Internal2.Flags & USER_LOGON_SUCCESS) &&
+        ((Buffer->Internal2.Flags & ~USER_LOGON_SUCCESS) == 0))
+    {
+        /* Update the LastLogon time */
+        Status = NtQuerySystemTime(&FixedData.LastLogon);
+        if (!NT_SUCCESS(Status))
+            goto done;
+
+        FixedData.LogonCount++;
+        FixedData.BadPasswordCount = 0;
+    }
+
+    if ((Buffer->Internal2.Flags & USER_LOGON_BAD_PASSWORD) &&
+        ((Buffer->Internal2.Flags & ~USER_LOGON_BAD_PASSWORD) == 0))
+    {
+        /* Update the LastBadPasswordTime */
+        Status = NtQuerySystemTime(&FixedData.LastBadPasswordTime);
+        if (!NT_SUCCESS(Status))
+            goto done;
+
+        FixedData.BadPasswordCount++;
+    }
+
+    /* Set the fixed user attributes */
+    Status = SampSetObjectAttribute(UserObject,
+                                    L"F",
+                                    REG_BINARY,
+                                    &FixedData,
+                                    Length);
+
+done:
+    return Status;
+}
+
+
 static NTSTATUS
 SampSetUserAll(PSAM_DB_OBJECT UserObject,
                PSAMPR_USER_INFO_BUFFER Buffer)
@@ -8095,6 +8148,7 @@ SamrSetInformationUser(IN SAMPR_HANDLE UserHandle,
             break;
 
         case UserAllInformation:
+        case UserInternal2Information:
             DesiredAccess = 0; /* FIXME */
             break;
 
@@ -8220,6 +8274,11 @@ SamrSetInformationUser(IN SAMPR_HANDLE UserHandle,
                                           Buffer);
             break;
 
+        case UserInternal2Information:
+            Status = SampSetUserInternal2(UserObject,
+                                          Buffer);
+            break;
+
         case UserParametersInformation:
             Status = SampSetObjectAttributeString(UserObject,
                                                   L"Parameters",

Reply via email to