mirror of
https://github.com/reactos/reactos.git
synced 2025-05-20 17:45:06 +00:00
[SAMSRV]
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:
parent
c5855337f5
commit
41b3af8267
4 changed files with 64 additions and 9 deletions
|
@ -2371,8 +2371,8 @@ SamrCreateUserInDomain(IN SAMPR_HANDLE DomainHandle,
|
||||||
Status = SampSetObjectAttribute(UserObject,
|
Status = SampSetObjectAttribute(UserObject,
|
||||||
L"LMPwd",
|
L"LMPwd",
|
||||||
REG_BINARY,
|
REG_BINARY,
|
||||||
NULL,
|
&EmptyLmHash,
|
||||||
0);
|
sizeof(ENCRYPTED_LM_OWF_PASSWORD));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
TRACE("failed with status 0x%08lx\n", Status);
|
TRACE("failed with status 0x%08lx\n", Status);
|
||||||
|
@ -2383,8 +2383,8 @@ SamrCreateUserInDomain(IN SAMPR_HANDLE DomainHandle,
|
||||||
Status = SampSetObjectAttribute(UserObject,
|
Status = SampSetObjectAttribute(UserObject,
|
||||||
L"NTPwd",
|
L"NTPwd",
|
||||||
REG_BINARY,
|
REG_BINARY,
|
||||||
NULL,
|
&EmptyNtHash,
|
||||||
0);
|
sizeof(ENCRYPTED_NT_OWF_PASSWORD));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
TRACE("failed with status 0x%08lx\n", Status);
|
TRACE("failed with status 0x%08lx\n", Status);
|
||||||
|
|
|
@ -23,7 +23,43 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(samsrv);
|
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
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -70,6 +106,10 @@ SamIInitialize(VOID)
|
||||||
|
|
||||||
TRACE("SamIInitialize() called\n");
|
TRACE("SamIInitialize() called\n");
|
||||||
|
|
||||||
|
Status = SampInitHashes();
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
return Status;
|
||||||
|
|
||||||
if (SampIsSetupRunning())
|
if (SampIsSetupRunning())
|
||||||
{
|
{
|
||||||
Status = SampInitializeRegistry();
|
Status = SampInitializeRegistry();
|
||||||
|
|
|
@ -118,6 +118,8 @@ typedef struct _SAM_USER_FIXED_DATA
|
||||||
|
|
||||||
|
|
||||||
extern PGENERIC_MAPPING pServerMapping;
|
extern PGENERIC_MAPPING pServerMapping;
|
||||||
|
extern ENCRYPTED_NT_OWF_PASSWORD EmptyNtHash;
|
||||||
|
extern ENCRYPTED_LM_OWF_PASSWORD EmptyLmHash;
|
||||||
|
|
||||||
|
|
||||||
/* alias.c */
|
/* alias.c */
|
||||||
|
@ -371,4 +373,17 @@ NTSTATUS
|
||||||
SampGetRidFromSid(IN PSID Sid,
|
SampGetRidFromSid(IN PSID Sid,
|
||||||
OUT PULONG Rid);
|
OUT PULONG Rid);
|
||||||
|
|
||||||
|
|
||||||
|
/* Undocumented advapi32 functions */
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
WINAPI
|
||||||
|
SystemFunction006(LPCSTR password,
|
||||||
|
LPSTR hash);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
WINAPI
|
||||||
|
SystemFunction007(PUNICODE_STRING string,
|
||||||
|
LPBYTE hash);
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -301,16 +301,16 @@ SampSetupCreateUserAccount(HKEY hDomainKey,
|
||||||
L"LMPwd",
|
L"LMPwd",
|
||||||
0,
|
0,
|
||||||
REG_BINARY,
|
REG_BINARY,
|
||||||
NULL,
|
(LPVOID)&EmptyLmHash,
|
||||||
0);
|
sizeof(ENCRYPTED_LM_OWF_PASSWORD));
|
||||||
|
|
||||||
/* Set NTPwd attribute*/
|
/* Set NTPwd attribute*/
|
||||||
RegSetValueEx(hAccountKey,
|
RegSetValueEx(hAccountKey,
|
||||||
L"NTPwd",
|
L"NTPwd",
|
||||||
0,
|
0,
|
||||||
REG_BINARY,
|
REG_BINARY,
|
||||||
NULL,
|
(LPVOID)&EmptyNtHash,
|
||||||
0);
|
sizeof(ENCRYPTED_NT_OWF_PASSWORD));
|
||||||
|
|
||||||
/* Set LMPwdHistory attribute*/
|
/* Set LMPwdHistory attribute*/
|
||||||
RegSetValueEx(hAccountKey,
|
RegSetValueEx(hAccountKey,
|
||||||
|
|
Loading…
Reference in a new issue