[SAMSRV]
authorEric Kohl <eric.kohl@reactos.org>
Sun, 18 Aug 2013 11:33:51 +0000 (11:33 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 18 Aug 2013 11:33:51 +0000 (11:33 +0000)
SampSetUserPassword: Fix check for vaild password hashes.

svn path=/trunk/; revision=59769

reactos/dll/win32/samsrv/user.c

index d2f0918..9c8a651 100644 (file)
@@ -402,12 +402,14 @@ SampSetUserPassword(IN PSAM_DB_OBJECT UserObject,
     NTSTATUS Status;
 
     UseNtPassword =
-       ((memcmp(NtPassword, &EmptyNtHash, sizeof(ENCRYPTED_NT_OWF_PASSWORD)) != 0) &&
-        (NtPasswordPresent != FALSE));
+       ((NtPasswordPresent != FALSE) &&
+        (NtPassword != NULL) &&
+        (memcmp(NtPassword, &EmptyNtHash, sizeof(ENCRYPTED_NT_OWF_PASSWORD)) != 0));
 
     UseLmPassword =
-       ((memcmp(LmPassword, &EmptyLmHash, sizeof(ENCRYPTED_LM_OWF_PASSWORD)) != 0) &&
-        (LmPasswordPresent != FALSE));
+       ((LmPasswordPresent != FALSE) &&
+        (LmPassword != NULL) &&
+        (memcmp(LmPassword, &EmptyLmHash, sizeof(ENCRYPTED_LM_OWF_PASSWORD)) != 0));
 
     /* Update the NT password history only if we have a new non-empty NT password */
     if (UseNtPassword)