Author: ekohl
Date: Thu Jan 31 20:35:54 2013
New Revision: 58256
URL:
http://svn.reactos.org/svn/reactos?rev=58256&view=rev
Log:
[SAMLIB]
SamSetInformationUser: Add special code for the UserSetPasswordInformation class that
calculates the NT hash of the password and stores it by calling SamrSetInformationUser
using the UserInternal1Information class.
Modified:
trunk/reactos/dll/win32/samlib/samlib.c
Modified: trunk/reactos/dll/win32/samlib/samlib.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samlib/samlib.c?…
==============================================================================
--- trunk/reactos/dll/win32/samlib/samlib.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samlib/samlib.c [iso-8859-1] Thu Jan 31 20:35:54 2013
@@ -31,6 +31,12 @@
WINE_DEFAULT_DEBUG_CHANNEL(samlib);
+
+NTSTATUS
+WINAPI
+SystemFunction007(PUNICODE_STRING string,
+ LPBYTE hash);
+
/* GLOBALS *******************************************************************/
@@ -1594,10 +1600,49 @@
IN USER_INFORMATION_CLASS UserInformationClass,
IN PVOID Buffer)
{
+ PSAMPR_USER_SET_PASSWORD_INFORMATION PasswordBuffer;
+ SAMPR_USER_INTERNAL1_INFORMATION Internal1Buffer;
+
NTSTATUS Status;
TRACE("SamSetInformationUser(%p %lu %p)\n",
UserHandle, UserInformationClass, Buffer);
+
+ if (UserInformationClass == UserSetPasswordInformation)
+ {
+ PasswordBuffer = (PSAMPR_USER_SET_PASSWORD_INFORMATION)Buffer;
+
+ /* Calculate the NT hash value of the passord */
+ Status = SystemFunction007((PUNICODE_STRING)&PasswordBuffer->Password,
+ (LPBYTE)&Internal1Buffer.EncryptedNtOwfPassword);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("SystemFunction007 failed (Status 0x%08lx)\n", Status);
+ return Status;
+ }
+
+ Internal1Buffer.NtPasswordPresent = TRUE;
+ Internal1Buffer.LmPasswordPresent = FALSE;
+ Internal1Buffer.PasswordExpired = PasswordBuffer->PasswordExpired;
+
+ RpcTryExcept
+ {
+ Status = SamrSetInformationUser((SAMPR_HANDLE)UserHandle,
+ UserInternal1Information,
+ (PVOID)&Internal1Buffer);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("SamrSetInformation() failed (Status 0x%08lx)\n", Status);
+ return Status;
+ }
+ }
RpcTryExcept
{