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 0 : 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_LookupAliasMembers */
309 0 : struct wbint_LookupAliasMembers *r2 = (struct wbint_LookupAliasMembers *)r;
310 0 : if (DEBUGLEVEL >= 10) {
311 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupAliasMembers, NDR_IN, r2);
312 : }
313 0 : NDR_ZERO_STRUCT(r2->out);
314 0 : r2->out.sids = talloc_zero(r2, struct wbint_SidArray);
315 0 : if (r2->out.sids == 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_LookupAliasMembers(p, r2);
322 0 : break;
323 : }
324 0 : case 14: { /* wbint_QueryGroupList */
325 0 : struct wbint_QueryGroupList *r2 = (struct wbint_QueryGroupList *)r;
326 0 : if (DEBUGLEVEL >= 10) {
327 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_QueryGroupList, NDR_IN, r2);
328 : }
329 0 : NDR_ZERO_STRUCT(r2->out);
330 0 : r2->out.groups = talloc_zero(r2, struct wbint_Principals);
331 0 : if (r2->out.groups == 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_QueryGroupList(p, r2);
338 0 : break;
339 : }
340 0 : case 15: { /* wbint_QueryUserRidList */
341 0 : struct wbint_QueryUserRidList *r2 = (struct wbint_QueryUserRidList *)r;
342 0 : if (DEBUGLEVEL >= 10) {
343 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_QueryUserRidList, NDR_IN, r2);
344 : }
345 0 : NDR_ZERO_STRUCT(r2->out);
346 0 : r2->out.rids = talloc_zero(r2, struct wbint_RidArray);
347 0 : if (r2->out.rids == 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_QueryUserRidList(p, r2);
354 0 : break;
355 : }
356 0 : case 16: { /* wbint_DsGetDcName */
357 0 : struct wbint_DsGetDcName *r2 = (struct wbint_DsGetDcName *)r;
358 0 : if (DEBUGLEVEL >= 10) {
359 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_DsGetDcName, NDR_IN, r2);
360 : }
361 0 : NDR_ZERO_STRUCT(r2->out);
362 0 : r2->out.dc_info = talloc_zero(r2, struct netr_DsRGetDCNameInfo *);
363 0 : if (r2->out.dc_info == 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.result = _wbint_DsGetDcName(p, r2);
370 0 : break;
371 : }
372 0 : case 17: { /* wbint_LookupRids */
373 0 : struct wbint_LookupRids *r2 = (struct wbint_LookupRids *)r;
374 0 : if (DEBUGLEVEL >= 10) {
375 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupRids, NDR_IN, r2);
376 : }
377 0 : NDR_ZERO_STRUCT(r2->out);
378 0 : r2->out.domain_name = talloc_zero(r2, const char *);
379 0 : if (r2->out.domain_name == NULL) {
380 0 : status = NT_STATUS_NO_MEMORY;
381 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
382 0 : goto fail;
383 : }
384 :
385 0 : r2->out.names = talloc_zero(r2, struct wbint_Principals);
386 0 : if (r2->out.names == NULL) {
387 0 : status = NT_STATUS_NO_MEMORY;
388 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
389 0 : goto fail;
390 : }
391 :
392 0 : r2->out.result = _wbint_LookupRids(p, r2);
393 0 : break;
394 : }
395 0 : case 18: { /* wbint_CheckMachineAccount */
396 0 : struct wbint_CheckMachineAccount *r2 = (struct wbint_CheckMachineAccount *)r;
397 0 : if (DEBUGLEVEL >= 10) {
398 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_CheckMachineAccount, NDR_IN, r2);
399 : }
400 0 : r2->out.result = _wbint_CheckMachineAccount(p, r2);
401 0 : break;
402 : }
403 0 : case 19: { /* wbint_ChangeMachineAccount */
404 0 : struct wbint_ChangeMachineAccount *r2 = (struct wbint_ChangeMachineAccount *)r;
405 0 : if (DEBUGLEVEL >= 10) {
406 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_ChangeMachineAccount, NDR_IN, r2);
407 : }
408 0 : r2->out.result = _wbint_ChangeMachineAccount(p, r2);
409 0 : break;
410 : }
411 0 : case 20: { /* wbint_PingDc */
412 0 : struct wbint_PingDc *r2 = (struct wbint_PingDc *)r;
413 0 : if (DEBUGLEVEL >= 10) {
414 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PingDc, NDR_IN, r2);
415 : }
416 0 : NDR_ZERO_STRUCT(r2->out);
417 0 : r2->out.dcname = talloc_zero(r2, const char *);
418 0 : if (r2->out.dcname == 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_PingDc(p, r2);
425 0 : break;
426 : }
427 0 : case 21: { /* wbint_ListTrustedDomains */
428 0 : struct wbint_ListTrustedDomains *r2 = (struct wbint_ListTrustedDomains *)r;
429 0 : if (DEBUGLEVEL >= 10) {
430 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_ListTrustedDomains, NDR_IN, r2);
431 : }
432 0 : NDR_ZERO_STRUCT(r2->out);
433 0 : r2->out.domains = talloc_zero(r2, struct netr_DomainTrustList);
434 0 : if (r2->out.domains == 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_ListTrustedDomains(p, r2);
441 0 : break;
442 : }
443 0 : case 22: { /* wbint_PamAuth */
444 0 : struct wbint_PamAuth *r2 = (struct wbint_PamAuth *)r;
445 0 : if (DEBUGLEVEL >= 10) {
446 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuth, NDR_IN, r2);
447 : }
448 0 : NDR_ZERO_STRUCT(r2->out);
449 0 : r2->out.validation = talloc_zero(r2, struct wbint_Validation);
450 0 : if (r2->out.validation == 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.result = _wbint_PamAuth(p, r2);
457 0 : break;
458 : }
459 0 : case 23: { /* wbint_PamAuthCrap */
460 0 : struct wbint_PamAuthCrap *r2 = (struct wbint_PamAuthCrap *)r;
461 0 : if (DEBUGLEVEL >= 10) {
462 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuthCrap, NDR_IN, r2);
463 : }
464 0 : NDR_ZERO_STRUCT(r2->out);
465 0 : r2->out.authoritative = talloc_zero(r2, uint8_t);
466 0 : if (r2->out.authoritative == NULL) {
467 0 : status = NT_STATUS_NO_MEMORY;
468 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
469 0 : goto fail;
470 : }
471 :
472 0 : r2->out.validation = talloc_zero(r2, struct wbint_PamAuthCrapValidation);
473 0 : if (r2->out.validation == NULL) {
474 0 : status = NT_STATUS_NO_MEMORY;
475 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
476 0 : goto fail;
477 : }
478 :
479 0 : r2->out.result = _wbint_PamAuthCrap(p, r2);
480 0 : break;
481 : }
482 0 : case 24: { /* wbint_PamLogOff */
483 0 : struct wbint_PamLogOff *r2 = (struct wbint_PamLogOff *)r;
484 0 : if (DEBUGLEVEL >= 10) {
485 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamLogOff, NDR_IN, r2);
486 : }
487 0 : r2->out.result = _wbint_PamLogOff(p, r2);
488 0 : break;
489 : }
490 0 : case 25: { /* wbint_PamAuthCrapChangePassword */
491 0 : struct wbint_PamAuthCrapChangePassword *r2 = (struct wbint_PamAuthCrapChangePassword *)r;
492 0 : if (DEBUGLEVEL >= 10) {
493 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuthCrapChangePassword, NDR_IN, r2);
494 : }
495 0 : r2->out.result = _wbint_PamAuthCrapChangePassword(p, r2);
496 0 : break;
497 : }
498 0 : case 26: { /* wbint_PamAuthChangePassword */
499 0 : struct wbint_PamAuthChangePassword *r2 = (struct wbint_PamAuthChangePassword *)r;
500 0 : if (DEBUGLEVEL >= 10) {
501 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuthChangePassword, NDR_IN, r2);
502 : }
503 0 : NDR_ZERO_STRUCT(r2->out);
504 0 : r2->out.dominfo = talloc_zero(r2, struct samr_DomInfo1 *);
505 0 : if (r2->out.dominfo == NULL) {
506 0 : status = NT_STATUS_NO_MEMORY;
507 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
508 0 : goto fail;
509 : }
510 :
511 0 : r2->out.reject_reason = talloc_zero(r2, enum samPwdChangeReason);
512 0 : if (r2->out.reject_reason == 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.result = _wbint_PamAuthChangePassword(p, r2);
519 0 : break;
520 : }
521 0 : case 27: { /* wbint_InitConnection */
522 0 : struct wbint_InitConnection *r2 = (struct wbint_InitConnection *)r;
523 0 : if (DEBUGLEVEL >= 10) {
524 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_InitConnection, NDR_IN, r2);
525 : }
526 0 : NDR_ZERO_STRUCT(r2->out);
527 0 : r2->out.name = talloc_zero(r2, const char *);
528 0 : if (r2->out.name == NULL) {
529 0 : status = NT_STATUS_NO_MEMORY;
530 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
531 0 : goto fail;
532 : }
533 :
534 0 : r2->out.alt_name = talloc_zero(r2, const char *);
535 0 : if (r2->out.alt_name == NULL) {
536 0 : status = NT_STATUS_NO_MEMORY;
537 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
538 0 : goto fail;
539 : }
540 :
541 0 : r2->out.sid = talloc_zero(r2, struct dom_sid);
542 0 : if (r2->out.sid == NULL) {
543 0 : status = NT_STATUS_NO_MEMORY;
544 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
545 0 : goto fail;
546 : }
547 :
548 0 : r2->out.flags = talloc_zero(r2, enum DomainInfoFlags);
549 0 : if (r2->out.flags == NULL) {
550 0 : status = NT_STATUS_NO_MEMORY;
551 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
552 0 : goto fail;
553 : }
554 :
555 0 : r2->out.result = _wbint_InitConnection(p, r2);
556 0 : break;
557 : }
558 0 : case 28: { /* winbind_SamLogon */
559 0 : struct winbind_SamLogon *r2 = (struct winbind_SamLogon *)r;
560 0 : if (DEBUGLEVEL >= 10) {
561 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_SamLogon, NDR_IN, r2);
562 : }
563 0 : NDR_ZERO_STRUCT(r2->out);
564 0 : r2->out.result = _winbind_SamLogon(p, r2);
565 0 : break;
566 : }
567 0 : case 29: { /* winbind_DsrUpdateReadOnlyServerDnsRecords */
568 0 : struct winbind_DsrUpdateReadOnlyServerDnsRecords *r2 = (struct winbind_DsrUpdateReadOnlyServerDnsRecords *)r;
569 0 : if (DEBUGLEVEL >= 10) {
570 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_DsrUpdateReadOnlyServerDnsRecords, NDR_IN, r2);
571 : }
572 0 : NDR_ZERO_STRUCT(r2->out);
573 0 : r2->out.dns_names = r2->in.dns_names;
574 0 : r2->out.result = _winbind_DsrUpdateReadOnlyServerDnsRecords(p, r2);
575 0 : break;
576 : }
577 0 : case 30: { /* winbind_LogonControl */
578 0 : struct winbind_LogonControl *r2 = (struct winbind_LogonControl *)r;
579 0 : if (DEBUGLEVEL >= 10) {
580 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_LogonControl, NDR_IN, r2);
581 : }
582 0 : NDR_ZERO_STRUCT(r2->out);
583 0 : r2->out.query = talloc_zero(r2, union netr_CONTROL_QUERY_INFORMATION);
584 0 : if (r2->out.query == 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_LogonControl(p, r2);
591 0 : break;
592 : }
593 0 : case 31: { /* winbind_GetForestTrustInformation */
594 0 : struct winbind_GetForestTrustInformation *r2 = (struct winbind_GetForestTrustInformation *)r;
595 0 : if (DEBUGLEVEL >= 10) {
596 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_GetForestTrustInformation, NDR_IN, r2);
597 : }
598 0 : NDR_ZERO_STRUCT(r2->out);
599 0 : r2->out.forest_trust_info = talloc_zero(r2, struct lsa_ForestTrustInformation *);
600 0 : if (r2->out.forest_trust_info == NULL) {
601 0 : status = NT_STATUS_NO_MEMORY;
602 0 : p->fault_state = DCERPC_FAULT_CANT_PERFORM;
603 0 : goto fail;
604 : }
605 :
606 0 : r2->out.result = _winbind_GetForestTrustInformation(p, r2);
607 0 : break;
608 : }
609 0 : case 32: { /* winbind_SendToSam */
610 0 : struct winbind_SendToSam *r2 = (struct winbind_SendToSam *)r;
611 0 : if (DEBUGLEVEL >= 10) {
612 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_SendToSam, NDR_IN, r2);
613 : }
614 0 : r2->out.result = _winbind_SendToSam(p, r2);
615 0 : break;
616 : }
617 0 : default:
618 0 : dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
619 0 : break;
620 : }
621 :
622 0 : fail:
623 : /* Unimpersonate */
624 0 : if (impersonated) {
625 0 : unbecome_authenticated_pipe_user();
626 : }
627 :
628 0 : p->dce_call = NULL;
629 0 : p->mem_ctx = NULL;
630 : /* Check pipes struct fault state */
631 0 : if (p->fault_state != 0) {
632 0 : dce_call->fault_code = p->fault_state;
633 : }
634 0 : if (dce_call->fault_code != 0) {
635 0 : status = NT_STATUS_NET_WRITE_FAULT;
636 : }
637 :
638 0 : return status;
639 : }
640 :
641 0 : NTSTATUS winbind__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
642 : {
643 0 : return winbind__op_dispatch_internal(dce_call, mem_ctx, r, S3COMPAT_RPC_DISPATCH_EXTERNAL);
644 : }
645 :
646 0 : NTSTATUS winbind__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
647 : {
648 0 : uint16_t opnum = dce_call->pkt.u.request.opnum;
649 :
650 0 : switch (opnum) {
651 0 : case 0: { /* wbint_Ping */
652 0 : struct wbint_Ping *r2 = (struct wbint_Ping *)r;
653 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
654 0 : DEBUG(5,("function wbint_Ping replied async\n"));
655 : }
656 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
657 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_Ping, NDR_OUT | NDR_SET_VALUES, r2);
658 : }
659 0 : if (dce_call->fault_code != 0) {
660 0 : DBG_WARNING("dcerpc_fault %s in wbint_Ping\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
661 : }
662 0 : break;
663 : }
664 0 : case 1: { /* wbint_LookupSid */
665 0 : struct wbint_LookupSid *r2 = (struct wbint_LookupSid *)r;
666 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
667 0 : DEBUG(5,("function wbint_LookupSid replied async\n"));
668 : }
669 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
670 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupSid, NDR_OUT | NDR_SET_VALUES, r2);
671 : }
672 0 : if (dce_call->fault_code != 0) {
673 0 : DBG_WARNING("dcerpc_fault %s in wbint_LookupSid\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
674 : }
675 0 : break;
676 : }
677 0 : case 2: { /* wbint_LookupSids */
678 0 : struct wbint_LookupSids *r2 = (struct wbint_LookupSids *)r;
679 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
680 0 : DEBUG(5,("function wbint_LookupSids replied async\n"));
681 : }
682 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
683 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupSids, NDR_OUT | NDR_SET_VALUES, r2);
684 : }
685 0 : if (dce_call->fault_code != 0) {
686 0 : DBG_WARNING("dcerpc_fault %s in wbint_LookupSids\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
687 : }
688 0 : break;
689 : }
690 0 : case 3: { /* wbint_LookupName */
691 0 : struct wbint_LookupName *r2 = (struct wbint_LookupName *)r;
692 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
693 0 : DEBUG(5,("function wbint_LookupName replied async\n"));
694 : }
695 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
696 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupName, NDR_OUT | NDR_SET_VALUES, r2);
697 : }
698 0 : if (dce_call->fault_code != 0) {
699 0 : DBG_WARNING("dcerpc_fault %s in wbint_LookupName\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
700 : }
701 0 : break;
702 : }
703 0 : case 4: { /* wbint_Sids2UnixIDs */
704 0 : struct wbint_Sids2UnixIDs *r2 = (struct wbint_Sids2UnixIDs *)r;
705 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
706 0 : DEBUG(5,("function wbint_Sids2UnixIDs replied async\n"));
707 : }
708 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
709 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_Sids2UnixIDs, NDR_OUT | NDR_SET_VALUES, r2);
710 : }
711 0 : if (dce_call->fault_code != 0) {
712 0 : DBG_WARNING("dcerpc_fault %s in wbint_Sids2UnixIDs\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
713 : }
714 0 : break;
715 : }
716 0 : case 5: { /* wbint_UnixIDs2Sids */
717 0 : struct wbint_UnixIDs2Sids *r2 = (struct wbint_UnixIDs2Sids *)r;
718 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
719 0 : DEBUG(5,("function wbint_UnixIDs2Sids replied async\n"));
720 : }
721 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
722 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_UnixIDs2Sids, NDR_OUT | NDR_SET_VALUES, r2);
723 : }
724 0 : if (dce_call->fault_code != 0) {
725 0 : DBG_WARNING("dcerpc_fault %s in wbint_UnixIDs2Sids\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
726 : }
727 0 : break;
728 : }
729 0 : case 6: { /* wbint_AllocateUid */
730 0 : struct wbint_AllocateUid *r2 = (struct wbint_AllocateUid *)r;
731 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
732 0 : DEBUG(5,("function wbint_AllocateUid replied async\n"));
733 : }
734 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
735 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_AllocateUid, NDR_OUT | NDR_SET_VALUES, r2);
736 : }
737 0 : if (dce_call->fault_code != 0) {
738 0 : DBG_WARNING("dcerpc_fault %s in wbint_AllocateUid\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
739 : }
740 0 : break;
741 : }
742 0 : case 7: { /* wbint_AllocateGid */
743 0 : struct wbint_AllocateGid *r2 = (struct wbint_AllocateGid *)r;
744 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
745 0 : DEBUG(5,("function wbint_AllocateGid replied async\n"));
746 : }
747 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
748 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_AllocateGid, NDR_OUT | NDR_SET_VALUES, r2);
749 : }
750 0 : if (dce_call->fault_code != 0) {
751 0 : DBG_WARNING("dcerpc_fault %s in wbint_AllocateGid\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
752 : }
753 0 : break;
754 : }
755 0 : case 8: { /* wbint_GetNssInfo */
756 0 : struct wbint_GetNssInfo *r2 = (struct wbint_GetNssInfo *)r;
757 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
758 0 : DEBUG(5,("function wbint_GetNssInfo replied async\n"));
759 : }
760 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
761 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_GetNssInfo, NDR_OUT | NDR_SET_VALUES, r2);
762 : }
763 0 : if (dce_call->fault_code != 0) {
764 0 : DBG_WARNING("dcerpc_fault %s in wbint_GetNssInfo\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
765 : }
766 0 : break;
767 : }
768 0 : case 9: { /* wbint_LookupUserAliases */
769 0 : struct wbint_LookupUserAliases *r2 = (struct wbint_LookupUserAliases *)r;
770 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
771 0 : DEBUG(5,("function wbint_LookupUserAliases replied async\n"));
772 : }
773 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
774 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupUserAliases, NDR_OUT | NDR_SET_VALUES, r2);
775 : }
776 0 : if (dce_call->fault_code != 0) {
777 0 : DBG_WARNING("dcerpc_fault %s in wbint_LookupUserAliases\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
778 : }
779 0 : break;
780 : }
781 0 : case 10: { /* wbint_LookupUserGroups */
782 0 : struct wbint_LookupUserGroups *r2 = (struct wbint_LookupUserGroups *)r;
783 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
784 0 : DEBUG(5,("function wbint_LookupUserGroups replied async\n"));
785 : }
786 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
787 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupUserGroups, NDR_OUT | NDR_SET_VALUES, r2);
788 : }
789 0 : if (dce_call->fault_code != 0) {
790 0 : DBG_WARNING("dcerpc_fault %s in wbint_LookupUserGroups\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
791 : }
792 0 : break;
793 : }
794 0 : case 11: { /* wbint_QuerySequenceNumber */
795 0 : struct wbint_QuerySequenceNumber *r2 = (struct wbint_QuerySequenceNumber *)r;
796 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
797 0 : DEBUG(5,("function wbint_QuerySequenceNumber replied async\n"));
798 : }
799 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
800 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_QuerySequenceNumber, NDR_OUT | NDR_SET_VALUES, r2);
801 : }
802 0 : if (dce_call->fault_code != 0) {
803 0 : DBG_WARNING("dcerpc_fault %s in wbint_QuerySequenceNumber\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
804 : }
805 0 : break;
806 : }
807 0 : case 12: { /* wbint_LookupGroupMembers */
808 0 : struct wbint_LookupGroupMembers *r2 = (struct wbint_LookupGroupMembers *)r;
809 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
810 0 : DEBUG(5,("function wbint_LookupGroupMembers replied async\n"));
811 : }
812 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
813 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupGroupMembers, NDR_OUT | NDR_SET_VALUES, r2);
814 : }
815 0 : if (dce_call->fault_code != 0) {
816 0 : DBG_WARNING("dcerpc_fault %s in wbint_LookupGroupMembers\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
817 : }
818 0 : break;
819 : }
820 0 : case 13: { /* wbint_LookupAliasMembers */
821 0 : struct wbint_LookupAliasMembers *r2 = (struct wbint_LookupAliasMembers *)r;
822 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
823 0 : DEBUG(5,("function wbint_LookupAliasMembers replied async\n"));
824 : }
825 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
826 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupAliasMembers, NDR_OUT | NDR_SET_VALUES, r2);
827 : }
828 0 : if (dce_call->fault_code != 0) {
829 0 : DBG_WARNING("dcerpc_fault %s in wbint_LookupAliasMembers\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
830 : }
831 0 : break;
832 : }
833 0 : case 14: { /* wbint_QueryGroupList */
834 0 : struct wbint_QueryGroupList *r2 = (struct wbint_QueryGroupList *)r;
835 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
836 0 : DEBUG(5,("function wbint_QueryGroupList replied async\n"));
837 : }
838 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
839 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_QueryGroupList, NDR_OUT | NDR_SET_VALUES, r2);
840 : }
841 0 : if (dce_call->fault_code != 0) {
842 0 : DBG_WARNING("dcerpc_fault %s in wbint_QueryGroupList\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
843 : }
844 0 : break;
845 : }
846 0 : case 15: { /* wbint_QueryUserRidList */
847 0 : struct wbint_QueryUserRidList *r2 = (struct wbint_QueryUserRidList *)r;
848 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
849 0 : DEBUG(5,("function wbint_QueryUserRidList replied async\n"));
850 : }
851 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
852 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_QueryUserRidList, NDR_OUT | NDR_SET_VALUES, r2);
853 : }
854 0 : if (dce_call->fault_code != 0) {
855 0 : DBG_WARNING("dcerpc_fault %s in wbint_QueryUserRidList\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
856 : }
857 0 : break;
858 : }
859 0 : case 16: { /* wbint_DsGetDcName */
860 0 : struct wbint_DsGetDcName *r2 = (struct wbint_DsGetDcName *)r;
861 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
862 0 : DEBUG(5,("function wbint_DsGetDcName replied async\n"));
863 : }
864 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
865 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_DsGetDcName, NDR_OUT | NDR_SET_VALUES, r2);
866 : }
867 0 : if (dce_call->fault_code != 0) {
868 0 : DBG_WARNING("dcerpc_fault %s in wbint_DsGetDcName\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
869 : }
870 0 : break;
871 : }
872 0 : case 17: { /* wbint_LookupRids */
873 0 : struct wbint_LookupRids *r2 = (struct wbint_LookupRids *)r;
874 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
875 0 : DEBUG(5,("function wbint_LookupRids replied async\n"));
876 : }
877 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
878 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_LookupRids, NDR_OUT | NDR_SET_VALUES, r2);
879 : }
880 0 : if (dce_call->fault_code != 0) {
881 0 : DBG_WARNING("dcerpc_fault %s in wbint_LookupRids\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
882 : }
883 0 : break;
884 : }
885 0 : case 18: { /* wbint_CheckMachineAccount */
886 0 : struct wbint_CheckMachineAccount *r2 = (struct wbint_CheckMachineAccount *)r;
887 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
888 0 : DEBUG(5,("function wbint_CheckMachineAccount replied async\n"));
889 : }
890 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
891 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_CheckMachineAccount, NDR_OUT | NDR_SET_VALUES, r2);
892 : }
893 0 : if (dce_call->fault_code != 0) {
894 0 : DBG_WARNING("dcerpc_fault %s in wbint_CheckMachineAccount\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
895 : }
896 0 : break;
897 : }
898 0 : case 19: { /* wbint_ChangeMachineAccount */
899 0 : struct wbint_ChangeMachineAccount *r2 = (struct wbint_ChangeMachineAccount *)r;
900 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
901 0 : DEBUG(5,("function wbint_ChangeMachineAccount replied async\n"));
902 : }
903 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
904 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_ChangeMachineAccount, NDR_OUT | NDR_SET_VALUES, r2);
905 : }
906 0 : if (dce_call->fault_code != 0) {
907 0 : DBG_WARNING("dcerpc_fault %s in wbint_ChangeMachineAccount\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
908 : }
909 0 : break;
910 : }
911 0 : case 20: { /* wbint_PingDc */
912 0 : struct wbint_PingDc *r2 = (struct wbint_PingDc *)r;
913 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
914 0 : DEBUG(5,("function wbint_PingDc replied async\n"));
915 : }
916 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
917 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PingDc, NDR_OUT | NDR_SET_VALUES, r2);
918 : }
919 0 : if (dce_call->fault_code != 0) {
920 0 : DBG_WARNING("dcerpc_fault %s in wbint_PingDc\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
921 : }
922 0 : break;
923 : }
924 0 : case 21: { /* wbint_ListTrustedDomains */
925 0 : struct wbint_ListTrustedDomains *r2 = (struct wbint_ListTrustedDomains *)r;
926 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
927 0 : DEBUG(5,("function wbint_ListTrustedDomains replied async\n"));
928 : }
929 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
930 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_ListTrustedDomains, NDR_OUT | NDR_SET_VALUES, r2);
931 : }
932 0 : if (dce_call->fault_code != 0) {
933 0 : DBG_WARNING("dcerpc_fault %s in wbint_ListTrustedDomains\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
934 : }
935 0 : break;
936 : }
937 0 : case 22: { /* wbint_PamAuth */
938 0 : struct wbint_PamAuth *r2 = (struct wbint_PamAuth *)r;
939 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
940 0 : DEBUG(5,("function wbint_PamAuth replied async\n"));
941 : }
942 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
943 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuth, NDR_OUT | NDR_SET_VALUES, r2);
944 : }
945 0 : if (dce_call->fault_code != 0) {
946 0 : DBG_WARNING("dcerpc_fault %s in wbint_PamAuth\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
947 : }
948 0 : break;
949 : }
950 0 : case 23: { /* wbint_PamAuthCrap */
951 0 : struct wbint_PamAuthCrap *r2 = (struct wbint_PamAuthCrap *)r;
952 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
953 0 : DEBUG(5,("function wbint_PamAuthCrap replied async\n"));
954 : }
955 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
956 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuthCrap, NDR_OUT | NDR_SET_VALUES, r2);
957 : }
958 0 : if (dce_call->fault_code != 0) {
959 0 : DBG_WARNING("dcerpc_fault %s in wbint_PamAuthCrap\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
960 : }
961 0 : break;
962 : }
963 0 : case 24: { /* wbint_PamLogOff */
964 0 : struct wbint_PamLogOff *r2 = (struct wbint_PamLogOff *)r;
965 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
966 0 : DEBUG(5,("function wbint_PamLogOff replied async\n"));
967 : }
968 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
969 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamLogOff, NDR_OUT | NDR_SET_VALUES, r2);
970 : }
971 0 : if (dce_call->fault_code != 0) {
972 0 : DBG_WARNING("dcerpc_fault %s in wbint_PamLogOff\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
973 : }
974 0 : break;
975 : }
976 0 : case 25: { /* wbint_PamAuthCrapChangePassword */
977 0 : struct wbint_PamAuthCrapChangePassword *r2 = (struct wbint_PamAuthCrapChangePassword *)r;
978 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
979 0 : DEBUG(5,("function wbint_PamAuthCrapChangePassword replied async\n"));
980 : }
981 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
982 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuthCrapChangePassword, NDR_OUT | NDR_SET_VALUES, r2);
983 : }
984 0 : if (dce_call->fault_code != 0) {
985 0 : DBG_WARNING("dcerpc_fault %s in wbint_PamAuthCrapChangePassword\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
986 : }
987 0 : break;
988 : }
989 0 : case 26: { /* wbint_PamAuthChangePassword */
990 0 : struct wbint_PamAuthChangePassword *r2 = (struct wbint_PamAuthChangePassword *)r;
991 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
992 0 : DEBUG(5,("function wbint_PamAuthChangePassword replied async\n"));
993 : }
994 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
995 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_PamAuthChangePassword, NDR_OUT | NDR_SET_VALUES, r2);
996 : }
997 0 : if (dce_call->fault_code != 0) {
998 0 : DBG_WARNING("dcerpc_fault %s in wbint_PamAuthChangePassword\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
999 : }
1000 0 : break;
1001 : }
1002 0 : case 27: { /* wbint_InitConnection */
1003 0 : struct wbint_InitConnection *r2 = (struct wbint_InitConnection *)r;
1004 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
1005 0 : DEBUG(5,("function wbint_InitConnection replied async\n"));
1006 : }
1007 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
1008 0 : NDR_PRINT_FUNCTION_DEBUG(wbint_InitConnection, NDR_OUT | NDR_SET_VALUES, r2);
1009 : }
1010 0 : if (dce_call->fault_code != 0) {
1011 0 : DBG_WARNING("dcerpc_fault %s in wbint_InitConnection\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
1012 : }
1013 0 : break;
1014 : }
1015 0 : case 28: { /* winbind_SamLogon */
1016 0 : struct winbind_SamLogon *r2 = (struct winbind_SamLogon *)r;
1017 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
1018 0 : DEBUG(5,("function winbind_SamLogon replied async\n"));
1019 : }
1020 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
1021 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_SamLogon, NDR_OUT | NDR_SET_VALUES, r2);
1022 : }
1023 0 : if (dce_call->fault_code != 0) {
1024 0 : DBG_WARNING("dcerpc_fault %s in winbind_SamLogon\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
1025 : }
1026 0 : break;
1027 : }
1028 0 : case 29: { /* winbind_DsrUpdateReadOnlyServerDnsRecords */
1029 0 : struct winbind_DsrUpdateReadOnlyServerDnsRecords *r2 = (struct winbind_DsrUpdateReadOnlyServerDnsRecords *)r;
1030 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
1031 0 : DEBUG(5,("function winbind_DsrUpdateReadOnlyServerDnsRecords replied async\n"));
1032 : }
1033 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
1034 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_DsrUpdateReadOnlyServerDnsRecords, NDR_OUT | NDR_SET_VALUES, r2);
1035 : }
1036 0 : if (dce_call->fault_code != 0) {
1037 0 : DBG_WARNING("dcerpc_fault %s in winbind_DsrUpdateReadOnlyServerDnsRecords\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
1038 : }
1039 0 : break;
1040 : }
1041 0 : case 30: { /* winbind_LogonControl */
1042 0 : struct winbind_LogonControl *r2 = (struct winbind_LogonControl *)r;
1043 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
1044 0 : DEBUG(5,("function winbind_LogonControl replied async\n"));
1045 : }
1046 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
1047 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_LogonControl, NDR_OUT | NDR_SET_VALUES, r2);
1048 : }
1049 0 : if (dce_call->fault_code != 0) {
1050 0 : DBG_WARNING("dcerpc_fault %s in winbind_LogonControl\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
1051 : }
1052 0 : break;
1053 : }
1054 0 : case 31: { /* winbind_GetForestTrustInformation */
1055 0 : struct winbind_GetForestTrustInformation *r2 = (struct winbind_GetForestTrustInformation *)r;
1056 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
1057 0 : DEBUG(5,("function winbind_GetForestTrustInformation replied async\n"));
1058 : }
1059 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
1060 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_GetForestTrustInformation, NDR_OUT | NDR_SET_VALUES, r2);
1061 : }
1062 0 : if (dce_call->fault_code != 0) {
1063 0 : DBG_WARNING("dcerpc_fault %s in winbind_GetForestTrustInformation\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
1064 : }
1065 0 : break;
1066 : }
1067 0 : case 32: { /* winbind_SendToSam */
1068 0 : struct winbind_SendToSam *r2 = (struct winbind_SendToSam *)r;
1069 0 : if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
1070 0 : DEBUG(5,("function winbind_SendToSam replied async\n"));
1071 : }
1072 0 : if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
1073 0 : NDR_PRINT_FUNCTION_DEBUG(winbind_SendToSam, NDR_OUT | NDR_SET_VALUES, r2);
1074 : }
1075 0 : if (dce_call->fault_code != 0) {
1076 0 : DBG_WARNING("dcerpc_fault %s in winbind_SendToSam\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
1077 : }
1078 0 : break;
1079 : }
1080 0 : default:
1081 0 : dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
1082 0 : break;
1083 : }
1084 :
1085 0 : if (dce_call->fault_code != 0) {
1086 0 : return NT_STATUS_NET_WRITE_FAULT;
1087 : }
1088 :
1089 0 : return NT_STATUS_OK;
1090 : }
1091 :
1092 0 : NTSTATUS winbind__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
1093 : {
1094 0 : enum ndr_err_code ndr_err;
1095 0 : uint16_t opnum = dce_call->pkt.u.request.opnum;
1096 :
1097 0 : ndr_err = ndr_table_winbind.calls[opnum].ndr_push(push, NDR_OUT, r);
1098 0 : if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1099 0 : dce_call->fault_code = DCERPC_FAULT_NDR;
1100 0 : return NT_STATUS_NET_WRITE_FAULT;
1101 : }
1102 :
1103 0 : return NT_STATUS_OK;
1104 : }
1105 :
1106 0 : NTSTATUS winbind__op_local(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
1107 : {
1108 0 : return winbind__op_dispatch_internal(dce_call, mem_ctx, r, S3COMPAT_RPC_DISPATCH_INTERNAL);
1109 : }
1110 :
1111 : static const struct dcesrv_interface dcesrv_winbind_interface = {
1112 : .name = "winbind",
1113 : .syntax_id = {{0xbf09192c,0xed60,0x4928,{0x9d,0xff},{0xd0,0xd7,0xbc,0xb0,0x3e,0xd8}},1.0},
1114 : .bind = winbind__op_bind,
1115 : .unbind = winbind__op_unbind,
1116 : .ndr_pull = winbind__op_ndr_pull,
1117 : .dispatch = winbind__op_dispatch,
1118 : .reply = winbind__op_reply,
1119 : .ndr_push = winbind__op_ndr_push,
1120 : .local = winbind__op_local,
1121 : #ifdef DCESRV_INTERFACE_WINBIND_FLAGS
1122 : .flags = DCESRV_INTERFACE_WINBIND_FLAGS
1123 : #else
1124 : .flags = 0
1125 : #endif
1126 : };
1127 :
1128 45 : static NTSTATUS winbind__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
1129 : {
1130 0 : uint32_t i;
1131 0 : NTSTATUS ret;
1132 :
1133 : #ifdef DCESRV_INTERFACE_WINBIND_NCACN_NP_SECONDARY_ENDPOINT
1134 : const char *ncacn_np_secondary_endpoint = DCESRV_INTERFACE_WINBIND_NCACN_NP_SECONDARY_ENDPOINT;
1135 : #else
1136 45 : const char *ncacn_np_secondary_endpoint = NULL;
1137 : #endif
1138 :
1139 90 : for (i=0;i<ndr_table_winbind.endpoints->count;i++) {
1140 45 : const char *name = ndr_table_winbind.endpoints->names[i];
1141 :
1142 45 : ret = dcesrv_interface_register(dce_ctx, name, ncacn_np_secondary_endpoint, &dcesrv_winbind_interface, NULL);
1143 45 : if (!NT_STATUS_IS_OK(ret)) {
1144 0 : DBG_ERR("Failed to register endpoint '%s'\n",name);
1145 0 : return ret;
1146 : }
1147 : }
1148 :
1149 45 : return NT_STATUS_OK;
1150 : }
1151 :
1152 0 : static NTSTATUS winbind__op_shutdown_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
1153 : {
1154 0 : return NT_STATUS_OK;
1155 : }
1156 :
1157 0 : static bool winbind__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
1158 : {
1159 0 : if (dcesrv_winbind_interface.syntax_id.if_version == if_version && GUID_equal(&dcesrv_winbind_interface.syntax_id.uuid, uuid)) {
1160 0 : memcpy(iface,&dcesrv_winbind_interface, sizeof(*iface));
1161 0 : return true;
1162 : }
1163 :
1164 0 : return false;
1165 : }
1166 :
1167 0 : static bool winbind__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
1168 : {
1169 0 : if (strcmp(dcesrv_winbind_interface.name, name)==0) {
1170 0 : memcpy(iface, &dcesrv_winbind_interface, sizeof(*iface));
1171 0 : return true;
1172 : }
1173 :
1174 0 : return false;
1175 : }
1176 :
1177 : static const struct dcesrv_endpoint_server winbind_ep_server = {
1178 : /* fill in our name */
1179 : .name = "winbind",
1180 :
1181 : /* Initialization flag */
1182 : .initialized = false,
1183 :
1184 : /* fill in all the operations */
1185 : #ifdef DCESRV_INTERFACE_WINBIND_INIT_SERVER
1186 : .init_server = DCESRV_INTERFACE_WINBIND_INIT_SERVER,
1187 : #else
1188 : .init_server = winbind__op_init_server,
1189 : #endif
1190 : #ifdef DCESRV_INTERFACE_WINBIND_SHUTDOWN_SERVER
1191 : .shutdown_server = DCESRV_INTERFACE_WINBIND_SHUTDOWN_SERVER,
1192 : #else
1193 : .shutdown_server = winbind__op_shutdown_server,
1194 : #endif
1195 : .interface_by_uuid = winbind__op_interface_by_uuid,
1196 : .interface_by_name = winbind__op_interface_by_name
1197 : };
1198 :
1199 45 : const struct dcesrv_endpoint_server *winbind_get_ep_server(void)
1200 : {
1201 45 : return &winbind_ep_server;
1202 : }
|