Author: ekohl
Date: Sun Apr 29 22:09:35 2012
New Revision: 56452
URL:
http://svn.reactos.org/svn/reactos?rev=56452&view=rev
Log:
[LSASRV]
Implement LsarCreateAccount.
Modified:
trunk/reactos/dll/win32/lsasrv/CMakeLists.txt
trunk/reactos/dll/win32/lsasrv/lsarpc.c
trunk/reactos/dll/win32/lsasrv/lsasrv.h
Modified: trunk/reactos/dll/win32/lsasrv/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/CMakeList…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/CMakeLists.txt [iso-8859-1] Sun Apr 29 22:09:35 2012
@@ -27,7 +27,7 @@
set_module_type(lsasrv win32dll ENTRYPOINT 0 UNICODE)
target_link_libraries(lsasrv wine ${PSEH_LIB})
-add_importlibs(lsasrv rpcrt4 msvcrt kernel32 ntdll)
+add_importlibs(lsasrv rpcrt4 msvcrt kernel32 advapi32 ntdll)
add_pch(lsasrv lsasrv.h)
add_dependencies(lsasrv psdk)
add_cd_file(TARGET lsasrv DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/dll/win32/lsasrv/lsarpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsarpc.c?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] Sun Apr 29 22:09:35 2012
@@ -310,8 +310,65 @@
ACCESS_MASK DesiredAccess,
LSAPR_HANDLE *AccountHandle)
{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+ LSAPR_HANDLE AccountsHandle;
+ LSAPR_HANDLE Account;
+ LPWSTR SidString;
+ NTSTATUS Status;
+
+ /* Validate the PolicyHandle */
+ Status = LsapValidateDbObject(PolicyHandle,
+ LsaDbPolicyObject,
+ POLICY_CREATE_ACCOUNT);
+ if (!NT_SUCCESS(Status))
+ {
+ ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
+ return Status;
+ }
+
+ /* Open the Accounts object */
+ AccountsHandle = LsapCreateDbObject(PolicyHandle,
+ L"Accounts",
+ TRUE,
+ LsaDbContainerObject,
+ 0);
+ if (AccountsHandle == NULL)
+ {
+ ERR("LsapCreateDbObject (Accounts) failed\n");
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ /* Create SID string */
+ if (!ConvertSidToStringSid((PSID)AccountSid,
+ &SidString))
+ {
+ ERR("ConvertSidToStringSid failed\n");
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ /* Create the Account object */
+ Account = LsapCreateDbObject(AccountsHandle,
+ SidString,
+ FALSE,
+ LsaDbAccountObject,
+ DesiredAccess);
+ if (Account != NULL)
+ {
+ /* Set the Sid attribute */
+ Status = LsapSetObjectAttribute((PLSA_DB_OBJECT)Account,
+ L"Sid",
+ (PVOID)AccountSid,
+ GetLengthSid(AccountSid));
+ if (NT_SUCCESS(Status))
+ {
+ *AccountHandle = Account;
+ }
+ }
+
+ LocalFree(SidString);
+
+ LsapCloseDbObject(AccountsHandle);
+
+ return STATUS_SUCCESS;
}
Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.h?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] Sun Apr 29 22:09:35 2012
@@ -17,8 +17,8 @@
#include <ndk/rtlfuncs.h>
#include <ndk/setypes.h>
-
#include <ntsecapi.h>
+#include <sddl.h>
#include <string.h>