From 580872f32da9e743174416aab0c8c62c7b85bb19 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Tue, 25 Sep 2012 16:08:00 +0000 Subject: [PATCH] [LSASRV] - Set the default quota limits when the LSA database is created. - Implement the PolicyDefaultQuotaInformation class of LsarQueryInformationPolicy. svn path=/trunk/; revision=57383 --- reactos/dll/win32/lsasrv/database.c | 15 ++++++++++++++ reactos/dll/win32/lsasrv/lsarpc.c | 6 +++++- reactos/dll/win32/lsasrv/lsasrv.h | 4 ++++ reactos/dll/win32/lsasrv/policy.c | 32 +++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/lsasrv/database.c b/reactos/dll/win32/lsasrv/database.c index faa85ba65a8..268074a91d0 100644 --- a/reactos/dll/win32/lsasrv/database.c +++ b/reactos/dll/win32/lsasrv/database.c @@ -226,10 +226,19 @@ LsapCreateRandomDomainSid(OUT PSID *Sid) static NTSTATUS LsapCreateDatabaseObjects(VOID) { + POLICY_DEFAULT_QUOTA_INFO QuotaInfo; PLSA_DB_OBJECT PolicyObject = NULL; PSID AccountDomainSid = NULL; NTSTATUS Status; + /* Initialize the default quota limits */ + QuotaInfo.QuotaLimits.PagedPoolLimit = 0x2000000; + QuotaInfo.QuotaLimits.NonPagedPoolLimit = 0x100000; + QuotaInfo.QuotaLimits.MinimumWorkingSetSize = 0x10000; + QuotaInfo.QuotaLimits.MaximumWorkingSetSize = 0xF000000; + QuotaInfo.QuotaLimits.PagefileLimit = 0; + QuotaInfo.QuotaLimits.TimeLimit.QuadPart = 0; + /* Create a random domain SID */ Status = LsapCreateRandomDomainSid(&AccountDomainSid); if (!NT_SUCCESS(Status)) @@ -264,6 +273,12 @@ LsapCreateDatabaseObjects(VOID) AccountDomainSid, RtlLengthSid(AccountDomainSid)); + /* Set the default quota limits attribute */ + LsapSetObjectAttribute(PolicyObject, + L"DefQuota", + &QuotaInfo, + sizeof(POLICY_DEFAULT_QUOTA_INFO)); + done: if (PolicyObject != NULL) LsapCloseDbObject(PolicyObject); diff --git a/reactos/dll/win32/lsasrv/lsarpc.c b/reactos/dll/win32/lsasrv/lsarpc.c index 4c8876651b6..c406cab7700 100644 --- a/reactos/dll/win32/lsasrv/lsarpc.c +++ b/reactos/dll/win32/lsasrv/lsarpc.c @@ -248,6 +248,11 @@ NTSTATUS WINAPI LsarQueryInformationPolicy( PolicyInformation); break; + case PolicyDefaultQuotaInformation: /* 8 */ + Status = LsarQueryDefaultQuota(PolicyHandle, + PolicyInformation); + break; + case PolicyDnsDomainInformation: /* 12 (0xc) */ Status = LsarQueryDnsDomain(PolicyHandle, PolicyInformation); @@ -257,7 +262,6 @@ NTSTATUS WINAPI LsarQueryInformationPolicy( case PolicyPdAccountInformation: case PolicyLsaServerRoleInformation: case PolicyReplicaSourceInformation: - case PolicyDefaultQuotaInformation: case PolicyModificationInformation: case PolicyAuditFullSetInformation: case PolicyAuditFullQueryInformation: diff --git a/reactos/dll/win32/lsasrv/lsasrv.h b/reactos/dll/win32/lsasrv/lsasrv.h index 7442977e371..126d5cb7c36 100644 --- a/reactos/dll/win32/lsasrv/lsasrv.h +++ b/reactos/dll/win32/lsasrv/lsasrv.h @@ -113,6 +113,10 @@ NTSTATUS LsarQueryAccountDomain(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation); +NTSTATUS +LsarQueryDefaultQuota(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_INFORMATION *PolicyInformation); + NTSTATUS LsarQueryDnsDomain(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation); diff --git a/reactos/dll/win32/lsasrv/policy.c b/reactos/dll/win32/lsasrv/policy.c index ecece84dfe1..b8bad2e89df 100644 --- a/reactos/dll/win32/lsasrv/policy.c +++ b/reactos/dll/win32/lsasrv/policy.c @@ -357,6 +357,38 @@ Done: } +NTSTATUS +LsarQueryDefaultQuota(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_INFORMATION *PolicyInformation) +{ + PPOLICY_DEFAULT_QUOTA_INFO QuotaInfo = NULL; + ULONG AttributeSize; + NTSTATUS Status; + + *PolicyInformation = NULL; + + AttributeSize = sizeof(POLICY_DEFAULT_QUOTA_INFO); + QuotaInfo = MIDL_user_allocate(AttributeSize); + if (QuotaInfo == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Status = LsapGetObjectAttribute(PolicyObject, + L"DefQuota", + QuotaInfo, + &AttributeSize); + if (!NT_SUCCESS(Status)) + { + MIDL_user_free(QuotaInfo); + } + else + { + *PolicyInformation = (PLSAPR_POLICY_INFORMATION)QuotaInfo; + } + + return Status; +} + + NTSTATUS LsarQueryDnsDomain(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)