Add credential function stubs to the lsa dispatch table.

svn path=/trunk/; revision=70568
This commit is contained in:
Eric Kohl 2016-01-10 13:01:29 +00:00
parent 396b335764
commit 3c1003aaf5
3 changed files with 97 additions and 13 deletions

View file

@ -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)

View file

@ -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);

View file

@ -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,