s3:winbind: Convert WINBINDD_REMOVE_MAPPING to the new API
[sfrench/samba-autobuild/.git] / source3 / librpc / gen_ndr / srv_wbint.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * server auto-generated by pidl. DO NOT MODIFY!
4  */
5
6 #include "includes.h"
7 #include "librpc/gen_ndr/srv_wbint.h"
8
9 static bool api_wbint_Ping(pipes_struct *p)
10 {
11         const struct ndr_interface_call *call;
12         struct ndr_pull *pull;
13         struct ndr_push *push;
14         enum ndr_err_code ndr_err;
15         DATA_BLOB blob;
16         struct wbint_Ping *r;
17
18         call = &ndr_table_wbint.calls[NDR_WBINT_PING];
19
20         r = talloc(talloc_tos(), struct wbint_Ping);
21         if (r == NULL) {
22                 return false;
23         }
24
25         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
26                 talloc_free(r);
27                 return false;
28         }
29
30         pull = ndr_pull_init_blob(&blob, r, NULL);
31         if (pull == NULL) {
32                 talloc_free(r);
33                 return false;
34         }
35
36         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
37         ndr_err = call->ndr_pull(pull, NDR_IN, r);
38         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
39                 talloc_free(r);
40                 return false;
41         }
42
43         if (DEBUGLEVEL >= 10) {
44                 NDR_PRINT_IN_DEBUG(wbint_Ping, r);
45         }
46
47         ZERO_STRUCT(r->out);
48         r->out.out_data = talloc_zero(r, uint32_t);
49         if (r->out.out_data == NULL) {
50                 talloc_free(r);
51                 return false;
52         }
53
54         _wbint_Ping(p, r);
55
56         if (p->rng_fault_state) {
57                 talloc_free(r);
58                 /* Return true here, srv_pipe_hnd.c will take care */
59                 return true;
60         }
61
62         if (DEBUGLEVEL >= 10) {
63                 NDR_PRINT_OUT_DEBUG(wbint_Ping, r);
64         }
65
66         push = ndr_push_init_ctx(r, NULL);
67         if (push == NULL) {
68                 talloc_free(r);
69                 return false;
70         }
71
72         ndr_err = call->ndr_push(push, NDR_OUT, r);
73         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
74                 talloc_free(r);
75                 return false;
76         }
77
78         blob = ndr_push_blob(push);
79         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
80                 talloc_free(r);
81                 return false;
82         }
83
84         talloc_free(r);
85
86         return true;
87 }
88
89 static bool api_wbint_LookupSid(pipes_struct *p)
90 {
91         const struct ndr_interface_call *call;
92         struct ndr_pull *pull;
93         struct ndr_push *push;
94         enum ndr_err_code ndr_err;
95         DATA_BLOB blob;
96         struct wbint_LookupSid *r;
97
98         call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPSID];
99
100         r = talloc(talloc_tos(), struct wbint_LookupSid);
101         if (r == NULL) {
102                 return false;
103         }
104
105         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
106                 talloc_free(r);
107                 return false;
108         }
109
110         pull = ndr_pull_init_blob(&blob, r, NULL);
111         if (pull == NULL) {
112                 talloc_free(r);
113                 return false;
114         }
115
116         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
117         ndr_err = call->ndr_pull(pull, NDR_IN, r);
118         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
119                 talloc_free(r);
120                 return false;
121         }
122
123         if (DEBUGLEVEL >= 10) {
124                 NDR_PRINT_IN_DEBUG(wbint_LookupSid, r);
125         }
126
127         ZERO_STRUCT(r->out);
128         r->out.type = talloc_zero(r, enum lsa_SidType);
129         if (r->out.type == NULL) {
130                 talloc_free(r);
131                 return false;
132         }
133
134         r->out.domain = talloc_zero(r, const char *);
135         if (r->out.domain == NULL) {
136                 talloc_free(r);
137                 return false;
138         }
139
140         r->out.name = talloc_zero(r, const char *);
141         if (r->out.name == NULL) {
142                 talloc_free(r);
143                 return false;
144         }
145
146         r->out.result = _wbint_LookupSid(p, r);
147
148         if (p->rng_fault_state) {
149                 talloc_free(r);
150                 /* Return true here, srv_pipe_hnd.c will take care */
151                 return true;
152         }
153
154         if (DEBUGLEVEL >= 10) {
155                 NDR_PRINT_OUT_DEBUG(wbint_LookupSid, r);
156         }
157
158         push = ndr_push_init_ctx(r, NULL);
159         if (push == NULL) {
160                 talloc_free(r);
161                 return false;
162         }
163
164         ndr_err = call->ndr_push(push, NDR_OUT, r);
165         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
166                 talloc_free(r);
167                 return false;
168         }
169
170         blob = ndr_push_blob(push);
171         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
172                 talloc_free(r);
173                 return false;
174         }
175
176         talloc_free(r);
177
178         return true;
179 }
180
181 static bool api_wbint_LookupName(pipes_struct *p)
182 {
183         const struct ndr_interface_call *call;
184         struct ndr_pull *pull;
185         struct ndr_push *push;
186         enum ndr_err_code ndr_err;
187         DATA_BLOB blob;
188         struct wbint_LookupName *r;
189
190         call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPNAME];
191
192         r = talloc(talloc_tos(), struct wbint_LookupName);
193         if (r == NULL) {
194                 return false;
195         }
196
197         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
198                 talloc_free(r);
199                 return false;
200         }
201
202         pull = ndr_pull_init_blob(&blob, r, NULL);
203         if (pull == NULL) {
204                 talloc_free(r);
205                 return false;
206         }
207
208         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
209         ndr_err = call->ndr_pull(pull, NDR_IN, r);
210         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
211                 talloc_free(r);
212                 return false;
213         }
214
215         if (DEBUGLEVEL >= 10) {
216                 NDR_PRINT_IN_DEBUG(wbint_LookupName, r);
217         }
218
219         ZERO_STRUCT(r->out);
220         r->out.type = talloc_zero(r, enum lsa_SidType);
221         if (r->out.type == NULL) {
222                 talloc_free(r);
223                 return false;
224         }
225
226         r->out.sid = talloc_zero(r, struct dom_sid);
227         if (r->out.sid == NULL) {
228                 talloc_free(r);
229                 return false;
230         }
231
232         r->out.result = _wbint_LookupName(p, r);
233
234         if (p->rng_fault_state) {
235                 talloc_free(r);
236                 /* Return true here, srv_pipe_hnd.c will take care */
237                 return true;
238         }
239
240         if (DEBUGLEVEL >= 10) {
241                 NDR_PRINT_OUT_DEBUG(wbint_LookupName, r);
242         }
243
244         push = ndr_push_init_ctx(r, NULL);
245         if (push == NULL) {
246                 talloc_free(r);
247                 return false;
248         }
249
250         ndr_err = call->ndr_push(push, NDR_OUT, r);
251         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
252                 talloc_free(r);
253                 return false;
254         }
255
256         blob = ndr_push_blob(push);
257         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
258                 talloc_free(r);
259                 return false;
260         }
261
262         talloc_free(r);
263
264         return true;
265 }
266
267 static bool api_wbint_Sid2Uid(pipes_struct *p)
268 {
269         const struct ndr_interface_call *call;
270         struct ndr_pull *pull;
271         struct ndr_push *push;
272         enum ndr_err_code ndr_err;
273         DATA_BLOB blob;
274         struct wbint_Sid2Uid *r;
275
276         call = &ndr_table_wbint.calls[NDR_WBINT_SID2UID];
277
278         r = talloc(talloc_tos(), struct wbint_Sid2Uid);
279         if (r == NULL) {
280                 return false;
281         }
282
283         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
284                 talloc_free(r);
285                 return false;
286         }
287
288         pull = ndr_pull_init_blob(&blob, r, NULL);
289         if (pull == NULL) {
290                 talloc_free(r);
291                 return false;
292         }
293
294         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
295         ndr_err = call->ndr_pull(pull, NDR_IN, r);
296         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
297                 talloc_free(r);
298                 return false;
299         }
300
301         if (DEBUGLEVEL >= 10) {
302                 NDR_PRINT_IN_DEBUG(wbint_Sid2Uid, r);
303         }
304
305         ZERO_STRUCT(r->out);
306         r->out.uid = talloc_zero(r, uint64_t);
307         if (r->out.uid == NULL) {
308                 talloc_free(r);
309                 return false;
310         }
311
312         r->out.result = _wbint_Sid2Uid(p, r);
313
314         if (p->rng_fault_state) {
315                 talloc_free(r);
316                 /* Return true here, srv_pipe_hnd.c will take care */
317                 return true;
318         }
319
320         if (DEBUGLEVEL >= 10) {
321                 NDR_PRINT_OUT_DEBUG(wbint_Sid2Uid, r);
322         }
323
324         push = ndr_push_init_ctx(r, NULL);
325         if (push == NULL) {
326                 talloc_free(r);
327                 return false;
328         }
329
330         ndr_err = call->ndr_push(push, NDR_OUT, r);
331         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
332                 talloc_free(r);
333                 return false;
334         }
335
336         blob = ndr_push_blob(push);
337         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
338                 talloc_free(r);
339                 return false;
340         }
341
342         talloc_free(r);
343
344         return true;
345 }
346
347 static bool api_wbint_Sid2Gid(pipes_struct *p)
348 {
349         const struct ndr_interface_call *call;
350         struct ndr_pull *pull;
351         struct ndr_push *push;
352         enum ndr_err_code ndr_err;
353         DATA_BLOB blob;
354         struct wbint_Sid2Gid *r;
355
356         call = &ndr_table_wbint.calls[NDR_WBINT_SID2GID];
357
358         r = talloc(talloc_tos(), struct wbint_Sid2Gid);
359         if (r == NULL) {
360                 return false;
361         }
362
363         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
364                 talloc_free(r);
365                 return false;
366         }
367
368         pull = ndr_pull_init_blob(&blob, r, NULL);
369         if (pull == NULL) {
370                 talloc_free(r);
371                 return false;
372         }
373
374         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
375         ndr_err = call->ndr_pull(pull, NDR_IN, r);
376         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
377                 talloc_free(r);
378                 return false;
379         }
380
381         if (DEBUGLEVEL >= 10) {
382                 NDR_PRINT_IN_DEBUG(wbint_Sid2Gid, r);
383         }
384
385         ZERO_STRUCT(r->out);
386         r->out.gid = talloc_zero(r, uint64_t);
387         if (r->out.gid == NULL) {
388                 talloc_free(r);
389                 return false;
390         }
391
392         r->out.result = _wbint_Sid2Gid(p, r);
393
394         if (p->rng_fault_state) {
395                 talloc_free(r);
396                 /* Return true here, srv_pipe_hnd.c will take care */
397                 return true;
398         }
399
400         if (DEBUGLEVEL >= 10) {
401                 NDR_PRINT_OUT_DEBUG(wbint_Sid2Gid, r);
402         }
403
404         push = ndr_push_init_ctx(r, NULL);
405         if (push == NULL) {
406                 talloc_free(r);
407                 return false;
408         }
409
410         ndr_err = call->ndr_push(push, NDR_OUT, r);
411         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
412                 talloc_free(r);
413                 return false;
414         }
415
416         blob = ndr_push_blob(push);
417         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
418                 talloc_free(r);
419                 return false;
420         }
421
422         talloc_free(r);
423
424         return true;
425 }
426
427 static bool api_wbint_Uid2Sid(pipes_struct *p)
428 {
429         const struct ndr_interface_call *call;
430         struct ndr_pull *pull;
431         struct ndr_push *push;
432         enum ndr_err_code ndr_err;
433         DATA_BLOB blob;
434         struct wbint_Uid2Sid *r;
435
436         call = &ndr_table_wbint.calls[NDR_WBINT_UID2SID];
437
438         r = talloc(talloc_tos(), struct wbint_Uid2Sid);
439         if (r == NULL) {
440                 return false;
441         }
442
443         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
444                 talloc_free(r);
445                 return false;
446         }
447
448         pull = ndr_pull_init_blob(&blob, r, NULL);
449         if (pull == NULL) {
450                 talloc_free(r);
451                 return false;
452         }
453
454         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
455         ndr_err = call->ndr_pull(pull, NDR_IN, r);
456         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
457                 talloc_free(r);
458                 return false;
459         }
460
461         if (DEBUGLEVEL >= 10) {
462                 NDR_PRINT_IN_DEBUG(wbint_Uid2Sid, r);
463         }
464
465         ZERO_STRUCT(r->out);
466         r->out.sid = talloc_zero(r, struct dom_sid);
467         if (r->out.sid == NULL) {
468                 talloc_free(r);
469                 return false;
470         }
471
472         r->out.result = _wbint_Uid2Sid(p, r);
473
474         if (p->rng_fault_state) {
475                 talloc_free(r);
476                 /* Return true here, srv_pipe_hnd.c will take care */
477                 return true;
478         }
479
480         if (DEBUGLEVEL >= 10) {
481                 NDR_PRINT_OUT_DEBUG(wbint_Uid2Sid, r);
482         }
483
484         push = ndr_push_init_ctx(r, NULL);
485         if (push == NULL) {
486                 talloc_free(r);
487                 return false;
488         }
489
490         ndr_err = call->ndr_push(push, NDR_OUT, r);
491         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
492                 talloc_free(r);
493                 return false;
494         }
495
496         blob = ndr_push_blob(push);
497         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
498                 talloc_free(r);
499                 return false;
500         }
501
502         talloc_free(r);
503
504         return true;
505 }
506
507 static bool api_wbint_Gid2Sid(pipes_struct *p)
508 {
509         const struct ndr_interface_call *call;
510         struct ndr_pull *pull;
511         struct ndr_push *push;
512         enum ndr_err_code ndr_err;
513         DATA_BLOB blob;
514         struct wbint_Gid2Sid *r;
515
516         call = &ndr_table_wbint.calls[NDR_WBINT_GID2SID];
517
518         r = talloc(talloc_tos(), struct wbint_Gid2Sid);
519         if (r == NULL) {
520                 return false;
521         }
522
523         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
524                 talloc_free(r);
525                 return false;
526         }
527
528         pull = ndr_pull_init_blob(&blob, r, NULL);
529         if (pull == NULL) {
530                 talloc_free(r);
531                 return false;
532         }
533
534         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
535         ndr_err = call->ndr_pull(pull, NDR_IN, r);
536         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
537                 talloc_free(r);
538                 return false;
539         }
540
541         if (DEBUGLEVEL >= 10) {
542                 NDR_PRINT_IN_DEBUG(wbint_Gid2Sid, r);
543         }
544
545         ZERO_STRUCT(r->out);
546         r->out.sid = talloc_zero(r, struct dom_sid);
547         if (r->out.sid == NULL) {
548                 talloc_free(r);
549                 return false;
550         }
551
552         r->out.result = _wbint_Gid2Sid(p, r);
553
554         if (p->rng_fault_state) {
555                 talloc_free(r);
556                 /* Return true here, srv_pipe_hnd.c will take care */
557                 return true;
558         }
559
560         if (DEBUGLEVEL >= 10) {
561                 NDR_PRINT_OUT_DEBUG(wbint_Gid2Sid, r);
562         }
563
564         push = ndr_push_init_ctx(r, NULL);
565         if (push == NULL) {
566                 talloc_free(r);
567                 return false;
568         }
569
570         ndr_err = call->ndr_push(push, NDR_OUT, r);
571         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
572                 talloc_free(r);
573                 return false;
574         }
575
576         blob = ndr_push_blob(push);
577         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
578                 talloc_free(r);
579                 return false;
580         }
581
582         talloc_free(r);
583
584         return true;
585 }
586
587 static bool api_wbint_AllocateUid(pipes_struct *p)
588 {
589         const struct ndr_interface_call *call;
590         struct ndr_pull *pull;
591         struct ndr_push *push;
592         enum ndr_err_code ndr_err;
593         DATA_BLOB blob;
594         struct wbint_AllocateUid *r;
595
596         call = &ndr_table_wbint.calls[NDR_WBINT_ALLOCATEUID];
597
598         r = talloc(talloc_tos(), struct wbint_AllocateUid);
599         if (r == NULL) {
600                 return false;
601         }
602
603         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
604                 talloc_free(r);
605                 return false;
606         }
607
608         pull = ndr_pull_init_blob(&blob, r, NULL);
609         if (pull == NULL) {
610                 talloc_free(r);
611                 return false;
612         }
613
614         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
615         ndr_err = call->ndr_pull(pull, NDR_IN, r);
616         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
617                 talloc_free(r);
618                 return false;
619         }
620
621         if (DEBUGLEVEL >= 10) {
622                 NDR_PRINT_IN_DEBUG(wbint_AllocateUid, r);
623         }
624
625         ZERO_STRUCT(r->out);
626         r->out.uid = talloc_zero(r, uint64_t);
627         if (r->out.uid == NULL) {
628                 talloc_free(r);
629                 return false;
630         }
631
632         r->out.result = _wbint_AllocateUid(p, r);
633
634         if (p->rng_fault_state) {
635                 talloc_free(r);
636                 /* Return true here, srv_pipe_hnd.c will take care */
637                 return true;
638         }
639
640         if (DEBUGLEVEL >= 10) {
641                 NDR_PRINT_OUT_DEBUG(wbint_AllocateUid, r);
642         }
643
644         push = ndr_push_init_ctx(r, NULL);
645         if (push == NULL) {
646                 talloc_free(r);
647                 return false;
648         }
649
650         ndr_err = call->ndr_push(push, NDR_OUT, r);
651         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
652                 talloc_free(r);
653                 return false;
654         }
655
656         blob = ndr_push_blob(push);
657         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
658                 talloc_free(r);
659                 return false;
660         }
661
662         talloc_free(r);
663
664         return true;
665 }
666
667 static bool api_wbint_AllocateGid(pipes_struct *p)
668 {
669         const struct ndr_interface_call *call;
670         struct ndr_pull *pull;
671         struct ndr_push *push;
672         enum ndr_err_code ndr_err;
673         DATA_BLOB blob;
674         struct wbint_AllocateGid *r;
675
676         call = &ndr_table_wbint.calls[NDR_WBINT_ALLOCATEGID];
677
678         r = talloc(talloc_tos(), struct wbint_AllocateGid);
679         if (r == NULL) {
680                 return false;
681         }
682
683         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
684                 talloc_free(r);
685                 return false;
686         }
687
688         pull = ndr_pull_init_blob(&blob, r, NULL);
689         if (pull == NULL) {
690                 talloc_free(r);
691                 return false;
692         }
693
694         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
695         ndr_err = call->ndr_pull(pull, NDR_IN, r);
696         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
697                 talloc_free(r);
698                 return false;
699         }
700
701         if (DEBUGLEVEL >= 10) {
702                 NDR_PRINT_IN_DEBUG(wbint_AllocateGid, r);
703         }
704
705         ZERO_STRUCT(r->out);
706         r->out.gid = talloc_zero(r, uint64_t);
707         if (r->out.gid == NULL) {
708                 talloc_free(r);
709                 return false;
710         }
711
712         r->out.result = _wbint_AllocateGid(p, r);
713
714         if (p->rng_fault_state) {
715                 talloc_free(r);
716                 /* Return true here, srv_pipe_hnd.c will take care */
717                 return true;
718         }
719
720         if (DEBUGLEVEL >= 10) {
721                 NDR_PRINT_OUT_DEBUG(wbint_AllocateGid, r);
722         }
723
724         push = ndr_push_init_ctx(r, NULL);
725         if (push == NULL) {
726                 talloc_free(r);
727                 return false;
728         }
729
730         ndr_err = call->ndr_push(push, NDR_OUT, r);
731         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
732                 talloc_free(r);
733                 return false;
734         }
735
736         blob = ndr_push_blob(push);
737         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
738                 talloc_free(r);
739                 return false;
740         }
741
742         talloc_free(r);
743
744         return true;
745 }
746
747 static bool api_wbint_QueryUser(pipes_struct *p)
748 {
749         const struct ndr_interface_call *call;
750         struct ndr_pull *pull;
751         struct ndr_push *push;
752         enum ndr_err_code ndr_err;
753         DATA_BLOB blob;
754         struct wbint_QueryUser *r;
755
756         call = &ndr_table_wbint.calls[NDR_WBINT_QUERYUSER];
757
758         r = talloc(talloc_tos(), struct wbint_QueryUser);
759         if (r == NULL) {
760                 return false;
761         }
762
763         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
764                 talloc_free(r);
765                 return false;
766         }
767
768         pull = ndr_pull_init_blob(&blob, r, NULL);
769         if (pull == NULL) {
770                 talloc_free(r);
771                 return false;
772         }
773
774         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
775         ndr_err = call->ndr_pull(pull, NDR_IN, r);
776         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
777                 talloc_free(r);
778                 return false;
779         }
780
781         if (DEBUGLEVEL >= 10) {
782                 NDR_PRINT_IN_DEBUG(wbint_QueryUser, r);
783         }
784
785         ZERO_STRUCT(r->out);
786         r->out.info = talloc_zero(r, struct wbint_userinfo);
787         if (r->out.info == NULL) {
788                 talloc_free(r);
789                 return false;
790         }
791
792         r->out.result = _wbint_QueryUser(p, r);
793
794         if (p->rng_fault_state) {
795                 talloc_free(r);
796                 /* Return true here, srv_pipe_hnd.c will take care */
797                 return true;
798         }
799
800         if (DEBUGLEVEL >= 10) {
801                 NDR_PRINT_OUT_DEBUG(wbint_QueryUser, r);
802         }
803
804         push = ndr_push_init_ctx(r, NULL);
805         if (push == NULL) {
806                 talloc_free(r);
807                 return false;
808         }
809
810         ndr_err = call->ndr_push(push, NDR_OUT, r);
811         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
812                 talloc_free(r);
813                 return false;
814         }
815
816         blob = ndr_push_blob(push);
817         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
818                 talloc_free(r);
819                 return false;
820         }
821
822         talloc_free(r);
823
824         return true;
825 }
826
827 static bool api_wbint_LookupUserAliases(pipes_struct *p)
828 {
829         const struct ndr_interface_call *call;
830         struct ndr_pull *pull;
831         struct ndr_push *push;
832         enum ndr_err_code ndr_err;
833         DATA_BLOB blob;
834         struct wbint_LookupUserAliases *r;
835
836         call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPUSERALIASES];
837
838         r = talloc(talloc_tos(), struct wbint_LookupUserAliases);
839         if (r == NULL) {
840                 return false;
841         }
842
843         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
844                 talloc_free(r);
845                 return false;
846         }
847
848         pull = ndr_pull_init_blob(&blob, r, NULL);
849         if (pull == NULL) {
850                 talloc_free(r);
851                 return false;
852         }
853
854         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
855         ndr_err = call->ndr_pull(pull, NDR_IN, r);
856         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
857                 talloc_free(r);
858                 return false;
859         }
860
861         if (DEBUGLEVEL >= 10) {
862                 NDR_PRINT_IN_DEBUG(wbint_LookupUserAliases, r);
863         }
864
865         ZERO_STRUCT(r->out);
866         r->out.rids = talloc_zero(r, struct wbint_RidArray);
867         if (r->out.rids == NULL) {
868                 talloc_free(r);
869                 return false;
870         }
871
872         r->out.result = _wbint_LookupUserAliases(p, r);
873
874         if (p->rng_fault_state) {
875                 talloc_free(r);
876                 /* Return true here, srv_pipe_hnd.c will take care */
877                 return true;
878         }
879
880         if (DEBUGLEVEL >= 10) {
881                 NDR_PRINT_OUT_DEBUG(wbint_LookupUserAliases, r);
882         }
883
884         push = ndr_push_init_ctx(r, NULL);
885         if (push == NULL) {
886                 talloc_free(r);
887                 return false;
888         }
889
890         ndr_err = call->ndr_push(push, NDR_OUT, r);
891         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
892                 talloc_free(r);
893                 return false;
894         }
895
896         blob = ndr_push_blob(push);
897         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
898                 talloc_free(r);
899                 return false;
900         }
901
902         talloc_free(r);
903
904         return true;
905 }
906
907 static bool api_wbint_LookupUserGroups(pipes_struct *p)
908 {
909         const struct ndr_interface_call *call;
910         struct ndr_pull *pull;
911         struct ndr_push *push;
912         enum ndr_err_code ndr_err;
913         DATA_BLOB blob;
914         struct wbint_LookupUserGroups *r;
915
916         call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPUSERGROUPS];
917
918         r = talloc(talloc_tos(), struct wbint_LookupUserGroups);
919         if (r == NULL) {
920                 return false;
921         }
922
923         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
924                 talloc_free(r);
925                 return false;
926         }
927
928         pull = ndr_pull_init_blob(&blob, r, NULL);
929         if (pull == NULL) {
930                 talloc_free(r);
931                 return false;
932         }
933
934         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
935         ndr_err = call->ndr_pull(pull, NDR_IN, r);
936         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
937                 talloc_free(r);
938                 return false;
939         }
940
941         if (DEBUGLEVEL >= 10) {
942                 NDR_PRINT_IN_DEBUG(wbint_LookupUserGroups, r);
943         }
944
945         ZERO_STRUCT(r->out);
946         r->out.sids = talloc_zero(r, struct wbint_SidArray);
947         if (r->out.sids == NULL) {
948                 talloc_free(r);
949                 return false;
950         }
951
952         r->out.result = _wbint_LookupUserGroups(p, r);
953
954         if (p->rng_fault_state) {
955                 talloc_free(r);
956                 /* Return true here, srv_pipe_hnd.c will take care */
957                 return true;
958         }
959
960         if (DEBUGLEVEL >= 10) {
961                 NDR_PRINT_OUT_DEBUG(wbint_LookupUserGroups, r);
962         }
963
964         push = ndr_push_init_ctx(r, NULL);
965         if (push == NULL) {
966                 talloc_free(r);
967                 return false;
968         }
969
970         ndr_err = call->ndr_push(push, NDR_OUT, r);
971         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
972                 talloc_free(r);
973                 return false;
974         }
975
976         blob = ndr_push_blob(push);
977         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
978                 talloc_free(r);
979                 return false;
980         }
981
982         talloc_free(r);
983
984         return true;
985 }
986
987 static bool api_wbint_QuerySequenceNumber(pipes_struct *p)
988 {
989         const struct ndr_interface_call *call;
990         struct ndr_pull *pull;
991         struct ndr_push *push;
992         enum ndr_err_code ndr_err;
993         DATA_BLOB blob;
994         struct wbint_QuerySequenceNumber *r;
995
996         call = &ndr_table_wbint.calls[NDR_WBINT_QUERYSEQUENCENUMBER];
997
998         r = talloc(talloc_tos(), struct wbint_QuerySequenceNumber);
999         if (r == NULL) {
1000                 return false;
1001         }
1002
1003         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1004                 talloc_free(r);
1005                 return false;
1006         }
1007
1008         pull = ndr_pull_init_blob(&blob, r, NULL);
1009         if (pull == NULL) {
1010                 talloc_free(r);
1011                 return false;
1012         }
1013
1014         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1015         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1016         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1017                 talloc_free(r);
1018                 return false;
1019         }
1020
1021         if (DEBUGLEVEL >= 10) {
1022                 NDR_PRINT_IN_DEBUG(wbint_QuerySequenceNumber, r);
1023         }
1024
1025         ZERO_STRUCT(r->out);
1026         r->out.sequence = talloc_zero(r, uint32_t);
1027         if (r->out.sequence == NULL) {
1028                 talloc_free(r);
1029                 return false;
1030         }
1031
1032         r->out.result = _wbint_QuerySequenceNumber(p, r);
1033
1034         if (p->rng_fault_state) {
1035                 talloc_free(r);
1036                 /* Return true here, srv_pipe_hnd.c will take care */
1037                 return true;
1038         }
1039
1040         if (DEBUGLEVEL >= 10) {
1041                 NDR_PRINT_OUT_DEBUG(wbint_QuerySequenceNumber, r);
1042         }
1043
1044         push = ndr_push_init_ctx(r, NULL);
1045         if (push == NULL) {
1046                 talloc_free(r);
1047                 return false;
1048         }
1049
1050         ndr_err = call->ndr_push(push, NDR_OUT, r);
1051         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1052                 talloc_free(r);
1053                 return false;
1054         }
1055
1056         blob = ndr_push_blob(push);
1057         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1058                 talloc_free(r);
1059                 return false;
1060         }
1061
1062         talloc_free(r);
1063
1064         return true;
1065 }
1066
1067 static bool api_wbint_LookupGroupMembers(pipes_struct *p)
1068 {
1069         const struct ndr_interface_call *call;
1070         struct ndr_pull *pull;
1071         struct ndr_push *push;
1072         enum ndr_err_code ndr_err;
1073         DATA_BLOB blob;
1074         struct wbint_LookupGroupMembers *r;
1075
1076         call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPGROUPMEMBERS];
1077
1078         r = talloc(talloc_tos(), struct wbint_LookupGroupMembers);
1079         if (r == NULL) {
1080                 return false;
1081         }
1082
1083         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1084                 talloc_free(r);
1085                 return false;
1086         }
1087
1088         pull = ndr_pull_init_blob(&blob, r, NULL);
1089         if (pull == NULL) {
1090                 talloc_free(r);
1091                 return false;
1092         }
1093
1094         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1095         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1096         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1097                 talloc_free(r);
1098                 return false;
1099         }
1100
1101         if (DEBUGLEVEL >= 10) {
1102                 NDR_PRINT_IN_DEBUG(wbint_LookupGroupMembers, r);
1103         }
1104
1105         ZERO_STRUCT(r->out);
1106         r->out.members = talloc_zero(r, struct wbint_Principals);
1107         if (r->out.members == NULL) {
1108                 talloc_free(r);
1109                 return false;
1110         }
1111
1112         r->out.result = _wbint_LookupGroupMembers(p, r);
1113
1114         if (p->rng_fault_state) {
1115                 talloc_free(r);
1116                 /* Return true here, srv_pipe_hnd.c will take care */
1117                 return true;
1118         }
1119
1120         if (DEBUGLEVEL >= 10) {
1121                 NDR_PRINT_OUT_DEBUG(wbint_LookupGroupMembers, r);
1122         }
1123
1124         push = ndr_push_init_ctx(r, NULL);
1125         if (push == NULL) {
1126                 talloc_free(r);
1127                 return false;
1128         }
1129
1130         ndr_err = call->ndr_push(push, NDR_OUT, r);
1131         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1132                 talloc_free(r);
1133                 return false;
1134         }
1135
1136         blob = ndr_push_blob(push);
1137         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1138                 talloc_free(r);
1139                 return false;
1140         }
1141
1142         talloc_free(r);
1143
1144         return true;
1145 }
1146
1147 static bool api_wbint_QueryUserList(pipes_struct *p)
1148 {
1149         const struct ndr_interface_call *call;
1150         struct ndr_pull *pull;
1151         struct ndr_push *push;
1152         enum ndr_err_code ndr_err;
1153         DATA_BLOB blob;
1154         struct wbint_QueryUserList *r;
1155
1156         call = &ndr_table_wbint.calls[NDR_WBINT_QUERYUSERLIST];
1157
1158         r = talloc(talloc_tos(), struct wbint_QueryUserList);
1159         if (r == NULL) {
1160                 return false;
1161         }
1162
1163         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1164                 talloc_free(r);
1165                 return false;
1166         }
1167
1168         pull = ndr_pull_init_blob(&blob, r, NULL);
1169         if (pull == NULL) {
1170                 talloc_free(r);
1171                 return false;
1172         }
1173
1174         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1175         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1176         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1177                 talloc_free(r);
1178                 return false;
1179         }
1180
1181         if (DEBUGLEVEL >= 10) {
1182                 NDR_PRINT_IN_DEBUG(wbint_QueryUserList, r);
1183         }
1184
1185         ZERO_STRUCT(r->out);
1186         r->out.users = talloc_zero(r, struct wbint_userinfos);
1187         if (r->out.users == NULL) {
1188                 talloc_free(r);
1189                 return false;
1190         }
1191
1192         r->out.result = _wbint_QueryUserList(p, r);
1193
1194         if (p->rng_fault_state) {
1195                 talloc_free(r);
1196                 /* Return true here, srv_pipe_hnd.c will take care */
1197                 return true;
1198         }
1199
1200         if (DEBUGLEVEL >= 10) {
1201                 NDR_PRINT_OUT_DEBUG(wbint_QueryUserList, r);
1202         }
1203
1204         push = ndr_push_init_ctx(r, NULL);
1205         if (push == NULL) {
1206                 talloc_free(r);
1207                 return false;
1208         }
1209
1210         ndr_err = call->ndr_push(push, NDR_OUT, r);
1211         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1212                 talloc_free(r);
1213                 return false;
1214         }
1215
1216         blob = ndr_push_blob(push);
1217         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1218                 talloc_free(r);
1219                 return false;
1220         }
1221
1222         talloc_free(r);
1223
1224         return true;
1225 }
1226
1227 static bool api_wbint_QueryGroupList(pipes_struct *p)
1228 {
1229         const struct ndr_interface_call *call;
1230         struct ndr_pull *pull;
1231         struct ndr_push *push;
1232         enum ndr_err_code ndr_err;
1233         DATA_BLOB blob;
1234         struct wbint_QueryGroupList *r;
1235
1236         call = &ndr_table_wbint.calls[NDR_WBINT_QUERYGROUPLIST];
1237
1238         r = talloc(talloc_tos(), struct wbint_QueryGroupList);
1239         if (r == NULL) {
1240                 return false;
1241         }
1242
1243         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1244                 talloc_free(r);
1245                 return false;
1246         }
1247
1248         pull = ndr_pull_init_blob(&blob, r, NULL);
1249         if (pull == NULL) {
1250                 talloc_free(r);
1251                 return false;
1252         }
1253
1254         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1255         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1256         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1257                 talloc_free(r);
1258                 return false;
1259         }
1260
1261         if (DEBUGLEVEL >= 10) {
1262                 NDR_PRINT_IN_DEBUG(wbint_QueryGroupList, r);
1263         }
1264
1265         ZERO_STRUCT(r->out);
1266         r->out.groups = talloc_zero(r, struct wbint_Principals);
1267         if (r->out.groups == NULL) {
1268                 talloc_free(r);
1269                 return false;
1270         }
1271
1272         r->out.result = _wbint_QueryGroupList(p, r);
1273
1274         if (p->rng_fault_state) {
1275                 talloc_free(r);
1276                 /* Return true here, srv_pipe_hnd.c will take care */
1277                 return true;
1278         }
1279
1280         if (DEBUGLEVEL >= 10) {
1281                 NDR_PRINT_OUT_DEBUG(wbint_QueryGroupList, r);
1282         }
1283
1284         push = ndr_push_init_ctx(r, NULL);
1285         if (push == NULL) {
1286                 talloc_free(r);
1287                 return false;
1288         }
1289
1290         ndr_err = call->ndr_push(push, NDR_OUT, r);
1291         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1292                 talloc_free(r);
1293                 return false;
1294         }
1295
1296         blob = ndr_push_blob(push);
1297         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1298                 talloc_free(r);
1299                 return false;
1300         }
1301
1302         talloc_free(r);
1303
1304         return true;
1305 }
1306
1307 static bool api_wbint_DsGetDcName(pipes_struct *p)
1308 {
1309         const struct ndr_interface_call *call;
1310         struct ndr_pull *pull;
1311         struct ndr_push *push;
1312         enum ndr_err_code ndr_err;
1313         DATA_BLOB blob;
1314         struct wbint_DsGetDcName *r;
1315
1316         call = &ndr_table_wbint.calls[NDR_WBINT_DSGETDCNAME];
1317
1318         r = talloc(talloc_tos(), struct wbint_DsGetDcName);
1319         if (r == NULL) {
1320                 return false;
1321         }
1322
1323         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1324                 talloc_free(r);
1325                 return false;
1326         }
1327
1328         pull = ndr_pull_init_blob(&blob, r, NULL);
1329         if (pull == NULL) {
1330                 talloc_free(r);
1331                 return false;
1332         }
1333
1334         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1335         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1336         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1337                 talloc_free(r);
1338                 return false;
1339         }
1340
1341         if (DEBUGLEVEL >= 10) {
1342                 NDR_PRINT_IN_DEBUG(wbint_DsGetDcName, r);
1343         }
1344
1345         ZERO_STRUCT(r->out);
1346         r->out.dc_info = talloc_zero(r, struct netr_DsRGetDCNameInfo *);
1347         if (r->out.dc_info == NULL) {
1348                 talloc_free(r);
1349                 return false;
1350         }
1351
1352         r->out.result = _wbint_DsGetDcName(p, r);
1353
1354         if (p->rng_fault_state) {
1355                 talloc_free(r);
1356                 /* Return true here, srv_pipe_hnd.c will take care */
1357                 return true;
1358         }
1359
1360         if (DEBUGLEVEL >= 10) {
1361                 NDR_PRINT_OUT_DEBUG(wbint_DsGetDcName, r);
1362         }
1363
1364         push = ndr_push_init_ctx(r, NULL);
1365         if (push == NULL) {
1366                 talloc_free(r);
1367                 return false;
1368         }
1369
1370         ndr_err = call->ndr_push(push, NDR_OUT, r);
1371         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1372                 talloc_free(r);
1373                 return false;
1374         }
1375
1376         blob = ndr_push_blob(push);
1377         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1378                 talloc_free(r);
1379                 return false;
1380         }
1381
1382         talloc_free(r);
1383
1384         return true;
1385 }
1386
1387 static bool api_wbint_LookupRids(pipes_struct *p)
1388 {
1389         const struct ndr_interface_call *call;
1390         struct ndr_pull *pull;
1391         struct ndr_push *push;
1392         enum ndr_err_code ndr_err;
1393         DATA_BLOB blob;
1394         struct wbint_LookupRids *r;
1395
1396         call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPRIDS];
1397
1398         r = talloc(talloc_tos(), struct wbint_LookupRids);
1399         if (r == NULL) {
1400                 return false;
1401         }
1402
1403         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1404                 talloc_free(r);
1405                 return false;
1406         }
1407
1408         pull = ndr_pull_init_blob(&blob, r, NULL);
1409         if (pull == NULL) {
1410                 talloc_free(r);
1411                 return false;
1412         }
1413
1414         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1415         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1416         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1417                 talloc_free(r);
1418                 return false;
1419         }
1420
1421         if (DEBUGLEVEL >= 10) {
1422                 NDR_PRINT_IN_DEBUG(wbint_LookupRids, r);
1423         }
1424
1425         ZERO_STRUCT(r->out);
1426         r->out.names = talloc_zero(r, struct wbint_Principals);
1427         if (r->out.names == NULL) {
1428                 talloc_free(r);
1429                 return false;
1430         }
1431
1432         r->out.result = _wbint_LookupRids(p, r);
1433
1434         if (p->rng_fault_state) {
1435                 talloc_free(r);
1436                 /* Return true here, srv_pipe_hnd.c will take care */
1437                 return true;
1438         }
1439
1440         if (DEBUGLEVEL >= 10) {
1441                 NDR_PRINT_OUT_DEBUG(wbint_LookupRids, r);
1442         }
1443
1444         push = ndr_push_init_ctx(r, NULL);
1445         if (push == NULL) {
1446                 talloc_free(r);
1447                 return false;
1448         }
1449
1450         ndr_err = call->ndr_push(push, NDR_OUT, r);
1451         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1452                 talloc_free(r);
1453                 return false;
1454         }
1455
1456         blob = ndr_push_blob(push);
1457         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1458                 talloc_free(r);
1459                 return false;
1460         }
1461
1462         talloc_free(r);
1463
1464         return true;
1465 }
1466
1467 static bool api_wbint_CheckMachineAccount(pipes_struct *p)
1468 {
1469         const struct ndr_interface_call *call;
1470         struct ndr_pull *pull;
1471         struct ndr_push *push;
1472         enum ndr_err_code ndr_err;
1473         DATA_BLOB blob;
1474         struct wbint_CheckMachineAccount *r;
1475
1476         call = &ndr_table_wbint.calls[NDR_WBINT_CHECKMACHINEACCOUNT];
1477
1478         r = talloc(talloc_tos(), struct wbint_CheckMachineAccount);
1479         if (r == NULL) {
1480                 return false;
1481         }
1482
1483         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1484                 talloc_free(r);
1485                 return false;
1486         }
1487
1488         pull = ndr_pull_init_blob(&blob, r, NULL);
1489         if (pull == NULL) {
1490                 talloc_free(r);
1491                 return false;
1492         }
1493
1494         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1495         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1496         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1497                 talloc_free(r);
1498                 return false;
1499         }
1500
1501         if (DEBUGLEVEL >= 10) {
1502                 NDR_PRINT_IN_DEBUG(wbint_CheckMachineAccount, r);
1503         }
1504
1505         r->out.result = _wbint_CheckMachineAccount(p, r);
1506
1507         if (p->rng_fault_state) {
1508                 talloc_free(r);
1509                 /* Return true here, srv_pipe_hnd.c will take care */
1510                 return true;
1511         }
1512
1513         if (DEBUGLEVEL >= 10) {
1514                 NDR_PRINT_OUT_DEBUG(wbint_CheckMachineAccount, r);
1515         }
1516
1517         push = ndr_push_init_ctx(r, NULL);
1518         if (push == NULL) {
1519                 talloc_free(r);
1520                 return false;
1521         }
1522
1523         ndr_err = call->ndr_push(push, NDR_OUT, r);
1524         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1525                 talloc_free(r);
1526                 return false;
1527         }
1528
1529         blob = ndr_push_blob(push);
1530         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1531                 talloc_free(r);
1532                 return false;
1533         }
1534
1535         talloc_free(r);
1536
1537         return true;
1538 }
1539
1540 static bool api_wbint_SetMapping(pipes_struct *p)
1541 {
1542         const struct ndr_interface_call *call;
1543         struct ndr_pull *pull;
1544         struct ndr_push *push;
1545         enum ndr_err_code ndr_err;
1546         DATA_BLOB blob;
1547         struct wbint_SetMapping *r;
1548
1549         call = &ndr_table_wbint.calls[NDR_WBINT_SETMAPPING];
1550
1551         r = talloc(talloc_tos(), struct wbint_SetMapping);
1552         if (r == NULL) {
1553                 return false;
1554         }
1555
1556         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1557                 talloc_free(r);
1558                 return false;
1559         }
1560
1561         pull = ndr_pull_init_blob(&blob, r, NULL);
1562         if (pull == NULL) {
1563                 talloc_free(r);
1564                 return false;
1565         }
1566
1567         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1568         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1569         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1570                 talloc_free(r);
1571                 return false;
1572         }
1573
1574         if (DEBUGLEVEL >= 10) {
1575                 NDR_PRINT_IN_DEBUG(wbint_SetMapping, r);
1576         }
1577
1578         r->out.result = _wbint_SetMapping(p, r);
1579
1580         if (p->rng_fault_state) {
1581                 talloc_free(r);
1582                 /* Return true here, srv_pipe_hnd.c will take care */
1583                 return true;
1584         }
1585
1586         if (DEBUGLEVEL >= 10) {
1587                 NDR_PRINT_OUT_DEBUG(wbint_SetMapping, r);
1588         }
1589
1590         push = ndr_push_init_ctx(r, NULL);
1591         if (push == NULL) {
1592                 talloc_free(r);
1593                 return false;
1594         }
1595
1596         ndr_err = call->ndr_push(push, NDR_OUT, r);
1597         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1598                 talloc_free(r);
1599                 return false;
1600         }
1601
1602         blob = ndr_push_blob(push);
1603         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1604                 talloc_free(r);
1605                 return false;
1606         }
1607
1608         talloc_free(r);
1609
1610         return true;
1611 }
1612
1613 static bool api_wbint_RemoveMapping(pipes_struct *p)
1614 {
1615         const struct ndr_interface_call *call;
1616         struct ndr_pull *pull;
1617         struct ndr_push *push;
1618         enum ndr_err_code ndr_err;
1619         DATA_BLOB blob;
1620         struct wbint_RemoveMapping *r;
1621
1622         call = &ndr_table_wbint.calls[NDR_WBINT_REMOVEMAPPING];
1623
1624         r = talloc(talloc_tos(), struct wbint_RemoveMapping);
1625         if (r == NULL) {
1626                 return false;
1627         }
1628
1629         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1630                 talloc_free(r);
1631                 return false;
1632         }
1633
1634         pull = ndr_pull_init_blob(&blob, r, NULL);
1635         if (pull == NULL) {
1636                 talloc_free(r);
1637                 return false;
1638         }
1639
1640         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1641         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1642         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1643                 talloc_free(r);
1644                 return false;
1645         }
1646
1647         if (DEBUGLEVEL >= 10) {
1648                 NDR_PRINT_IN_DEBUG(wbint_RemoveMapping, r);
1649         }
1650
1651         r->out.result = _wbint_RemoveMapping(p, r);
1652
1653         if (p->rng_fault_state) {
1654                 talloc_free(r);
1655                 /* Return true here, srv_pipe_hnd.c will take care */
1656                 return true;
1657         }
1658
1659         if (DEBUGLEVEL >= 10) {
1660                 NDR_PRINT_OUT_DEBUG(wbint_RemoveMapping, r);
1661         }
1662
1663         push = ndr_push_init_ctx(r, NULL);
1664         if (push == NULL) {
1665                 talloc_free(r);
1666                 return false;
1667         }
1668
1669         ndr_err = call->ndr_push(push, NDR_OUT, r);
1670         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1671                 talloc_free(r);
1672                 return false;
1673         }
1674
1675         blob = ndr_push_blob(push);
1676         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1677                 talloc_free(r);
1678                 return false;
1679         }
1680
1681         talloc_free(r);
1682
1683         return true;
1684 }
1685
1686
1687 /* Tables */
1688 static struct api_struct api_wbint_cmds[] = 
1689 {
1690         {"WBINT_PING", NDR_WBINT_PING, api_wbint_Ping},
1691         {"WBINT_LOOKUPSID", NDR_WBINT_LOOKUPSID, api_wbint_LookupSid},
1692         {"WBINT_LOOKUPNAME", NDR_WBINT_LOOKUPNAME, api_wbint_LookupName},
1693         {"WBINT_SID2UID", NDR_WBINT_SID2UID, api_wbint_Sid2Uid},
1694         {"WBINT_SID2GID", NDR_WBINT_SID2GID, api_wbint_Sid2Gid},
1695         {"WBINT_UID2SID", NDR_WBINT_UID2SID, api_wbint_Uid2Sid},
1696         {"WBINT_GID2SID", NDR_WBINT_GID2SID, api_wbint_Gid2Sid},
1697         {"WBINT_ALLOCATEUID", NDR_WBINT_ALLOCATEUID, api_wbint_AllocateUid},
1698         {"WBINT_ALLOCATEGID", NDR_WBINT_ALLOCATEGID, api_wbint_AllocateGid},
1699         {"WBINT_QUERYUSER", NDR_WBINT_QUERYUSER, api_wbint_QueryUser},
1700         {"WBINT_LOOKUPUSERALIASES", NDR_WBINT_LOOKUPUSERALIASES, api_wbint_LookupUserAliases},
1701         {"WBINT_LOOKUPUSERGROUPS", NDR_WBINT_LOOKUPUSERGROUPS, api_wbint_LookupUserGroups},
1702         {"WBINT_QUERYSEQUENCENUMBER", NDR_WBINT_QUERYSEQUENCENUMBER, api_wbint_QuerySequenceNumber},
1703         {"WBINT_LOOKUPGROUPMEMBERS", NDR_WBINT_LOOKUPGROUPMEMBERS, api_wbint_LookupGroupMembers},
1704         {"WBINT_QUERYUSERLIST", NDR_WBINT_QUERYUSERLIST, api_wbint_QueryUserList},
1705         {"WBINT_QUERYGROUPLIST", NDR_WBINT_QUERYGROUPLIST, api_wbint_QueryGroupList},
1706         {"WBINT_DSGETDCNAME", NDR_WBINT_DSGETDCNAME, api_wbint_DsGetDcName},
1707         {"WBINT_LOOKUPRIDS", NDR_WBINT_LOOKUPRIDS, api_wbint_LookupRids},
1708         {"WBINT_CHECKMACHINEACCOUNT", NDR_WBINT_CHECKMACHINEACCOUNT, api_wbint_CheckMachineAccount},
1709         {"WBINT_SETMAPPING", NDR_WBINT_SETMAPPING, api_wbint_SetMapping},
1710         {"WBINT_REMOVEMAPPING", NDR_WBINT_REMOVEMAPPING, api_wbint_RemoveMapping},
1711 };
1712
1713 void wbint_get_pipe_fns(struct api_struct **fns, int *n_fns)
1714 {
1715         *fns = api_wbint_cmds;
1716         *n_fns = sizeof(api_wbint_cmds) / sizeof(struct api_struct);
1717 }
1718
1719 NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)
1720 {
1721         if (cli->pipes_struct == NULL) {
1722                 return NT_STATUS_INVALID_PARAMETER;
1723         }
1724
1725         switch (opnum)
1726         {
1727                 case NDR_WBINT_PING: {
1728                         struct wbint_Ping *r = (struct wbint_Ping *)_r;
1729                         ZERO_STRUCT(r->out);
1730                         r->out.out_data = talloc_zero(mem_ctx, uint32_t);
1731                         if (r->out.out_data == NULL) {
1732                         return NT_STATUS_NO_MEMORY;
1733                         }
1734
1735                         _wbint_Ping(cli->pipes_struct, r);
1736                         return NT_STATUS_OK;
1737                 }
1738
1739                 case NDR_WBINT_LOOKUPSID: {
1740                         struct wbint_LookupSid *r = (struct wbint_LookupSid *)_r;
1741                         ZERO_STRUCT(r->out);
1742                         r->out.type = talloc_zero(mem_ctx, enum lsa_SidType);
1743                         if (r->out.type == NULL) {
1744                         return NT_STATUS_NO_MEMORY;
1745                         }
1746
1747                         r->out.domain = talloc_zero(mem_ctx, const char *);
1748                         if (r->out.domain == NULL) {
1749                         return NT_STATUS_NO_MEMORY;
1750                         }
1751
1752                         r->out.name = talloc_zero(mem_ctx, const char *);
1753                         if (r->out.name == NULL) {
1754                         return NT_STATUS_NO_MEMORY;
1755                         }
1756
1757                         r->out.result = _wbint_LookupSid(cli->pipes_struct, r);
1758                         return NT_STATUS_OK;
1759                 }
1760
1761                 case NDR_WBINT_LOOKUPNAME: {
1762                         struct wbint_LookupName *r = (struct wbint_LookupName *)_r;
1763                         ZERO_STRUCT(r->out);
1764                         r->out.type = talloc_zero(mem_ctx, enum lsa_SidType);
1765                         if (r->out.type == NULL) {
1766                         return NT_STATUS_NO_MEMORY;
1767                         }
1768
1769                         r->out.sid = talloc_zero(mem_ctx, struct dom_sid);
1770                         if (r->out.sid == NULL) {
1771                         return NT_STATUS_NO_MEMORY;
1772                         }
1773
1774                         r->out.result = _wbint_LookupName(cli->pipes_struct, r);
1775                         return NT_STATUS_OK;
1776                 }
1777
1778                 case NDR_WBINT_SID2UID: {
1779                         struct wbint_Sid2Uid *r = (struct wbint_Sid2Uid *)_r;
1780                         ZERO_STRUCT(r->out);
1781                         r->out.uid = talloc_zero(mem_ctx, uint64_t);
1782                         if (r->out.uid == NULL) {
1783                         return NT_STATUS_NO_MEMORY;
1784                         }
1785
1786                         r->out.result = _wbint_Sid2Uid(cli->pipes_struct, r);
1787                         return NT_STATUS_OK;
1788                 }
1789
1790                 case NDR_WBINT_SID2GID: {
1791                         struct wbint_Sid2Gid *r = (struct wbint_Sid2Gid *)_r;
1792                         ZERO_STRUCT(r->out);
1793                         r->out.gid = talloc_zero(mem_ctx, uint64_t);
1794                         if (r->out.gid == NULL) {
1795                         return NT_STATUS_NO_MEMORY;
1796                         }
1797
1798                         r->out.result = _wbint_Sid2Gid(cli->pipes_struct, r);
1799                         return NT_STATUS_OK;
1800                 }
1801
1802                 case NDR_WBINT_UID2SID: {
1803                         struct wbint_Uid2Sid *r = (struct wbint_Uid2Sid *)_r;
1804                         ZERO_STRUCT(r->out);
1805                         r->out.sid = talloc_zero(mem_ctx, struct dom_sid);
1806                         if (r->out.sid == NULL) {
1807                         return NT_STATUS_NO_MEMORY;
1808                         }
1809
1810                         r->out.result = _wbint_Uid2Sid(cli->pipes_struct, r);
1811                         return NT_STATUS_OK;
1812                 }
1813
1814                 case NDR_WBINT_GID2SID: {
1815                         struct wbint_Gid2Sid *r = (struct wbint_Gid2Sid *)_r;
1816                         ZERO_STRUCT(r->out);
1817                         r->out.sid = talloc_zero(mem_ctx, struct dom_sid);
1818                         if (r->out.sid == NULL) {
1819                         return NT_STATUS_NO_MEMORY;
1820                         }
1821
1822                         r->out.result = _wbint_Gid2Sid(cli->pipes_struct, r);
1823                         return NT_STATUS_OK;
1824                 }
1825
1826                 case NDR_WBINT_ALLOCATEUID: {
1827                         struct wbint_AllocateUid *r = (struct wbint_AllocateUid *)_r;
1828                         ZERO_STRUCT(r->out);
1829                         r->out.uid = talloc_zero(mem_ctx, uint64_t);
1830                         if (r->out.uid == NULL) {
1831                         return NT_STATUS_NO_MEMORY;
1832                         }
1833
1834                         r->out.result = _wbint_AllocateUid(cli->pipes_struct, r);
1835                         return NT_STATUS_OK;
1836                 }
1837
1838                 case NDR_WBINT_ALLOCATEGID: {
1839                         struct wbint_AllocateGid *r = (struct wbint_AllocateGid *)_r;
1840                         ZERO_STRUCT(r->out);
1841                         r->out.gid = talloc_zero(mem_ctx, uint64_t);
1842                         if (r->out.gid == NULL) {
1843                         return NT_STATUS_NO_MEMORY;
1844                         }
1845
1846                         r->out.result = _wbint_AllocateGid(cli->pipes_struct, r);
1847                         return NT_STATUS_OK;
1848                 }
1849
1850                 case NDR_WBINT_QUERYUSER: {
1851                         struct wbint_QueryUser *r = (struct wbint_QueryUser *)_r;
1852                         ZERO_STRUCT(r->out);
1853                         r->out.info = talloc_zero(mem_ctx, struct wbint_userinfo);
1854                         if (r->out.info == NULL) {
1855                         return NT_STATUS_NO_MEMORY;
1856                         }
1857
1858                         r->out.result = _wbint_QueryUser(cli->pipes_struct, r);
1859                         return NT_STATUS_OK;
1860                 }
1861
1862                 case NDR_WBINT_LOOKUPUSERALIASES: {
1863                         struct wbint_LookupUserAliases *r = (struct wbint_LookupUserAliases *)_r;
1864                         ZERO_STRUCT(r->out);
1865                         r->out.rids = talloc_zero(mem_ctx, struct wbint_RidArray);
1866                         if (r->out.rids == NULL) {
1867                         return NT_STATUS_NO_MEMORY;
1868                         }
1869
1870                         r->out.result = _wbint_LookupUserAliases(cli->pipes_struct, r);
1871                         return NT_STATUS_OK;
1872                 }
1873
1874                 case NDR_WBINT_LOOKUPUSERGROUPS: {
1875                         struct wbint_LookupUserGroups *r = (struct wbint_LookupUserGroups *)_r;
1876                         ZERO_STRUCT(r->out);
1877                         r->out.sids = talloc_zero(mem_ctx, struct wbint_SidArray);
1878                         if (r->out.sids == NULL) {
1879                         return NT_STATUS_NO_MEMORY;
1880                         }
1881
1882                         r->out.result = _wbint_LookupUserGroups(cli->pipes_struct, r);
1883                         return NT_STATUS_OK;
1884                 }
1885
1886                 case NDR_WBINT_QUERYSEQUENCENUMBER: {
1887                         struct wbint_QuerySequenceNumber *r = (struct wbint_QuerySequenceNumber *)_r;
1888                         ZERO_STRUCT(r->out);
1889                         r->out.sequence = talloc_zero(mem_ctx, uint32_t);
1890                         if (r->out.sequence == NULL) {
1891                         return NT_STATUS_NO_MEMORY;
1892                         }
1893
1894                         r->out.result = _wbint_QuerySequenceNumber(cli->pipes_struct, r);
1895                         return NT_STATUS_OK;
1896                 }
1897
1898                 case NDR_WBINT_LOOKUPGROUPMEMBERS: {
1899                         struct wbint_LookupGroupMembers *r = (struct wbint_LookupGroupMembers *)_r;
1900                         ZERO_STRUCT(r->out);
1901                         r->out.members = talloc_zero(mem_ctx, struct wbint_Principals);
1902                         if (r->out.members == NULL) {
1903                         return NT_STATUS_NO_MEMORY;
1904                         }
1905
1906                         r->out.result = _wbint_LookupGroupMembers(cli->pipes_struct, r);
1907                         return NT_STATUS_OK;
1908                 }
1909
1910                 case NDR_WBINT_QUERYUSERLIST: {
1911                         struct wbint_QueryUserList *r = (struct wbint_QueryUserList *)_r;
1912                         ZERO_STRUCT(r->out);
1913                         r->out.users = talloc_zero(mem_ctx, struct wbint_userinfos);
1914                         if (r->out.users == NULL) {
1915                         return NT_STATUS_NO_MEMORY;
1916                         }
1917
1918                         r->out.result = _wbint_QueryUserList(cli->pipes_struct, r);
1919                         return NT_STATUS_OK;
1920                 }
1921
1922                 case NDR_WBINT_QUERYGROUPLIST: {
1923                         struct wbint_QueryGroupList *r = (struct wbint_QueryGroupList *)_r;
1924                         ZERO_STRUCT(r->out);
1925                         r->out.groups = talloc_zero(mem_ctx, struct wbint_Principals);
1926                         if (r->out.groups == NULL) {
1927                         return NT_STATUS_NO_MEMORY;
1928                         }
1929
1930                         r->out.result = _wbint_QueryGroupList(cli->pipes_struct, r);
1931                         return NT_STATUS_OK;
1932                 }
1933
1934                 case NDR_WBINT_DSGETDCNAME: {
1935                         struct wbint_DsGetDcName *r = (struct wbint_DsGetDcName *)_r;
1936                         ZERO_STRUCT(r->out);
1937                         r->out.dc_info = talloc_zero(mem_ctx, struct netr_DsRGetDCNameInfo *);
1938                         if (r->out.dc_info == NULL) {
1939                         return NT_STATUS_NO_MEMORY;
1940                         }
1941
1942                         r->out.result = _wbint_DsGetDcName(cli->pipes_struct, r);
1943                         return NT_STATUS_OK;
1944                 }
1945
1946                 case NDR_WBINT_LOOKUPRIDS: {
1947                         struct wbint_LookupRids *r = (struct wbint_LookupRids *)_r;
1948                         ZERO_STRUCT(r->out);
1949                         r->out.names = talloc_zero(mem_ctx, struct wbint_Principals);
1950                         if (r->out.names == NULL) {
1951                         return NT_STATUS_NO_MEMORY;
1952                         }
1953
1954                         r->out.result = _wbint_LookupRids(cli->pipes_struct, r);
1955                         return NT_STATUS_OK;
1956                 }
1957
1958                 case NDR_WBINT_CHECKMACHINEACCOUNT: {
1959                         struct wbint_CheckMachineAccount *r = (struct wbint_CheckMachineAccount *)_r;
1960                         r->out.result = _wbint_CheckMachineAccount(cli->pipes_struct, r);
1961                         return NT_STATUS_OK;
1962                 }
1963
1964                 case NDR_WBINT_SETMAPPING: {
1965                         struct wbint_SetMapping *r = (struct wbint_SetMapping *)_r;
1966                         r->out.result = _wbint_SetMapping(cli->pipes_struct, r);
1967                         return NT_STATUS_OK;
1968                 }
1969
1970                 case NDR_WBINT_REMOVEMAPPING: {
1971                         struct wbint_RemoveMapping *r = (struct wbint_RemoveMapping *)_r;
1972                         r->out.result = _wbint_RemoveMapping(cli->pipes_struct, r);
1973                         return NT_STATUS_OK;
1974                 }
1975
1976                 default:
1977                         return NT_STATUS_NOT_IMPLEMENTED;
1978         }
1979 }
1980
1981 NTSTATUS rpc_wbint_init(void)
1982 {
1983         return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "wbint", "wbint", &ndr_table_wbint, api_wbint_cmds, sizeof(api_wbint_cmds) / sizeof(struct api_struct));
1984 }