Author: ekohl
Date: Sun Dec 9 11:34:09 2012
New Revision: 57837
URL:
http://svn.reactos.org/svn/reactos?rev=57837&view=rev
Log:
[LSASRV]
- LsarQueryAuditEvents: Do not fail if the PolAdtEv attribute does not exist and return
proper inormation to the caller.
- Implement LsarSetAuditEvents.
Modified:
trunk/reactos/dll/win32/lsasrv/policy.c
Modified: trunk/reactos/dll/win32/lsasrv/policy.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/policy.c?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/policy.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/policy.c [iso-8859-1] Sun Dec 9 11:34:09 2012
@@ -90,6 +90,7 @@
if (!NT_SUCCESS(Status))
return Status;
+ TRACE("Attribute size: %lu\n", AttributeSize);
if (AttributeSize > 0)
{
AuditData = MIDL_user_allocate(AttributeSize);
@@ -102,14 +103,23 @@
&AttributeSize);
if (!NT_SUCCESS(Status))
goto done;
-
- p = MIDL_user_allocate(sizeof(LSAPR_POLICY_AUDIT_EVENTS_INFO));
- if (p == NULL)
- {
- Status = STATUS_INSUFFICIENT_RESOURCES;
- goto done;
- }
-
+ }
+
+ p = MIDL_user_allocate(sizeof(LSAPR_POLICY_AUDIT_EVENTS_INFO));
+ if (p == NULL)
+ {
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ goto done;
+ }
+
+ if (AuditData == NULL)
+ {
+ p->AuditingMode = FALSE;
+ p->MaximumAuditEventCount = 0;
+ p->EventAuditingOptions = NULL;
+ }
+ else
+ {
p->AuditingMode = AuditData->AuditingMode;
p->MaximumAuditEventCount = AuditData->MaximumAuditEventCount;
@@ -128,19 +138,23 @@
*PolicyInformation = (PLSAPR_POLICY_INFORMATION)p;
done:
- if (!NT_SUCCESS(Status))
- {
- if (p->EventAuditingOptions != NULL)
- MIDL_user_free(p->EventAuditingOptions);
-
+ TRACE("Status: 0x%lx\n", Status);
+
+ if (!NT_SUCCESS(Status))
+ {
if (p != NULL)
+ {
+ if (p->EventAuditingOptions != NULL)
+ MIDL_user_free(p->EventAuditingOptions);
+
MIDL_user_free(p);
+ }
}
if (AuditData != NULL)
MIDL_user_free(AuditData);
- return STATUS_SUCCESS;
+ return Status;
}
@@ -783,8 +797,37 @@
LsarSetAuditEvents(PLSA_DB_OBJECT PolicyObject,
PLSAPR_POLICY_AUDIT_EVENTS_INFO Info)
{
- FIXME("\n");
- return STATUS_NOT_IMPLEMENTED;
+ PLSAP_POLICY_AUDIT_EVENTS_DATA AuditData = NULL;
+ ULONG AttributeSize;
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ TRACE("(%p %p)\n", PolicyObject, Info);
+
+ AttributeSize = sizeof(LSAP_POLICY_AUDIT_EVENTS_DATA) +
+ Info->MaximumAuditEventCount * sizeof(DWORD);
+
+ AuditData = RtlAllocateHeap(RtlGetProcessHeap(),
+ HEAP_ZERO_MEMORY,
+ AttributeSize);
+ if (AuditData == NULL)
+ return STATUS_INSUFFICIENT_RESOURCES;
+
+ AuditData->AuditingMode = Info->AuditingMode;
+ AuditData->MaximumAuditEventCount = Info->MaximumAuditEventCount;
+
+ memcpy(&(AuditData->AuditEvents[0]),
+ Info->EventAuditingOptions,
+ Info->MaximumAuditEventCount * sizeof(DWORD));
+
+ Status = LsapSetObjectAttribute(PolicyObject,
+ L"PolAdtEv",
+ AuditData,
+ AttributeSize);
+
+ if (AuditData != NULL)
+ RtlFreeHeap(RtlGetProcessHeap(), 0, AuditData);
+
+ return Status;
}