From 0683a941e9d48aac5611e2941abc10d94f12376f Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 30 Sep 2012 22:41:34 +0000 Subject: [PATCH] [LSASRV] - Validate Account SIDs in LsarCreateAccount and LsarOpenAccount. - LsarOpenAccount: Do not check the granted access of the policy handle. - LsarOpenAccount: Return the proper status code. svn path=/trunk/; revision=57448 --- reactos/dll/win32/lsasrv/lsarpc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/reactos/dll/win32/lsasrv/lsarpc.c b/reactos/dll/win32/lsasrv/lsarpc.c index 07ac20c564f..aef0c4b85bb 100644 --- a/reactos/dll/win32/lsasrv/lsarpc.c +++ b/reactos/dll/win32/lsasrv/lsarpc.c @@ -440,6 +440,10 @@ NTSTATUS WINAPI LsarCreateAccount( LPWSTR SidString = NULL; NTSTATUS Status = STATUS_SUCCESS; + /* Validate the AccountSid */ + if (!RtlValidSid(AccountSid)) + return STATUS_INVALID_PARAMETER; + /* Validate the PolicyHandle */ Status = LsapValidateDbObject(PolicyHandle, LsaDbPolicyObject, @@ -842,10 +846,14 @@ NTSTATUS WINAPI LsarOpenAccount( LPWSTR SidString = NULL; NTSTATUS Status = STATUS_SUCCESS; + /* Validate the AccountSid */ + if (!RtlValidSid(AccountSid)) + return STATUS_INVALID_PARAMETER; + /* Validate the PolicyHandle */ Status = LsapValidateDbObject(PolicyHandle, LsaDbPolicyObject, - POLICY_CREATE_ACCOUNT, + 0, &PolicyObject); if (!NT_SUCCESS(Status)) { @@ -861,7 +869,7 @@ NTSTATUS WINAPI LsarOpenAccount( &AccountsObject); if (!NT_SUCCESS(Status)) { - ERR("LsapCreateDbObject (Accounts) failed (Status 0x%08lx)\n", Status); + ERR("LsapOpenDbObject (Accounts) failed (Status 0x%08lx)\n", Status); goto done; } @@ -909,7 +917,7 @@ done: if (AccountsObject != NULL) LsapCloseDbObject(AccountsObject); - return STATUS_SUCCESS; + return Status; } -- 2.17.1