Author: ekohl
Date: Wed Oct 16 19:17:09 2013
New Revision: 60691
URL: 
http://svn.reactos.org/svn/reactos?rev=60691&view=rev
Log:
[SAMSRV]
Add query and set code of user private data and security descriptor attributes.
Modified:
    trunk/reactos/dll/win32/samsrv/samrpc.c
Modified: trunk/reactos/dll/win32/samsrv/samrpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samrpc.c?…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/samrpc.c     [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samsrv/samrpc.c     [iso-8859-1] Wed Oct 16 19:17:09 2013
@@ -6793,17 +6793,49 @@
     if (InfoBuffer->All.WhichFields & USER_ALL_PRIVATEDATA)
     {
+        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)
+    {
         /* FIXME */
     }
-    if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDEXPIRED)
-    {
-        /* FIXME */
-    }
-
     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;
@@ -6851,6 +6883,12 @@
             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 @@
         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)
@@ -7556,6 +7603,15 @@
         }
         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)