[SAMSRV]
authorEric Kohl <eric.kohl@reactos.org>
Sat, 21 May 2016 13:12:53 +0000 (13:12 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 21 May 2016 13:12:53 +0000 (13:12 +0000)
Add LM_OWF_PASSWORD and NT_OWF_PASSWORD types and use them.
See MS-NRPC sections 2.2.1.1.1 to 2.2.1.1.4.

svn path=/trunk/; revision=71364

reactos/dll/win32/samlib/samlib.c
reactos/dll/win32/samsrv/samrpc.c
reactos/sdk/include/reactos/idl/sam.idl

index 167c57c..c0d500b 100644 (file)
@@ -300,10 +300,10 @@ SamChangePasswordUser(IN SAM_HANDLE UserHandle,
                       IN PUNICODE_STRING OldPassword,
                       IN PUNICODE_STRING NewPassword)
 {
-    ENCRYPTED_NT_OWF_PASSWORD OldNtPassword;
-    ENCRYPTED_NT_OWF_PASSWORD NewNtPassword;
-    ENCRYPTED_LM_OWF_PASSWORD OldLmPassword;
-    ENCRYPTED_LM_OWF_PASSWORD NewLmPassword;
+    NT_OWF_PASSWORD OldNtPassword;
+    NT_OWF_PASSWORD NewNtPassword;
+    LM_OWF_PASSWORD OldLmPassword;
+    LM_OWF_PASSWORD NewLmPassword;
     OEM_STRING LmPwdString;
     CHAR LmPwdBuffer[15];
     BOOLEAN OldLmPasswordPresent = FALSE;
@@ -312,8 +312,8 @@ SamChangePasswordUser(IN SAM_HANDLE UserHandle,
 
     ENCRYPTED_LM_OWF_PASSWORD OldLmEncryptedWithNewLm;
     ENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithOldLm;
-    ENCRYPTED_LM_OWF_PASSWORD OldNtEncryptedWithNewNt;
-    ENCRYPTED_LM_OWF_PASSWORD NewNtEncryptedWithOldNt;
+    ENCRYPTED_NT_OWF_PASSWORD OldNtEncryptedWithNewNt;
+    ENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithOldNt;
     PENCRYPTED_LM_OWF_PASSWORD pOldLmEncryptedWithNewLm = NULL;
     PENCRYPTED_LM_OWF_PASSWORD pNewLmEncryptedWithOldLm = NULL;
 
@@ -377,6 +377,7 @@ SamChangePasswordUser(IN SAM_HANDLE UserHandle,
 
     if (OldLmPasswordPresent && NewLmPasswordPresent)
     {
+        /* Encrypt the old LM hash with the new LM hash */
         Status = SystemFunction012((const BYTE *)&OldLmPassword,
                                    (const BYTE *)&NewLmPassword,
                                    (LPBYTE)&OldLmEncryptedWithNewLm);
@@ -386,6 +387,7 @@ SamChangePasswordUser(IN SAM_HANDLE UserHandle,
             return Status;
         }
 
+        /* Encrypt the new LM hash with the old LM hash */
         Status = SystemFunction012((const BYTE *)&NewLmPassword,
                                    (const BYTE *)&OldLmPassword,
                                    (LPBYTE)&NewLmEncryptedWithOldLm);
@@ -399,6 +401,7 @@ SamChangePasswordUser(IN SAM_HANDLE UserHandle,
         pNewLmEncryptedWithOldLm = &NewLmEncryptedWithOldLm;
     }
 
+    /* Encrypt the old NT hash with the new NT hash */
     Status = SystemFunction012((const BYTE *)&OldNtPassword,
                                (const BYTE *)&NewNtPassword,
                                (LPBYTE)&OldNtEncryptedWithNewNt);
@@ -408,6 +411,7 @@ SamChangePasswordUser(IN SAM_HANDLE UserHandle,
         return Status;
     }
 
+    /* Encrypt the new NT hash with the old NT hash */
     Status = SystemFunction012((const BYTE *)&NewNtPassword,
                                (const BYTE *)&OldNtPassword,
                                (LPBYTE)&NewNtEncryptedWithOldNt);
index 5932c3b..9508d48 100644 (file)
@@ -8047,10 +8047,10 @@ SamrChangePasswordUser(IN SAMPR_HANDLE UserHandle,
 {
     ENCRYPTED_LM_OWF_PASSWORD StoredLmPassword;
     ENCRYPTED_NT_OWF_PASSWORD StoredNtPassword;
-    ENCRYPTED_LM_OWF_PASSWORD OldLmPassword;
-    ENCRYPTED_LM_OWF_PASSWORD NewLmPassword;
-    ENCRYPTED_NT_OWF_PASSWORD OldNtPassword;
-    ENCRYPTED_NT_OWF_PASSWORD NewNtPassword;
+    LM_OWF_PASSWORD OldLmPassword;
+    LM_OWF_PASSWORD NewLmPassword;
+    NT_OWF_PASSWORD OldNtPassword;
+    NT_OWF_PASSWORD NewNtPassword;
     BOOLEAN StoredLmPresent = FALSE;
     BOOLEAN StoredNtPresent = FALSE;
     BOOLEAN StoredLmEmpty = TRUE;
index 7111d7f..7322379 100644 (file)
@@ -28,7 +28,10 @@ typedef [context_handle] void *SAMPR_HANDLE;
 typedef struct _ENCRYPTED_LM_OWF_PASSWORD
 {
     char data[16];
-} ENCRYPTED_LM_OWF_PASSWORD, *PENCRYPTED_LM_OWF_PASSWORD, ENCRYPTED_NT_OWF_PASSWORD, *PENCRYPTED_NT_OWF_PASSWORD;
+} LM_OWF_PASSWORD, *PLM_OWF_PASSWORD,
+  NT_OWF_PASSWORD, *PNT_OWF_PASSWORD,
+  ENCRYPTED_LM_OWF_PASSWORD, *PENCRYPTED_LM_OWF_PASSWORD,
+  ENCRYPTED_NT_OWF_PASSWORD, *PENCRYPTED_NT_OWF_PASSWORD;
 
 typedef struct _SAMPR_ULONG_ARRAY
 {