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_CREATE_LOGON_SESSION)(PLUID);
typedef NTSTATUS (NTAPI *PLSA_DELETE_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 PVOID (NTAPI *PLSA_ALLOCATE_LSA_HEAP)(ULONG);
typedef VOID (NTAPI *PLSA_FREE_LSA_HEAP)(PVOID); typedef VOID (NTAPI *PLSA_FREE_LSA_HEAP)(PVOID);
typedef NTSTATUS (NTAPI *PLSA_ALLOCATE_CLIENT_BUFFER)(PLSA_CLIENT_REQUEST, ULONG, 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_CREATE_LOGON_SESSION CreateLogonSession;
PLSA_DELETE_LOGON_SESSION DeleteLogonSession; PLSA_DELETE_LOGON_SESSION DeleteLogonSession;
PVOID /*PLSA_ADD_CREDENTIAL */ AddCredential; PLSA_ADD_CREDENTIAL AddCredential;
PVOID /*PLSA_GET_CREDENTIALS */ GetCredentials; PLSA_GET_CREDENTIALS GetCredentials;
PVOID /*PLSA_DELETE_CREDENTIAL */ DeleteCredential; PLSA_DELETE_CREDENTIAL DeleteCredential;
PLSA_ALLOCATE_LSA_HEAP AllocateLsaHeap; PLSA_ALLOCATE_LSA_HEAP AllocateLsaHeap;
PLSA_FREE_LSA_HEAP FreeLsaHeap; PLSA_FREE_LSA_HEAP FreeLsaHeap;
PLSA_ALLOCATE_CLIENT_BUFFER AllocateClientBuffer; PLSA_ALLOCATE_CLIENT_BUFFER AllocateClientBuffer;
@ -481,9 +483,9 @@ LsapInitAuthPackages(VOID)
/* Initialize the dispatch table */ /* Initialize the dispatch table */
DispatchTable.CreateLogonSession = &LsapCreateLogonSession; DispatchTable.CreateLogonSession = &LsapCreateLogonSession;
DispatchTable.DeleteLogonSession = &LsapDeleteLogonSession; DispatchTable.DeleteLogonSession = &LsapDeleteLogonSession;
DispatchTable.AddCredential = NULL; DispatchTable.AddCredential = &LsapAddCredential;
DispatchTable.GetCredentials = NULL; DispatchTable.GetCredentials = &LsapGetCredentials;
DispatchTable.DeleteCredential = NULL; DispatchTable.DeleteCredential = &LsapDeleteCredential;
DispatchTable.AllocateLsaHeap = &LsapAllocateHeap; DispatchTable.AllocateLsaHeap = &LsapAllocateHeap;
DispatchTable.FreeLsaHeap = &LsapFreeHeap; DispatchTable.FreeLsaHeap = &LsapFreeHeap;
DispatchTable.AllocateClientBuffer = &LsapAllocateClientBuffer; DispatchTable.AllocateClientBuffer = &LsapAllocateClientBuffer;
@ -1602,7 +1604,7 @@ LsapLogonUser(PLSA_API_MSG RequestMsg,
goto done; goto done;
} }
TokenHandle = NULL; // TokenHandle = NULL;
Status = LsapSetLogonSessionData(&RequestMsg->LogonUser.Reply.LogonId); Status = LsapSetLogonSessionData(&RequestMsg->LogonUser.Reply.LogonId);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -1612,11 +1614,11 @@ LsapLogonUser(PLSA_API_MSG RequestMsg,
} }
done: done:
if (!NT_SUCCESS(Status)) // if (!NT_SUCCESS(Status))
{ // {
if (TokenHandle != NULL) if (TokenHandle != NULL)
NtClose(TokenHandle); NtClose(TokenHandle);
} // }
/* Free the local groups */ /* Free the local groups */
if (LocalGroups != NULL) if (LocalGroups != NULL)

View file

@ -414,6 +414,32 @@ NTSTATUS
NTAPI NTAPI
LsapDeleteLogonSession(IN PLUID LogonId); 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 NTSTATUS
LsapSetLogonSessionData(IN PLUID LogonId); 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 NTSTATUS
LsapEnumLogonSessions(IN OUT PLSA_API_MSG RequestMsg) LsapEnumLogonSessions(IN OUT PLSA_API_MSG RequestMsg)
{ {
@ -290,9 +331,10 @@ LsapGetLogonSessionData(IN OUT PLSA_API_MSG RequestMsg)
if (Session == NULL) if (Session == NULL)
return STATUS_NO_SUCH_LOGON_SESSION; 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->LogonDomain.MaximumLength +
Session->AuthenticationPackage.MaximumLength + Session->AuthenticationPackage.MaximumLength +
Session->LogonServer.MaximumLength + Session->LogonServer.MaximumLength +
@ -305,6 +347,7 @@ LsapGetLogonSessionData(IN OUT PLSA_API_MSG RequestMsg)
TRACE("Length: %lu\n", Length); TRACE("Length: %lu\n", Length);
/* Allocate the buffer */
LocalSessionData = RtlAllocateHeap(RtlGetProcessHeap(), LocalSessionData = RtlAllocateHeap(RtlGetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
Length); Length);
@ -319,6 +362,19 @@ LsapGetLogonSessionData(IN OUT PLSA_API_MSG RequestMsg)
RtlCopyLuid(&LocalSessionData->LogonId, RtlCopyLuid(&LocalSessionData->LogonId,
&RequestMsg->GetLogonSessionData.Request.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, InitializeObjectAttributes(&ObjectAttributes,
NULL, NULL,
0, 0,