Calculate NT and LM hashes of the empty password string and use them as default passwords hashes in new user accounts.

svn path=/trunk/; revision=59083
This commit is contained in:
Eric Kohl 2013-05-26 10:48:54 +00:00
parent c5855337f5
commit 41b3af8267
4 changed files with 64 additions and 9 deletions

View file

@ -2371,8 +2371,8 @@ SamrCreateUserInDomain(IN SAMPR_HANDLE DomainHandle,
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 @@ SamrCreateUserInDomain(IN SAMPR_HANDLE DomainHandle,
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);

View file

@ -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 @@ SamIInitialize(VOID)
TRACE("SamIInitialize() called\n");
Status = SampInitHashes();
if (!NT_SUCCESS(Status))
return Status;
if (SampIsSetupRunning())
{
Status = SampInitializeRegistry();

View file

@ -118,6 +118,8 @@ typedef struct _SAM_USER_FIXED_DATA
extern PGENERIC_MAPPING pServerMapping;
extern ENCRYPTED_NT_OWF_PASSWORD EmptyNtHash;
extern ENCRYPTED_LM_OWF_PASSWORD EmptyLmHash;
/* alias.c */
@ -371,4 +373,17 @@ NTSTATUS
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 */

View file

@ -301,16 +301,16 @@ SampSetupCreateUserAccount(HKEY hDomainKey,
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,