Author: ekohl
Date: Sun Mar 17 13:55:51 2013
New Revision: 58537
URL:
http://svn.reactos.org/svn/reactos?rev=58537&view=rev
Log:
[MSV1_0]
- Add LsaApLogonUserEx and LsaApLogonUserEx2 stubs.
- Delay import samsrv and lsasrv import libs.
- Start the implementation of the logon process.
Modified:
trunk/reactos/dll/win32/msv1_0/CMakeLists.txt
trunk/reactos/dll/win32/msv1_0/msv1_0.c
trunk/reactos/dll/win32/msv1_0/msv1_0.h
trunk/reactos/dll/win32/msv1_0/msv1_0.spec
Modified: trunk/reactos/dll/win32/msv1_0/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msv1_0/CMakeList…
==============================================================================
--- trunk/reactos/dll/win32/msv1_0/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msv1_0/CMakeLists.txt [iso-8859-1] Sun Mar 17 13:55:51 2013
@@ -13,6 +13,7 @@
add_library(msv1_0 SHARED ${SOURCE})
set_module_type(msv1_0 win32dll UNICODE ENTRYPOINT 0)
target_link_libraries(msv1_0 wine ${PSEH_LIB})
+add_delay_importlibs(msv1_0 samsrv lsasrv)
add_importlibs(msv1_0 kernel32 ntdll)
add_pch(msv1_0 msv1_0.h)
add_dependencies(msv1_0 psdk)
Modified: trunk/reactos/dll/win32/msv1_0/msv1_0.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msv1_0/msv1_0.c?…
==============================================================================
--- trunk/reactos/dll/win32/msv1_0/msv1_0.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msv1_0/msv1_0.c [iso-8859-1] Sun Mar 17 13:55:51 2013
@@ -19,6 +19,55 @@
/* FUNCTIONS ***************************************************************/
+
+static
+NTSTATUS
+GetDomainSid(PRPC_SID *Sid)
+{
+ LSAPR_HANDLE PolicyHandle = NULL;
+ PLSAPR_POLICY_INFORMATION PolicyInfo = NULL;
+ ULONG Length = 0;
+ NTSTATUS Status;
+
+ Status = LsaIOpenPolicyTrusted(&PolicyHandle);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("LsaIOpenPolicyTrusted() failed (Status 0x%08lx)\n", Status);
+ return Status;
+ }
+
+ Status = LsarQueryInformationPolicy(PolicyHandle,
+ PolicyAccountDomainInformation,
+ &PolicyInfo);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("LsarQueryInformationPolicy() failed (Status 0x%08lx)\n",
Status);
+ goto done;
+ }
+
+ Length = RtlLengthSid(PolicyInfo->PolicyAccountDomainInfo.Sid);
+
+ *Sid = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length);
+ if (*Sid == NULL)
+ {
+ ERR("Failed to allocate SID\n");
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ goto done;
+ }
+
+ memcpy(*Sid, PolicyInfo->PolicyAccountDomainInfo.Sid, Length);
+
+done:
+ if (PolicyInfo != NULL)
+ LsaIFree_LSAPR_POLICY_INFORMATION(PolicyAccountDomainInformation,
+ PolicyInfo);
+
+ if (PolicyHandle != NULL)
+ LsarClose(&PolicyHandle);
+
+ return Status;
+}
+
/*
* @unimplemented
@@ -95,6 +144,10 @@
/* Get the dispatch table entries */
DispatchTable.AllocateLsaHeap = LsaDispatchTable->AllocateLsaHeap;
DispatchTable.FreeLsaHeap = LsaDispatchTable->FreeLsaHeap;
+ DispatchTable.AllocateClientBuffer = LsaDispatchTable->AllocateClientBuffer;
+ DispatchTable.FreeClientBuffer = LsaDispatchTable->FreeClientBuffer;
+ DispatchTable.CopyToClientBuffer = LsaDispatchTable->CopyToClientBuffer;
+ DispatchTable.CopyFromClientBuffer = LsaDispatchTable->CopyFromClientBuffer;
/* Return the package name */
@@ -149,7 +202,186 @@
OUT PLSA_UNICODE_STRING *AccountName,
OUT PLSA_UNICODE_STRING *AuthenticatingAuthority)
{
- TRACE("()\n");
+ PMSV1_0_INTERACTIVE_LOGON LogonInfo;
+
+ SAMPR_HANDLE ServerHandle = NULL;
+ SAMPR_HANDLE DomainHandle = NULL;
+ PRPC_SID AccountDomainSid = NULL;
+ RPC_UNICODE_STRING Names[1];
+ SAMPR_ULONG_ARRAY RelativeIds = {0, NULL};
+ SAMPR_ULONG_ARRAY Use = {0, NULL};
+ NTSTATUS Status;
+
+ TRACE("()\n");
+
+ TRACE("LogonType: %lu\n", LogonType);
+ TRACE("AuthenticationInformation: %p\n", AuthenticationInformation);
+ TRACE("AuthenticationInformationLength: %lu\n",
AuthenticationInformationLength);
+
+
+ *ProfileBuffer = NULL;
+ *ProfileBufferLength = 0;
+ *SubStatus = STATUS_SUCCESS;
+
+ if (LogonType == Interactive ||
+ LogonType == Batch ||
+ LogonType == Service)
+ {
+ ULONG_PTR PtrOffset;
+
+ LogonInfo = (PMSV1_0_INTERACTIVE_LOGON)AuthenticationInformation;
+
+ /* Fix-up pointers in the authentication info */
+ PtrOffset = (ULONG_PTR)AuthenticationInformation -
(ULONG_PTR)ClientAuthenticationBase;
+
+ LogonInfo->LogonDomainName.Buffer =
(PWSTR)((ULONG_PTR)LogonInfo->LogonDomainName.Buffer + PtrOffset);
+ LogonInfo->UserName.Buffer = (PWSTR)((ULONG_PTR)LogonInfo->UserName.Buffer
+ PtrOffset);
+ LogonInfo->Password.Buffer = (PWSTR)((ULONG_PTR)LogonInfo->Password.Buffer
+ PtrOffset);
+
+ TRACE("Domain: %S\n", LogonInfo->LogonDomainName.Buffer);
+ TRACE("User: %S\n", LogonInfo->UserName.Buffer);
+ TRACE("Password: %S\n", LogonInfo->Password.Buffer);
+ }
+ else
+ {
+ FIXME("LogonType %lu is not supported yet!\n", LogonType);
+ return STATUS_NOT_IMPLEMENTED;
+ }
+
+ Status = GetDomainSid(&AccountDomainSid);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("GetDomainSid() failed (Status 0x%08lx)\n", Status);
+ return Status;
+ }
+
+ /* Connect to the SAM server */
+ Status = SamIConnect(NULL,
+ &ServerHandle,
+ SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN,
+ TRUE);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("SamIConnect() failed (Status 0x%08lx)\n", Status);
+ goto done;
+ }
+
+ /* Open the account domain */
+ Status = SamrOpenDomain(ServerHandle,
+ DOMAIN_LOOKUP,
+ AccountDomainSid,
+ &DomainHandle);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("SamrOpenDomain failed (Status %08lx)\n", Status);
+ goto done;
+ }
+
+ Names[0].Length = LogonInfo->UserName.Length;
+ Names[0].MaximumLength = LogonInfo->UserName.MaximumLength;
+ Names[0].Buffer = LogonInfo->UserName.Buffer;
+
+ /* Try to get the RID for the user name */
+ Status = SamrLookupNamesInDomain(DomainHandle,
+ 1,
+ Names,
+ &RelativeIds,
+ &Use);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("SamrLookupNamesInDomain failed (Status %08lx)\n", Status);
+ Status = STATUS_NO_SUCH_USER;
+ goto done;
+ }
+
+ /* Fail, if it is not a user account */
+ if (Use.Element[0] != SidTypeUser)
+ {
+ TRACE("Account is not a user account!\n");
+ Status = STATUS_NO_SUCH_USER;
+ goto done;
+ }
+
+
+
+done:
+ SamIFree_SAMPR_ULONG_ARRAY(&RelativeIds);
+ SamIFree_SAMPR_ULONG_ARRAY(&Use);
+
+ if (DomainHandle != NULL)
+ SamrCloseHandle(&DomainHandle);
+
+ if (ServerHandle != NULL)
+ SamrCloseHandle(&ServerHandle);
+
+ if (AccountDomainSid != NULL)
+ RtlFreeHeap(RtlGetProcessHeap(), 0, AccountDomainSid);
+
+ TRACE("LsaApLogonUser done (Status %08lx)\n", Status);
+
+ return Status;
+}
+
+
+/*
+ * @unimplemented
+ */
+NTSTATUS
+NTAPI
+LsaApLogonUserEx(IN PLSA_CLIENT_REQUEST ClientRequest,
+ IN SECURITY_LOGON_TYPE LogonType,
+ IN PVOID AuthenticationInformation,
+ IN PVOID ClientAuthenticationBase,
+ IN ULONG AuthenticationInformationLength,
+ OUT PVOID *ProfileBuffer,
+ OUT PULONG ProfileBufferLength,
+ OUT PLUID LogonId,
+ OUT PNTSTATUS SubStatus,
+ OUT PLSA_TOKEN_INFORMATION_TYPE TokenInformationType,
+ OUT PVOID *TokenInformation,
+ OUT PUNICODE_STRING *AccountName,
+ OUT PUNICODE_STRING *AuthenticatingAuthority,
+ OUT PUNICODE_STRING *MachineName)
+{
+ TRACE("()\n");
+
+ TRACE("LogonType: %lu\n", LogonType);
+ TRACE("AuthenticationInformation: %p\n", AuthenticationInformation);
+ TRACE("AuthenticationInformationLength: %lu\n",
AuthenticationInformationLength);
+
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/*
+ * @unimplemented
+ */
+NTSTATUS
+NTAPI
+LsaApLogonUserEx2(IN PLSA_CLIENT_REQUEST ClientRequest,
+ IN SECURITY_LOGON_TYPE LogonType,
+ IN PVOID ProtocolSubmitBuffer,
+ IN PVOID ClientBufferBase,
+ IN ULONG SubmitBufferSize,
+ OUT PVOID *ProfileBuffer,
+ OUT PULONG ProfileBufferSize,
+ OUT PLUID LogonId,
+ OUT PNTSTATUS SubStatus,
+ OUT PLSA_TOKEN_INFORMATION_TYPE TokenInformationType,
+ OUT PVOID *TokenInformation,
+ OUT PUNICODE_STRING *AccountName,
+ OUT PUNICODE_STRING *AuthenticatingAuthority,
+ OUT PUNICODE_STRING *MachineName,
+ OUT PSECPKG_PRIMARY_CRED PrimaryCredentials,
+ OUT PSECPKG_SUPPLEMENTAL_CRED_ARRAY *SupplementalCredentials)
+{
+ TRACE("()\n");
+
+ TRACE("LogonType: %lu\n", LogonType);
+ TRACE("ProtocolSubmitBuffer: %p\n", ProtocolSubmitBuffer);
+ TRACE("SubmitBufferSize: %lu\n", SubmitBufferSize);
+
+
return STATUS_NOT_IMPLEMENTED;
}
Modified: trunk/reactos/dll/win32/msv1_0/msv1_0.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msv1_0/msv1_0.h?…
==============================================================================
--- trunk/reactos/dll/win32/msv1_0/msv1_0.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msv1_0/msv1_0.h [iso-8859-1] Sun Mar 17 13:55:51 2013
@@ -27,7 +27,145 @@
#include <sspi.h>
#include <ntsecapi.h>
#include <ntsecpkg.h>
+#include <ntsam.h>
+#include <ntlsa.h>
+
+#include <samsrv/samsrv.h>
+//#include <lsass/lsasrv.h>
#include <wine/debug.h>
+typedef struct _RPC_SID
+{
+ UCHAR Revision;
+ UCHAR SubAuthorityCount;
+ SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
+ DWORD SubAuthority[];
+} RPC_SID, *PRPC_SID;
+
+typedef struct _RPC_UNICODE_STRING
+{
+ unsigned short Length;
+ unsigned short MaximumLength;
+ wchar_t *Buffer;
+} RPC_UNICODE_STRING, *PRPC_UNICODE_STRING;
+
+typedef wchar_t *PSAMPR_SERVER_NAME;
+typedef void *SAMPR_HANDLE;
+
+typedef struct _SAMPR_ULONG_ARRAY
+{
+ ULONG Count;
+ PULONG Element;
+} SAMPR_ULONG_ARRAY, *PSAMPR_ULONG_ARRAY;
+
+NTSTATUS
+NTAPI
+SamIConnect(IN PSAMPR_SERVER_NAME ServerName,
+ OUT SAMPR_HANDLE *ServerHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN BOOLEAN Trusted);
+
+VOID
+NTAPI
+SamIFree_SAMPR_ULONG_ARRAY(PSAMPR_ULONG_ARRAY Ptr);
+
+NTSTATUS
+NTAPI
+SamrCloseHandle(IN OUT SAMPR_HANDLE *SamHandle);
+
+NTSTATUS
+NTAPI
+SamrOpenDomain(IN SAMPR_HANDLE ServerHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN PRPC_SID DomainId,
+ OUT SAMPR_HANDLE *DomainHandle);
+
+NTSTATUS
+NTAPI
+SamrLookupNamesInDomain(IN SAMPR_HANDLE DomainHandle,
+ IN ULONG Count,
+ IN RPC_UNICODE_STRING Names[],
+ OUT PSAMPR_ULONG_ARRAY RelativeIds,
+ OUT PSAMPR_ULONG_ARRAY Use);
+
+typedef PVOID LSAPR_HANDLE;
+
+typedef struct _LSAPR_POLICY_AUDIT_EVENTS_INFO
+{
+ BOOLEAN AuditingMode;
+ DWORD *EventAuditingOptions;
+ DWORD MaximumAuditEventCount;
+} LSAPR_POLICY_AUDIT_EVENTS_INFO, *PLSAPR_POLICY_AUDIT_EVENTS_INFO;
+
+typedef struct _LSAPR_POLICY_PRIMARY_DOM_INFO
+{
+ RPC_UNICODE_STRING Name;
+ PRPC_SID Sid;
+} LSAPR_POLICY_PRIMARY_DOM_INFO, *PLSAPR_POLICY_PRIMARY_DOM_INFO;
+
+typedef struct _LSAPR_POLICY_ACCOUNT_DOM_INFO
+{
+ RPC_UNICODE_STRING DomainName;
+ PRPC_SID Sid;
+} LSAPR_POLICY_ACCOUNT_DOM_INFO, *PLSAPR_POLICY_ACCOUNT_DOM_INFO;
+
+typedef struct _LSAPR_POLICY_PD_ACCOUNT_INFO
+{
+ RPC_UNICODE_STRING Name;
+} LSAPR_POLICY_PD_ACCOUNT_INFO, *PLSAPR_POLICY_PD_ACCOUNT_INFO;
+
+typedef struct _POLICY_LSA_REPLICA_SRCE_INFO
+{
+ RPC_UNICODE_STRING ReplicaSource;
+ RPC_UNICODE_STRING ReplicaAccountName;
+} POLICY_LSA_REPLICA_SRCE_INFO, *PPOLICY_LSA_REPLICA_SRCE_INFO;
+
+typedef struct _LSAPR_POLICY_DNS_DOMAIN_INFO
+{
+ RPC_UNICODE_STRING Name;
+ RPC_UNICODE_STRING DnsDomainName;
+ RPC_UNICODE_STRING DnsForestName;
+ GUID DomainGuid;
+ PRPC_SID Sid;
+} LSAPR_POLICY_DNS_DOMAIN_INFO, *PLSAPR_POLICY_DNS_DOMAIN_INFO;
+
+typedef union _LSAPR_POLICY_INFORMATION
+{
+ POLICY_AUDIT_LOG_INFO PolicyAuditLogInfo;
+ LSAPR_POLICY_AUDIT_EVENTS_INFO PolicyAuditEventsInfo;
+ LSAPR_POLICY_PRIMARY_DOM_INFO PolicyPrimaryDomInfo;
+ LSAPR_POLICY_PD_ACCOUNT_INFO PolicyPdAccountInfo;
+ LSAPR_POLICY_ACCOUNT_DOM_INFO PolicyAccountDomainInfo;
+ POLICY_LSA_SERVER_ROLE_INFO PolicyServerRoleInfo;
+ POLICY_LSA_REPLICA_SRCE_INFO PolicyReplicaSourceInfo;
+ POLICY_DEFAULT_QUOTA_INFO PolicyDefaultQuotaInfo;
+ POLICY_MODIFICATION_INFO PolicyModificationInfo;
+ POLICY_AUDIT_FULL_SET_INFO PolicyAuditFullSetInfo;
+ POLICY_AUDIT_FULL_QUERY_INFO PolicyAuditFullQueryInfo;
+ LSAPR_POLICY_DNS_DOMAIN_INFO PolicyDnsDomainInfo;
+ LSAPR_POLICY_DNS_DOMAIN_INFO PolicyDnsDomainInfoInt;
+ LSAPR_POLICY_ACCOUNT_DOM_INFO PolicyLocalAccountDomainInfo;
+} LSAPR_POLICY_INFORMATION, *PLSAPR_POLICY_INFORMATION;
+
+VOID
+NTAPI
+LsaIFree_LSAPR_POLICY_INFORMATION(IN POLICY_INFORMATION_CLASS InformationClass,
+ IN PLSAPR_POLICY_INFORMATION PolicyInformation);
+
+NTSTATUS
+WINAPI
+LsaIOpenPolicyTrusted(OUT LSAPR_HANDLE *PolicyHandle);
+
+NTSTATUS
+WINAPI
+LsarClose(IN OUT LSAPR_HANDLE *ObjectHandle);
+
+NTSTATUS
+WINAPI
+LsarQueryInformationPolicy(IN LSAPR_HANDLE PolicyHandle,
+ IN POLICY_INFORMATION_CLASS InformationClass,
+ OUT PLSAPR_POLICY_INFORMATION *PolicyInformation);
+
+
/* EOF */
Modified: trunk/reactos/dll/win32/msv1_0/msv1_0.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msv1_0/msv1_0.sp…
==============================================================================
--- trunk/reactos/dll/win32/msv1_0/msv1_0.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msv1_0/msv1_0.spec [iso-8859-1] Sun Mar 17 13:55:51 2013
@@ -4,8 +4,8 @@
@ stdcall LsaApInitializePackage(long ptr ptr ptr ptr)
@ stdcall LsaApLogonTerminated(ptr)
@ stdcall LsaApLogonUser(ptr long ptr ptr long ptr ptr ptr ptr ptr ptr ptr ptr)
-@ stub LsaApLogonUserEx
-@ stub LsaApLogonUserEx2
+#@ stdcall LsaApLogonUserEx(ptr long ptr ptr long ptr ptr ptr ptr ptr ptr ptr ptr ptr)
+#@ stdcall LsaApLogonUserEx2(ptr long ptr ptr long ptr ptr ptr ptr ptr ptr ptr ptr ptr
ptr ptr)
@ stub Msv1_0ExportSubAuthenticationRoutine
@ stub Msv1_0SubAuthenticationPresent
@ stub MsvGetLogonAttemptCount