Author: ekohl
Date: Wed Sep 26 22:51:12 2012
New Revision: 57397
URL:
http://svn.reactos.org/svn/reactos?rev=57397&view=rev
Log:
[LSASRV]
- Implement the PolicyDnsDomainInformation class of LsarQueryInformationPolicy and enable
the PolicyModificationInformation class.
- Add required attributes to the initialization code.
Modified:
trunk/reactos/dll/win32/lsasrv/database.c
trunk/reactos/dll/win32/lsasrv/lsarpc.c
trunk/reactos/dll/win32/lsasrv/policy.c
Modified: trunk/reactos/dll/win32/lsasrv/database.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/database.…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/database.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/database.c [iso-8859-1] Wed Sep 26 22:51:12 2012
@@ -231,7 +231,7 @@
POLICY_MODIFICATION_INFO ModificationInfo;
POLICY_AUDIT_FULL_QUERY_INFO AuditFullInfo = {FALSE, FALSE};
POLICY_AUDIT_LOG_INFO AuditLogInfo;
-
+ GUID DnsDomainGuid;
PLSA_DB_OBJECT PolicyObject = NULL;
PSID AccountDomainSid = NULL;
ULONG AuditEventsCount;
@@ -255,6 +255,7 @@
AuditLogInfo.TimeToShutdown.QuadPart = 0; // LARGE_INTEGER
AuditLogInfo.NextAuditRecordId = 0; // DWORD
+ /* Initialize the Audit Events attribute */
AuditEventsCount = AuditCategoryAccountLogon - AuditCategorySystem + 1;
AuditEventsSize = sizeof(LSAP_POLICY_AUDIT_EVENTS_DATA) + AuditEventsCount *
sizeof(DWORD);
AuditEventsInfo = RtlAllocateHeap(RtlGetProcessHeap(),
@@ -268,6 +269,9 @@
for (i = 0; i < AuditEventsCount; i++)
AuditEventsInfo->AuditEvents[i] = 0;
+ /* Initialize the DNS Domain GUID attribute */
+ memset(&DnsDomainGuid, 0, sizeof(GUID));
+
/* Initialize the modification attribute */
ModificationInfo.ModifiedId.QuadPart = 0;
NtQuerySystemTime(&ModificationInfo.DatabaseCreationTime);
@@ -335,6 +339,24 @@
L"PolAdtEv",
&AuditEventsInfo,
AuditEventsSize);
+
+ /* Set the DNS Domain Name attribute */
+ LsapSetObjectAttribute(PolicyObject,
+ L"PolDnDDN",
+ NULL,
+ 0);
+
+ /* Set the DNS Forest Name attribute */
+ LsapSetObjectAttribute(PolicyObject,
+ L"PolDnTrN",
+ NULL,
+ 0);
+
+ /* Set the DNS Domain GUID attribute */
+ LsapSetObjectAttribute(PolicyObject,
+ L"PolDnDmG",
+ &DnsDomainGuid,
+ sizeof(GUID));
done:
if (AuditEventsInfo != NULL)
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] Wed Sep 26 22:51:12 2012
@@ -212,6 +212,7 @@
case PolicyLsaServerRoleInformation:
case PolicyReplicaSourceInformation:
case PolicyDefaultQuotaInformation:
+ case PolicyModificationInformation:
case PolicyDnsDomainInformation:
case PolicyDnsDomainInformationInt:
case PolicyLocalAccountDomainInformation:
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] Wed Sep 26 22:51:12 2012
@@ -612,42 +612,215 @@
PLSAPR_POLICY_INFORMATION *PolicyInformation)
{
PLSAPR_POLICY_DNS_DOMAIN_INFO p = NULL;
+ PUNICODE_STRING DomainName;
+ ULONG AttributeSize;
+ NTSTATUS Status;
+
+ *PolicyInformation = NULL;
p = MIDL_user_allocate(sizeof(LSAPR_POLICY_DNS_DOMAIN_INFO));
if (p == NULL)
return STATUS_INSUFFICIENT_RESOURCES;
- p->Name.Length = 0;
- p->Name.MaximumLength = 0;
- p->Name.Buffer = NULL;
-#if 0
- p->Name.Length = wcslen(L"COMPUTERNAME");
- p->Name.MaximumLength = p->Name.Length + sizeof(WCHAR);
- p->Name.Buffer = MIDL_user_allocate(p->Name.MaximumLength);
+ /* Primary Domain Name */
+ AttributeSize = 0;
+ Status = LsapGetObjectAttribute(PolicyObject,
+ L"PolPrDmN",
+ NULL,
+ &AttributeSize);
+ if (!NT_SUCCESS(Status))
+ {
+ goto done;
+ }
+
+ if (AttributeSize > 0)
+ {
+ DomainName = MIDL_user_allocate(AttributeSize);
+ if (DomainName == NULL)
+ {
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ goto done;
+ }
+
+ Status = LsapGetObjectAttribute(PolicyObject,
+ L"PolPrDmN",
+ DomainName,
+ &AttributeSize);
+ if (Status == STATUS_SUCCESS)
+ {
+ DomainName->Buffer = (LPWSTR)((ULONG_PTR)DomainName +
(ULONG_PTR)DomainName->Buffer);
+
+ TRACE("PrimaryDomainName: %wZ\n", DomainName);
+
+ p->Name.Buffer = MIDL_user_allocate(DomainName->MaximumLength);
if (p->Name.Buffer == NULL)
{
- MIDL_user_free(p);
- return STATUS_INSUFFICIENT_RESOURCES;
+ MIDL_user_free(DomainName);
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ goto done;
}
- wcscpy(p->Name.Buffer, L"COMPUTERNAME");
-#endif
-
- p->DnsDomainName.Length = 0;
- p->DnsDomainName.MaximumLength = 0;
- p->DnsDomainName.Buffer = NULL;
-
- p->DnsForestName.Length = 0;
- p->DnsForestName.MaximumLength = 0;
- p->DnsForestName.Buffer = 0;
-
- memset(&p->DomainGuid, 0, sizeof(GUID));
-
- p->Sid = NULL; /* no domain, no workgroup */
+ p->Name.Length = DomainName->Length;
+ p->Name.MaximumLength = DomainName->MaximumLength;
+ memcpy(p->Name.Buffer,
+ DomainName->Buffer,
+ DomainName->MaximumLength);
+ }
+
+ MIDL_user_free(DomainName);
+ }
+
+ /* Primary Domain SID */
+ AttributeSize = 0;
+ Status = LsapGetObjectAttribute(PolicyObject,
+ L"PolPrDmS",
+ NULL,
+ &AttributeSize);
+ if (!NT_SUCCESS(Status))
+ {
+ goto done;
+ }
+
+ if (AttributeSize > 0)
+ {
+ p->Sid = MIDL_user_allocate(AttributeSize);
+ if (p->Sid == NULL)
+ {
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ goto done;
+ }
+
+ Status = LsapGetObjectAttribute(PolicyObject,
+ L"PolPrDmS",
+ p->Sid,
+ &AttributeSize);
+ }
+
+ /* DNS Domain Name */
+ AttributeSize = 0;
+ Status = LsapGetObjectAttribute(PolicyObject,
+ L"PolDnDDN",
+ NULL,
+ &AttributeSize);
+ if (!NT_SUCCESS(Status))
+ goto done;
+
+ if (AttributeSize > 0)
+ {
+ DomainName = MIDL_user_allocate(AttributeSize);
+ if (DomainName == NULL)
+ {
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ goto done;
+ }
+
+ Status = LsapGetObjectAttribute(PolicyObject,
+ L"PolDnDDN",
+ DomainName,
+ &AttributeSize);
+ if (Status == STATUS_SUCCESS)
+ {
+ DomainName->Buffer = (LPWSTR)((ULONG_PTR)DomainName +
(ULONG_PTR)DomainName->Buffer);
+
+ TRACE("DNS Domain Name: %wZ\n", DomainName);
+
+ p->DnsDomainName.Buffer =
MIDL_user_allocate(DomainName->MaximumLength);
+ if (p->DnsDomainName.Buffer == NULL)
+ {
+ MIDL_user_free(DomainName);
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ goto done;
+ }
+
+ p->DnsDomainName.Length = DomainName->Length;
+ p->DnsDomainName.MaximumLength = DomainName->MaximumLength;
+ memcpy(p->DnsDomainName.Buffer,
+ DomainName->Buffer,
+ DomainName->MaximumLength);
+ }
+
+ MIDL_user_free(DomainName);
+ }
+
+ /* DNS Forest Name */
+ AttributeSize = 0;
+ Status = LsapGetObjectAttribute(PolicyObject,
+ L"PolDnTrN",
+ NULL,
+ &AttributeSize);
+ if (!NT_SUCCESS(Status))
+ goto done;
+
+ if (AttributeSize > 0)
+ {
+ DomainName = MIDL_user_allocate(AttributeSize);
+ if (DomainName == NULL)
+ {
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ goto done;
+ }
+
+ Status = LsapGetObjectAttribute(PolicyObject,
+ L"PolDnTrN",
+ DomainName,
+ &AttributeSize);
+ if (Status == STATUS_SUCCESS)
+ {
+ DomainName->Buffer = (LPWSTR)((ULONG_PTR)DomainName +
(ULONG_PTR)DomainName->Buffer);
+
+ TRACE("DNS Forest Name: %wZ\n", DomainName);
+
+ p->DnsForestName.Buffer =
MIDL_user_allocate(DomainName->MaximumLength);
+ if (p->DnsForestName.Buffer == NULL)
+ {
+ MIDL_user_free(DomainName);
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ goto done;
+ }
+
+ p->DnsForestName.Length = DomainName->Length;
+ p->DnsForestName.MaximumLength = DomainName->MaximumLength;
+ memcpy(p->DnsForestName.Buffer,
+ DomainName->Buffer,
+ DomainName->MaximumLength);
+ }
+
+ MIDL_user_free(DomainName);
+ }
+
+ /* DNS Domain GUID */
+ AttributeSize = sizeof(GUID);
+ Status = LsapGetObjectAttribute(PolicyObject,
+ L"PolDnDmG",
+ &(p->DomainGuid),
+ &AttributeSize);
+ if (!NT_SUCCESS(Status))
+ goto done;
*PolicyInformation = (PLSAPR_POLICY_INFORMATION)p;
- return STATUS_SUCCESS;
+done:
+ if (!NT_SUCCESS(Status))
+ {
+ if (p)
+ {
+ if (p->Name.Buffer)
+ MIDL_user_free(p->Name.Buffer);
+
+ if (p->DnsDomainName.Buffer)
+ MIDL_user_free(p->DnsDomainName.Buffer);
+
+ if (p->DnsForestName.Buffer)
+ MIDL_user_free(p->DnsForestName.Buffer);
+
+ if (p->Sid)
+ MIDL_user_free(p->Sid);
+
+ MIDL_user_free(p);
+ }
+ }
+
+ return Status;
}