Author: ekohl
Date: Sun May 26 10:48:54 2013
New Revision: 59083
URL:
http://svn.reactos.org/svn/reactos?rev=59083&view=rev
Log:
[SAMSRV]
Calculate NT and LM hashes of the empty password string and use them as default passwords
hashes in new user accounts.
Modified:
trunk/reactos/dll/win32/samsrv/samrpc.c
trunk/reactos/dll/win32/samsrv/samsrv.c
trunk/reactos/dll/win32/samsrv/samsrv.h
trunk/reactos/dll/win32/samsrv/setup.c
Modified: trunk/reactos/dll/win32/samsrv/samrpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samrpc.c?…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] Sun May 26 10:48:54 2013
@@ -2371,8 +2371,8 @@
Status = SampSetObjectAttribute(UserObject,
L"LMPwd",
REG_BINARY,
- NULL,
- 0);
+ &EmptyLmHash,
+ sizeof(ENCRYPTED_LM_OWF_PASSWORD));
if (!NT_SUCCESS(Status))
{
TRACE("failed with status 0x%08lx\n", Status);
@@ -2383,8 +2383,8 @@
Status = SampSetObjectAttribute(UserObject,
L"NTPwd",
REG_BINARY,
- NULL,
- 0);
+ &EmptyNtHash,
+ sizeof(ENCRYPTED_NT_OWF_PASSWORD));
if (!NT_SUCCESS(Status))
{
TRACE("failed with status 0x%08lx\n", Status);
Modified: trunk/reactos/dll/win32/samsrv/samsrv.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samsrv.c?…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/samsrv.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samsrv/samsrv.c [iso-8859-1] Sun May 26 10:48:54 2013
@@ -23,7 +23,43 @@
WINE_DEFAULT_DEBUG_CHANNEL(samsrv);
-/* FUNCTIONS ****************************************************************/
+
+/* GLOBALS *******************************************************************/
+
+ENCRYPTED_NT_OWF_PASSWORD EmptyNtHash;
+ENCRYPTED_LM_OWF_PASSWORD EmptyLmHash;
+
+
+/* FUNCTIONS *****************************************************************/
+
+static
+NTSTATUS
+SampInitHashes(VOID)
+{
+ UNICODE_STRING EmptyNtPassword = {0, 0, NULL};
+ CHAR EmptyLmPassword[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
+ NTSTATUS Status;
+
+ /* Calculate the NT hash value of the empty password */
+ Status = SystemFunction007(&EmptyNtPassword,
+ (LPBYTE)&EmptyNtHash);
+ if (!NT_SUCCESS(Status))
+ {
+ ERR("Calculation of the empty NT hash failed (Status 0x%08lx)\n",
Status);
+ return Status;
+ }
+
+ /* Calculate the LM hash value of the empty password */
+ Status = SystemFunction006(EmptyLmPassword,
+ (LPSTR)&EmptyLmHash);
+ if (!NT_SUCCESS(Status))
+ {
+ ERR("Calculation of the empty LM hash failed (Status 0x%08lx)\n",
Status);
+ }
+
+ return Status;
+}
+
NTSTATUS
NTAPI
@@ -70,6 +106,10 @@
TRACE("SamIInitialize() called\n");
+ Status = SampInitHashes();
+ if (!NT_SUCCESS(Status))
+ return Status;
+
if (SampIsSetupRunning())
{
Status = SampInitializeRegistry();
Modified: trunk/reactos/dll/win32/samsrv/samsrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samsrv.h?…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/samsrv.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samsrv/samsrv.h [iso-8859-1] Sun May 26 10:48:54 2013
@@ -118,6 +118,8 @@
extern PGENERIC_MAPPING pServerMapping;
+extern ENCRYPTED_NT_OWF_PASSWORD EmptyNtHash;
+extern ENCRYPTED_LM_OWF_PASSWORD EmptyLmHash;
/* alias.c */
@@ -371,4 +373,17 @@
SampGetRidFromSid(IN PSID Sid,
OUT PULONG Rid);
+
+/* Undocumented advapi32 functions */
+
+NTSTATUS
+WINAPI
+SystemFunction006(LPCSTR password,
+ LPSTR hash);
+
+NTSTATUS
+WINAPI
+SystemFunction007(PUNICODE_STRING string,
+ LPBYTE hash);
+
/* EOF */
Modified: trunk/reactos/dll/win32/samsrv/setup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/setup.c?r…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/setup.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samsrv/setup.c [iso-8859-1] Sun May 26 10:48:54 2013
@@ -301,16 +301,16 @@
L"LMPwd",
0,
REG_BINARY,
- NULL,
- 0);
+ (LPVOID)&EmptyLmHash,
+ sizeof(ENCRYPTED_LM_OWF_PASSWORD));
/* Set NTPwd attribute*/
RegSetValueEx(hAccountKey,
L"NTPwd",
0,
REG_BINARY,
- NULL,
- 0);
+ (LPVOID)&EmptyNtHash,
+ sizeof(ENCRYPTED_NT_OWF_PASSWORD));
/* Set LMPwdHistory attribute*/
RegSetValueEx(hAccountKey,