Document default of the printing config variable.
[Samba/nascimento.git] / source3 / rpc_server / srv_dssetup_nt.c
blob2b18e6b2aeb914143cec45251f708a8a349dbcf2
1 /*
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/>.
25 #include "includes.h"
27 #undef DBGC_CLASS
28 #define DBGC_CLASS DBGC_RPC_SRV
30 /********************************************************************
31 Fill in a dssetup_DsRolePrimaryDomInfoBasic structure
32 ********************************************************************/
34 static WERROR fill_dsrole_dominfo_basic(TALLOC_CTX *ctx,
35 struct dssetup_DsRolePrimaryDomInfoBasic **info)
37 struct dssetup_DsRolePrimaryDomInfoBasic *basic = NULL;
38 char *dnsdomain = NULL;
40 DEBUG(10,("fill_dsrole_dominfo_basic: enter\n"));
42 basic = TALLOC_ZERO_P(ctx, struct dssetup_DsRolePrimaryDomInfoBasic);
43 if (!basic) {
44 DEBUG(0,("fill_dsrole_dominfo_basic: out of memory\n"));
45 return WERR_NOMEM;
48 switch (lp_server_role()) {
49 case ROLE_STANDALONE:
50 basic->role = DS_ROLE_STANDALONE_SERVER;
51 basic->domain = get_global_sam_name();
52 break;
53 case ROLE_DOMAIN_MEMBER:
54 basic->role = DS_ROLE_MEMBER_SERVER;
55 basic->domain = lp_workgroup();
56 break;
57 case ROLE_DOMAIN_BDC:
58 basic->role = DS_ROLE_BACKUP_DC;
59 basic->domain = get_global_sam_name();
60 break;
61 case ROLE_DOMAIN_PDC:
62 basic->role = DS_ROLE_PRIMARY_DC;
63 basic->domain = get_global_sam_name();
64 break;
67 if (secrets_fetch_domain_guid(lp_workgroup(), &basic->domain_guid)) {
68 basic->flags |= DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT;
71 /* fill in some additional fields if we are a member of an AD domain */
73 if (lp_security() == SEC_ADS) {
74 dnsdomain = talloc_strdup(ctx, lp_realm());
75 if (!dnsdomain) {
76 return WERR_NOMEM;
78 strlower_m(dnsdomain);
79 basic->dns_domain = dnsdomain;
81 /* FIXME!! We really should fill in the correct forest
82 name. Should get this information from winbindd. */
83 basic->forest = dnsdomain;
84 } else {
85 /* security = domain should not fill in the dns or
86 forest name */
87 basic->dns_domain = NULL;
88 basic->forest = NULL;
91 *info = basic;
93 return WERR_OK;
96 /********************************************************************
97 Implement the _dssetup_DsRoleGetPrimaryDomainInformation() call
98 ********************************************************************/
100 WERROR _dssetup_DsRoleGetPrimaryDomainInformation(pipes_struct *p,
101 struct dssetup_DsRoleGetPrimaryDomainInformation *r)
103 WERROR werr = WERR_OK;
105 switch (r->in.level) {
107 case DS_ROLE_BASIC_INFORMATION: {
108 struct dssetup_DsRolePrimaryDomInfoBasic *basic = NULL;
109 werr = fill_dsrole_dominfo_basic(p->mem_ctx, &basic);
110 if (W_ERROR_IS_OK(werr)) {
111 r->out.info->basic = *basic;
113 break;
115 default:
116 DEBUG(0,("_dssetup_DsRoleGetPrimaryDomainInformation: "
117 "Unknown info level [%d]!\n", r->in.level));
118 werr = WERR_UNKNOWN_LEVEL;
121 return werr;
124 /****************************************************************
125 ****************************************************************/
127 WERROR _dssetup_DsRoleDnsNameToFlatName(pipes_struct *p,
128 struct dssetup_DsRoleDnsNameToFlatName *r)
130 p->rng_fault_state = true;
131 return WERR_NOT_SUPPORTED;
134 /****************************************************************
135 ****************************************************************/
137 WERROR _dssetup_DsRoleDcAsDc(pipes_struct *p,
138 struct dssetup_DsRoleDcAsDc *r)
140 p->rng_fault_state = true;
141 return WERR_NOT_SUPPORTED;
144 /****************************************************************
145 ****************************************************************/
147 WERROR _dssetup_DsRoleDcAsReplica(pipes_struct *p,
148 struct dssetup_DsRoleDcAsReplica *r)
150 p->rng_fault_state = true;
151 return WERR_NOT_SUPPORTED;
154 /****************************************************************
155 ****************************************************************/
157 WERROR _dssetup_DsRoleDemoteDc(pipes_struct *p,
158 struct dssetup_DsRoleDemoteDc *r)
160 p->rng_fault_state = true;
161 return WERR_NOT_SUPPORTED;
164 /****************************************************************
165 ****************************************************************/
167 WERROR _dssetup_DsRoleGetDcOperationProgress(pipes_struct *p,
168 struct dssetup_DsRoleGetDcOperationProgress *r)
170 p->rng_fault_state = true;
171 return WERR_NOT_SUPPORTED;
174 /****************************************************************
175 ****************************************************************/
177 WERROR _dssetup_DsRoleGetDcOperationResults(pipes_struct *p,
178 struct dssetup_DsRoleGetDcOperationResults *r)
180 p->rng_fault_state = true;
181 return WERR_NOT_SUPPORTED;
184 /****************************************************************
185 ****************************************************************/
187 WERROR _dssetup_DsRoleCancel(pipes_struct *p,
188 struct dssetup_DsRoleCancel *r)
190 p->rng_fault_state = true;
191 return WERR_NOT_SUPPORTED;
194 /****************************************************************
195 ****************************************************************/
197 WERROR _dssetup_DsRoleServerSaveStateForUpgrade(pipes_struct *p,
198 struct dssetup_DsRoleServerSaveStateForUpgrade *r)
200 p->rng_fault_state = true;
201 return WERR_NOT_SUPPORTED;
204 /****************************************************************
205 ****************************************************************/
207 WERROR _dssetup_DsRoleUpgradeDownlevelServer(pipes_struct *p,
208 struct dssetup_DsRoleUpgradeDownlevelServer *r)
210 p->rng_fault_state = true;
211 return WERR_NOT_SUPPORTED;
214 /****************************************************************
215 ****************************************************************/
217 WERROR _dssetup_DsRoleAbortDownlevelServerUpgrade(pipes_struct *p,
218 struct dssetup_DsRoleAbortDownlevelServerUpgrade *r)
220 p->rng_fault_state = true;
221 return WERR_NOT_SUPPORTED;