mirror of
https://github.com/reactos/reactos.git
synced 2024-12-30 19:14:31 +00:00
[LSASRV]
Move the session functions into a separate file and implement basic session management routines. svn path=/trunk/; revision=60482
This commit is contained in:
parent
1066f92fd3
commit
a9e0120a16
5 changed files with 135 additions and 24 deletions
|
@ -18,6 +18,7 @@ list(APPEND SOURCE
|
|||
privileges.c
|
||||
registry.c
|
||||
security.c
|
||||
session.c
|
||||
utils.c
|
||||
lsasrv.rc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/lsasrv_stubs.c
|
||||
|
|
|
@ -31,6 +31,9 @@ typedef struct _LSA_TOKEN_INFORMATION_V1
|
|||
|
||||
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 NTSTATUS (NTAPI *PLSA_COPY_FROM_CLIENT_BUFFER)(PLSA_CLIENT_REQUEST,
|
|||
|
||||
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;
|
||||
|
@ -294,26 +297,6 @@ LsapGetAuthenticationPackage(IN ULONG PackageId)
|
|||
}
|
||||
|
||||
|
||||
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
|
||||
|
@ -454,8 +437,7 @@ LsapInitAuthPackages(VOID)
|
|||
&PackageId,
|
||||
NULL);
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ LsapInitLsa(VOID)
|
|||
/* Initialize the LSA database */
|
||||
LsapInitDatabase();
|
||||
|
||||
/* Initialize logon sessions */
|
||||
LsapInitLogonSessions();
|
||||
|
||||
/* Initialize registered authentication packages */
|
||||
Status = LsapInitAuthPackages();
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
|
|
@ -383,6 +383,18 @@ NTSTATUS
|
|||
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,
|
||||
|
|
113
reactos/dll/win32/lsasrv/session.c
Normal file
113
reactos/dll/win32/lsasrv/session.c
Normal file
|
@ -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 */
|
Loading…
Reference in a new issue