Line data Source code
1 : /* s3 compat server functions auto-generated by pidl */
2 : #include "bin/default/librpc/gen_ndr/ndr_wkssvc.h"
3 : #include "bin/default/librpc/gen_ndr/ndr_wkssvc_scompat.h"
4 : #include <librpc/rpc/dcesrv_core.h>
5 : #include <rpc_server/rpc_config.h>
6 : #include <rpc_server/rpc_server.h>
7 : #include <util/debug.h>
8 :
9 : enum s3compat_rpc_dispatch {
10 : S3COMPAT_RPC_DISPATCH_EXTERNAL = 0x00000001,
11 : S3COMPAT_RPC_DISPATCH_INTERNAL = 0x00000002,
12 : };
13 :
14 : /* wkssvc - dcerpc server boilerplate generated by pidl */
15 4 : static NTSTATUS wkssvc__op_bind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
16 : {
17 : #ifdef DCESRV_INTERFACE_WKSSVC_BIND
18 : return DCESRV_INTERFACE_WKSSVC_BIND(context,iface);
19 : #else
20 4 : return NT_STATUS_OK;
21 : #endif
22 : }
23 :
24 4 : static void wkssvc__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
25 : {
26 : #ifdef DCESRV_INTERFACE_WKSSVC_UNBIND
27 : DCESRV_INTERFACE_WKSSVC_UNBIND(context, iface);
28 : #else
29 4 : return;
30 : #endif
31 : }
32 :
33 58 : NTSTATUS wkssvc__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
34 : {
35 0 : enum ndr_err_code ndr_err;
36 58 : uint16_t opnum = dce_call->pkt.u.request.opnum;
37 :
38 58 : dce_call->fault_code = 0;
39 :
40 58 : if (opnum >= ndr_table_wkssvc.num_calls) {
41 0 : dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
42 0 : return NT_STATUS_NET_WRITE_FAULT;
43 : }
44 :
45 58 : *r = talloc_named(mem_ctx, ndr_table_wkssvc.calls[opnum].struct_size, "struct %s", ndr_table_wkssvc.calls[opnum].name);
46 58 : NT_STATUS_HAVE_NO_MEMORY(*r);
47 :
48 : /* unravel the NDR for the packet */
49 58 : ndr_err = ndr_table_wkssvc.calls[opnum].ndr_pull(pull, NDR_IN, *r);
50 58 : if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
51 0 : dce_call->fault_code = DCERPC_FAULT_NDR;
52 0 : return NT_STATUS_NET_WRITE_FAULT;
53 : }
54 :
55 58 : return NT_STATUS_OK;
56 : }
57 :
58 58 : static NTSTATUS wkssvc__op_dispatch_internal(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r, enum s3compat_rpc_dispatch dispatch)
59 : {
60 58 : uint16_t opnum = dce_call->pkt.u.request.opnum;
61 58 : struct pipes_struct *p = NULL;
62 58 : NTSTATUS status = NT_STATUS_OK;
63 58 : bool impersonated = false;
64 :
65 : /* Retrieve pipes struct */
66 58 : p = dcesrv_get_pipes_struct(dce_call->conn);
67 58 : p->dce_call = dce_call;
68 58 : p->mem_ctx = mem_ctx;
69 : /* Reset pipes struct fault state */
70 58 : p->fault_state = 0;
71 :
72 : /* Impersonate */
73 58 : if (dispatch == S3COMPAT_RPC_DISPATCH_EXTERNAL) {
74 58 : impersonated = become_authenticated_pipe_user(dce_call->auth_state->session_info);
75 58 : if (!impersonated) {
76 0 : dce_call->fault_code = DCERPC_FAULT_ACCESS_DENIED;
77 0 : status = NT_STATUS_NET_WRITE_FAULT;
78 0 : goto fail;
79 : }
80 : }
81 :
82 58 : switch (opnum) {
83 10 : case 0: { /* wkssvc_NetWkstaGetInfo */
84 10 : struct wkssvc_NetWkstaGetInfo *r2 = (struct wkssvc_NetWkstaGetInfo *)r;
85 10 : if (DEBUGLEVEL >= 10) {
86 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetWkstaGetInfo, NDR_IN, r2);
87 : }
88 10 : NDR_ZERO_STRUCT(r2->out);
89 10 : r2->out.info = talloc_zero(r2, union wkssvc_NetWkstaInfo);
90 10 : if (r2->out.info == NULL) {
91 0 : status = NT_STATUS_NO_MEMORY;
92 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
93 0 : goto fail;
94 : }
95 :
96 10 : r2->out.result = _wkssvc_NetWkstaGetInfo(p, r2);
97 10 : break;
98 : }
99 0 : case 1: { /* wkssvc_NetWkstaSetInfo */
100 0 : struct wkssvc_NetWkstaSetInfo *r2 = (struct wkssvc_NetWkstaSetInfo *)r;
101 0 : if (DEBUGLEVEL >= 10) {
102 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetWkstaSetInfo, NDR_IN, r2);
103 : }
104 0 : NDR_ZERO_STRUCT(r2->out);
105 0 : r2->out.parm_error = r2->in.parm_error;
106 0 : r2->out.result = _wkssvc_NetWkstaSetInfo(p, r2);
107 0 : break;
108 : }
109 4 : case 2: { /* wkssvc_NetWkstaEnumUsers */
110 4 : struct wkssvc_NetWkstaEnumUsers *r2 = (struct wkssvc_NetWkstaEnumUsers *)r;
111 4 : if (DEBUGLEVEL >= 10) {
112 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetWkstaEnumUsers, NDR_IN, r2);
113 : }
114 4 : NDR_ZERO_STRUCT(r2->out);
115 4 : r2->out.info = r2->in.info;
116 4 : r2->out.resume_handle = r2->in.resume_handle;
117 4 : r2->out.entries_read = talloc_zero(r2, uint32_t);
118 4 : if (r2->out.entries_read == NULL) {
119 0 : status = NT_STATUS_NO_MEMORY;
120 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
121 0 : goto fail;
122 : }
123 :
124 4 : r2->out.result = _wkssvc_NetWkstaEnumUsers(p, r2);
125 4 : break;
126 : }
127 2 : case 3: { /* wkssvc_NetrWkstaUserGetInfo */
128 2 : struct wkssvc_NetrWkstaUserGetInfo *r2 = (struct wkssvc_NetrWkstaUserGetInfo *)r;
129 2 : if (DEBUGLEVEL >= 10) {
130 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrWkstaUserGetInfo, NDR_IN, r2);
131 : }
132 2 : NDR_ZERO_STRUCT(r2->out);
133 2 : r2->out.info = talloc_zero(r2, union wkssvc_NetrWkstaUserInfo);
134 2 : if (r2->out.info == NULL) {
135 0 : status = NT_STATUS_NO_MEMORY;
136 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
137 0 : goto fail;
138 : }
139 :
140 2 : r2->out.result = _wkssvc_NetrWkstaUserGetInfo(p, r2);
141 2 : break;
142 : }
143 0 : case 4: { /* wkssvc_NetrWkstaUserSetInfo */
144 0 : struct wkssvc_NetrWkstaUserSetInfo *r2 = (struct wkssvc_NetrWkstaUserSetInfo *)r;
145 0 : if (DEBUGLEVEL >= 10) {
146 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrWkstaUserSetInfo, NDR_IN, r2);
147 : }
148 0 : NDR_ZERO_STRUCT(r2->out);
149 0 : r2->out.parm_err = r2->in.parm_err;
150 0 : r2->out.result = _wkssvc_NetrWkstaUserSetInfo(p, r2);
151 0 : break;
152 : }
153 2 : case 5: { /* wkssvc_NetWkstaTransportEnum */
154 2 : struct wkssvc_NetWkstaTransportEnum *r2 = (struct wkssvc_NetWkstaTransportEnum *)r;
155 2 : if (DEBUGLEVEL >= 10) {
156 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetWkstaTransportEnum, NDR_IN, r2);
157 : }
158 2 : NDR_ZERO_STRUCT(r2->out);
159 2 : r2->out.info = r2->in.info;
160 2 : r2->out.resume_handle = r2->in.resume_handle;
161 2 : r2->out.total_entries = talloc_zero(r2, uint32_t);
162 2 : if (r2->out.total_entries == NULL) {
163 0 : status = NT_STATUS_NO_MEMORY;
164 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
165 0 : goto fail;
166 : }
167 :
168 2 : r2->out.result = _wkssvc_NetWkstaTransportEnum(p, r2);
169 2 : break;
170 : }
171 2 : case 6: { /* wkssvc_NetrWkstaTransportAdd */
172 2 : struct wkssvc_NetrWkstaTransportAdd *r2 = (struct wkssvc_NetrWkstaTransportAdd *)r;
173 2 : if (DEBUGLEVEL >= 10) {
174 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrWkstaTransportAdd, NDR_IN, r2);
175 : }
176 2 : NDR_ZERO_STRUCT(r2->out);
177 2 : r2->out.parm_err = r2->in.parm_err;
178 2 : r2->out.result = _wkssvc_NetrWkstaTransportAdd(p, r2);
179 2 : break;
180 : }
181 2 : case 7: { /* wkssvc_NetrWkstaTransportDel */
182 2 : struct wkssvc_NetrWkstaTransportDel *r2 = (struct wkssvc_NetrWkstaTransportDel *)r;
183 2 : if (DEBUGLEVEL >= 10) {
184 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrWkstaTransportDel, NDR_IN, r2);
185 : }
186 2 : r2->out.result = _wkssvc_NetrWkstaTransportDel(p, r2);
187 2 : break;
188 : }
189 2 : case 8: { /* wkssvc_NetrUseAdd */
190 2 : struct wkssvc_NetrUseAdd *r2 = (struct wkssvc_NetrUseAdd *)r;
191 2 : if (DEBUGLEVEL >= 10) {
192 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrUseAdd, NDR_IN, r2);
193 : }
194 2 : NDR_ZERO_STRUCT(r2->out);
195 2 : r2->out.parm_err = r2->in.parm_err;
196 2 : r2->out.result = _wkssvc_NetrUseAdd(p, r2);
197 2 : break;
198 : }
199 0 : case 9: { /* wkssvc_NetrUseGetInfo */
200 0 : struct wkssvc_NetrUseGetInfo *r2 = (struct wkssvc_NetrUseGetInfo *)r;
201 0 : if (DEBUGLEVEL >= 10) {
202 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrUseGetInfo, NDR_IN, r2);
203 : }
204 0 : NDR_ZERO_STRUCT(r2->out);
205 0 : r2->out.ctr = talloc_zero(r2, union wkssvc_NetrUseGetInfoCtr);
206 0 : if (r2->out.ctr == NULL) {
207 0 : status = NT_STATUS_NO_MEMORY;
208 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
209 0 : goto fail;
210 : }
211 :
212 0 : r2->out.result = _wkssvc_NetrUseGetInfo(p, r2);
213 0 : break;
214 : }
215 2 : case 10: { /* wkssvc_NetrUseDel */
216 2 : struct wkssvc_NetrUseDel *r2 = (struct wkssvc_NetrUseDel *)r;
217 2 : if (DEBUGLEVEL >= 10) {
218 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrUseDel, NDR_IN, r2);
219 : }
220 2 : r2->out.result = _wkssvc_NetrUseDel(p, r2);
221 2 : break;
222 : }
223 4 : case 11: { /* wkssvc_NetrUseEnum */
224 4 : struct wkssvc_NetrUseEnum *r2 = (struct wkssvc_NetrUseEnum *)r;
225 4 : if (DEBUGLEVEL >= 10) {
226 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrUseEnum, NDR_IN, r2);
227 : }
228 4 : NDR_ZERO_STRUCT(r2->out);
229 4 : r2->out.info = r2->in.info;
230 4 : r2->out.resume_handle = r2->in.resume_handle;
231 4 : r2->out.entries_read = talloc_zero(r2, uint32_t);
232 4 : if (r2->out.entries_read == NULL) {
233 0 : status = NT_STATUS_NO_MEMORY;
234 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
235 0 : goto fail;
236 : }
237 :
238 4 : r2->out.result = _wkssvc_NetrUseEnum(p, r2);
239 4 : break;
240 : }
241 2 : case 12: { /* wkssvc_NetrMessageBufferSend */
242 2 : struct wkssvc_NetrMessageBufferSend *r2 = (struct wkssvc_NetrMessageBufferSend *)r;
243 2 : if (DEBUGLEVEL >= 10) {
244 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrMessageBufferSend, NDR_IN, r2);
245 : }
246 2 : r2->out.result = _wkssvc_NetrMessageBufferSend(p, r2);
247 2 : break;
248 : }
249 2 : case 13: { /* wkssvc_NetrWorkstationStatisticsGet */
250 2 : struct wkssvc_NetrWorkstationStatisticsGet *r2 = (struct wkssvc_NetrWorkstationStatisticsGet *)r;
251 2 : if (DEBUGLEVEL >= 10) {
252 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrWorkstationStatisticsGet, NDR_IN, r2);
253 : }
254 2 : NDR_ZERO_STRUCT(r2->out);
255 2 : r2->out.info = talloc_zero(r2, struct wkssvc_NetrWorkstationStatistics *);
256 2 : if (r2->out.info == NULL) {
257 0 : status = NT_STATUS_NO_MEMORY;
258 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
259 0 : goto fail;
260 : }
261 :
262 2 : r2->out.result = _wkssvc_NetrWorkstationStatisticsGet(p, r2);
263 2 : break;
264 : }
265 2 : case 14: { /* wkssvc_NetrLogonDomainNameAdd */
266 2 : struct wkssvc_NetrLogonDomainNameAdd *r2 = (struct wkssvc_NetrLogonDomainNameAdd *)r;
267 2 : if (DEBUGLEVEL >= 10) {
268 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrLogonDomainNameAdd, NDR_IN, r2);
269 : }
270 2 : r2->out.result = _wkssvc_NetrLogonDomainNameAdd(p, r2);
271 2 : break;
272 : }
273 2 : case 15: { /* wkssvc_NetrLogonDomainNameDel */
274 2 : struct wkssvc_NetrLogonDomainNameDel *r2 = (struct wkssvc_NetrLogonDomainNameDel *)r;
275 2 : if (DEBUGLEVEL >= 10) {
276 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrLogonDomainNameDel, NDR_IN, r2);
277 : }
278 2 : r2->out.result = _wkssvc_NetrLogonDomainNameDel(p, r2);
279 2 : break;
280 : }
281 2 : case 16: { /* wkssvc_NetrJoinDomain */
282 2 : struct wkssvc_NetrJoinDomain *r2 = (struct wkssvc_NetrJoinDomain *)r;
283 2 : if (DEBUGLEVEL >= 10) {
284 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrJoinDomain, NDR_IN, r2);
285 : }
286 2 : r2->out.result = _wkssvc_NetrJoinDomain(p, r2);
287 2 : break;
288 : }
289 2 : case 17: { /* wkssvc_NetrUnjoinDomain */
290 2 : struct wkssvc_NetrUnjoinDomain *r2 = (struct wkssvc_NetrUnjoinDomain *)r;
291 2 : if (DEBUGLEVEL >= 10) {
292 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrUnjoinDomain, NDR_IN, r2);
293 : }
294 2 : r2->out.result = _wkssvc_NetrUnjoinDomain(p, r2);
295 2 : break;
296 : }
297 0 : case 18: { /* wkssvc_NetrRenameMachineInDomain */
298 0 : struct wkssvc_NetrRenameMachineInDomain *r2 = (struct wkssvc_NetrRenameMachineInDomain *)r;
299 0 : if (DEBUGLEVEL >= 10) {
300 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrRenameMachineInDomain, NDR_IN, r2);
301 : }
302 0 : r2->out.result = _wkssvc_NetrRenameMachineInDomain(p, r2);
303 0 : break;
304 : }
305 2 : case 19: { /* wkssvc_NetrValidateName */
306 2 : struct wkssvc_NetrValidateName *r2 = (struct wkssvc_NetrValidateName *)r;
307 2 : if (DEBUGLEVEL >= 10) {
308 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrValidateName, NDR_IN, r2);
309 : }
310 2 : r2->out.result = _wkssvc_NetrValidateName(p, r2);
311 2 : break;
312 : }
313 2 : case 20: { /* wkssvc_NetrGetJoinInformation */
314 2 : struct wkssvc_NetrGetJoinInformation *r2 = (struct wkssvc_NetrGetJoinInformation *)r;
315 2 : if (DEBUGLEVEL >= 10) {
316 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrGetJoinInformation, NDR_IN, r2);
317 : }
318 2 : NDR_ZERO_STRUCT(r2->out);
319 2 : r2->out.name_buffer = r2->in.name_buffer;
320 2 : r2->out.name_type = talloc_zero(r2, enum wkssvc_NetJoinStatus);
321 2 : if (r2->out.name_type == NULL) {
322 0 : status = NT_STATUS_NO_MEMORY;
323 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
324 0 : goto fail;
325 : }
326 :
327 2 : r2->out.result = _wkssvc_NetrGetJoinInformation(p, r2);
328 2 : break;
329 : }
330 2 : case 21: { /* wkssvc_NetrGetJoinableOus */
331 2 : struct wkssvc_NetrGetJoinableOus *r2 = (struct wkssvc_NetrGetJoinableOus *)r;
332 2 : if (DEBUGLEVEL >= 10) {
333 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrGetJoinableOus, NDR_IN, r2);
334 : }
335 2 : NDR_ZERO_STRUCT(r2->out);
336 2 : r2->out.num_ous = r2->in.num_ous;
337 2 : r2->out.ous = talloc_zero(r2, const char **);
338 2 : if (r2->out.ous == NULL) {
339 0 : status = NT_STATUS_NO_MEMORY;
340 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
341 0 : goto fail;
342 : }
343 :
344 2 : r2->out.result = _wkssvc_NetrGetJoinableOus(p, r2);
345 2 : break;
346 : }
347 0 : case 22: { /* wkssvc_NetrJoinDomain2 */
348 0 : struct wkssvc_NetrJoinDomain2 *r2 = (struct wkssvc_NetrJoinDomain2 *)r;
349 0 : if (DEBUGLEVEL >= 10) {
350 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrJoinDomain2, NDR_IN, r2);
351 : }
352 0 : r2->out.result = _wkssvc_NetrJoinDomain2(p, r2);
353 0 : break;
354 : }
355 0 : case 23: { /* wkssvc_NetrUnjoinDomain2 */
356 0 : struct wkssvc_NetrUnjoinDomain2 *r2 = (struct wkssvc_NetrUnjoinDomain2 *)r;
357 0 : if (DEBUGLEVEL >= 10) {
358 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrUnjoinDomain2, NDR_IN, r2);
359 : }
360 0 : r2->out.result = _wkssvc_NetrUnjoinDomain2(p, r2);
361 0 : break;
362 : }
363 0 : case 24: { /* wkssvc_NetrRenameMachineInDomain2 */
364 0 : struct wkssvc_NetrRenameMachineInDomain2 *r2 = (struct wkssvc_NetrRenameMachineInDomain2 *)r;
365 0 : if (DEBUGLEVEL >= 10) {
366 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrRenameMachineInDomain2, NDR_IN, r2);
367 : }
368 0 : r2->out.result = _wkssvc_NetrRenameMachineInDomain2(p, r2);
369 0 : break;
370 : }
371 2 : case 25: { /* wkssvc_NetrValidateName2 */
372 2 : struct wkssvc_NetrValidateName2 *r2 = (struct wkssvc_NetrValidateName2 *)r;
373 2 : if (DEBUGLEVEL >= 10) {
374 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrValidateName2, NDR_IN, r2);
375 : }
376 2 : r2->out.result = _wkssvc_NetrValidateName2(p, r2);
377 2 : break;
378 : }
379 2 : case 26: { /* wkssvc_NetrGetJoinableOus2 */
380 2 : struct wkssvc_NetrGetJoinableOus2 *r2 = (struct wkssvc_NetrGetJoinableOus2 *)r;
381 2 : if (DEBUGLEVEL >= 10) {
382 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrGetJoinableOus2, NDR_IN, r2);
383 : }
384 2 : NDR_ZERO_STRUCT(r2->out);
385 2 : r2->out.num_ous = r2->in.num_ous;
386 2 : r2->out.ous = talloc_zero(r2, const char **);
387 2 : if (r2->out.ous == NULL) {
388 0 : status = NT_STATUS_NO_MEMORY;
389 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
390 0 : goto fail;
391 : }
392 :
393 2 : r2->out.result = _wkssvc_NetrGetJoinableOus2(p, r2);
394 2 : break;
395 : }
396 2 : case 27: { /* wkssvc_NetrAddAlternateComputerName */
397 2 : struct wkssvc_NetrAddAlternateComputerName *r2 = (struct wkssvc_NetrAddAlternateComputerName *)r;
398 2 : if (DEBUGLEVEL >= 10) {
399 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrAddAlternateComputerName, NDR_IN, r2);
400 : }
401 2 : r2->out.result = _wkssvc_NetrAddAlternateComputerName(p, r2);
402 2 : break;
403 : }
404 2 : case 28: { /* wkssvc_NetrRemoveAlternateComputerName */
405 2 : struct wkssvc_NetrRemoveAlternateComputerName *r2 = (struct wkssvc_NetrRemoveAlternateComputerName *)r;
406 2 : if (DEBUGLEVEL >= 10) {
407 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrRemoveAlternateComputerName, NDR_IN, r2);
408 : }
409 2 : r2->out.result = _wkssvc_NetrRemoveAlternateComputerName(p, r2);
410 2 : break;
411 : }
412 0 : case 29: { /* wkssvc_NetrSetPrimaryComputername */
413 0 : struct wkssvc_NetrSetPrimaryComputername *r2 = (struct wkssvc_NetrSetPrimaryComputername *)r;
414 0 : if (DEBUGLEVEL >= 10) {
415 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrSetPrimaryComputername, NDR_IN, r2);
416 : }
417 0 : r2->out.result = _wkssvc_NetrSetPrimaryComputername(p, r2);
418 0 : break;
419 : }
420 2 : case 30: { /* wkssvc_NetrEnumerateComputerNames */
421 2 : struct wkssvc_NetrEnumerateComputerNames *r2 = (struct wkssvc_NetrEnumerateComputerNames *)r;
422 2 : if (DEBUGLEVEL >= 10) {
423 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrEnumerateComputerNames, NDR_IN, r2);
424 : }
425 2 : NDR_ZERO_STRUCT(r2->out);
426 2 : r2->out.ctr = talloc_zero(r2, struct wkssvc_ComputerNamesCtr *);
427 2 : if (r2->out.ctr == NULL) {
428 0 : status = NT_STATUS_NO_MEMORY;
429 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
430 0 : goto fail;
431 : }
432 :
433 2 : r2->out.result = _wkssvc_NetrEnumerateComputerNames(p, r2);
434 2 : break;
435 : }
436 0 : default:
437 0 : dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
438 0 : break;
439 : }
440 :
441 58 : fail:
442 : /* Unimpersonate */
443 58 : if (impersonated) {
444 58 : unbecome_authenticated_pipe_user();
445 : }
446 :
447 58 : p->dce_call = NULL;
448 58 : p->mem_ctx = NULL;
449 : /* Check pipes struct fault state */
450 58 : if (p->fault_state != 0) {
451 44 : dce_call->fault_code = p->fault_state;
452 : }
453 58 : if (dce_call->fault_code != 0) {
454 44 : status = NT_STATUS_NET_WRITE_FAULT;
455 : }
456 :
457 58 : return status;
458 : }
459 :
460 58 : NTSTATUS wkssvc__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
461 : {
462 58 : return wkssvc__op_dispatch_internal(dce_call, mem_ctx, r, S3COMPAT_RPC_DISPATCH_EXTERNAL);
463 : }
464 :
465 14 : NTSTATUS wkssvc__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
466 : {
467 14 : uint16_t opnum = dce_call->pkt.u.request.opnum;
468 :
469 14 : switch (opnum) {
470 10 : case 0: { /* wkssvc_NetWkstaGetInfo */
471 10 : struct wkssvc_NetWkstaGetInfo *r2 = (struct wkssvc_NetWkstaGetInfo *)r;
472 10 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
473 0 : DEBUG(5,("function wkssvc_NetWkstaGetInfo replied async\n"));
474 : }
475 10 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
476 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetWkstaGetInfo, NDR_OUT | NDR_SET_VALUES, r2);
477 : }
478 10 : if (dce_call->fault_code != 0) {
479 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetWkstaGetInfo\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
480 : }
481 10 : break;
482 : }
483 0 : case 1: { /* wkssvc_NetWkstaSetInfo */
484 0 : struct wkssvc_NetWkstaSetInfo *r2 = (struct wkssvc_NetWkstaSetInfo *)r;
485 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
486 0 : DEBUG(5,("function wkssvc_NetWkstaSetInfo replied async\n"));
487 : }
488 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
489 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetWkstaSetInfo, NDR_OUT | NDR_SET_VALUES, r2);
490 : }
491 0 : if (dce_call->fault_code != 0) {
492 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetWkstaSetInfo\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
493 : }
494 0 : break;
495 : }
496 4 : case 2: { /* wkssvc_NetWkstaEnumUsers */
497 4 : struct wkssvc_NetWkstaEnumUsers *r2 = (struct wkssvc_NetWkstaEnumUsers *)r;
498 4 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
499 0 : DEBUG(5,("function wkssvc_NetWkstaEnumUsers replied async\n"));
500 : }
501 4 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
502 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetWkstaEnumUsers, NDR_OUT | NDR_SET_VALUES, r2);
503 : }
504 4 : if (dce_call->fault_code != 0) {
505 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetWkstaEnumUsers\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
506 : }
507 4 : break;
508 : }
509 0 : case 3: { /* wkssvc_NetrWkstaUserGetInfo */
510 0 : struct wkssvc_NetrWkstaUserGetInfo *r2 = (struct wkssvc_NetrWkstaUserGetInfo *)r;
511 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
512 0 : DEBUG(5,("function wkssvc_NetrWkstaUserGetInfo replied async\n"));
513 : }
514 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
515 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrWkstaUserGetInfo, NDR_OUT | NDR_SET_VALUES, r2);
516 : }
517 0 : if (dce_call->fault_code != 0) {
518 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrWkstaUserGetInfo\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
519 : }
520 0 : break;
521 : }
522 0 : case 4: { /* wkssvc_NetrWkstaUserSetInfo */
523 0 : struct wkssvc_NetrWkstaUserSetInfo *r2 = (struct wkssvc_NetrWkstaUserSetInfo *)r;
524 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
525 0 : DEBUG(5,("function wkssvc_NetrWkstaUserSetInfo replied async\n"));
526 : }
527 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
528 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrWkstaUserSetInfo, NDR_OUT | NDR_SET_VALUES, r2);
529 : }
530 0 : if (dce_call->fault_code != 0) {
531 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrWkstaUserSetInfo\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
532 : }
533 0 : break;
534 : }
535 0 : case 5: { /* wkssvc_NetWkstaTransportEnum */
536 0 : struct wkssvc_NetWkstaTransportEnum *r2 = (struct wkssvc_NetWkstaTransportEnum *)r;
537 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
538 0 : DEBUG(5,("function wkssvc_NetWkstaTransportEnum replied async\n"));
539 : }
540 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
541 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetWkstaTransportEnum, NDR_OUT | NDR_SET_VALUES, r2);
542 : }
543 0 : if (dce_call->fault_code != 0) {
544 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetWkstaTransportEnum\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
545 : }
546 0 : break;
547 : }
548 0 : case 6: { /* wkssvc_NetrWkstaTransportAdd */
549 0 : struct wkssvc_NetrWkstaTransportAdd *r2 = (struct wkssvc_NetrWkstaTransportAdd *)r;
550 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
551 0 : DEBUG(5,("function wkssvc_NetrWkstaTransportAdd replied async\n"));
552 : }
553 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
554 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrWkstaTransportAdd, NDR_OUT | NDR_SET_VALUES, r2);
555 : }
556 0 : if (dce_call->fault_code != 0) {
557 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrWkstaTransportAdd\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
558 : }
559 0 : break;
560 : }
561 0 : case 7: { /* wkssvc_NetrWkstaTransportDel */
562 0 : struct wkssvc_NetrWkstaTransportDel *r2 = (struct wkssvc_NetrWkstaTransportDel *)r;
563 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
564 0 : DEBUG(5,("function wkssvc_NetrWkstaTransportDel replied async\n"));
565 : }
566 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
567 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrWkstaTransportDel, NDR_OUT | NDR_SET_VALUES, r2);
568 : }
569 0 : if (dce_call->fault_code != 0) {
570 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrWkstaTransportDel\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
571 : }
572 0 : break;
573 : }
574 0 : case 8: { /* wkssvc_NetrUseAdd */
575 0 : struct wkssvc_NetrUseAdd *r2 = (struct wkssvc_NetrUseAdd *)r;
576 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
577 0 : DEBUG(5,("function wkssvc_NetrUseAdd replied async\n"));
578 : }
579 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
580 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrUseAdd, NDR_OUT | NDR_SET_VALUES, r2);
581 : }
582 0 : if (dce_call->fault_code != 0) {
583 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrUseAdd\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
584 : }
585 0 : break;
586 : }
587 0 : case 9: { /* wkssvc_NetrUseGetInfo */
588 0 : struct wkssvc_NetrUseGetInfo *r2 = (struct wkssvc_NetrUseGetInfo *)r;
589 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
590 0 : DEBUG(5,("function wkssvc_NetrUseGetInfo replied async\n"));
591 : }
592 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
593 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrUseGetInfo, NDR_OUT | NDR_SET_VALUES, r2);
594 : }
595 0 : if (dce_call->fault_code != 0) {
596 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrUseGetInfo\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
597 : }
598 0 : break;
599 : }
600 0 : case 10: { /* wkssvc_NetrUseDel */
601 0 : struct wkssvc_NetrUseDel *r2 = (struct wkssvc_NetrUseDel *)r;
602 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
603 0 : DEBUG(5,("function wkssvc_NetrUseDel replied async\n"));
604 : }
605 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
606 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrUseDel, NDR_OUT | NDR_SET_VALUES, r2);
607 : }
608 0 : if (dce_call->fault_code != 0) {
609 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrUseDel\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
610 : }
611 0 : break;
612 : }
613 0 : case 11: { /* wkssvc_NetrUseEnum */
614 0 : struct wkssvc_NetrUseEnum *r2 = (struct wkssvc_NetrUseEnum *)r;
615 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
616 0 : DEBUG(5,("function wkssvc_NetrUseEnum replied async\n"));
617 : }
618 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
619 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrUseEnum, NDR_OUT | NDR_SET_VALUES, r2);
620 : }
621 0 : if (dce_call->fault_code != 0) {
622 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrUseEnum\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
623 : }
624 0 : break;
625 : }
626 0 : case 12: { /* wkssvc_NetrMessageBufferSend */
627 0 : struct wkssvc_NetrMessageBufferSend *r2 = (struct wkssvc_NetrMessageBufferSend *)r;
628 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
629 0 : DEBUG(5,("function wkssvc_NetrMessageBufferSend replied async\n"));
630 : }
631 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
632 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrMessageBufferSend, NDR_OUT | NDR_SET_VALUES, r2);
633 : }
634 0 : if (dce_call->fault_code != 0) {
635 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrMessageBufferSend\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
636 : }
637 0 : break;
638 : }
639 0 : case 13: { /* wkssvc_NetrWorkstationStatisticsGet */
640 0 : struct wkssvc_NetrWorkstationStatisticsGet *r2 = (struct wkssvc_NetrWorkstationStatisticsGet *)r;
641 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
642 0 : DEBUG(5,("function wkssvc_NetrWorkstationStatisticsGet replied async\n"));
643 : }
644 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
645 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrWorkstationStatisticsGet, NDR_OUT | NDR_SET_VALUES, r2);
646 : }
647 0 : if (dce_call->fault_code != 0) {
648 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrWorkstationStatisticsGet\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
649 : }
650 0 : break;
651 : }
652 0 : case 14: { /* wkssvc_NetrLogonDomainNameAdd */
653 0 : struct wkssvc_NetrLogonDomainNameAdd *r2 = (struct wkssvc_NetrLogonDomainNameAdd *)r;
654 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
655 0 : DEBUG(5,("function wkssvc_NetrLogonDomainNameAdd replied async\n"));
656 : }
657 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
658 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrLogonDomainNameAdd, NDR_OUT | NDR_SET_VALUES, r2);
659 : }
660 0 : if (dce_call->fault_code != 0) {
661 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrLogonDomainNameAdd\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
662 : }
663 0 : break;
664 : }
665 0 : case 15: { /* wkssvc_NetrLogonDomainNameDel */
666 0 : struct wkssvc_NetrLogonDomainNameDel *r2 = (struct wkssvc_NetrLogonDomainNameDel *)r;
667 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
668 0 : DEBUG(5,("function wkssvc_NetrLogonDomainNameDel replied async\n"));
669 : }
670 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
671 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrLogonDomainNameDel, NDR_OUT | NDR_SET_VALUES, r2);
672 : }
673 0 : if (dce_call->fault_code != 0) {
674 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrLogonDomainNameDel\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
675 : }
676 0 : break;
677 : }
678 0 : case 16: { /* wkssvc_NetrJoinDomain */
679 0 : struct wkssvc_NetrJoinDomain *r2 = (struct wkssvc_NetrJoinDomain *)r;
680 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
681 0 : DEBUG(5,("function wkssvc_NetrJoinDomain replied async\n"));
682 : }
683 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
684 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrJoinDomain, NDR_OUT | NDR_SET_VALUES, r2);
685 : }
686 0 : if (dce_call->fault_code != 0) {
687 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrJoinDomain\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
688 : }
689 0 : break;
690 : }
691 0 : case 17: { /* wkssvc_NetrUnjoinDomain */
692 0 : struct wkssvc_NetrUnjoinDomain *r2 = (struct wkssvc_NetrUnjoinDomain *)r;
693 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
694 0 : DEBUG(5,("function wkssvc_NetrUnjoinDomain replied async\n"));
695 : }
696 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
697 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrUnjoinDomain, NDR_OUT | NDR_SET_VALUES, r2);
698 : }
699 0 : if (dce_call->fault_code != 0) {
700 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrUnjoinDomain\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
701 : }
702 0 : break;
703 : }
704 0 : case 18: { /* wkssvc_NetrRenameMachineInDomain */
705 0 : struct wkssvc_NetrRenameMachineInDomain *r2 = (struct wkssvc_NetrRenameMachineInDomain *)r;
706 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
707 0 : DEBUG(5,("function wkssvc_NetrRenameMachineInDomain replied async\n"));
708 : }
709 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
710 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrRenameMachineInDomain, NDR_OUT | NDR_SET_VALUES, r2);
711 : }
712 0 : if (dce_call->fault_code != 0) {
713 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrRenameMachineInDomain\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
714 : }
715 0 : break;
716 : }
717 0 : case 19: { /* wkssvc_NetrValidateName */
718 0 : struct wkssvc_NetrValidateName *r2 = (struct wkssvc_NetrValidateName *)r;
719 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
720 0 : DEBUG(5,("function wkssvc_NetrValidateName replied async\n"));
721 : }
722 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
723 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrValidateName, NDR_OUT | NDR_SET_VALUES, r2);
724 : }
725 0 : if (dce_call->fault_code != 0) {
726 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrValidateName\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
727 : }
728 0 : break;
729 : }
730 0 : case 20: { /* wkssvc_NetrGetJoinInformation */
731 0 : struct wkssvc_NetrGetJoinInformation *r2 = (struct wkssvc_NetrGetJoinInformation *)r;
732 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
733 0 : DEBUG(5,("function wkssvc_NetrGetJoinInformation replied async\n"));
734 : }
735 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
736 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrGetJoinInformation, NDR_OUT | NDR_SET_VALUES, r2);
737 : }
738 0 : if (dce_call->fault_code != 0) {
739 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrGetJoinInformation\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
740 : }
741 0 : break;
742 : }
743 0 : case 21: { /* wkssvc_NetrGetJoinableOus */
744 0 : struct wkssvc_NetrGetJoinableOus *r2 = (struct wkssvc_NetrGetJoinableOus *)r;
745 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
746 0 : DEBUG(5,("function wkssvc_NetrGetJoinableOus replied async\n"));
747 : }
748 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
749 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrGetJoinableOus, NDR_OUT | NDR_SET_VALUES, r2);
750 : }
751 0 : if (dce_call->fault_code != 0) {
752 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrGetJoinableOus\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
753 : }
754 0 : break;
755 : }
756 0 : case 22: { /* wkssvc_NetrJoinDomain2 */
757 0 : struct wkssvc_NetrJoinDomain2 *r2 = (struct wkssvc_NetrJoinDomain2 *)r;
758 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
759 0 : DEBUG(5,("function wkssvc_NetrJoinDomain2 replied async\n"));
760 : }
761 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
762 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrJoinDomain2, NDR_OUT | NDR_SET_VALUES, r2);
763 : }
764 0 : if (dce_call->fault_code != 0) {
765 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrJoinDomain2\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
766 : }
767 0 : break;
768 : }
769 0 : case 23: { /* wkssvc_NetrUnjoinDomain2 */
770 0 : struct wkssvc_NetrUnjoinDomain2 *r2 = (struct wkssvc_NetrUnjoinDomain2 *)r;
771 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
772 0 : DEBUG(5,("function wkssvc_NetrUnjoinDomain2 replied async\n"));
773 : }
774 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
775 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrUnjoinDomain2, NDR_OUT | NDR_SET_VALUES, r2);
776 : }
777 0 : if (dce_call->fault_code != 0) {
778 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrUnjoinDomain2\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
779 : }
780 0 : break;
781 : }
782 0 : case 24: { /* wkssvc_NetrRenameMachineInDomain2 */
783 0 : struct wkssvc_NetrRenameMachineInDomain2 *r2 = (struct wkssvc_NetrRenameMachineInDomain2 *)r;
784 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
785 0 : DEBUG(5,("function wkssvc_NetrRenameMachineInDomain2 replied async\n"));
786 : }
787 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
788 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrRenameMachineInDomain2, NDR_OUT | NDR_SET_VALUES, r2);
789 : }
790 0 : if (dce_call->fault_code != 0) {
791 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrRenameMachineInDomain2\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
792 : }
793 0 : break;
794 : }
795 0 : case 25: { /* wkssvc_NetrValidateName2 */
796 0 : struct wkssvc_NetrValidateName2 *r2 = (struct wkssvc_NetrValidateName2 *)r;
797 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
798 0 : DEBUG(5,("function wkssvc_NetrValidateName2 replied async\n"));
799 : }
800 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
801 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrValidateName2, NDR_OUT | NDR_SET_VALUES, r2);
802 : }
803 0 : if (dce_call->fault_code != 0) {
804 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrValidateName2\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
805 : }
806 0 : break;
807 : }
808 0 : case 26: { /* wkssvc_NetrGetJoinableOus2 */
809 0 : struct wkssvc_NetrGetJoinableOus2 *r2 = (struct wkssvc_NetrGetJoinableOus2 *)r;
810 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
811 0 : DEBUG(5,("function wkssvc_NetrGetJoinableOus2 replied async\n"));
812 : }
813 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
814 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrGetJoinableOus2, NDR_OUT | NDR_SET_VALUES, r2);
815 : }
816 0 : if (dce_call->fault_code != 0) {
817 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrGetJoinableOus2\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
818 : }
819 0 : break;
820 : }
821 0 : case 27: { /* wkssvc_NetrAddAlternateComputerName */
822 0 : struct wkssvc_NetrAddAlternateComputerName *r2 = (struct wkssvc_NetrAddAlternateComputerName *)r;
823 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
824 0 : DEBUG(5,("function wkssvc_NetrAddAlternateComputerName replied async\n"));
825 : }
826 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
827 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrAddAlternateComputerName, NDR_OUT | NDR_SET_VALUES, r2);
828 : }
829 0 : if (dce_call->fault_code != 0) {
830 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrAddAlternateComputerName\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
831 : }
832 0 : break;
833 : }
834 0 : case 28: { /* wkssvc_NetrRemoveAlternateComputerName */
835 0 : struct wkssvc_NetrRemoveAlternateComputerName *r2 = (struct wkssvc_NetrRemoveAlternateComputerName *)r;
836 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
837 0 : DEBUG(5,("function wkssvc_NetrRemoveAlternateComputerName replied async\n"));
838 : }
839 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
840 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrRemoveAlternateComputerName, NDR_OUT | NDR_SET_VALUES, r2);
841 : }
842 0 : if (dce_call->fault_code != 0) {
843 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrRemoveAlternateComputerName\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
844 : }
845 0 : break;
846 : }
847 0 : case 29: { /* wkssvc_NetrSetPrimaryComputername */
848 0 : struct wkssvc_NetrSetPrimaryComputername *r2 = (struct wkssvc_NetrSetPrimaryComputername *)r;
849 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
850 0 : DEBUG(5,("function wkssvc_NetrSetPrimaryComputername replied async\n"));
851 : }
852 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
853 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrSetPrimaryComputername, NDR_OUT | NDR_SET_VALUES, r2);
854 : }
855 0 : if (dce_call->fault_code != 0) {
856 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrSetPrimaryComputername\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
857 : }
858 0 : break;
859 : }
860 0 : case 30: { /* wkssvc_NetrEnumerateComputerNames */
861 0 : struct wkssvc_NetrEnumerateComputerNames *r2 = (struct wkssvc_NetrEnumerateComputerNames *)r;
862 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
863 0 : DEBUG(5,("function wkssvc_NetrEnumerateComputerNames replied async\n"));
864 : }
865 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
866 0 : NDR_PRINT_FUNCTION_DEBUG(wkssvc_NetrEnumerateComputerNames, NDR_OUT | NDR_SET_VALUES, r2);
867 : }
868 0 : if (dce_call->fault_code != 0) {
869 0 : DBG_WARNING("dcerpc_fault %s in wkssvc_NetrEnumerateComputerNames\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
870 : }
871 0 : break;
872 : }
873 0 : default:
874 0 : dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
875 0 : break;
876 : }
877 :
878 14 : if (dce_call->fault_code != 0) {
879 0 : return NT_STATUS_NET_WRITE_FAULT;
880 : }
881 :
882 14 : return NT_STATUS_OK;
883 : }
884 :
885 14 : NTSTATUS wkssvc__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
886 : {
887 0 : enum ndr_err_code ndr_err;
888 14 : uint16_t opnum = dce_call->pkt.u.request.opnum;
889 :
890 14 : ndr_err = ndr_table_wkssvc.calls[opnum].ndr_push(push, NDR_OUT, r);
891 14 : if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
892 0 : dce_call->fault_code = DCERPC_FAULT_NDR;
893 0 : return NT_STATUS_NET_WRITE_FAULT;
894 : }
895 :
896 14 : return NT_STATUS_OK;
897 : }
898 :
899 0 : NTSTATUS wkssvc__op_local(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
900 : {
901 0 : return wkssvc__op_dispatch_internal(dce_call, mem_ctx, r, S3COMPAT_RPC_DISPATCH_INTERNAL);
902 : }
903 :
904 : static const struct dcesrv_interface dcesrv_wkssvc_interface = {
905 : .name = "wkssvc",
906 : .syntax_id = {{0x6bffd098,0xa112,0x3610,{0x98,0x33},{0x46,0xc3,0xf8,0x7e,0x34,0x5a}},1.0},
907 : .bind = wkssvc__op_bind,
908 : .unbind = wkssvc__op_unbind,
909 : .ndr_pull = wkssvc__op_ndr_pull,
910 : .dispatch = wkssvc__op_dispatch,
911 : .reply = wkssvc__op_reply,
912 : .ndr_push = wkssvc__op_ndr_push,
913 : .local = wkssvc__op_local,
914 : #ifdef DCESRV_INTERFACE_WKSSVC_FLAGS
915 : .flags = DCESRV_INTERFACE_WKSSVC_FLAGS
916 : #else
917 : .flags = 0
918 : #endif
919 : };
920 :
921 93 : static NTSTATUS wkssvc__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
922 : {
923 0 : uint32_t i;
924 0 : NTSTATUS ret;
925 :
926 : #ifdef DCESRV_INTERFACE_WKSSVC_NCACN_NP_SECONDARY_ENDPOINT
927 : const char *ncacn_np_secondary_endpoint = DCESRV_INTERFACE_WKSSVC_NCACN_NP_SECONDARY_ENDPOINT;
928 : #else
929 93 : const char *ncacn_np_secondary_endpoint = NULL;
930 : #endif
931 :
932 372 : for (i=0;i<ndr_table_wkssvc.endpoints->count;i++) {
933 279 : const char *name = ndr_table_wkssvc.endpoints->names[i];
934 :
935 279 : ret = dcesrv_interface_register(dce_ctx, name, ncacn_np_secondary_endpoint, &dcesrv_wkssvc_interface, NULL);
936 279 : if (!NT_STATUS_IS_OK(ret)) {
937 0 : DBG_ERR("Failed to register endpoint '%s'\n",name);
938 0 : return ret;
939 : }
940 : }
941 :
942 93 : return NT_STATUS_OK;
943 : }
944 :
945 93 : static NTSTATUS wkssvc__op_shutdown_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
946 : {
947 93 : return NT_STATUS_OK;
948 : }
949 :
950 0 : static bool wkssvc__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
951 : {
952 0 : if (dcesrv_wkssvc_interface.syntax_id.if_version == if_version && GUID_equal(&dcesrv_wkssvc_interface.syntax_id.uuid, uuid)) {
953 0 : memcpy(iface,&dcesrv_wkssvc_interface, sizeof(*iface));
954 0 : return true;
955 : }
956 :
957 0 : return false;
958 : }
959 :
960 0 : static bool wkssvc__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
961 : {
962 0 : if (strcmp(dcesrv_wkssvc_interface.name, name)==0) {
963 0 : memcpy(iface, &dcesrv_wkssvc_interface, sizeof(*iface));
964 0 : return true;
965 : }
966 :
967 0 : return false;
968 : }
969 :
970 : static const struct dcesrv_endpoint_server wkssvc_ep_server = {
971 : /* fill in our name */
972 : .name = "wkssvc",
973 :
974 : /* Initialization flag */
975 : .initialized = false,
976 :
977 : /* fill in all the operations */
978 : #ifdef DCESRV_INTERFACE_WKSSVC_INIT_SERVER
979 : .init_server = DCESRV_INTERFACE_WKSSVC_INIT_SERVER,
980 : #else
981 : .init_server = wkssvc__op_init_server,
982 : #endif
983 : #ifdef DCESRV_INTERFACE_WKSSVC_SHUTDOWN_SERVER
984 : .shutdown_server = DCESRV_INTERFACE_WKSSVC_SHUTDOWN_SERVER,
985 : #else
986 : .shutdown_server = wkssvc__op_shutdown_server,
987 : #endif
988 : .interface_by_uuid = wkssvc__op_interface_by_uuid,
989 : .interface_by_name = wkssvc__op_interface_by_name
990 : };
991 :
992 126 : const struct dcesrv_endpoint_server *wkssvc_get_ep_server(void)
993 : {
994 126 : return &wkssvc_ep_server;
995 : }
|