mirror of
https://github.com/reactos/reactos.git
synced 2024-12-30 19:14:31 +00:00
[LSASRV]
Implement the Directory Service Setup (dssetup) server. svn path=/trunk/; revision=66520
This commit is contained in:
parent
55af6547e4
commit
a4ed9e2e4e
4 changed files with 180 additions and 1 deletions
|
@ -4,13 +4,16 @@ include_directories(
|
|||
${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 @@ list(APPEND SOURCE
|
|||
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)
|
||||
|
||||
|
|
169
reactos/dll/win32/lsasrv/dssetup.c
Normal file
169
reactos/dll/win32/lsasrv/dssetup.c
Normal file
|
@ -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 */
|
|
@ -44,6 +44,8 @@ LsarStartRpcServer(VOID)
|
|||
return;
|
||||
}
|
||||
|
||||
DsSetupInit();
|
||||
|
||||
Status = RpcServerListen(1, 20, TRUE);
|
||||
if (Status != RPC_S_OK)
|
||||
{
|
||||
|
|
|
@ -166,6 +166,10 @@ NTSTATUS
|
|||
LsapDeleteObjectAttribute(PLSA_DB_OBJECT DbObject,
|
||||
LPWSTR AttributeName);
|
||||
|
||||
/* dssetup.c */
|
||||
VOID
|
||||
DsSetupInit(VOID);
|
||||
|
||||
/* lookup.c */
|
||||
NTSTATUS
|
||||
LsapInitSids(VOID);
|
||||
|
|
Loading…
Reference in a new issue