Author: ekohl
Date: Mon Sep 30 19:49:46 2013
New Revision: 60482
URL:
http://svn.reactos.org/svn/reactos?rev=60482&view=rev
Log:
[LSASRV]
Move the session functions into a separate file and implement basic session management
routines.
Added:
trunk/reactos/dll/win32/lsasrv/session.c (with props)
Modified:
trunk/reactos/dll/win32/lsasrv/CMakeLists.txt
trunk/reactos/dll/win32/lsasrv/authpackage.c
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] Mon Sep 30 19:49:46 2013
@@ -18,6 +18,7 @@
privileges.c
registry.c
security.c
+ session.c
utils.c
lsasrv.rc
${CMAKE_CURRENT_BINARY_DIR}/lsasrv_stubs.c
Modified: 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 [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/authpackage.c [iso-8859-1] Mon Sep 30 19:49:46 2013
@@ -31,6 +31,9 @@
typedef PVOID PLSA_CLIENT_REQUEST;
+typedef NTSTATUS (NTAPI *PLSA_CREATE_LOGON_SESSION)(PLUID);
+typedef NTSTATUS (NTAPI *PLSA_DELETE_LOGON_SESSION)(PLUID);
+
typedef PVOID (NTAPI *PLSA_ALLOCATE_LSA_HEAP)(ULONG);
typedef VOID (NTAPI *PLSA_FREE_LSA_HEAP)(PVOID);
typedef NTSTATUS (NTAPI *PLSA_ALLOCATE_CLIENT_BUFFER)(PLSA_CLIENT_REQUEST, ULONG,
PVOID*);
@@ -42,8 +45,8 @@
typedef struct LSA_DISPATCH_TABLE
{
- PVOID /*PLSA_CREATE_LOGON_SESSION */ CreateLogonSession;
- PVOID /*PLSA_DELETE_LOGON_SESSION */ DeleteLogonSession;
+ PLSA_CREATE_LOGON_SESSION CreateLogonSession;
+ PLSA_DELETE_LOGON_SESSION DeleteLogonSession;
PVOID /*PLSA_ADD_CREDENTIAL */ AddCredential;
PVOID /*PLSA_GET_CREDENTIALS */ GetCredentials;
PVOID /*PLSA_DELETE_CREDENTIAL */ DeleteCredential;
@@ -295,26 +298,6 @@
static
-NTSTATUS
-NTAPI
-LsapCreateLogonSession(IN PLUID LogonId)
-{
- TRACE("()\n");
- return STATUS_SUCCESS;
-}
-
-
-static
-NTSTATUS
-NTAPI
-LsapDeleteLogonSession(IN PLUID LogonId)
-{
- TRACE("()\n");
- return STATUS_SUCCESS;
-}
-
-
-static
PVOID
NTAPI
LsapAllocateHeap(IN ULONG Length)
@@ -454,8 +437,7 @@
&PackageId,
NULL);
-
- return STATUS_SUCCESS;
+ return Status;
}
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] Mon Sep 30 19:49:46 2013
@@ -136,6 +136,9 @@
/* Initialize the LSA database */
LsapInitDatabase();
+
+ /* Initialize logon sessions */
+ LsapInitLogonSessions();
/* Initialize registered authentication packages */
Status = LsapInitAuthPackages();
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] Mon Sep 30 19:49:46 2013
@@ -383,6 +383,18 @@
LsapCreateSecretSd(PSECURITY_DESCRIPTOR *SecretSd,
PULONG SecretSdSize);
+/* session.c */
+VOID
+LsapInitLogonSessions(VOID);
+
+NTSTATUS
+NTAPI
+LsapCreateLogonSession(IN PLUID LogonId);
+
+NTSTATUS
+NTAPI
+LsapDeleteLogonSession(IN PLUID LogonId);
+
/* utils.c */
INT
LsapLoadString(HINSTANCE hInstance,
Added: trunk/reactos/dll/win32/lsasrv/session.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/session.c…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/session.c (added)
+++ trunk/reactos/dll/win32/lsasrv/session.c [iso-8859-1] Mon Sep 30 19:49:46 2013
@@ -0,0 +1,113 @@
+/*
+ * PROJECT: Local Security Authority Server DLL
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: dll/win32/lsasrv/session.c
+ * PURPOSE: Logon session management routines
+ * COPYRIGHT: Copyright 2013 Eric Kohl
+ */
+
+/* INCLUDES ****************************************************************/
+
+#include "lsasrv.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(lsasrv);
+
+typedef struct _LSAP_LOGON_SESSION
+{
+ LIST_ENTRY Entry;
+ LUID LogonId;
+} LSAP_LOGON_SESSION, *PLSAP_LOGON_SESSION;
+
+
+/* GLOBALS *****************************************************************/
+
+LIST_ENTRY SessionListHead;
+ULONG SessionCount;
+
+/* FUNCTIONS ***************************************************************/
+
+VOID
+LsapInitLogonSessions(VOID)
+{
+ InitializeListHead(&SessionListHead);
+ SessionCount = 0;
+}
+
+
+static
+PLSAP_LOGON_SESSION
+LsapGetLogonSession(IN PLUID LogonId)
+{
+ PLIST_ENTRY SessionEntry;
+ PLSAP_LOGON_SESSION CurrentSession;
+
+ SessionEntry = SessionListHead.Flink;
+ while (SessionEntry != &SessionListHead)
+ {
+ CurrentSession = CONTAINING_RECORD(SessionEntry,
+ LSAP_LOGON_SESSION,
+ Entry);
+ if (RtlEqualLuid(&CurrentSession->LogonId, LogonId))
+ return CurrentSession;
+
+ SessionEntry = SessionEntry->Flink;
+ }
+
+ return NULL;
+}
+
+
+NTSTATUS
+NTAPI
+LsapCreateLogonSession(IN PLUID LogonId)
+{
+ PLSAP_LOGON_SESSION Session;
+
+ TRACE("()\n");
+
+ /* Fail, if a session already exists */
+ if (LsapGetLogonSession(LogonId) != NULL)
+ return STATUS_LOGON_SESSION_COLLISION;
+
+ /* Allocate a new session entry */
+ Session = RtlAllocateHeap(RtlGetProcessHeap(),
+ HEAP_ZERO_MEMORY,
+ sizeof(LSAP_LOGON_SESSION));
+ if (Session == NULL)
+ return STATUS_INSUFFICIENT_RESOURCES;
+
+ /* Initialize the session entry */
+ RtlCopyLuid(&Session->LogonId, LogonId);
+
+ /* Insert the new session into the session list */
+ InsertTailList(&SessionListHead, &Session->Entry);
+ SessionCount++;
+
+ return STATUS_SUCCESS;
+}
+
+
+NTSTATUS
+NTAPI
+LsapDeleteLogonSession(IN PLUID LogonId)
+{
+ PLSAP_LOGON_SESSION Session;
+
+ TRACE("()\n");
+
+ /* Fail, if the session does not exist */
+ Session = LsapGetLogonSession(LogonId);
+ if (Session == NULL)
+ return STATUS_NO_SUCH_LOGON_SESSION;
+
+ /* Remove the session entry from the list */
+ RemoveEntryList(&Session->Entry);
+ SessionCount--;
+
+ /* Free the session entry */
+ RtlFreeHeap(RtlGetProcessHeap(), 0, Session);
+
+ return STATUS_SUCCESS;
+}
+
+/* EOF */
Propchange: trunk/reactos/dll/win32/lsasrv/session.c
------------------------------------------------------------------------------
svn:eol-style = native