From 2fd4c9a5603bd352be4f18340f279927777b2d8c Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 23 Sep 2011 18:24:33 +0000 Subject: [PATCH] [LSASRV] Initialize required policy attributes when the LSA database is created. This fixes the hanging lsa winetest. svn path=/trunk/; revision=53817 --- reactos/dll/win32/lsasrv/database.c | 72 +++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/lsasrv/database.c b/reactos/dll/win32/lsasrv/database.c index d58d07b8ac6..781b90f6c55 100644 --- a/reactos/dll/win32/lsasrv/database.c +++ b/reactos/dll/win32/lsasrv/database.c @@ -76,7 +76,7 @@ LsapIsDatabaseInstalled(VOID) static NTSTATUS -LsapInstallDatabase(VOID) +LsapCreateDatabaseKeys(VOID) { OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING KeyName; @@ -180,7 +180,6 @@ LsapInstallDatabase(VOID) goto Done; } - Done: if (SecretsKeyHandle != NULL) NtClose(SecretsKeyHandle); @@ -200,6 +199,55 @@ Done: } +static NTSTATUS +LsapCreateDatabaseObjects(VOID) +{ + PLSA_DB_OBJECT DbObject = NULL; + + /* Open the 'Policy' object */ + DbObject = (PLSA_DB_OBJECT)LsapCreateDbObject(NULL, + L"Policy", + TRUE, + LsaDbPolicyObject, + 0); + if (DbObject != NULL) + { + LsapSetObjectAttribute(DbObject, + L"PolPrDmN", + NULL, + 0); + + LsapSetObjectAttribute(DbObject, + L"PolPrDmS", + NULL, + 0); + + LsapSetObjectAttribute(DbObject, + L"PolAcDmN", + NULL, + 0); + + LsapSetObjectAttribute(DbObject, + L"PolAcDmS", + NULL, + 0); + + + /* Close the 'Policy' object */ + LsapCloseDbObject((LSAPR_HANDLE)DbObject); + } + + return STATUS_SUCCESS; +} + + +static NTSTATUS +LsapUpdateDatabase(VOID) +{ + return STATUS_SUCCESS; +} + + NTSTATUS LsapInitDatabase(VOID) { @@ -216,10 +264,26 @@ LsapInitDatabase(VOID) if (!LsapIsDatabaseInstalled()) { - Status = LsapInstallDatabase(); + Status = LsapCreateDatabaseKeys(); if (!NT_SUCCESS(Status)) { - ERR("Failed to install the LSA database (Status: 0x%08lx)\n", Status); + ERR("Failed to create the LSA database keys (Status: 0x%08lx)\n", Status); + return Status; + } + + Status = LsapCreateDatabaseObjects(); + if (!NT_SUCCESS(Status)) + { + ERR("Failed to create the LSA database objects (Status: 0x%08lx)\n", Status); + return Status; + } + } + else + { + Status = LsapUpdateDatabase(); + if (!NT_SUCCESS(Status)) + { + ERR("Failed to update the LSA database (Status: 0x%08lx)\n", Status); return Status; } }