From 7483a5ed77d0830e3130f9f93caf0e55af797f53 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Wed, 16 Oct 2013 19:17:09 +0000 Subject: [PATCH] [SAMSRV] Add query and set code of user private data and security descriptor attributes. svn path=/trunk/; revision=60691 --- reactos/dll/win32/samsrv/samrpc.c | 60 +++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/samsrv/samrpc.c b/reactos/dll/win32/samsrv/samrpc.c index d5bcf5c4ba2..3e7780c272b 100644 --- a/reactos/dll/win32/samsrv/samrpc.c +++ b/reactos/dll/win32/samsrv/samrpc.c @@ -6793,7 +6793,14 @@ SampQueryUserAll(PSAM_DB_OBJECT UserObject, if (InfoBuffer->All.WhichFields & USER_ALL_PRIVATEDATA) { - /* FIXME */ + Status = SampGetObjectAttributeString(UserObject, + L"PrivateData", + &InfoBuffer->All.PrivateData); + if (!NT_SUCCESS(Status)) + { + TRACE("Status 0x%08lx\n", Status); + goto done; + } } if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDEXPIRED) @@ -6803,7 +6810,32 @@ SampQueryUserAll(PSAM_DB_OBJECT UserObject, if (InfoBuffer->All.WhichFields & USER_ALL_SECURITYDESCRIPTOR) { - /* FIXME */ + Length = 0; + SampGetObjectAttribute(UserObject, + L"SecDesc", + NULL, + NULL, + &Length); + + if (Length > 0) + { + InfoBuffer->All.SecurityDescriptor.SecurityDescriptor = midl_user_allocate(Length); + if (InfoBuffer->All.SecurityDescriptor.SecurityDescriptor == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + InfoBuffer->All.SecurityDescriptor.Length = Length; + + Status = SampGetObjectAttribute(UserObject, + L"SecDesc", + NULL, + (PVOID)InfoBuffer->All.SecurityDescriptor.SecurityDescriptor, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + } } *Buffer = InfoBuffer; @@ -6852,6 +6884,12 @@ done: if (InfoBuffer->All.NtOwfPassword.Buffer != NULL) midl_user_free(InfoBuffer->All.NtOwfPassword.Buffer); + if (InfoBuffer->All.PrivateData.Buffer != NULL) + midl_user_free(InfoBuffer->All.PrivateData.Buffer); + + if (InfoBuffer->All.SecurityDescriptor.SecurityDescriptor != NULL) + midl_user_free(InfoBuffer->All.SecurityDescriptor.SecurityDescriptor); + midl_user_free(InfoBuffer); } } @@ -7539,6 +7577,15 @@ SampSetUserAll(PSAM_DB_OBJECT UserObject, WriteFixedData = TRUE; } + if (WhichFields & USER_ALL_PRIVATEDATA) + { + Status = SampSetObjectAttributeString(UserObject, + L"PrivateData", + &Buffer->All.PrivateData); + if (!NT_SUCCESS(Status)) + goto done; + } + if (WhichFields & USER_ALL_PASSWORDEXPIRED) { if (Buffer->All.PasswordExpired) @@ -7558,6 +7605,15 @@ SampSetUserAll(PSAM_DB_OBJECT UserObject, WriteFixedData = TRUE; } + if (WhichFields & USER_ALL_SECURITYDESCRIPTOR) + { + Status = SampSetObjectAttribute(UserObject, + L"SecDesc", + REG_BINARY, + Buffer->All.SecurityDescriptor.SecurityDescriptor, + Buffer->All.SecurityDescriptor.Length); + } + if (WriteFixedData == TRUE) { Status = SampSetObjectAttribute(UserObject, -- 2.17.1