Author: ekohl
Date: Sun Mar 3 19:43:33 2013
New Revision: 58421
URL:
http://svn.reactos.org/svn/reactos?rev=58421&view=rev
Log:
[LSASRV]
- Add authentication package loader code.
- Load registered authentication packages before the rpc server is started.
Added:
trunk/reactos/dll/win32/lsasrv/authpackage.c (with props)
Modified:
trunk/reactos/dll/win32/lsasrv/CMakeLists.txt
trunk/reactos/dll/win32/lsasrv/lsasrv.c
trunk/reactos/dll/win32/lsasrv/lsasrv.h
Modified: trunk/reactos/dll/win32/lsasrv/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/CMakeList…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/CMakeLists.txt [iso-8859-1] Sun Mar 3 19:43:33 2013
@@ -8,6 +8,7 @@
spec2def(lsasrv.dll lsasrv.spec ADD_IMPORTLIB)
list(APPEND SOURCE
+ authpackage.c
authport.c
database.c
lookup.c
Added: trunk/reactos/dll/win32/lsasrv/authpackage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/authpacka…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/authpackage.c (added)
+++ trunk/reactos/dll/win32/lsasrv/authpackage.c [iso-8859-1] Sun Mar 3 19:43:33 2013
@@ -1,0 +1,147 @@
+/*
+ * PROJECT: Local Security Authority Server DLL
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: dll/win32/lsasrv/authpackage.c
+ * PURPOSE: Authenticaton package management routines
+ * COPYRIGHT: Copyright 2013 Eric Kohl
+ */
+
+/* INCLUDES ****************************************************************/
+
+#include "lsasrv.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(lsasrv);
+
+
+
+typedef NTSTATUS (NTAPI *PLSA_AP_INITIALIZE_PACKAGE)(ULONG, PVOID
/*PLSA_DISPATCH_TABLE*/,
+ PLSA_STRING, PLSA_STRING, PLSA_STRING *);
+
+typedef struct _AUTH_PACKAGE
+{
+ LIST_ENTRY Entry;
+ PSTRING Name;
+ PVOID ModuleHandle;
+
+ PLSA_AP_INITIALIZE_PACKAGE LsaApInitializePackage;
+// PLSA_AP_CALL_PACKAGE LsaApCallPackage;
+// PLSA_AP_CALL_PACKAGE_UNTRUSTED LsaApCallPackageUntrusted;
+// PLSA_AP_LOGON_TERMINATED LsaApLogonTerminated;
+// PLSA_AP_LOGON_USER_EX2 LsaApLogonUserEx2;
+// PLSA_AP_LOGON_USER_EX LsaApLogonUserEx;
+// PLSA_AP_LOGON_USER LsaApLogonUser;
+} AUTH_PACKAGE, *PAUTH_PACKAGE;
+
+/* GLOBALS *****************************************************************/
+
+static LIST_ENTRY PackageListHead;
+static ULONG PackageId;
+
+/* FUNCTIONS ***************************************************************/
+
+static
+NTSTATUS
+NTAPI
+LsapAddAuthPackage(IN PWSTR ValueName,
+ IN ULONG ValueType,
+ IN PVOID ValueData,
+ IN ULONG ValueLength,
+ IN PVOID Context,
+ IN PVOID EntryContext)
+{
+ PAUTH_PACKAGE Package = NULL;
+ UNICODE_STRING PackageName;
+ STRING ProcName;
+ PULONG Id;
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ TRACE("LsapAddAuthPackage()\n");
+
+ PackageName.Length = (USHORT)ValueLength - sizeof(WCHAR);
+ PackageName.MaximumLength = (USHORT)ValueLength;
+ PackageName.Buffer = ValueData;
+
+ Id = (PULONG)Context;
+
+ Package = RtlAllocateHeap(RtlGetProcessHeap(),
+ HEAP_ZERO_MEMORY,
+ sizeof(AUTH_PACKAGE));
+ if (Package == NULL)
+ return STATUS_INSUFFICIENT_RESOURCES;
+
+ Status = LdrLoadDll(NULL,
+ NULL,
+ &PackageName,
+ &Package->ModuleHandle);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("LdrLoadDll failed (Status 0x%08lx)\n", Status);
+ goto done;
+ }
+
+ RtlInitAnsiString(&ProcName, "LsaApInitializePackage");
+ Status = LdrGetProcedureAddress(Package->ModuleHandle,
+ &ProcName,
+ 0,
+ (PVOID *)&Package->LsaApInitializePackage);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("LdrGetProcedureAddress() failed (Status 0x%08lx)\n", Status);
+ goto done;
+ }
+
+ Status = Package->LsaApInitializePackage(*Id,
+ NULL,
+ NULL,
+ NULL,
+ &Package->Name);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("Package->LsaApInitializePackage() failed (Status 0x%08lx)\n",
Status);
+ goto done;
+ }
+
+ *Id++;
+
+ InsertTailList(&PackageListHead, &Package->Entry);
+
+done:
+ if (!NT_SUCCESS(Status))
+ {
+ if (Package != NULL)
+ {
+ if (Package->ModuleHandle != NULL)
+ LdrUnloadDll(Package->ModuleHandle);
+
+ RtlFreeHeap(RtlGetProcessHeap(), 0, Package);
+ }
+ }
+
+ return Status;
+}
+
+
+NTSTATUS
+LsapInitAuthPackages(VOID)
+{
+ RTL_QUERY_REGISTRY_TABLE AuthPackageTable[] = {
+ {LsapAddAuthPackage, 0, L"Authentication Packages", NULL, REG_NONE, NULL,
0},
+ {NULL, 0, NULL, NULL, REG_NONE, NULL, 0}};
+
+ NTSTATUS Status;
+
+ InitializeListHead(&PackageListHead);
+ PackageId = 0;
+
+ /* Add registered authentication packages */
+ Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL,
+ L"Lsa",
+ AuthPackageTable,
+ &PackageId,
+ NULL);
+
+
+ return STATUS_SUCCESS;
+}
+
+/* EOF */
Propchange: trunk/reactos/dll/win32/lsasrv/authpackage.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/reactos/dll/win32/lsasrv/authpackage.c
------------------------------------------------------------------------------
svn:keywords = author date id revision
Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.c?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lsasrv.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lsasrv.c [iso-8859-1] Sun Mar 3 19:43:33 2013
@@ -20,6 +20,7 @@
{
HANDLE hEvent;
DWORD dwError;
+ NTSTATUS Status;
TRACE("LsapInitLsa() called\n");
@@ -28,6 +29,22 @@
/* Initialize the LSA database */
LsapInitDatabase();
+
+ /* Initialize registered authentication packages */
+ Status = LsapInitAuthPackages();
+ if (!NT_SUCCESS(Status))
+ {
+ ERR("LsapInitAuthPackages() failed (Status 0x%08lx)\n", Status);
+ return Status;
+ }
+
+ /* Start the authentication port thread */
+ Status = StartAuthenticationPort();
+ if (!NT_SUCCESS(Status))
+ {
+ ERR("StartAuthenticationPort() failed (Status 0x%08lx)\n", Status);
+ return Status;
+ }
/* Start the RPC server */
LsarStartRpcServer();
@@ -61,8 +78,6 @@
/* NOTE: Do not close the event handle!!!! */
- StartAuthenticationPort();
-
return STATUS_SUCCESS;
}
Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.h?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] Sun Mar 3 19:43:33 2013
@@ -19,10 +19,12 @@
#include <ndk/kefuncs.h>
#include <ndk/lpctypes.h>
#include <ndk/lpcfuncs.h>
+#include <ndk/mmfuncs.h>
#include <ndk/obfuncs.h>
#include <ndk/psfuncs.h>
#include <ndk/rtlfuncs.h>
#include <ndk/setypes.h>
+#include <ndk/umfuncs.h>
#include <ntsam.h>
#include <ntlsa.h>
@@ -79,6 +81,9 @@
extern PSID AccountDomainSid;
extern UNICODE_STRING AccountDomainName;
+/* authpackage.c */
+NTSTATUS
+LsapInitAuthPackages(VOID);
/* authport.c */
NTSTATUS