Author: ekohl
Date: Sun Mar 1 15:21:23 2015
New Revision: 66520
URL:
http://svn.reactos.org/svn/reactos?rev=66520&view=rev
Log:
[LSASRV]
Implement the Directory Service Setup (dssetup) server.
Added:
trunk/reactos/dll/win32/lsasrv/dssetup.c (with props)
Modified:
trunk/reactos/dll/win32/lsasrv/CMakeLists.txt
trunk/reactos/dll/win32/lsasrv/lsarpc.c
trunk/reactos/dll/win32/lsasrv/lsasrv.h
Modified: trunk/reactos/dll/win32/lsasrv/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/CMakeList…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/CMakeLists.txt [iso-8859-1] Sun Mar 1 15:21:23 2015
@@ -4,13 +4,16 @@
${REACTOS_SOURCE_DIR}/include/reactos/idl
${REACTOS_SOURCE_DIR}/include/reactos/subsys/lsass)
-add_rpc_files(server ${REACTOS_SOURCE_DIR}/include/reactos/idl/lsa.idl)
+add_rpc_files(server
+ ${REACTOS_SOURCE_DIR}/include/reactos/idl/dssetup.idl
+ ${REACTOS_SOURCE_DIR}/include/reactos/idl/lsa.idl)
spec2def(lsasrv.dll lsasrv.spec ADD_IMPORTLIB)
list(APPEND SOURCE
authpackage.c
authport.c
database.c
+ dssetup.c
lookup.c
lsarpc.c
lsasrv.c
@@ -21,6 +24,7 @@
session.c
utils.c
lsasrv.h
+ ${CMAKE_CURRENT_BINARY_DIR}/dssetup_s.c
${CMAKE_CURRENT_BINARY_DIR}/lsa_s.c
${CMAKE_CURRENT_BINARY_DIR}/lsasrv_stubs.c)
Added: trunk/reactos/dll/win32/lsasrv/dssetup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/dssetup.c…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/dssetup.c (added)
+++ trunk/reactos/dll/win32/lsasrv/dssetup.c [iso-8859-1] Sun Mar 1 15:21:23 2015
@@ -0,0 +1,169 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: Local Security Authority (LSA) Server
+ * FILE: reactos/dll/win32/lsasrv/dssetup.c
+ * PURPOSE: Directory Service setup functions
+ *
+ * PROGRAMMERS: Eric Kohl
+ */
+
+#include "lsasrv.h"
+#include "dssetup_s.h"
+#include "resources.h"
+
+VOID
+NTAPI
+LsaIFree_LSAPR_POLICY_INFORMATION(IN POLICY_INFORMATION_CLASS InformationClass,
+ IN PLSAPR_POLICY_INFORMATION PolicyInformation);
+
+/* GLOBALS *****************************************************************/
+
+VOID
+DsSetupInit(VOID)
+{
+ RPC_STATUS Status;
+
+ Status = RpcServerRegisterIf(dssetup_v0_0_s_ifspec,
+ NULL,
+ NULL);
+ if (Status != RPC_S_OK)
+ {
+ WARN("RpcServerRegisterIf() failed (Status %lx)\n", Status);
+ return;
+ }
+}
+
+
+static
+NET_API_STATUS
+DsRolepGetBasicInfo(
+ PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo)
+{
+ LSAPR_OBJECT_ATTRIBUTES ObjectAttributes;
+ PDSROLER_PRIMARY_DOMAIN_INFO_BASIC Buffer;
+ PLSAPR_POLICY_INFORMATION PolicyInfo;
+ LSA_HANDLE PolicyHandle;
+ ULONG Size;
+ NTSTATUS Status;
+
+ ZeroMemory(&ObjectAttributes, sizeof(ObjectAttributes));
+ Status = LsarOpenPolicy(NULL,
+ &ObjectAttributes,
+ POLICY_VIEW_LOCAL_INFORMATION,
+ &PolicyHandle);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("LsarOpenPolicyFailed with NT status %x\n",
+ LsaNtStatusToWinError(Status));
+ return ERROR_OUTOFMEMORY;
+ }
+
+ Status = LsarQueryInformationPolicy(PolicyHandle,
+ PolicyAccountDomainInformation,
+ &PolicyInfo);
+ LsarClose(PolicyHandle);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("LsarQueryInformationPolicy with NT status %x\n",
+ LsaNtStatusToWinError(Status));
+ return ERROR_OUTOFMEMORY;
+ }
+
+ Size = sizeof(DSROLER_PRIMARY_DOMAIN_INFO_BASIC) +
+ PolicyInfo->PolicyAccountDomainInfo.DomainName.Length + sizeof(WCHAR);
+
+ Buffer = midl_user_allocate(Size);
+ if (Buffer == NULL)
+ {
+ LsaIFree_LSAPR_POLICY_INFORMATION(PolicyAccountDomainInformation,
+ PolicyInfo);
+ return ERROR_OUTOFMEMORY;
+ }
+
+ Buffer->MachineRole = DsRole_RoleStandaloneWorkstation;
+ Buffer->DomainNameFlat = (LPWSTR)((LPBYTE)Buffer +
+ sizeof(DSROLER_PRIMARY_DOMAIN_INFO_BASIC));
+ wcscpy(Buffer->DomainNameFlat,
PolicyInfo->PolicyAccountDomainInfo.DomainName.Buffer);
+
+ LsaIFree_LSAPR_POLICY_INFORMATION(PolicyAccountDomainInformation,
+ PolicyInfo);
+
+ *DomainInfo = (PDSROLER_PRIMARY_DOMAIN_INFORMATION)Buffer;
+
+ return ERROR_SUCCESS;
+}
+
+
+static
+NET_API_STATUS
+DsRolepGetUpdateStatus(
+ PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo)
+{
+ PDSROLE_UPGRADE_STATUS_INFO Buffer;
+
+ Buffer = midl_user_allocate(sizeof(DSROLE_UPGRADE_STATUS_INFO));
+ if (Buffer == NULL)
+ return ERROR_OUTOFMEMORY;
+
+ Buffer->OperationState = 0;
+ Buffer->PreviousServerState = 0;
+
+ *DomainInfo = (PDSROLER_PRIMARY_DOMAIN_INFORMATION)Buffer;
+
+ return ERROR_SUCCESS;
+}
+
+
+static
+NET_API_STATUS
+DsRolepGetOperationState(
+ PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo)
+{
+ PDSROLE_OPERATION_STATE_INFO Buffer;
+
+ Buffer = midl_user_allocate(sizeof(DSROLE_OPERATION_STATE_INFO));
+ if (Buffer == NULL)
+ return ERROR_OUTOFMEMORY;
+
+ Buffer->OperationState = DsRoleOperationIdle;
+
+ *DomainInfo = (PDSROLER_PRIMARY_DOMAIN_INFORMATION)Buffer;
+
+ return ERROR_SUCCESS;
+}
+
+
+DWORD
+WINAPI
+DsRolerGetPrimaryDomainInformation(
+ handle_t hBinding,
+ DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel,
+ PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo)
+{
+ NET_API_STATUS ret;
+
+ TRACE("DsRolerGetPrimaryDomainInformation(%p, %d, %p)\n",
+ hBinding, InfoLevel, DomainInfo);
+
+ switch (InfoLevel)
+ {
+ case DsRolePrimaryDomainInfoBasic:
+ ret = DsRolepGetBasicInfo(DomainInfo);
+ break;
+
+ case DsRoleUpgradeStatus:
+ ret = DsRolepGetUpdateStatus(DomainInfo);
+ break;
+
+ case DsRoleOperationState:
+ ret = DsRolepGetOperationState(DomainInfo);
+ break;
+
+ default:
+ ret = ERROR_CALL_NOT_IMPLEMENTED;
+ }
+
+ return ret;
+}
+
+/* EOF */
Propchange: trunk/reactos/dll/win32/lsasrv/dssetup.c
------------------------------------------------------------------------------
svn:eol-style = native
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] Sun Mar 1 15:21:23 2015
@@ -43,6 +43,8 @@
WARN("RpcServerRegisterIf() failed (Status %lx)\n", Status);
return;
}
+
+ DsSetupInit();
Status = RpcServerListen(1, 20, TRUE);
if (Status != RPC_S_OK)
Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.h?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] Sun Mar 1 15:21:23 2015
@@ -166,6 +166,10 @@
LsapDeleteObjectAttribute(PLSA_DB_OBJECT DbObject,
LPWSTR AttributeName);
+/* dssetup.c */
+VOID
+DsSetupInit(VOID);
+
/* lookup.c */
NTSTATUS
LsapInitSids(VOID);