From 3c1003aaf586b6553a2f5da19e54b7ed068b4c0c Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 10 Jan 2016 13:01:29 +0000 Subject: [PATCH] [LSASRV] Add credential function stubs to the lsa dispatch table. svn path=/trunk/; revision=70568 --- reactos/dll/win32/lsasrv/authpackage.c | 24 ++++++----- reactos/dll/win32/lsasrv/lsasrv.h | 26 +++++++++++ reactos/dll/win32/lsasrv/session.c | 60 +++++++++++++++++++++++++- 3 files changed, 97 insertions(+), 13 deletions(-) diff --git a/reactos/dll/win32/lsasrv/authpackage.c b/reactos/dll/win32/lsasrv/authpackage.c index 60eb2ada170..16a9e36a77f 100644 --- a/reactos/dll/win32/lsasrv/authpackage.c +++ b/reactos/dll/win32/lsasrv/authpackage.c @@ -32,7 +32,9 @@ typedef PVOID PLSA_CLIENT_REQUEST; typedef NTSTATUS (NTAPI *PLSA_CREATE_LOGON_SESSION)(PLUID); typedef NTSTATUS (NTAPI *PLSA_DELETE_LOGON_SESSION)(PLUID); - +typedef NTSTATUS (NTAPI *PLSA_ADD_CREDENTIAL)(PLUID, ULONG, PLSA_STRING, PLSA_STRING); +typedef NTSTATUS (NTAPI *PLSA_GET_CREDENTIALS)(PLUID, ULONG, PULONG, BOOLEAN, PLSA_STRING, PULONG, PLSA_STRING); +typedef NTSTATUS (NTAPI *PLSA_DELETE_CREDENTIAL)(PLUID, ULONG, PLSA_STRING); 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*); @@ -46,9 +48,9 @@ typedef struct LSA_DISPATCH_TABLE { 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; + PLSA_ADD_CREDENTIAL AddCredential; + PLSA_GET_CREDENTIALS GetCredentials; + PLSA_DELETE_CREDENTIAL DeleteCredential; PLSA_ALLOCATE_LSA_HEAP AllocateLsaHeap; PLSA_FREE_LSA_HEAP FreeLsaHeap; PLSA_ALLOCATE_CLIENT_BUFFER AllocateClientBuffer; @@ -481,9 +483,9 @@ LsapInitAuthPackages(VOID) /* Initialize the dispatch table */ DispatchTable.CreateLogonSession = &LsapCreateLogonSession; DispatchTable.DeleteLogonSession = &LsapDeleteLogonSession; - DispatchTable.AddCredential = NULL; - DispatchTable.GetCredentials = NULL; - DispatchTable.DeleteCredential = NULL; + DispatchTable.AddCredential = &LsapAddCredential; + DispatchTable.GetCredentials = &LsapGetCredentials; + DispatchTable.DeleteCredential = &LsapDeleteCredential; DispatchTable.AllocateLsaHeap = &LsapAllocateHeap; DispatchTable.FreeLsaHeap = &LsapFreeHeap; DispatchTable.AllocateClientBuffer = &LsapAllocateClientBuffer; @@ -1602,7 +1604,7 @@ LsapLogonUser(PLSA_API_MSG RequestMsg, goto done; } - TokenHandle = NULL; +// TokenHandle = NULL; Status = LsapSetLogonSessionData(&RequestMsg->LogonUser.Reply.LogonId); if (!NT_SUCCESS(Status)) @@ -1612,11 +1614,11 @@ LsapLogonUser(PLSA_API_MSG RequestMsg, } done: - if (!NT_SUCCESS(Status)) - { +// if (!NT_SUCCESS(Status)) +// { if (TokenHandle != NULL) NtClose(TokenHandle); - } +// } /* Free the local groups */ if (LocalGroups != NULL) diff --git a/reactos/dll/win32/lsasrv/lsasrv.h b/reactos/dll/win32/lsasrv/lsasrv.h index d0f1831e5a1..af878e87698 100644 --- a/reactos/dll/win32/lsasrv/lsasrv.h +++ b/reactos/dll/win32/lsasrv/lsasrv.h @@ -414,6 +414,32 @@ NTSTATUS NTAPI LsapDeleteLogonSession(IN PLUID LogonId); +NTSTATUS +NTAPI +LsapAddCredential( + _In_ PLUID LogonId, + _In_ ULONG AuthenticationPackage, + _In_ PLSA_STRING PrimaryKeyValue, + _In_ PLSA_STRING Credential); + +NTSTATUS +NTAPI +LsapGetCredentials( + _In_ PLUID LogonId, + _In_ ULONG AuthenticationPackage, + _Inout_ PULONG QueryContext, + _In_ BOOLEAN RetrieveAllCredentials, + _Inout_ PLSA_STRING PrimaryKeyValue, + _Out_ PULONG PrimaryKeyLength, + _Out_ PLSA_STRING Credentials); + +NTSTATUS +NTAPI +LsapDeleteCredential( + _In_ PLUID LogonId, + _In_ ULONG AuthenticationPackage, + _In_ PLSA_STRING PrimaryKeyValue); + NTSTATUS LsapSetLogonSessionData(IN PLUID LogonId); diff --git a/reactos/dll/win32/lsasrv/session.c b/reactos/dll/win32/lsasrv/session.c index c9152607fa1..b7831814a09 100644 --- a/reactos/dll/win32/lsasrv/session.c +++ b/reactos/dll/win32/lsasrv/session.c @@ -176,6 +176,47 @@ LsapDeleteLogonSession(IN PLUID LogonId) } +NTSTATUS +NTAPI +LsapAddCredential( + _In_ PLUID LogonId, + _In_ ULONG AuthenticationPackage, + _In_ PLSA_STRING PrimaryKeyValue, + _In_ PLSA_STRING Credential) +{ + + return STATUS_SUCCESS; +} + + +NTSTATUS +NTAPI +LsapGetCredentials( + _In_ PLUID LogonId, + _In_ ULONG AuthenticationPackage, + _Inout_ PULONG QueryContext, + _In_ BOOLEAN RetrieveAllCredentials, + _Inout_ PLSA_STRING PrimaryKeyValue, + _Out_ PULONG PrimaryKeyLength, + _Out_ PLSA_STRING Credentials) +{ + + return STATUS_SUCCESS; +} + + +NTSTATUS +NTAPI +LsapDeleteCredential( + _In_ PLUID LogonId, + _In_ ULONG AuthenticationPackage, + _In_ PLSA_STRING PrimaryKeyValue) +{ + + return STATUS_SUCCESS; +} + + NTSTATUS LsapEnumLogonSessions(IN OUT PLSA_API_MSG RequestMsg) { @@ -290,9 +331,10 @@ LsapGetLogonSessionData(IN OUT PLSA_API_MSG RequestMsg) if (Session == NULL) return STATUS_NO_SUCH_LOGON_SESSION; - Length = sizeof(SECURITY_LOGON_SESSION_DATA); + /* Calculate the required buffer size */ + Length = sizeof(SECURITY_LOGON_SESSION_DATA) + + Session->UserName.MaximumLength; /* - Session->UserName.MaximumLength + Session->LogonDomain.MaximumLength + Session->AuthenticationPackage.MaximumLength + Session->LogonServer.MaximumLength + @@ -305,6 +347,7 @@ LsapGetLogonSessionData(IN OUT PLSA_API_MSG RequestMsg) TRACE("Length: %lu\n", Length); + /* Allocate the buffer */ LocalSessionData = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, Length); @@ -319,6 +362,19 @@ LsapGetLogonSessionData(IN OUT PLSA_API_MSG RequestMsg) RtlCopyLuid(&LocalSessionData->LogonId, &RequestMsg->GetLogonSessionData.Request.LogonId); + LocalSessionData->UserName.Length = Session->UserName.Length; + LocalSessionData->UserName.MaximumLength = Session->UserName.MaximumLength; + LocalSessionData->UserName.Buffer = Ptr; + +// RtlCopyMemory(Ptr) + + + LocalSessionData->LogonType = Session->LogonType; + LocalSessionData->Session = 0; + + + + InitializeObjectAttributes(&ObjectAttributes, NULL, 0,