Author: ekohl
Date: Sat Jun 29 18:45:45 2013
New Revision: 59369
URL:
http://svn.reactos.org/svn/reactos?rev=59369&view=rev
Log:
[LSALIB]
- Implement LsaConnectUntrusted.
- Remove dead code.
- LsaRegisterLogonProcess: Fix ConnectInfo.Status check.
Modified:
trunk/reactos/lib/lsalib/lsa.c
Modified: trunk/reactos/lib/lsalib/lsa.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/lsalib/lsa.c?rev=59369…
==============================================================================
--- trunk/reactos/lib/lsalib/lsa.c [iso-8859-1] (original)
+++ trunk/reactos/lib/lsalib/lsa.c [iso-8859-1] Sat Jun 29 18:45:45 2013
@@ -66,13 +66,50 @@
/*
- * @unimplemented
+ * @implemented
*/
NTSTATUS WINAPI
LsaConnectUntrusted(PHANDLE LsaHandle)
{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+ UNICODE_STRING PortName; // =
RTL_CONSTANT_STRING(L"\\LsaAuthenticationPort");
+ SECURITY_QUALITY_OF_SERVICE SecurityQos;
+ LSA_CONNECTION_INFO ConnectInfo;
+ ULONG ConnectInfoLength = sizeof(ConnectInfo);
+ NTSTATUS Status;
+
+ DPRINT1("LsaConnectUntrusted(%p)\n", LsaHandle);
+
+ RtlInitUnicodeString(&PortName,
+ L"\\LsaAuthenticationPort");
+
+ SecurityQos.Length = sizeof(SecurityQos);
+ SecurityQos.ImpersonationLevel = SecurityIdentification;
+ SecurityQos.ContextTrackingMode = SECURITY_DYNAMIC_TRACKING;
+ SecurityQos.EffectiveOnly = TRUE;
+
+ RtlZeroMemory(&ConnectInfo,
+ ConnectInfoLength);
+
+ Status = ZwConnectPort(LsaHandle,
+ &PortName,
+ &SecurityQos,
+ NULL,
+ NULL,
+ NULL,
+ &ConnectInfo,
+ &ConnectInfoLength);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("ZwConnectPort failed (Status 0x%08lx)\n", Status);
+ return Status;
+ }
+
+ if (!NT_SUCCESS(ConnectInfo.Status))
+ {
+ DPRINT1("ConnectInfo.Status: 0x%08lx\n", ConnectInfo.Status);
+ }
+
+ return ConnectInfo.Status;
}
@@ -122,56 +159,6 @@
*ProtocolStatus = ApiMessage.CallAuthenticationPackage.Reply.ProtocolStatus;
return Status;
-
-
-#if 0
- PLSASS_REQUEST Request;
- PLSASS_REPLY Reply;
- LSASS_REQUEST RawRequest;
- LSASS_REPLY RawReply;
- NTSTATUS Status;
- ULONG OutBufferSize;
-
- Request = (PLSASS_REQUEST)&RawRequest;
- Reply = (PLSASS_REPLY)&RawReply;
-
- Request->Header.u1.s1.DataLength = sizeof(LSASS_REQUEST) + SubmitBufferLength -
- sizeof(PORT_MESSAGE);
- Request->Header.u1.s1.TotalLength =
- Request->Header.u1.s1.DataLength + sizeof(PORT_MESSAGE);
- Request->Type = LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE;
- Request->d.CallAuthenticationPackageRequest.AuthenticationPackage =
- AuthenticationPackage;
- Request->d.CallAuthenticationPackageRequest.InBufferLength =
- SubmitBufferLength;
- memcpy(Request->d.CallAuthenticationPackageRequest.InBuffer,
- ProtocolSubmitBuffer,
- SubmitBufferLength);
-
- Status = ZwRequestWaitReplyPort(LsaHandle,
- &Request->Header,
- &Reply->Header);
- if (!NT_SUCCESS(Status))
- {
- return Status;
- }
-
- if (!NT_SUCCESS(Reply->Status))
- {
- return Reply->Status;
- }
-
- OutBufferSize = Reply->d.CallAuthenticationPackageReply.OutBufferLength;
- *ProtocolReturnBuffer = RtlAllocateHeap(Secur32Heap,
- 0,
- OutBufferSize);
- *ReturnBufferLength = OutBufferSize;
- memcpy(*ProtocolReturnBuffer,
- Reply->d.CallAuthenticationPackageReply.OutBuffer,
- *ReturnBufferLength);
-
- return Status;
-#endif
}
@@ -297,91 +284,6 @@
*SubStatus = ApiMessage.LogonUser.Reply.SubStatus;
return Status;
-
-#if 0
- ULONG RequestLength;
- ULONG CurrentLength;
- PLSASS_REQUEST Request;
- LSASS_REQUEST RawMessage;
- PLSASS_REPLY Reply;
- LSASS_REPLY RawReply;
- NTSTATUS Status;
-
- RequestLength = sizeof(LSASS_REQUEST) - sizeof(PORT_MESSAGE);
- RequestLength = RequestLength + (OriginName->Length * sizeof(WCHAR));
- RequestLength = RequestLength + AuthenticationInformationLength;
- RequestLength = RequestLength +
- (LocalGroups->GroupCount * sizeof(SID_AND_ATTRIBUTES));
-
- CurrentLength = 0;
- Request = (PLSASS_REQUEST)&RawMessage;
-
- Request->d.LogonUserRequest.OriginNameLength = OriginName->Length;
- Request->d.LogonUserRequest.OriginName = (PWSTR)&RawMessage + CurrentLength;
- memcpy((PWSTR)&RawMessage + CurrentLength,
- OriginName->Buffer,
- OriginName->Length * sizeof(WCHAR));
- CurrentLength = CurrentLength + (OriginName->Length * sizeof(WCHAR));
-
- Request->d.LogonUserRequest.LogonType = LogonType;
-
- Request->d.LogonUserRequest.AuthenticationPackage =
- AuthenticationPackage;
-
- Request->d.LogonUserRequest.AuthenticationInformation =
- (PVOID)((ULONG_PTR)&RawMessage + CurrentLength);
- Request->d.LogonUserRequest.AuthenticationInformationLength =
- AuthenticationInformationLength;
- memcpy((PVOID)((ULONG_PTR)&RawMessage + CurrentLength),
- AuthenticationInformation,
- AuthenticationInformationLength);
- CurrentLength = CurrentLength + AuthenticationInformationLength;
-
- Request->d.LogonUserRequest.LocalGroupsCount = LocalGroups->GroupCount;
- Request->d.LogonUserRequest.LocalGroups =
- (PSID_AND_ATTRIBUTES)&RawMessage + CurrentLength;
- memcpy((PSID_AND_ATTRIBUTES)&RawMessage + CurrentLength,
- LocalGroups->Groups,
- LocalGroups->GroupCount * sizeof(SID_AND_ATTRIBUTES));
-
- Request->d.LogonUserRequest.SourceContext = *SourceContext;
-
- Request->Type = LSASS_REQUEST_LOGON_USER;
- Request->Header.u1.s1.DataLength = RequestLength - sizeof(PORT_MESSAGE);
- Request->Header.u1.s1.TotalLength = RequestLength + sizeof(PORT_MESSAGE);
-
- Reply = (PLSASS_REPLY)&RawReply;
-
- Status = ZwRequestWaitReplyPort(LsaHandle,
- &Request->Header,
- &Reply->Header);
- if (!NT_SUCCESS(Status))
- {
- return Status;
- }
-
- *SubStatus = Reply->d.LogonUserReply.SubStatus;
-
- if (!NT_SUCCESS(Reply->Status))
- {
- return Status;
- }
-
- *ProfileBuffer = RtlAllocateHeap(Secur32Heap,
- 0,
- Reply->d.LogonUserReply.ProfileBufferLength);
- memcpy(*ProfileBuffer,
- (PVOID)((ULONG_PTR)Reply->d.LogonUserReply.Data +
- (ULONG_PTR)Reply->d.LogonUserReply.ProfileBuffer),
- Reply->d.LogonUserReply.ProfileBufferLength);
- *LogonId = Reply->d.LogonUserReply.LogonId;
- *Token = Reply->d.LogonUserReply.Token;
- memcpy(Quotas,
- &Reply->d.LogonUserReply.Quotas,
- sizeof(Reply->d.LogonUserReply.Quotas));
-
- return Status;
-#endif
}
@@ -436,7 +338,7 @@
DPRINT("ConnectInfo.OperationalMode: 0x%08lx\n",
ConnectInfo.OperationalMode);
*OperationalMode = ConnectInfo.OperationalMode;
- if (!NT_SUCCESS(Status))
+ if (!NT_SUCCESS(ConnectInfo.Status))
{
DPRINT1("ConnectInfo.Status: 0x%08lx\n", ConnectInfo.Status);
}