[LSASRV]
authorEric Kohl <eric.kohl@reactos.org>
Tue, 25 Sep 2012 16:08:00 +0000 (16:08 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Tue, 25 Sep 2012 16:08:00 +0000 (16:08 +0000)
- 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
reactos/dll/win32/lsasrv/lsarpc.c
reactos/dll/win32/lsasrv/lsasrv.h
reactos/dll/win32/lsasrv/policy.c

index faa85ba..268074a 100644 (file)
@@ -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);
index 4c88766..c406cab 100644 (file)
@@ -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:
index 7442977..126d5cb 100644 (file)
@@ -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);
index ecece84..b8bad2e 100644 (file)
@@ -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)