Author: hpoussin
Date: Sat Aug 8 09:27:37 2009
New Revision: 42495
URL:
http://svn.reactos.org/svn/reactos?rev=42495&view=rev
Log:
[lsasrv] Do not launch a thread to listen for incoming calls, but do it directly
Better LsarClose stub, which tries to do the right thing
Fix a few prototypes
See issue #4689 for more details.
Modified:
trunk/reactos/dll/win32/lsasrv/lsarpc.c
trunk/reactos/include/reactos/idl/lsa.idl
Modified: trunk/reactos/dll/win32/lsasrv/lsarpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsarpc.c?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] Sat Aug 8 09:27:37 2009
@@ -6,7 +6,6 @@
#define NTOS_MODE_USER
#include <ndk/ntndk.h>
-#include "lsasrv.h"
#include "lsa_s.h"
#include <wine/debug.h>
@@ -26,10 +25,11 @@
/* FUNCTIONS ***************************************************************/
-/*static*/ NTSTATUS
-ReferencePolicyHandle(IN LSAPR_HANDLE ObjectHandle,
- IN ACCESS_MASK DesiredAccess,
- OUT PLSAR_POLICY_HANDLE *Policy)
+static NTSTATUS
+ReferencePolicyHandle(
+ IN LSA_HANDLE ObjectHandle,
+ IN ACCESS_MASK DesiredAccess,
+ OUT PLSAR_POLICY_HANDLE *Policy)
{
PLSAR_POLICY_HANDLE ReferencedPolicy;
NTSTATUS Status = STATUS_SUCCESS;
@@ -58,10 +58,10 @@
return Status;
}
-
-/*static*/ VOID
-DereferencePolicyHandle(IN OUT PLSAR_POLICY_HANDLE Policy,
- IN BOOLEAN Delete)
+static VOID
+DereferencePolicyHandle(
+ IN OUT PLSAR_POLICY_HANDLE Policy,
+ IN BOOLEAN Delete)
{
RtlEnterCriticalSection(&PolicyHandleTableLock);
@@ -83,13 +83,17 @@
RtlLeaveCriticalSection(&PolicyHandleTableLock);
}
-
-DWORD WINAPI
-LsapRpcThreadRoutine(LPVOID lpParameter)
+VOID
+LsarStartRpcServer(VOID)
{
RPC_STATUS Status;
- TRACE("LsapRpcThreadRoutine() called");
+ RtlInitializeCriticalSection(&PolicyHandleTableLock);
+ RtlInitializeHandleTable(0x1000,
+ sizeof(LSAR_POLICY_HANDLE),
+ &PolicyHandleTable);
+
+ TRACE("LsarStartRpcServer() called");
Status = RpcServerUseProtseqEpW(L"ncacn_np",
10,
@@ -98,7 +102,7 @@
if (Status != RPC_S_OK)
{
WARN("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status);
- return 0;
+ return;
}
Status = RpcServerRegisterIf(lsarpc_v0_0_s_ifspec,
@@ -107,51 +111,17 @@
if (Status != RPC_S_OK)
{
WARN("RpcServerRegisterIf() failed (Status %lx)\n", Status);
- return 0;
+ return;
}
- Status = RpcServerListen(1, 20, FALSE);
+ Status = RpcServerListen(1, 20, TRUE);
if (Status != RPC_S_OK)
{
WARN("RpcServerListen() failed (Status %lx)\n", Status);
- return 0;
+ return;
}
- TRACE("LsapRpcThreadRoutine() done\n");
-
- return 0;
-}
-
-
-VOID
-LsarStartRpcServer(VOID)
-{
- HANDLE hThread;
-
- TRACE("LsarStartRpcServer() called");
-
- RtlInitializeCriticalSection(&PolicyHandleTableLock);
- RtlInitializeHandleTable(0x1000,
- sizeof(LSAR_POLICY_HANDLE),
- &PolicyHandleTable);
-
- hThread = CreateThread(NULL,
- 0,
- (LPTHREAD_START_ROUTINE)
- LsapRpcThreadRoutine,
- NULL,
- 0,
- NULL);
- if (!hThread)
- {
- WARN("Starting LsapRpcThreadRoutine-Thread failed!\n");
- }
- else
- {
- CloseHandle(hThread);
- }
-
- TRACE("LsarStartRpcServer() done");
+ TRACE("LsarStartRpcServer() done\n");
}
@@ -162,16 +132,24 @@
/* Function 0 */
-NTSTATUS
-LsarClose(LSAPR_HANDLE *ObjectHandle)
-{
-#if 0
+NTSTATUS LsarClose(
+ LSAPR_HANDLE *ObjectHandle)
+{
PLSAR_POLICY_HANDLE Policy = NULL;
NTSTATUS Status;
TRACE("0x%p\n", ObjectHandle);
- Status = ReferencePolicyHandle(*ObjectHandle,
+#if 1
+ /* This is our fake handle, don't go too much long way */
+ if (*ObjectHandle == (LSA_HANDLE)0xcafe)
+ {
+ *ObjectHandle = NULL;
+ Status = STATUS_SUCCESS;
+ }
+#endif
+
+ Status = ReferencePolicyHandle((LSA_HANDLE)*ObjectHandle,
0,
&Policy);
if (NT_SUCCESS(Status))
@@ -182,28 +160,12 @@
}
return Status;
-#endif
- NTSTATUS Status = STATUS_NOT_IMPLEMENTED;
-
- TRACE("LsarClose called!\n");
-
- /* This is our fake handle, don't go too much long way */
- if (*ObjectHandle == (LSA_HANDLE)0xcafe)
- {
- *ObjectHandle = NULL;
- Status = STATUS_SUCCESS;
- }
-
-
- TRACE("LsarClose done (Status: 0x%08lx)!\n", Status);
-
- return Status;
}
/* Function 1 */
-NTSTATUS
-LsarDelete(LSAPR_HANDLE ObjectHandle)
+NTSTATUS LsarDelete(
+ LSAPR_HANDLE ObjectHandle)
{
/* Deprecated */
return STATUS_NOT_SUPPORTED;
@@ -246,7 +208,7 @@
/* Function 5 */
NTSTATUS LsarChangePassword(
- handle_t hBinding, /* FIXME */
+ handle_t IDL_handle,
PRPC_UNICODE_STRING String1,
PRPC_UNICODE_STRING String2,
PRPC_UNICODE_STRING String3,
@@ -265,6 +227,7 @@
ACCESS_MASK DesiredAccess,
LSAPR_HANDLE *PolicyHandle)
{
+#if 1
TRACE("LsarOpenPolicy called!\n");
*PolicyHandle = (LSAPR_HANDLE)0xcafe;
@@ -272,6 +235,10 @@
TRACE("LsarOpenPolicy done!\n");
return STATUS_SUCCESS;
+#else
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+#endif
}
@@ -572,7 +539,11 @@
/* Function 33 */
NTSTATUS LsarLookupPrivilegeDisplayName(
- LSAPR_HANDLE PolicyHandle, /* FIXME */
+ LSAPR_HANDLE PolicyHandle,
+ PRPC_UNICODE_STRING Name,
+ USHORT ClientLanguage,
+ USHORT ClientSystemDefaultLanguage,
+ PRPC_UNICODE_STRING *DisplayName,
USHORT *LanguageReturned)
{
UNIMPLEMENTED;
@@ -1044,7 +1015,7 @@
/* Function 76 */
NTSTATUS LsarLookupSids3(
- handle_t hBinding,
+ LSAPR_HANDLE PolicyHandle,
PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
PLSAPR_TRANSLATED_NAMES_EX TranslatedNames,
@@ -1060,7 +1031,6 @@
/* Function 77 */
NTSTATUS LsarLookupNames4(
- handle_t hBinding,
handle_t RpcHandle,
DWORD Count,
PRPC_UNICODE_STRING Names,
@@ -1111,4 +1081,121 @@
return STATUS_NOT_IMPLEMENTED;
}
+
+/* Function 82 */
+NTSTATUS CredrFindBestCredential(
+ handle_t hBinding)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/* Function 83 */
+NTSTATUS LsarSetAuditPolicy(
+ handle_t hBinding)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/* Function 84 */
+NTSTATUS LsarQueryAuditPolicy(
+ handle_t hBinding)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/* Function 85 */
+NTSTATUS LsarEnumerateAuditPolicy(
+ handle_t hBinding)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/* Function 86 */
+NTSTATUS LsarEnumerateAuditCategories(
+ handle_t hBinding)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/* Function 87 */
+NTSTATUS LsarEnumerateAuditSubCategories(
+ handle_t hBinding)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/* Function 88 */
+NTSTATUS LsarLookupAuditCategoryName(
+ handle_t hBinding)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/* Function 89 */
+NTSTATUS LsarLookupAuditSubCategoryName(
+ handle_t hBinding)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/* Function 90 */
+NTSTATUS LsarSetAuditSecurity(
+ handle_t hBinding)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/* Function 91 */
+NTSTATUS LsarQueryAuditSecurity(
+ handle_t hBinding)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/* Function 92 */
+NTSTATUS CredReadByTokenHandle(
+ handle_t hBinding)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/* Function 93 */
+NTSTATUS CredrRestoreCredentials(
+ handle_t hBinding)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/* Function 94 */
+NTSTATUS CredrBackupCredentials(
+ handle_t hBinding)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
/* EOF */
Modified: trunk/reactos/include/reactos/idl/lsa.idl
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/idl/lsa.id…
==============================================================================
--- trunk/reactos/include/reactos/idl/lsa.idl [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/idl/lsa.idl [iso-8859-1] Sat Aug 8 09:27:37 2009
@@ -622,7 +622,6 @@
/* Function 5 */
NTSTATUS LsarChangePassword(
- [in] handle_t hBinding, /* FIXME */
[in] PRPC_UNICODE_STRING String1,
[in] PRPC_UNICODE_STRING String2,
[in] PRPC_UNICODE_STRING String3,
@@ -805,11 +804,11 @@
/* Function 33 */
NTSTATUS LsarLookupPrivilegeDisplayName(
- [in] LSAPR_HANDLE PolicyHandle, /* FIXME */
- /*[in] PRPC_UNICODE_STRING Name,
+ [in] LSAPR_HANDLE PolicyHandle,
+ [in] PRPC_UNICODE_STRING Name,
[in] USHORT ClientLanguage,
[in] USHORT ClientSystemDefaultLanguage,
- [out] PRPC_UNICODE_STRING *DisplayName,*/
+ [out] PRPC_UNICODE_STRING *DisplayName,
[out] USHORT *LanguageReturned);
/* Function 34 */
@@ -1078,7 +1077,7 @@
/* Function 76 */
NTSTATUS LsarLookupSids3(
- [in] handle_t hBinding, /* FIXME */
+ [in] LSAPR_HANDLE PolicyHandle,
[in] PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
[out] PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
[in, out] PLSAPR_TRANSLATED_NAMES_EX TranslatedNames,
@@ -1089,8 +1088,7 @@
/* Function 77 */
NTSTATUS LsarLookupNames4(
- [in] handle_t hBinding, /* FIXME */
- [in] handle_t RpcHandle,
+ [in] LSAPR_HANDLE PolicyHandle,
[in] DWORD Count,
[in, size_is(Count)] PRPC_UNICODE_STRING Names,
[out] PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,