Author: ekohl
Date: Sat Mar 1 20:45:10 2014
New Revision: 62369
URL:
http://svn.reactos.org/svn/reactos?rev=62369&view=rev
Log:
[MSGINA]
MyLogonUser: Pass the sub status to the caller.
Modified:
trunk/reactos/dll/win32/msgina/lsa.c
trunk/reactos/dll/win32/msgina/msgina.c
trunk/reactos/dll/win32/msgina/msgina.h
trunk/reactos/dll/win32/msgina/tui.c
Modified: trunk/reactos/dll/win32/msgina/lsa.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lsa.c?rev…
==============================================================================
--- trunk/reactos/dll/win32/msgina/lsa.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msgina/lsa.c [iso-8859-1] Sat Mar 1 20:45:10 2014
@@ -7,7 +7,7 @@
#include "msgina.h"
-BOOL
+NTSTATUS
ConnectToLsa(
PGINA_CONTEXT pgContext)
{
@@ -18,7 +18,7 @@
/* We are already connected to the LSA */
if (pgContext->LsaHandle != NULL)
- return TRUE;
+ return STATUS_SUCCESS;
/* Connect to the LSA server */
RtlInitAnsiString((PANSI_STRING)&LogonProcessName,
@@ -30,7 +30,7 @@
if (!NT_SUCCESS(Status))
{
ERR("LsaRegisterLogonProcess failed (Status 0x%08lx)\n", Status);
- return FALSE;
+ return Status;
}
/* Get the authentication package */
@@ -43,21 +43,21 @@
if (!NT_SUCCESS(Status))
{
ERR("LsaLookupAuthenticationPackage failed (Status 0x%08lx)\n",
Status);
- return FALSE;
- }
-
- return TRUE;
+ }
+
+ return Status;
}
-BOOL
+NTSTATUS
MyLogonUser(
HANDLE LsaHandle,
ULONG AuthenticationPackage,
LPWSTR lpszUsername,
LPWSTR lpszDomain,
LPWSTR lpszPassword,
- PHANDLE phToken)
+ PHANDLE phToken,
+ PNTSTATUS SubStatus)
{
SID_IDENTIFIER_AUTHORITY LocalAuthority = {SECURITY_LOCAL_SID_AUTHORITY};
SID_IDENTIFIER_AUTHORITY SystemAuthority = {SECURITY_NT_AUTHORITY};
@@ -78,7 +78,6 @@
LUID LogonId = {0, 0};
HANDLE TokenHandle = NULL;
QUOTA_LIMITS QuotaLimits;
- NTSTATUS SubStatus = STATUS_SUCCESS;
NTSTATUS Status;
*phToken = NULL;
@@ -209,7 +208,7 @@
&Luid,
&TokenHandle,
&QuotaLimits,
- &SubStatus);
+ SubStatus);
if (!NT_SUCCESS(Status))
{
ERR("LsaLogonUser failed (Status 0x%08lx)\n", Status);
@@ -259,13 +258,7 @@
if (AuthInfo != NULL)
RtlFreeHeap(RtlGetProcessHeap(), 0, AuthInfo);
- if (!NT_SUCCESS(Status))
- {
- SetLastError(RtlNtStatusToDosError(Status));
- return FALSE;
- }
-
- return TRUE;
+ return Status;
}
/* EOF */
Modified: trunk/reactos/dll/win32/msgina/msgina.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/msgina.c?…
==============================================================================
--- trunk/reactos/dll/win32/msgina/msgina.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msgina/msgina.c [iso-8859-1] Sat Mar 1 20:45:10 2014
@@ -612,20 +612,27 @@
ULONG Size;
ULONG i;
NTSTATUS Status;
+ NTSTATUS SubStatus = STATUS_SUCCESS;
TRACE("(%S %S %S)\n", UserName, Domain, Password);
- if (!ConnectToLsa(pgContext))
- return FALSE;
-
- if (!MyLogonUser(pgContext->LsaHandle,
- pgContext->AuthenticationPackage,
- UserName,
- Domain,
- Password,
- &pgContext->UserToken))
- {
- WARN("LogonUserW() failed\n");
+ Status = ConnectToLsa(pgContext);
+ if (!NT_SUCCESS(Status))
+ {
+ WARN("ConnectToLsa() failed\n");
+ return FALSE;
+ }
+
+ Status = MyLogonUser(pgContext->LsaHandle,
+ pgContext->AuthenticationPackage,
+ UserName,
+ Domain,
+ Password,
+ &pgContext->UserToken,
+ &SubStatus);
+ if (!NT_SUCCESS(Status))
+ {
+ WARN("MyLogonUser() failed\n");
return FALSE;
}
@@ -693,18 +700,26 @@
DWORD cbStats, cbSize;
DWORD dwLength;
BOOL bResult;
-
- if (!ConnectToLsa(pgContext))
- return FALSE;
-
- if (!MyLogonUser(pgContext->LsaHandle,
- pgContext->AuthenticationPackage,
- UserName,
- Domain,
- Password,
- &pgContext->UserToken))
- {
- WARN("LogonUserW() failed\n");
+ NTSTATUS SubStatus;
+ NTSTATUS Status;
+
+ Status = ConnectToLsa(pgContext);
+ if (!NT_SUCCESS(Status))
+ {
+ WARN("ConnectToLsa() failed\n");
+ return FALSE;
+ }
+
+ Status = MyLogonUser(pgContext->LsaHandle,
+ pgContext->AuthenticationPackage,
+ UserName,
+ Domain,
+ Password,
+ &pgContext->UserToken,
+ &SubStatus);
+ if (!NT_SUCCESS(Status))
+ {
+ WARN("MyLogonUser() failed\n");
goto cleanup;
}
Modified: trunk/reactos/dll/win32/msgina/msgina.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/msgina.h?…
==============================================================================
--- trunk/reactos/dll/win32/msgina/msgina.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msgina/msgina.h [iso-8859-1] Sat Mar 1 20:45:10 2014
@@ -81,18 +81,19 @@
/* lsa.c */
-BOOL
+NTSTATUS
ConnectToLsa(
PGINA_CONTEXT pgContext);
-BOOL
+NTSTATUS
MyLogonUser(
HANDLE LsaHandle,
ULONG AuthenticationPackage,
LPWSTR lpszUsername,
LPWSTR lpszDomain,
LPWSTR lpszPassword,
- PHANDLE phToken);
+ PHANDLE phToken,
+ PNTSTATUS SubStatus);
/* msgina.c */
Modified: trunk/reactos/dll/win32/msgina/tui.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/tui.c?rev…
==============================================================================
--- trunk/reactos/dll/win32/msgina/tui.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msgina/tui.c [iso-8859-1] Sat Mar 1 20:45:10 2014
@@ -221,6 +221,8 @@
HANDLE hToken;
WCHAR UserName[256];
WCHAR Password[256];
+ NTSTATUS SubStatus;
+ NTSTATUS Status;
TRACE("TUILockedSAS()\n");
@@ -235,17 +237,23 @@
if (!ReadString(IDS_ASKFORPASSWORD, Password, 256, FALSE))
return WLX_SAS_ACTION_NONE;
- if (!ConnectToLsa(pgContext))
- return WLX_SAS_ACTION_NONE;
-
- if (!MyLogonUser(pgContext->LsaHandle,
- pgContext->AuthenticationPackage,
- UserName,
- NULL,
- Password,
- &hToken))
- {
- WARN("LogonUserW() failed\n");
+ Status = ConnectToLsa(pgContext);
+ if (!NT_SUCCESS(Status))
+ {
+ WARN("ConnectToLsa() failed\n");
+ return WLX_SAS_ACTION_NONE;
+ }
+
+ Status = MyLogonUser(pgContext->LsaHandle,
+ pgContext->AuthenticationPackage,
+ UserName,
+ NULL,
+ Password,
+ &hToken,
+ &SubStatus);
+ if (!NT_SUCCESS(Status))
+ {
+ WARN("MyLogonUser() failed\n");
return WLX_SAS_ACTION_NONE;
}