2
* Unix SMB/CIFS implementation.
3
* RPC Pipe client / server routines
4
* Copyright (C) Andrew Tridgell 1992-1997.
5
* Copyright (C) Luke Kenneth Casson Leighton 1996-1997.
6
* Copyright (C) Paul Ashton 1997.
7
* Copyright (C) Jeremy Allison 2001.
8
* Copyright (C) Gerald Carter 2002.
9
* Copyright (C) Guenther Deschner 2008.
11
* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 3 of the License, or
14
* (at your option) any later version.
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
21
* You should have received a copy of the GNU General Public License
22
* along with this program; if not, see <http://www.gnu.org/licenses/>.
26
#include "../librpc/gen_ndr/srv_dssetup.h"
29
#define DBGC_CLASS DBGC_RPC_SRV
31
/********************************************************************
32
Fill in a dssetup_DsRolePrimaryDomInfoBasic structure
33
********************************************************************/
35
static WERROR fill_dsrole_dominfo_basic(TALLOC_CTX *ctx,
36
struct dssetup_DsRolePrimaryDomInfoBasic **info)
38
struct dssetup_DsRolePrimaryDomInfoBasic *basic = NULL;
39
char *dnsdomain = NULL;
41
DEBUG(10,("fill_dsrole_dominfo_basic: enter\n"));
43
basic = TALLOC_ZERO_P(ctx, struct dssetup_DsRolePrimaryDomInfoBasic);
45
DEBUG(0,("fill_dsrole_dominfo_basic: out of memory\n"));
49
switch (lp_server_role()) {
51
basic->role = DS_ROLE_STANDALONE_SERVER;
52
basic->domain = get_global_sam_name();
54
case ROLE_DOMAIN_MEMBER:
55
basic->role = DS_ROLE_MEMBER_SERVER;
56
basic->domain = lp_workgroup();
59
basic->role = DS_ROLE_BACKUP_DC;
60
basic->domain = get_global_sam_name();
63
basic->role = DS_ROLE_PRIMARY_DC;
64
basic->domain = get_global_sam_name();
68
if (secrets_fetch_domain_guid(lp_workgroup(), &basic->domain_guid)) {
69
basic->flags |= DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT;
72
/* fill in some additional fields if we are a member of an AD domain */
74
if (lp_security() == SEC_ADS) {
75
dnsdomain = talloc_strdup(ctx, lp_realm());
79
strlower_m(dnsdomain);
80
basic->dns_domain = dnsdomain;
82
/* FIXME!! We really should fill in the correct forest
83
name. Should get this information from winbindd. */
84
basic->forest = dnsdomain;
86
/* security = domain should not fill in the dns or
88
basic->dns_domain = NULL;
97
/********************************************************************
98
Implement the _dssetup_DsRoleGetPrimaryDomainInformation() call
99
********************************************************************/
101
WERROR _dssetup_DsRoleGetPrimaryDomainInformation(pipes_struct *p,
102
struct dssetup_DsRoleGetPrimaryDomainInformation *r)
104
WERROR werr = WERR_OK;
106
switch (r->in.level) {
108
case DS_ROLE_BASIC_INFORMATION: {
109
struct dssetup_DsRolePrimaryDomInfoBasic *basic = NULL;
110
werr = fill_dsrole_dominfo_basic(p->mem_ctx, &basic);
111
if (W_ERROR_IS_OK(werr)) {
112
r->out.info->basic = *basic;
117
DEBUG(0,("_dssetup_DsRoleGetPrimaryDomainInformation: "
118
"Unknown info level [%d]!\n", r->in.level));
119
werr = WERR_UNKNOWN_LEVEL;
125
/****************************************************************
126
****************************************************************/
128
WERROR _dssetup_DsRoleDnsNameToFlatName(pipes_struct *p,
129
struct dssetup_DsRoleDnsNameToFlatName *r)
131
p->rng_fault_state = true;
132
return WERR_NOT_SUPPORTED;
135
/****************************************************************
136
****************************************************************/
138
WERROR _dssetup_DsRoleDcAsDc(pipes_struct *p,
139
struct dssetup_DsRoleDcAsDc *r)
141
p->rng_fault_state = true;
142
return WERR_NOT_SUPPORTED;
145
/****************************************************************
146
****************************************************************/
148
WERROR _dssetup_DsRoleDcAsReplica(pipes_struct *p,
149
struct dssetup_DsRoleDcAsReplica *r)
151
p->rng_fault_state = true;
152
return WERR_NOT_SUPPORTED;
155
/****************************************************************
156
****************************************************************/
158
WERROR _dssetup_DsRoleDemoteDc(pipes_struct *p,
159
struct dssetup_DsRoleDemoteDc *r)
161
p->rng_fault_state = true;
162
return WERR_NOT_SUPPORTED;
165
/****************************************************************
166
****************************************************************/
168
WERROR _dssetup_DsRoleGetDcOperationProgress(pipes_struct *p,
169
struct dssetup_DsRoleGetDcOperationProgress *r)
171
p->rng_fault_state = true;
172
return WERR_NOT_SUPPORTED;
175
/****************************************************************
176
****************************************************************/
178
WERROR _dssetup_DsRoleGetDcOperationResults(pipes_struct *p,
179
struct dssetup_DsRoleGetDcOperationResults *r)
181
p->rng_fault_state = true;
182
return WERR_NOT_SUPPORTED;
185
/****************************************************************
186
****************************************************************/
188
WERROR _dssetup_DsRoleCancel(pipes_struct *p,
189
struct dssetup_DsRoleCancel *r)
191
p->rng_fault_state = true;
192
return WERR_NOT_SUPPORTED;
195
/****************************************************************
196
****************************************************************/
198
WERROR _dssetup_DsRoleServerSaveStateForUpgrade(pipes_struct *p,
199
struct dssetup_DsRoleServerSaveStateForUpgrade *r)
201
p->rng_fault_state = true;
202
return WERR_NOT_SUPPORTED;
205
/****************************************************************
206
****************************************************************/
208
WERROR _dssetup_DsRoleUpgradeDownlevelServer(pipes_struct *p,
209
struct dssetup_DsRoleUpgradeDownlevelServer *r)
211
p->rng_fault_state = true;
212
return WERR_NOT_SUPPORTED;
215
/****************************************************************
216
****************************************************************/
218
WERROR _dssetup_DsRoleAbortDownlevelServerUpgrade(pipes_struct *p,
219
struct dssetup_DsRoleAbortDownlevelServerUpgrade *r)
221
p->rng_fault_state = true;
222
return WERR_NOT_SUPPORTED;