ReactOS  0.4.14-dev-838-g99f979d
dssetup.c File Reference
#include "lsasrv.h"
#include "dssetup_s.h"
#include "resources.h"
Include dependency graph for dssetup.c:

Go to the source code of this file.

Functions

VOID NTAPI LsaIFree_LSAPR_POLICY_INFORMATION (IN POLICY_INFORMATION_CLASS InformationClass, IN PLSAPR_POLICY_INFORMATION PolicyInformation)
 
VOID DsSetupInit (VOID)
 
static NET_API_STATUS DsRolepGetBasicInfo (PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo)
 
static NET_API_STATUS DsRolepGetUpdateStatus (PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo)
 
static NET_API_STATUS DsRolepGetOperationState (PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo)
 
DWORD WINAPI DsRolerGetPrimaryDomainInformation (handle_t hBinding, DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel, PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo)
 

Function Documentation

◆ DsRolepGetBasicInfo()

static NET_API_STATUS DsRolepGetBasicInfo ( PDSROLER_PRIMARY_DOMAIN_INFORMATION DomainInfo)
static

Definition at line 39 of file dssetup.c.

41 {
44  PLSAPR_POLICY_INFORMATION PolicyInfo;
45  LSA_HANDLE PolicyHandle;
46  ULONG Size;
48 
53  &PolicyHandle);
54  if (!NT_SUCCESS(Status))
55  {
56  TRACE("LsarOpenPolicyFailed with NT status %x\n",
58  return ERROR_OUTOFMEMORY;
59  }
60 
61  Status = LsarQueryInformationPolicy(PolicyHandle,
63  &PolicyInfo);
64  LsarClose(&PolicyHandle);
65  if (!NT_SUCCESS(Status))
66  {
67  TRACE("LsarQueryInformationPolicy with NT status %x\n",
69  return ERROR_OUTOFMEMORY;
70  }
71 
73  PolicyInfo->PolicyAccountDomainInfo.DomainName.Length + sizeof(WCHAR);
74 
76  if (Buffer == NULL)
77  {
79  PolicyInfo);
80  return ERROR_OUTOFMEMORY;
81  }
82 
84  Buffer->DomainNameFlat = (LPWSTR)((LPBYTE)Buffer +
86  wcscpy(Buffer->DomainNameFlat, PolicyInfo->PolicyAccountDomainInfo.DomainName.Buffer);
87 
89  PolicyInfo);
90 
92 
93  return ERROR_SUCCESS;
94 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
RPC_UNICODE_STRING DomainName
Definition: msv1_0.h:277
#define ERROR_SUCCESS
Definition: deptool.c:10
#define midl_user_allocate
Definition: rpc.h:44
#define POLICY_VIEW_LOCAL_INFORMATION
Definition: ntsecapi.h:61
LONG NTSTATUS
Definition: precomp.h:26
LSAPR_POLICY_ACCOUNT_DOM_INFO PolicyAccountDomainInfo
Definition: msv1_0.h:307
VOID NTAPI LsaIFree_LSAPR_POLICY_INFORMATION(IN POLICY_INFORMATION_CLASS InformationClass, IN PLSAPR_POLICY_INFORMATION PolicyInformation)
Definition: lsasrv.c:51
unsigned char * LPBYTE
Definition: typedefs.h:52
union _DSROLER_PRIMARY_DOMAIN_INFORMATION * PDSROLER_PRIMARY_DOMAIN_INFORMATION
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
NTSTATUS WINAPI LsarQueryInformationPolicy(LSAPR_HANDLE PolicyHandle, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: lsarpc.c:531
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
ULONG WINAPI LsaNtStatusToWinError(IN NTSTATUS Status)
Definition: lsa.c:1129
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _DSROLER_PRIMARY_DOMAIN_INFO_BASIC DSROLER_PRIMARY_DOMAIN_INFO_BASIC
NTSTATUS WINAPI LsarClose(LSAPR_HANDLE *ObjectHandle)
Definition: lsarpc.c:125
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
unsigned short Length
Definition: msv1_0.h:53
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
NTSTATUS WINAPI LsarOpenPolicy(LPWSTR SystemName, PLSAPR_OBJECT_ATTRIBUTES ObjectAttributes, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *PolicyHandle)
Definition: lsarpc.c:495
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
WCHAR * LPWSTR
Definition: xmlstorage.h:184
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by DsRolerGetPrimaryDomainInformation().

◆ DsRolepGetOperationState()

static NET_API_STATUS DsRolepGetOperationState ( PDSROLER_PRIMARY_DOMAIN_INFORMATION DomainInfo)
static

Definition at line 119 of file dssetup.c.

121 {
123 
125  if (Buffer == NULL)
126  return ERROR_OUTOFMEMORY;
127 
128  Buffer->OperationState = DsRoleOperationIdle;
129 
131 
132  return ERROR_SUCCESS;
133 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define midl_user_allocate
Definition: rpc.h:44
union _DSROLER_PRIMARY_DOMAIN_INFORMATION * PDSROLER_PRIMARY_DOMAIN_INFORMATION
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by DsRolerGetPrimaryDomainInformation().

◆ DsRolepGetUpdateStatus()

static NET_API_STATUS DsRolepGetUpdateStatus ( PDSROLER_PRIMARY_DOMAIN_INFORMATION DomainInfo)
static

Definition at line 99 of file dssetup.c.

101 {
103 
105  if (Buffer == NULL)
106  return ERROR_OUTOFMEMORY;
107 
108  Buffer->OperationState = 0;
109  Buffer->PreviousServerState = 0;
110 
112 
113  return ERROR_SUCCESS;
114 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define midl_user_allocate
Definition: rpc.h:44
union _DSROLER_PRIMARY_DOMAIN_INFORMATION * PDSROLER_PRIMARY_DOMAIN_INFORMATION
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by DsRolerGetPrimaryDomainInformation().

◆ DsRolerGetPrimaryDomainInformation()

DWORD WINAPI DsRolerGetPrimaryDomainInformation ( handle_t  hBinding,
DSROLE_PRIMARY_DOMAIN_INFO_LEVEL  InfoLevel,
PDSROLER_PRIMARY_DOMAIN_INFORMATION DomainInfo 
)

Definition at line 138 of file dssetup.c.

142 {
144 
145  TRACE("DsRolerGetPrimaryDomainInformation(%p, %d, %p)\n",
146  hBinding, InfoLevel, DomainInfo);
147 
148  switch (InfoLevel)
149  {
151  ret = DsRolepGetBasicInfo(DomainInfo);
152  break;
153 
154  case DsRoleUpgradeStatus:
155  ret = DsRolepGetUpdateStatus(DomainInfo);
156  break;
157 
159  ret = DsRolepGetOperationState(DomainInfo);
160  break;
161 
162  default:
164  }
165 
166  return ret;
167 }
handle_t hBinding
Definition: ctx_c.c:54
static NET_API_STATUS DsRolepGetOperationState(PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo)
Definition: dssetup.c:119
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define TRACE(s)
Definition: solgame.cpp:4
int ret
static NET_API_STATUS DsRolepGetUpdateStatus(PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo)
Definition: dssetup.c:99
static NET_API_STATUS DsRolepGetBasicInfo(PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo)
Definition: dssetup.c:39
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

Referenced by DsRoleGetPrimaryDomainInformation().

◆ DsSetupInit()

VOID DsSetupInit ( VOID  )

Definition at line 22 of file dssetup.c.

23 {
25 
26  Status = RpcServerRegisterIf(dssetup_v0_0_s_ifspec,
27  NULL,
28  NULL);
29  if (Status != RPC_S_OK)
30  {
31  WARN("RpcServerRegisterIf() failed (Status %lx)\n", Status);
32  return;
33  }
34 }
#define WARN(fmt,...)
Definition: debug.h:111
long RPC_STATUS
Definition: rpc.h:52
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS WINAPI RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv)
Definition: rpc_server.c:1116
Status
Definition: gdiplustypes.h:24
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by LsarStartRpcServer().

◆ LsaIFree_LSAPR_POLICY_INFORMATION()

VOID NTAPI LsaIFree_LSAPR_POLICY_INFORMATION ( IN POLICY_INFORMATION_CLASS  InformationClass,
IN PLSAPR_POLICY_INFORMATION  PolicyInformation 
)

Definition at line 51 of file lsasrv.c.

53 {
54  if (PolicyInformation != NULL)
55  {
56  switch (InformationClass)
57  {
58  case PolicyAuditLogInformation: /* 1 */
59  break;
60 
61  case PolicyAuditEventsInformation: /* 2 */
62  if (PolicyInformation->PolicyAuditEventsInfo.EventAuditingOptions != NULL)
63  midl_user_free(PolicyInformation->PolicyAuditEventsInfo.EventAuditingOptions);
64  break;
65 
66  case PolicyPrimaryDomainInformation: /* 3 */
67  if (PolicyInformation->PolicyPrimaryDomInfo.Name.Buffer != NULL)
68  midl_user_free(PolicyInformation->PolicyPrimaryDomInfo.Name.Buffer);
69 
70  if (PolicyInformation->PolicyPrimaryDomInfo.Sid != NULL)
71  midl_user_free(PolicyInformation->PolicyPrimaryDomInfo.Sid);
72  break;
73 
74  case PolicyPdAccountInformation: /* 4 */
75  if (PolicyInformation->PolicyPdAccountInfo.Name.Buffer != NULL)
76  midl_user_free(PolicyInformation->PolicyPdAccountInfo.Name.Buffer);
77  break;
78 
79  case PolicyAccountDomainInformation: /* 5 */
80  if (PolicyInformation->PolicyAccountDomainInfo.DomainName.Buffer != NULL)
81  midl_user_free(PolicyInformation->PolicyAccountDomainInfo.DomainName.Buffer);
82 
83  if (PolicyInformation->PolicyAccountDomainInfo.Sid != NULL)
84  midl_user_free(PolicyInformation->PolicyAccountDomainInfo.Sid);
85  break;
86 
87  case PolicyLsaServerRoleInformation: /* 6 */
88  break;
89 
90  case PolicyReplicaSourceInformation: /* 7 */
91  if (PolicyInformation->PolicyReplicaSourceInfo.ReplicaSource.Buffer != NULL)
92  midl_user_free(PolicyInformation->PolicyReplicaSourceInfo.ReplicaSource.Buffer);
93 
94  if (PolicyInformation->PolicyReplicaSourceInfo.ReplicaAccountName.Buffer != NULL)
95  midl_user_free(PolicyInformation->PolicyReplicaSourceInfo.ReplicaAccountName.Buffer);
96  break;
97 
98  case PolicyDefaultQuotaInformation: /* 8 */
99  break;
100 
101  case PolicyModificationInformation: /* 9 */
102  break;
103 
104  case PolicyAuditFullSetInformation: /* 10 (0xA) */
105  break;
106 
107  case PolicyAuditFullQueryInformation: /* 11 (0xB) */
108  break;
109 
110  case PolicyDnsDomainInformation: /* 12 (0xC) */
111  if (PolicyInformation->PolicyDnsDomainInfo.Name.Buffer != NULL)
112  midl_user_free(PolicyInformation->PolicyDnsDomainInfo.Name.Buffer);
113 
114  if (PolicyInformation->PolicyDnsDomainInfo.DnsDomainName.Buffer != NULL)
115  midl_user_free(PolicyInformation->PolicyDnsDomainInfo.DnsDomainName.Buffer);
116 
117  if (PolicyInformation->PolicyDnsDomainInfo.DnsForestName.Buffer != NULL)
118  midl_user_free(PolicyInformation->PolicyDnsDomainInfo.DnsForestName.Buffer);
119 
120  if (PolicyInformation->PolicyDnsDomainInfo.Sid != NULL)
121  midl_user_free(PolicyInformation->PolicyDnsDomainInfo.Sid);
122  break;
123 
124  case PolicyDnsDomainInformationInt: /* 13 (0xD) */
125  if (PolicyInformation->PolicyDnsDomainInfoInt.Name.Buffer != NULL)
126  midl_user_free(PolicyInformation->PolicyDnsDomainInfoInt.Name.Buffer);
127 
128  if (PolicyInformation->PolicyDnsDomainInfoInt.DnsDomainName.Buffer != NULL)
129  midl_user_free(PolicyInformation->PolicyDnsDomainInfoInt.DnsDomainName.Buffer);
130 
131  if (PolicyInformation->PolicyDnsDomainInfoInt.DnsForestName.Buffer != NULL)
132  midl_user_free(PolicyInformation->PolicyDnsDomainInfoInt.DnsForestName.Buffer);
133 
134  if (PolicyInformation->PolicyDnsDomainInfoInt.Sid != NULL)
135  midl_user_free(PolicyInformation->PolicyDnsDomainInfoInt.Sid);
136  break;
137 
138  case PolicyLocalAccountDomainInformation: /* 14 (0xE) */
139  if (PolicyInformation->PolicyLocalAccountDomainInfo.DomainName.Buffer != NULL)
140  midl_user_free(PolicyInformation->PolicyLocalAccountDomainInfo.DomainName.Buffer);
141 
142  if (PolicyInformation->PolicyLocalAccountDomainInfo.Sid != NULL)
143  midl_user_free(PolicyInformation->PolicyLocalAccountDomainInfo.Sid);
144  break;
145 
146  default:
147  ERR("Invalid InformationClass: %lu\n", InformationClass);
148  break;
149  }
150 
151  midl_user_free(PolicyInformation);
152  }
153 }
smooth NULL
Definition: ftsmooth.c:416
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: lsasrv.c:346
#define ERR(fmt,...)
Definition: debug.h:109
_In_ FILTER_INFORMATION_CLASS InformationClass
Definition: fltkernel.h:1714

Referenced by DsRolepGetBasicInfo(), and GetAccountDomainSid().