Line data Source code
1 : /* s3 compat server functions auto-generated by pidl */
2 : #include "bin/default/librpc/gen_ndr/ndr_winbind.h"
3 : #include "bin/default/librpc/gen_ndr/ndr_winbind_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 : /* winbind - dcerpc server boilerplate generated by pidl */
15 0 : static NTSTATUS winbind__op_bind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
16 : {
17 : #ifdef DCESRV_INTERFACE_WINBIND_BIND
18 : return DCESRV_INTERFACE_WINBIND_BIND(context,iface);
19 : #else
20 0 : return NT_STATUS_OK;
21 : #endif
22 : }
23 :
24 0 : static void winbind__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
25 : {
26 : #ifdef DCESRV_INTERFACE_WINBIND_UNBIND
27 : DCESRV_INTERFACE_WINBIND_UNBIND(context, iface);
28 : #else
29 0 : return;
30 : #endif
31 : }
32 :
33 0 : NTSTATUS winbind__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
34 : {
35 : enum ndr_err_code ndr_err;
36 0 : uint16_t opnum = dce_call->pkt.u.request.opnum;
37 :
38 0 : dce_call->fault_code = 0;
39 :
40 0 : if (opnum >= ndr_table_winbind.num_calls) {
41 0 : dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
42 0 : return NT_STATUS_NET_WRITE_FAULT;
43 : }
44 :
45 0 : *r = talloc_named(mem_ctx, ndr_table_winbind.calls[opnum].struct_size, "struct %s", ndr_table_winbind.calls[opnum].name);
46 0 : NT_STATUS_HAVE_NO_MEMORY(*r);
47 :
48 : /* unravel the NDR for the packet */
49 0 : ndr_err = ndr_table_winbind.calls[opnum].ndr_pull(pull, NDR_IN, *r);
50 0 : 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 0 : return NT_STATUS_OK;
56 : }
57 :
58 0 : static NTSTATUS winbind__op_dispatch_internal(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r, enum s3compat_rpc_dispatch dispatch)
59 : {
60 0 : uint16_t opnum = dce_call->pkt.u.request.opnum;
61 0 : struct pipes_struct *p = NULL;
62 0 : NTSTATUS status = NT_STATUS_OK;
63 0 : bool impersonated = false;
64 :
65 : /* Retrieve pipes struct */
66 0 : p = dcesrv_get_pipes_struct(dce_call->conn);
67 0 : p->dce_call = dce_call;
68 0 : p->mem_ctx = mem_ctx;
69 : /* Reset pipes struct fault state */
70 0 : p->fault_state = 0;
71 :
72 : /* Impersonate */
73 0 : if (dispatch == S3COMPAT_RPC_DISPATCH_EXTERNAL) {
74 0 : impersonated = become_authenticated_pipe_user(dce_call->auth_state->session_info);
75 0 : 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 0 : switch (opnum) {
83 0 : case 0: { /* wbint_Ping */
84 0 : struct wbint_Ping *r2 = (struct wbint_Ping *)r;
85 0 : if (DEBUGLEVEL >= 10) {
86 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_Ping, NDR_IN, r2);
87 : }
88 0 : NDR_ZERO_STRUCT(r2->out);
89 0 : r2->out.out_data = talloc_zero(r2, uint32_t);
90 0 : if (r2->out.out_data == NULL) {
91 0 : status = NT_STATUS_NO_MEMORY;
92 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
93 0 : goto fail;
94 : }
95 :
96 0 : r2->out.result = _wbint_Ping(p, r2);
97 0 : break;
98 : }
99 0 : case 1: { /* wbint_LookupSid */
100 0 : struct wbint_LookupSid *r2 = (struct wbint_LookupSid *)r;
101 0 : if (DEBUGLEVEL >= 10) {
102 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupSid, NDR_IN, r2);
103 : }
104 0 : NDR_ZERO_STRUCT(r2->out);
105 0 : r2->out.type = talloc_zero(r2, enum lsa_SidType);
106 0 : if (r2->out.type == NULL) {
107 0 : status = NT_STATUS_NO_MEMORY;
108 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
109 0 : goto fail;
110 : }
111 :
112 0 : r2->out.domain = talloc_zero(r2, const char *);
113 0 : if (r2->out.domain == NULL) {
114 0 : status = NT_STATUS_NO_MEMORY;
115 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
116 0 : goto fail;
117 : }
118 :
119 0 : r2->out.name = talloc_zero(r2, const char *);
120 0 : if (r2->out.name == NULL) {
121 0 : status = NT_STATUS_NO_MEMORY;
122 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
123 0 : goto fail;
124 : }
125 :
126 0 : r2->out.result = _wbint_LookupSid(p, r2);
127 0 : break;
128 : }
129 0 : case 2: { /* wbint_LookupSids */
130 0 : struct wbint_LookupSids *r2 = (struct wbint_LookupSids *)r;
131 0 : if (DEBUGLEVEL >= 10) {
132 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupSids, NDR_IN, r2);
133 : }
134 0 : NDR_ZERO_STRUCT(r2->out);
135 0 : r2->out.domains = talloc_zero(r2, struct lsa_RefDomainList);
136 0 : if (r2->out.domains == NULL) {
137 0 : status = NT_STATUS_NO_MEMORY;
138 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
139 0 : goto fail;
140 : }
141 :
142 0 : r2->out.names = talloc_zero(r2, struct lsa_TransNameArray);
143 0 : if (r2->out.names == NULL) {
144 0 : status = NT_STATUS_NO_MEMORY;
145 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
146 0 : goto fail;
147 : }
148 :
149 0 : r2->out.result = _wbint_LookupSids(p, r2);
150 0 : break;
151 : }
152 0 : case 3: { /* wbint_LookupName */
153 0 : struct wbint_LookupName *r2 = (struct wbint_LookupName *)r;
154 0 : if (DEBUGLEVEL >= 10) {
155 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupName, NDR_IN, r2);
156 : }
157 0 : NDR_ZERO_STRUCT(r2->out);
158 0 : r2->out.type = talloc_zero(r2, enum lsa_SidType);
159 0 : if (r2->out.type == NULL) {
160 0 : status = NT_STATUS_NO_MEMORY;
161 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
162 0 : goto fail;
163 : }
164 :
165 0 : r2->out.sid = talloc_zero(r2, struct dom_sid);
166 0 : if (r2->out.sid == NULL) {
167 0 : status = NT_STATUS_NO_MEMORY;
168 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
169 0 : goto fail;
170 : }
171 :
172 0 : r2->out.result = _wbint_LookupName(p, r2);
173 0 : break;
174 : }
175 0 : case 4: { /* wbint_Sids2UnixIDs */
176 0 : struct wbint_Sids2UnixIDs *r2 = (struct wbint_Sids2UnixIDs *)r;
177 0 : if (DEBUGLEVEL >= 10) {
178 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_Sids2UnixIDs, NDR_IN, r2);
179 : }
180 0 : NDR_ZERO_STRUCT(r2->out);
181 0 : r2->out.ids = r2->in.ids;
182 0 : r2->out.result = _wbint_Sids2UnixIDs(p, r2);
183 0 : break;
184 : }
185 0 : case 5: { /* wbint_UnixIDs2Sids */
186 0 : struct wbint_UnixIDs2Sids *r2 = (struct wbint_UnixIDs2Sids *)r;
187 0 : if (DEBUGLEVEL >= 10) {
188 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_UnixIDs2Sids, NDR_IN, r2);
189 : }
190 0 : NDR_ZERO_STRUCT(r2->out);
191 0 : r2->out.xids = r2->in.xids;
192 0 : r2->out.sids = talloc_zero_array(r2, struct dom_sid, r2->in.num_ids);
193 0 : if (r2->out.sids == NULL) {
194 0 : status = NT_STATUS_NO_MEMORY;
195 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
196 0 : goto fail;
197 : }
198 :
199 0 : r2->out.result = _wbint_UnixIDs2Sids(p, r2);
200 0 : break;
201 : }
202 0 : case 6: { /* wbint_AllocateUid */
203 0 : struct wbint_AllocateUid *r2 = (struct wbint_AllocateUid *)r;
204 0 : if (DEBUGLEVEL >= 10) {
205 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_AllocateUid, NDR_IN, r2);
206 : }
207 0 : NDR_ZERO_STRUCT(r2->out);
208 0 : r2->out.uid = talloc_zero(r2, uint64_t);
209 0 : if (r2->out.uid == NULL) {
210 0 : status = NT_STATUS_NO_MEMORY;
211 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
212 0 : goto fail;
213 : }
214 :
215 0 : r2->out.result = _wbint_AllocateUid(p, r2);
216 0 : break;
217 : }
218 0 : case 7: { /* wbint_AllocateGid */
219 0 : struct wbint_AllocateGid *r2 = (struct wbint_AllocateGid *)r;
220 0 : if (DEBUGLEVEL >= 10) {
221 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_AllocateGid, NDR_IN, r2);
222 : }
223 0 : NDR_ZERO_STRUCT(r2->out);
224 0 : r2->out.gid = talloc_zero(r2, uint64_t);
225 0 : if (r2->out.gid == NULL) {
226 0 : status = NT_STATUS_NO_MEMORY;
227 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
228 0 : goto fail;
229 : }
230 :
231 0 : r2->out.result = _wbint_AllocateGid(p, r2);
232 0 : break;
233 : }
234 0 : case 8: { /* wbint_GetNssInfo */
235 0 : struct wbint_GetNssInfo *r2 = (struct wbint_GetNssInfo *)r;
236 0 : if (DEBUGLEVEL >= 10) {
237 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_GetNssInfo, NDR_IN, r2);
238 : }
239 0 : NDR_ZERO_STRUCT(r2->out);
240 0 : r2->out.info = r2->in.info;
241 0 : r2->out.result = _wbint_GetNssInfo(p, r2);
242 0 : break;
243 : }
244 0 : case 9: { /* wbint_LookupUserAliases */
245 0 : struct wbint_LookupUserAliases *r2 = (struct wbint_LookupUserAliases *)r;
246 0 : if (DEBUGLEVEL >= 10) {
247 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupUserAliases, NDR_IN, r2);
248 : }
249 0 : NDR_ZERO_STRUCT(r2->out);
250 0 : r2->out.rids = talloc_zero(r2, struct wbint_RidArray);
251 0 : if (r2->out.rids == NULL) {
252 0 : status = NT_STATUS_NO_MEMORY;
253 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
254 0 : goto fail;
255 : }
256 :
257 0 : r2->out.result = _wbint_LookupUserAliases(p, r2);
258 0 : break;
259 : }
260 0 : case 10: { /* wbint_LookupUserGroups */
261 0 : struct wbint_LookupUserGroups *r2 = (struct wbint_LookupUserGroups *)r;
262 0 : if (DEBUGLEVEL >= 10) {
263 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupUserGroups, NDR_IN, r2);
264 : }
265 0 : NDR_ZERO_STRUCT(r2->out);
266 0 : r2->out.sids = talloc_zero(r2, struct wbint_SidArray);
267 0 : if (r2->out.sids == NULL) {
268 0 : status = NT_STATUS_NO_MEMORY;
269 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
270 0 : goto fail;
271 : }
272 :
273 0 : r2->out.result = _wbint_LookupUserGroups(p, r2);
274 0 : break;
275 : }
276 0 : case 11: { /* wbint_QuerySequenceNumber */
277 0 : struct wbint_QuerySequenceNumber *r2 = (struct wbint_QuerySequenceNumber *)r;
278 0 : if (DEBUGLEVEL >= 10) {
279 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_QuerySequenceNumber, NDR_IN, r2);
280 : }
281 0 : NDR_ZERO_STRUCT(r2->out);
282 0 : r2->out.sequence = talloc_zero(r2, uint32_t);
283 0 : if (r2->out.sequence == NULL) {
284 0 : status = NT_STATUS_NO_MEMORY;
285 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
286 0 : goto fail;
287 : }
288 :
289 0 : r2->out.result = _wbint_QuerySequenceNumber(p, r2);
290 0 : break;
291 : }
292 0 : case 12: { /* wbint_LookupGroupMembers */
293 0 : struct wbint_LookupGroupMembers *r2 = (struct wbint_LookupGroupMembers *)r;
294 0 : if (DEBUGLEVEL >= 10) {
295 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupGroupMembers, NDR_IN, r2);
296 : }
297 0 : NDR_ZERO_STRUCT(r2->out);
298 0 : r2->out.members = talloc_zero(r2, struct wbint_Principals);
299 0 : if (r2->out.members == NULL) {
300 0 : status = NT_STATUS_NO_MEMORY;
301 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
302 0 : goto fail;
303 : }
304 :
305 0 : r2->out.result = _wbint_LookupGroupMembers(p, r2);
306 0 : break;
307 : }
308 0 : case 13: { /* wbint_QueryGroupList */
309 0 : struct wbint_QueryGroupList *r2 = (struct wbint_QueryGroupList *)r;
310 0 : if (DEBUGLEVEL >= 10) {
311 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_QueryGroupList, NDR_IN, r2);
312 : }
313 0 : NDR_ZERO_STRUCT(r2->out);
314 0 : r2->out.groups = talloc_zero(r2, struct wbint_Principals);
315 0 : if (r2->out.groups == NULL) {
316 0 : status = NT_STATUS_NO_MEMORY;
317 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
318 0 : goto fail;
319 : }
320 :
321 0 : r2->out.result = _wbint_QueryGroupList(p, r2);
322 0 : break;
323 : }
324 0 : case 14: { /* wbint_QueryUserRidList */
325 0 : struct wbint_QueryUserRidList *r2 = (struct wbint_QueryUserRidList *)r;
326 0 : if (DEBUGLEVEL >= 10) {
327 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_QueryUserRidList, NDR_IN, r2);
328 : }
329 0 : NDR_ZERO_STRUCT(r2->out);
330 0 : r2->out.rids = talloc_zero(r2, struct wbint_RidArray);
331 0 : if (r2->out.rids == NULL) {
332 0 : status = NT_STATUS_NO_MEMORY;
333 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
334 0 : goto fail;
335 : }
336 :
337 0 : r2->out.result = _wbint_QueryUserRidList(p, r2);
338 0 : break;
339 : }
340 0 : case 15: { /* wbint_DsGetDcName */
341 0 : struct wbint_DsGetDcName *r2 = (struct wbint_DsGetDcName *)r;
342 0 : if (DEBUGLEVEL >= 10) {
343 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_DsGetDcName, NDR_IN, r2);
344 : }
345 0 : NDR_ZERO_STRUCT(r2->out);
346 0 : r2->out.dc_info = talloc_zero(r2, struct netr_DsRGetDCNameInfo *);
347 0 : if (r2->out.dc_info == NULL) {
348 0 : status = NT_STATUS_NO_MEMORY;
349 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
350 0 : goto fail;
351 : }
352 :
353 0 : r2->out.result = _wbint_DsGetDcName(p, r2);
354 0 : break;
355 : }
356 0 : case 16: { /* wbint_LookupRids */
357 0 : struct wbint_LookupRids *r2 = (struct wbint_LookupRids *)r;
358 0 : if (DEBUGLEVEL >= 10) {
359 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupRids, NDR_IN, r2);
360 : }
361 0 : NDR_ZERO_STRUCT(r2->out);
362 0 : r2->out.domain_name = talloc_zero(r2, const char *);
363 0 : if (r2->out.domain_name == NULL) {
364 0 : status = NT_STATUS_NO_MEMORY;
365 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
366 0 : goto fail;
367 : }
368 :
369 0 : r2->out.names = talloc_zero(r2, struct wbint_Principals);
370 0 : if (r2->out.names == NULL) {
371 0 : status = NT_STATUS_NO_MEMORY;
372 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
373 0 : goto fail;
374 : }
375 :
376 0 : r2->out.result = _wbint_LookupRids(p, r2);
377 0 : break;
378 : }
379 0 : case 17: { /* wbint_CheckMachineAccount */
380 0 : struct wbint_CheckMachineAccount *r2 = (struct wbint_CheckMachineAccount *)r;
381 0 : if (DEBUGLEVEL >= 10) {
382 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_CheckMachineAccount, NDR_IN, r2);
383 : }
384 0 : r2->out.result = _wbint_CheckMachineAccount(p, r2);
385 0 : break;
386 : }
387 0 : case 18: { /* wbint_ChangeMachineAccount */
388 0 : struct wbint_ChangeMachineAccount *r2 = (struct wbint_ChangeMachineAccount *)r;
389 0 : if (DEBUGLEVEL >= 10) {
390 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_ChangeMachineAccount, NDR_IN, r2);
391 : }
392 0 : r2->out.result = _wbint_ChangeMachineAccount(p, r2);
393 0 : break;
394 : }
395 0 : case 19: { /* wbint_PingDc */
396 0 : struct wbint_PingDc *r2 = (struct wbint_PingDc *)r;
397 0 : if (DEBUGLEVEL >= 10) {
398 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PingDc, NDR_IN, r2);
399 : }
400 0 : NDR_ZERO_STRUCT(r2->out);
401 0 : r2->out.dcname = talloc_zero(r2, const char *);
402 0 : if (r2->out.dcname == NULL) {
403 0 : status = NT_STATUS_NO_MEMORY;
404 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
405 0 : goto fail;
406 : }
407 :
408 0 : r2->out.result = _wbint_PingDc(p, r2);
409 0 : break;
410 : }
411 0 : case 20: { /* wbint_ListTrustedDomains */
412 0 : struct wbint_ListTrustedDomains *r2 = (struct wbint_ListTrustedDomains *)r;
413 0 : if (DEBUGLEVEL >= 10) {
414 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_ListTrustedDomains, NDR_IN, r2);
415 : }
416 0 : NDR_ZERO_STRUCT(r2->out);
417 0 : r2->out.domains = talloc_zero(r2, struct netr_DomainTrustList);
418 0 : if (r2->out.domains == NULL) {
419 0 : status = NT_STATUS_NO_MEMORY;
420 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
421 0 : goto fail;
422 : }
423 :
424 0 : r2->out.result = _wbint_ListTrustedDomains(p, r2);
425 0 : break;
426 : }
427 0 : case 21: { /* wbint_PamAuth */
428 0 : struct wbint_PamAuth *r2 = (struct wbint_PamAuth *)r;
429 0 : if (DEBUGLEVEL >= 10) {
430 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuth, NDR_IN, r2);
431 : }
432 0 : NDR_ZERO_STRUCT(r2->out);
433 0 : r2->out.validation = talloc_zero(r2, struct wbint_Validation);
434 0 : if (r2->out.validation == NULL) {
435 0 : status = NT_STATUS_NO_MEMORY;
436 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
437 0 : goto fail;
438 : }
439 :
440 0 : r2->out.result = _wbint_PamAuth(p, r2);
441 0 : break;
442 : }
443 0 : case 22: { /* wbint_PamAuthCrap */
444 0 : struct wbint_PamAuthCrap *r2 = (struct wbint_PamAuthCrap *)r;
445 0 : if (DEBUGLEVEL >= 10) {
446 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuthCrap, NDR_IN, r2);
447 : }
448 0 : NDR_ZERO_STRUCT(r2->out);
449 0 : r2->out.authoritative = talloc_zero(r2, uint8_t);
450 0 : if (r2->out.authoritative == NULL) {
451 0 : status = NT_STATUS_NO_MEMORY;
452 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
453 0 : goto fail;
454 : }
455 :
456 0 : r2->out.validation = talloc_zero(r2, struct wbint_PamAuthCrapValidation);
457 0 : if (r2->out.validation == NULL) {
458 0 : status = NT_STATUS_NO_MEMORY;
459 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
460 0 : goto fail;
461 : }
462 :
463 0 : r2->out.result = _wbint_PamAuthCrap(p, r2);
464 0 : break;
465 : }
466 0 : case 23: { /* wbint_PamLogOff */
467 0 : struct wbint_PamLogOff *r2 = (struct wbint_PamLogOff *)r;
468 0 : if (DEBUGLEVEL >= 10) {
469 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamLogOff, NDR_IN, r2);
470 : }
471 0 : r2->out.result = _wbint_PamLogOff(p, r2);
472 0 : break;
473 : }
474 0 : case 24: { /* wbint_PamAuthCrapChangePassword */
475 0 : struct wbint_PamAuthCrapChangePassword *r2 = (struct wbint_PamAuthCrapChangePassword *)r;
476 0 : if (DEBUGLEVEL >= 10) {
477 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuthCrapChangePassword, NDR_IN, r2);
478 : }
479 0 : r2->out.result = _wbint_PamAuthCrapChangePassword(p, r2);
480 0 : break;
481 : }
482 0 : case 25: { /* wbint_PamAuthChangePassword */
483 0 : struct wbint_PamAuthChangePassword *r2 = (struct wbint_PamAuthChangePassword *)r;
484 0 : if (DEBUGLEVEL >= 10) {
485 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuthChangePassword, NDR_IN, r2);
486 : }
487 0 : NDR_ZERO_STRUCT(r2->out);
488 0 : r2->out.dominfo = talloc_zero(r2, struct samr_DomInfo1 *);
489 0 : if (r2->out.dominfo == NULL) {
490 0 : status = NT_STATUS_NO_MEMORY;
491 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
492 0 : goto fail;
493 : }
494 :
495 0 : r2->out.reject_reason = talloc_zero(r2, enum samPwdChangeReason);
496 0 : if (r2->out.reject_reason == NULL) {
497 0 : status = NT_STATUS_NO_MEMORY;
498 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
499 0 : goto fail;
500 : }
501 :
502 0 : r2->out.result = _wbint_PamAuthChangePassword(p, r2);
503 0 : break;
504 : }
505 0 : case 26: { /* wbint_InitConnection */
506 0 : struct wbint_InitConnection *r2 = (struct wbint_InitConnection *)r;
507 0 : if (DEBUGLEVEL >= 10) {
508 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_InitConnection, NDR_IN, r2);
509 : }
510 0 : NDR_ZERO_STRUCT(r2->out);
511 0 : r2->out.name = talloc_zero(r2, const char *);
512 0 : if (r2->out.name == NULL) {
513 0 : status = NT_STATUS_NO_MEMORY;
514 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
515 0 : goto fail;
516 : }
517 :
518 0 : r2->out.alt_name = talloc_zero(r2, const char *);
519 0 : if (r2->out.alt_name == NULL) {
520 0 : status = NT_STATUS_NO_MEMORY;
521 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
522 0 : goto fail;
523 : }
524 :
525 0 : r2->out.sid = talloc_zero(r2, struct dom_sid);
526 0 : if (r2->out.sid == NULL) {
527 0 : status = NT_STATUS_NO_MEMORY;
528 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
529 0 : goto fail;
530 : }
531 :
532 0 : r2->out.flags = talloc_zero(r2, enum DomainInfoFlags);
533 0 : if (r2->out.flags == NULL) {
534 0 : status = NT_STATUS_NO_MEMORY;
535 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
536 0 : goto fail;
537 : }
538 :
539 0 : r2->out.result = _wbint_InitConnection(p, r2);
540 0 : break;
541 : }
542 0 : case 27: { /* winbind_SamLogon */
543 0 : struct winbind_SamLogon *r2 = (struct winbind_SamLogon *)r;
544 0 : if (DEBUGLEVEL >= 10) {
545 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_SamLogon, NDR_IN, r2);
546 : }
547 0 : NDR_ZERO_STRUCT(r2->out);
548 0 : r2->out.result = _winbind_SamLogon(p, r2);
549 0 : break;
550 : }
551 0 : case 28: { /* winbind_DsrUpdateReadOnlyServerDnsRecords */
552 0 : struct winbind_DsrUpdateReadOnlyServerDnsRecords *r2 = (struct winbind_DsrUpdateReadOnlyServerDnsRecords *)r;
553 0 : if (DEBUGLEVEL >= 10) {
554 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_DsrUpdateReadOnlyServerDnsRecords, NDR_IN, r2);
555 : }
556 0 : NDR_ZERO_STRUCT(r2->out);
557 0 : r2->out.dns_names = r2->in.dns_names;
558 0 : r2->out.result = _winbind_DsrUpdateReadOnlyServerDnsRecords(p, r2);
559 0 : break;
560 : }
561 0 : case 29: { /* winbind_LogonControl */
562 0 : struct winbind_LogonControl *r2 = (struct winbind_LogonControl *)r;
563 0 : if (DEBUGLEVEL >= 10) {
564 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_LogonControl, NDR_IN, r2);
565 : }
566 0 : NDR_ZERO_STRUCT(r2->out);
567 0 : r2->out.query = talloc_zero(r2, union netr_CONTROL_QUERY_INFORMATION);
568 0 : if (r2->out.query == NULL) {
569 0 : status = NT_STATUS_NO_MEMORY;
570 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
571 0 : goto fail;
572 : }
573 :
574 0 : r2->out.result = _winbind_LogonControl(p, r2);
575 0 : break;
576 : }
577 0 : case 30: { /* winbind_GetForestTrustInformation */
578 0 : struct winbind_GetForestTrustInformation *r2 = (struct winbind_GetForestTrustInformation *)r;
579 0 : if (DEBUGLEVEL >= 10) {
580 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_GetForestTrustInformation, NDR_IN, r2);
581 : }
582 0 : NDR_ZERO_STRUCT(r2->out);
583 0 : r2->out.forest_trust_info = talloc_zero(r2, struct lsa_ForestTrustInformation *);
584 0 : if (r2->out.forest_trust_info == NULL) {
585 0 : status = NT_STATUS_NO_MEMORY;
586 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
587 0 : goto fail;
588 : }
589 :
590 0 : r2->out.result = _winbind_GetForestTrustInformation(p, r2);
591 0 : break;
592 : }
593 0 : case 31: { /* winbind_SendToSam */
594 0 : struct winbind_SendToSam *r2 = (struct winbind_SendToSam *)r;
595 0 : if (DEBUGLEVEL >= 10) {
596 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_SendToSam, NDR_IN, r2);
597 : }
598 0 : r2->out.result = _winbind_SendToSam(p, r2);
599 0 : break;
600 : }
601 0 : default:
602 0 : dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
603 0 : break;
604 : }
605 :
606 0 : fail:
607 : /* Unimpersonate */
608 0 : if (impersonated) {
609 0 : unbecome_authenticated_pipe_user();
610 : }
611 :
612 0 : p->dce_call = NULL;
613 0 : p->mem_ctx = NULL;
614 : /* Check pipes struct fault state */
615 0 : if (p->fault_state != 0) {
616 0 : dce_call->fault_code = p->fault_state;
617 : }
618 0 : if (dce_call->fault_code != 0) {
619 0 : status = NT_STATUS_NET_WRITE_FAULT;
620 : }
621 :
622 0 : return status;
623 : }
624 :
625 0 : NTSTATUS winbind__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
626 : {
627 0 : return winbind__op_dispatch_internal(dce_call, mem_ctx, r, S3COMPAT_RPC_DISPATCH_EXTERNAL);
628 : }
629 :
630 0 : NTSTATUS winbind__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
631 : {
632 0 : uint16_t opnum = dce_call->pkt.u.request.opnum;
633 :
634 0 : switch (opnum) {
635 0 : case 0: { /* wbint_Ping */
636 0 : struct wbint_Ping *r2 = (struct wbint_Ping *)r;
637 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
638 0 : DEBUG(5,("function wbint_Ping replied async\n"));
639 : }
640 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
641 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_Ping, NDR_OUT | NDR_SET_VALUES, r2);
642 : }
643 0 : if (dce_call->fault_code != 0) {
644 0 : DBG_WARNING("dcerpc_fault %s in wbint_Ping\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
645 : }
646 0 : break;
647 : }
648 0 : case 1: { /* wbint_LookupSid */
649 0 : struct wbint_LookupSid *r2 = (struct wbint_LookupSid *)r;
650 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
651 0 : DEBUG(5,("function wbint_LookupSid replied async\n"));
652 : }
653 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
654 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupSid, NDR_OUT | NDR_SET_VALUES, r2);
655 : }
656 0 : if (dce_call->fault_code != 0) {
657 0 : DBG_WARNING("dcerpc_fault %s in wbint_LookupSid\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
658 : }
659 0 : break;
660 : }
661 0 : case 2: { /* wbint_LookupSids */
662 0 : struct wbint_LookupSids *r2 = (struct wbint_LookupSids *)r;
663 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
664 0 : DEBUG(5,("function wbint_LookupSids replied async\n"));
665 : }
666 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
667 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupSids, NDR_OUT | NDR_SET_VALUES, r2);
668 : }
669 0 : if (dce_call->fault_code != 0) {
670 0 : DBG_WARNING("dcerpc_fault %s in wbint_LookupSids\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
671 : }
672 0 : break;
673 : }
674 0 : case 3: { /* wbint_LookupName */
675 0 : struct wbint_LookupName *r2 = (struct wbint_LookupName *)r;
676 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
677 0 : DEBUG(5,("function wbint_LookupName replied async\n"));
678 : }
679 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
680 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupName, NDR_OUT | NDR_SET_VALUES, r2);
681 : }
682 0 : if (dce_call->fault_code != 0) {
683 0 : DBG_WARNING("dcerpc_fault %s in wbint_LookupName\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
684 : }
685 0 : break;
686 : }
687 0 : case 4: { /* wbint_Sids2UnixIDs */
688 0 : struct wbint_Sids2UnixIDs *r2 = (struct wbint_Sids2UnixIDs *)r;
689 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
690 0 : DEBUG(5,("function wbint_Sids2UnixIDs replied async\n"));
691 : }
692 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
693 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_Sids2UnixIDs, NDR_OUT | NDR_SET_VALUES, r2);
694 : }
695 0 : if (dce_call->fault_code != 0) {
696 0 : DBG_WARNING("dcerpc_fault %s in wbint_Sids2UnixIDs\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
697 : }
698 0 : break;
699 : }
700 0 : case 5: { /* wbint_UnixIDs2Sids */
701 0 : struct wbint_UnixIDs2Sids *r2 = (struct wbint_UnixIDs2Sids *)r;
702 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
703 0 : DEBUG(5,("function wbint_UnixIDs2Sids replied async\n"));
704 : }
705 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
706 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_UnixIDs2Sids, NDR_OUT | NDR_SET_VALUES, r2);
707 : }
708 0 : if (dce_call->fault_code != 0) {
709 0 : DBG_WARNING("dcerpc_fault %s in wbint_UnixIDs2Sids\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
710 : }
711 0 : break;
712 : }
713 0 : case 6: { /* wbint_AllocateUid */
714 0 : struct wbint_AllocateUid *r2 = (struct wbint_AllocateUid *)r;
715 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
716 0 : DEBUG(5,("function wbint_AllocateUid replied async\n"));
717 : }
718 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
719 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_AllocateUid, NDR_OUT | NDR_SET_VALUES, r2);
720 : }
721 0 : if (dce_call->fault_code != 0) {
722 0 : DBG_WARNING("dcerpc_fault %s in wbint_AllocateUid\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
723 : }
724 0 : break;
725 : }
726 0 : case 7: { /* wbint_AllocateGid */
727 0 : struct wbint_AllocateGid *r2 = (struct wbint_AllocateGid *)r;
728 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
729 0 : DEBUG(5,("function wbint_AllocateGid replied async\n"));
730 : }
731 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
732 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_AllocateGid, NDR_OUT | NDR_SET_VALUES, r2);
733 : }
734 0 : if (dce_call->fault_code != 0) {
735 0 : DBG_WARNING("dcerpc_fault %s in wbint_AllocateGid\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
736 : }
737 0 : break;
738 : }
739 0 : case 8: { /* wbint_GetNssInfo */
740 0 : struct wbint_GetNssInfo *r2 = (struct wbint_GetNssInfo *)r;
741 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
742 0 : DEBUG(5,("function wbint_GetNssInfo replied async\n"));
743 : }
744 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
745 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_GetNssInfo, NDR_OUT | NDR_SET_VALUES, r2);
746 : }
747 0 : if (dce_call->fault_code != 0) {
748 0 : DBG_WARNING("dcerpc_fault %s in wbint_GetNssInfo\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
749 : }
750 0 : break;
751 : }
752 0 : case 9: { /* wbint_LookupUserAliases */
753 0 : struct wbint_LookupUserAliases *r2 = (struct wbint_LookupUserAliases *)r;
754 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
755 0 : DEBUG(5,("function wbint_LookupUserAliases replied async\n"));
756 : }
757 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
758 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupUserAliases, NDR_OUT | NDR_SET_VALUES, r2);
759 : }
760 0 : if (dce_call->fault_code != 0) {
761 0 : DBG_WARNING("dcerpc_fault %s in wbint_LookupUserAliases\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
762 : }
763 0 : break;
764 : }
765 0 : case 10: { /* wbint_LookupUserGroups */
766 0 : struct wbint_LookupUserGroups *r2 = (struct wbint_LookupUserGroups *)r;
767 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
768 0 : DEBUG(5,("function wbint_LookupUserGroups replied async\n"));
769 : }
770 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
771 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupUserGroups, NDR_OUT | NDR_SET_VALUES, r2);
772 : }
773 0 : if (dce_call->fault_code != 0) {
774 0 : DBG_WARNING("dcerpc_fault %s in wbint_LookupUserGroups\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
775 : }
776 0 : break;
777 : }
778 0 : case 11: { /* wbint_QuerySequenceNumber */
779 0 : struct wbint_QuerySequenceNumber *r2 = (struct wbint_QuerySequenceNumber *)r;
780 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
781 0 : DEBUG(5,("function wbint_QuerySequenceNumber replied async\n"));
782 : }
783 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
784 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_QuerySequenceNumber, NDR_OUT | NDR_SET_VALUES, r2);
785 : }
786 0 : if (dce_call->fault_code != 0) {
787 0 : DBG_WARNING("dcerpc_fault %s in wbint_QuerySequenceNumber\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
788 : }
789 0 : break;
790 : }
791 0 : case 12: { /* wbint_LookupGroupMembers */
792 0 : struct wbint_LookupGroupMembers *r2 = (struct wbint_LookupGroupMembers *)r;
793 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
794 0 : DEBUG(5,("function wbint_LookupGroupMembers replied async\n"));
795 : }
796 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
797 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupGroupMembers, NDR_OUT | NDR_SET_VALUES, r2);
798 : }
799 0 : if (dce_call->fault_code != 0) {
800 0 : DBG_WARNING("dcerpc_fault %s in wbint_LookupGroupMembers\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
801 : }
802 0 : break;
803 : }
804 0 : case 13: { /* wbint_QueryGroupList */
805 0 : struct wbint_QueryGroupList *r2 = (struct wbint_QueryGroupList *)r;
806 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
807 0 : DEBUG(5,("function wbint_QueryGroupList replied async\n"));
808 : }
809 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
810 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_QueryGroupList, NDR_OUT | NDR_SET_VALUES, r2);
811 : }
812 0 : if (dce_call->fault_code != 0) {
813 0 : DBG_WARNING("dcerpc_fault %s in wbint_QueryGroupList\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
814 : }
815 0 : break;
816 : }
817 0 : case 14: { /* wbint_QueryUserRidList */
818 0 : struct wbint_QueryUserRidList *r2 = (struct wbint_QueryUserRidList *)r;
819 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
820 0 : DEBUG(5,("function wbint_QueryUserRidList replied async\n"));
821 : }
822 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
823 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_QueryUserRidList, NDR_OUT | NDR_SET_VALUES, r2);
824 : }
825 0 : if (dce_call->fault_code != 0) {
826 0 : DBG_WARNING("dcerpc_fault %s in wbint_QueryUserRidList\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
827 : }
828 0 : break;
829 : }
830 0 : case 15: { /* wbint_DsGetDcName */
831 0 : struct wbint_DsGetDcName *r2 = (struct wbint_DsGetDcName *)r;
832 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
833 0 : DEBUG(5,("function wbint_DsGetDcName replied async\n"));
834 : }
835 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
836 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_DsGetDcName, NDR_OUT | NDR_SET_VALUES, r2);
837 : }
838 0 : if (dce_call->fault_code != 0) {
839 0 : DBG_WARNING("dcerpc_fault %s in wbint_DsGetDcName\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
840 : }
841 0 : break;
842 : }
843 0 : case 16: { /* wbint_LookupRids */
844 0 : struct wbint_LookupRids *r2 = (struct wbint_LookupRids *)r;
845 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
846 0 : DEBUG(5,("function wbint_LookupRids replied async\n"));
847 : }
848 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
849 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupRids, NDR_OUT | NDR_SET_VALUES, r2);
850 : }
851 0 : if (dce_call->fault_code != 0) {
852 0 : DBG_WARNING("dcerpc_fault %s in wbint_LookupRids\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
853 : }
854 0 : break;
855 : }
856 0 : case 17: { /* wbint_CheckMachineAccount */
857 0 : struct wbint_CheckMachineAccount *r2 = (struct wbint_CheckMachineAccount *)r;
858 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
859 0 : DEBUG(5,("function wbint_CheckMachineAccount replied async\n"));
860 : }
861 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
862 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_CheckMachineAccount, NDR_OUT | NDR_SET_VALUES, r2);
863 : }
864 0 : if (dce_call->fault_code != 0) {
865 0 : DBG_WARNING("dcerpc_fault %s in wbint_CheckMachineAccount\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
866 : }
867 0 : break;
868 : }
869 0 : case 18: { /* wbint_ChangeMachineAccount */
870 0 : struct wbint_ChangeMachineAccount *r2 = (struct wbint_ChangeMachineAccount *)r;
871 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
872 0 : DEBUG(5,("function wbint_ChangeMachineAccount replied async\n"));
873 : }
874 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
875 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_ChangeMachineAccount, NDR_OUT | NDR_SET_VALUES, r2);
876 : }
877 0 : if (dce_call->fault_code != 0) {
878 0 : DBG_WARNING("dcerpc_fault %s in wbint_ChangeMachineAccount\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
879 : }
880 0 : break;
881 : }
882 0 : case 19: { /* wbint_PingDc */
883 0 : struct wbint_PingDc *r2 = (struct wbint_PingDc *)r;
884 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
885 0 : DEBUG(5,("function wbint_PingDc replied async\n"));
886 : }
887 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
888 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PingDc, NDR_OUT | NDR_SET_VALUES, r2);
889 : }
890 0 : if (dce_call->fault_code != 0) {
891 0 : DBG_WARNING("dcerpc_fault %s in wbint_PingDc\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
892 : }
893 0 : break;
894 : }
895 0 : case 20: { /* wbint_ListTrustedDomains */
896 0 : struct wbint_ListTrustedDomains *r2 = (struct wbint_ListTrustedDomains *)r;
897 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
898 0 : DEBUG(5,("function wbint_ListTrustedDomains replied async\n"));
899 : }
900 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
901 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_ListTrustedDomains, NDR_OUT | NDR_SET_VALUES, r2);
902 : }
903 0 : if (dce_call->fault_code != 0) {
904 0 : DBG_WARNING("dcerpc_fault %s in wbint_ListTrustedDomains\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
905 : }
906 0 : break;
907 : }
908 0 : case 21: { /* wbint_PamAuth */
909 0 : struct wbint_PamAuth *r2 = (struct wbint_PamAuth *)r;
910 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
911 0 : DEBUG(5,("function wbint_PamAuth replied async\n"));
912 : }
913 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
914 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuth, NDR_OUT | NDR_SET_VALUES, r2);
915 : }
916 0 : if (dce_call->fault_code != 0) {
917 0 : DBG_WARNING("dcerpc_fault %s in wbint_PamAuth\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
918 : }
919 0 : break;
920 : }
921 0 : case 22: { /* wbint_PamAuthCrap */
922 0 : struct wbint_PamAuthCrap *r2 = (struct wbint_PamAuthCrap *)r;
923 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
924 0 : DEBUG(5,("function wbint_PamAuthCrap replied async\n"));
925 : }
926 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
927 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuthCrap, NDR_OUT | NDR_SET_VALUES, r2);
928 : }
929 0 : if (dce_call->fault_code != 0) {
930 0 : DBG_WARNING("dcerpc_fault %s in wbint_PamAuthCrap\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
931 : }
932 0 : break;
933 : }
934 0 : case 23: { /* wbint_PamLogOff */
935 0 : struct wbint_PamLogOff *r2 = (struct wbint_PamLogOff *)r;
936 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
937 0 : DEBUG(5,("function wbint_PamLogOff replied async\n"));
938 : }
939 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
940 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamLogOff, NDR_OUT | NDR_SET_VALUES, r2);
941 : }
942 0 : if (dce_call->fault_code != 0) {
943 0 : DBG_WARNING("dcerpc_fault %s in wbint_PamLogOff\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
944 : }
945 0 : break;
946 : }
947 0 : case 24: { /* wbint_PamAuthCrapChangePassword */
948 0 : struct wbint_PamAuthCrapChangePassword *r2 = (struct wbint_PamAuthCrapChangePassword *)r;
949 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
950 0 : DEBUG(5,("function wbint_PamAuthCrapChangePassword replied async\n"));
951 : }
952 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
953 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuthCrapChangePassword, NDR_OUT | NDR_SET_VALUES, r2);
954 : }
955 0 : if (dce_call->fault_code != 0) {
956 0 : DBG_WARNING("dcerpc_fault %s in wbint_PamAuthCrapChangePassword\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
957 : }
958 0 : break;
959 : }
960 0 : case 25: { /* wbint_PamAuthChangePassword */
961 0 : struct wbint_PamAuthChangePassword *r2 = (struct wbint_PamAuthChangePassword *)r;
962 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
963 0 : DEBUG(5,("function wbint_PamAuthChangePassword replied async\n"));
964 : }
965 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
966 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuthChangePassword, NDR_OUT | NDR_SET_VALUES, r2);
967 : }
968 0 : if (dce_call->fault_code != 0) {
969 0 : DBG_WARNING("dcerpc_fault %s in wbint_PamAuthChangePassword\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
970 : }
971 0 : break;
972 : }
973 0 : case 26: { /* wbint_InitConnection */
974 0 : struct wbint_InitConnection *r2 = (struct wbint_InitConnection *)r;
975 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
976 0 : DEBUG(5,("function wbint_InitConnection replied async\n"));
977 : }
978 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
979 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_InitConnection, NDR_OUT | NDR_SET_VALUES, r2);
980 : }
981 0 : if (dce_call->fault_code != 0) {
982 0 : DBG_WARNING("dcerpc_fault %s in wbint_InitConnection\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
983 : }
984 0 : break;
985 : }
986 0 : case 27: { /* winbind_SamLogon */
987 0 : struct winbind_SamLogon *r2 = (struct winbind_SamLogon *)r;
988 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
989 0 : DEBUG(5,("function winbind_SamLogon replied async\n"));
990 : }
991 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
992 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_SamLogon, NDR_OUT | NDR_SET_VALUES, r2);
993 : }
994 0 : if (dce_call->fault_code != 0) {
995 0 : DBG_WARNING("dcerpc_fault %s in winbind_SamLogon\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
996 : }
997 0 : break;
998 : }
999 0 : case 28: { /* winbind_DsrUpdateReadOnlyServerDnsRecords */
1000 0 : struct winbind_DsrUpdateReadOnlyServerDnsRecords *r2 = (struct winbind_DsrUpdateReadOnlyServerDnsRecords *)r;
1001 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
1002 0 : DEBUG(5,("function winbind_DsrUpdateReadOnlyServerDnsRecords replied async\n"));
1003 : }
1004 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
1005 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_DsrUpdateReadOnlyServerDnsRecords, NDR_OUT | NDR_SET_VALUES, r2);
1006 : }
1007 0 : if (dce_call->fault_code != 0) {
1008 0 : DBG_WARNING("dcerpc_fault %s in winbind_DsrUpdateReadOnlyServerDnsRecords\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
1009 : }
1010 0 : break;
1011 : }
1012 0 : case 29: { /* winbind_LogonControl */
1013 0 : struct winbind_LogonControl *r2 = (struct winbind_LogonControl *)r;
1014 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
1015 0 : DEBUG(5,("function winbind_LogonControl replied async\n"));
1016 : }
1017 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
1018 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_LogonControl, NDR_OUT | NDR_SET_VALUES, r2);
1019 : }
1020 0 : if (dce_call->fault_code != 0) {
1021 0 : DBG_WARNING("dcerpc_fault %s in winbind_LogonControl\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
1022 : }
1023 0 : break;
1024 : }
1025 0 : case 30: { /* winbind_GetForestTrustInformation */
1026 0 : struct winbind_GetForestTrustInformation *r2 = (struct winbind_GetForestTrustInformation *)r;
1027 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
1028 0 : DEBUG(5,("function winbind_GetForestTrustInformation replied async\n"));
1029 : }
1030 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
1031 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_GetForestTrustInformation, NDR_OUT | NDR_SET_VALUES, r2);
1032 : }
1033 0 : if (dce_call->fault_code != 0) {
1034 0 : DBG_WARNING("dcerpc_fault %s in winbind_GetForestTrustInformation\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
1035 : }
1036 0 : break;
1037 : }
1038 0 : case 31: { /* winbind_SendToSam */
1039 0 : struct winbind_SendToSam *r2 = (struct winbind_SendToSam *)r;
1040 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
1041 0 : DEBUG(5,("function winbind_SendToSam replied async\n"));
1042 : }
1043 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
1044 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_SendToSam, NDR_OUT | NDR_SET_VALUES, r2);
1045 : }
1046 0 : if (dce_call->fault_code != 0) {
1047 0 : DBG_WARNING("dcerpc_fault %s in winbind_SendToSam\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
1048 : }
1049 0 : break;
1050 : }
1051 0 : default:
1052 0 : dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
1053 0 : break;
1054 : }
1055 :
1056 0 : if (dce_call->fault_code != 0) {
1057 0 : return NT_STATUS_NET_WRITE_FAULT;
1058 : }
1059 :
1060 0 : return NT_STATUS_OK;
1061 : }
1062 :
1063 0 : NTSTATUS winbind__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
1064 : {
1065 : enum ndr_err_code ndr_err;
1066 0 : uint16_t opnum = dce_call->pkt.u.request.opnum;
1067 :
1068 0 : ndr_err = ndr_table_winbind.calls[opnum].ndr_push(push, NDR_OUT, r);
1069 0 : if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1070 0 : dce_call->fault_code = DCERPC_FAULT_NDR;
1071 0 : return NT_STATUS_NET_WRITE_FAULT;
1072 : }
1073 :
1074 0 : return NT_STATUS_OK;
1075 : }
1076 :
1077 0 : NTSTATUS winbind__op_local(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
1078 : {
1079 0 : return winbind__op_dispatch_internal(dce_call, mem_ctx, r, S3COMPAT_RPC_DISPATCH_INTERNAL);
1080 : }
1081 :
1082 : static const struct dcesrv_interface dcesrv_winbind_interface = {
1083 : .name = "winbind",
1084 : .syntax_id = {{0xbf09192c,0xed60,0x4928,{0x9d,0xff},{0xd0,0xd7,0xbc,0xb0,0x3e,0xd8}},1.0},
1085 : .bind = winbind__op_bind,
1086 : .unbind = winbind__op_unbind,
1087 : .ndr_pull = winbind__op_ndr_pull,
1088 : .dispatch = winbind__op_dispatch,
1089 : .reply = winbind__op_reply,
1090 : .ndr_push = winbind__op_ndr_push,
1091 : .local = winbind__op_local,
1092 : #ifdef DCESRV_INTERFACE_WINBIND_FLAGS
1093 : .flags = DCESRV_INTERFACE_WINBIND_FLAGS
1094 : #else
1095 : .flags = 0
1096 : #endif
1097 : };
1098 :
1099 68 : static NTSTATUS winbind__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
1100 : {
1101 : uint32_t i;
1102 : NTSTATUS ret;
1103 :
1104 : #ifdef DCESRV_INTERFACE_WINBIND_NCACN_NP_SECONDARY_ENDPOINT
1105 : const char *ncacn_np_secondary_endpoint = DCESRV_INTERFACE_WINBIND_NCACN_NP_SECONDARY_ENDPOINT;
1106 : #else
1107 68 : const char *ncacn_np_secondary_endpoint = NULL;
1108 : #endif
1109 :
1110 136 : for (i=0;i<ndr_table_winbind.endpoints->count;i++) {
1111 68 : const char *name = ndr_table_winbind.endpoints->names[i];
1112 :
1113 68 : ret = dcesrv_interface_register(dce_ctx, name, ncacn_np_secondary_endpoint, &dcesrv_winbind_interface, NULL);
1114 68 : if (!NT_STATUS_IS_OK(ret)) {
1115 0 : DBG_ERR("Failed to register endpoint '%s'\n",name);
1116 0 : return ret;
1117 : }
1118 : }
1119 :
1120 68 : return NT_STATUS_OK;
1121 : }
1122 :
1123 0 : static NTSTATUS winbind__op_shutdown_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
1124 : {
1125 0 : return NT_STATUS_OK;
1126 : }
1127 :
1128 0 : static bool winbind__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
1129 : {
1130 0 : if (dcesrv_winbind_interface.syntax_id.if_version == if_version && GUID_equal(&dcesrv_winbind_interface.syntax_id.uuid, uuid)) {
1131 0 : memcpy(iface,&dcesrv_winbind_interface, sizeof(*iface));
1132 0 : return true;
1133 : }
1134 :
1135 0 : return false;
1136 : }
1137 :
1138 0 : static bool winbind__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
1139 : {
1140 0 : if (strcmp(dcesrv_winbind_interface.name, name)==0) {
1141 0 : memcpy(iface, &dcesrv_winbind_interface, sizeof(*iface));
1142 0 : return true;
1143 : }
1144 :
1145 0 : return false;
1146 : }
1147 :
1148 : static const struct dcesrv_endpoint_server winbind_ep_server = {
1149 : /* fill in our name */
1150 : .name = "winbind",
1151 :
1152 : /* Initialization flag */
1153 : .initialized = false,
1154 :
1155 : /* fill in all the operations */
1156 : #ifdef DCESRV_INTERFACE_WINBIND_INIT_SERVER
1157 : .init_server = DCESRV_INTERFACE_WINBIND_INIT_SERVER,
1158 : #else
1159 : .init_server = winbind__op_init_server,
1160 : #endif
1161 : #ifdef DCESRV_INTERFACE_WINBIND_SHUTDOWN_SERVER
1162 : .shutdown_server = DCESRV_INTERFACE_WINBIND_SHUTDOWN_SERVER,
1163 : #else
1164 : .shutdown_server = winbind__op_shutdown_server,
1165 : #endif
1166 : .interface_by_uuid = winbind__op_interface_by_uuid,
1167 : .interface_by_name = winbind__op_interface_by_name
1168 : };
1169 :
1170 68 : const struct dcesrv_endpoint_server *winbind_get_ep_server(void)
1171 : {
1172 68 : return &winbind_ep_server;
1173 : }
|