19d2d2eabf2312d9201d70cebe5c29eba46f1adf
[samba.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_QueryUser(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_QueryUser *r;
595
596         call = &ndr_table_wbint.calls[NDR_WBINT_QUERYUSER];
597
598         r = talloc(talloc_tos(), struct wbint_QueryUser);
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_QueryUser, r);
623         }
624
625         ZERO_STRUCT(r->out);
626         r->out.info = talloc_zero(r, struct wbint_userinfo);
627         if (r->out.info == NULL) {
628                 talloc_free(r);
629                 return false;
630         }
631
632         r->out.result = _wbint_QueryUser(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_QueryUser, 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_LookupUserAliases(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_LookupUserAliases *r;
675
676         call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPUSERALIASES];
677
678         r = talloc(talloc_tos(), struct wbint_LookupUserAliases);
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_LookupUserAliases, r);
703         }
704
705         ZERO_STRUCT(r->out);
706         r->out.rids = talloc_zero(r, struct wbint_RidArray);
707         if (r->out.rids == NULL) {
708                 talloc_free(r);
709                 return false;
710         }
711
712         r->out.result = _wbint_LookupUserAliases(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_LookupUserAliases, 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
748 /* Tables */
749 static struct api_struct api_wbint_cmds[] =
750 {
751         {"WBINT_PING", NDR_WBINT_PING, api_wbint_Ping},
752         {"WBINT_LOOKUPSID", NDR_WBINT_LOOKUPSID, api_wbint_LookupSid},
753         {"WBINT_LOOKUPNAME", NDR_WBINT_LOOKUPNAME, api_wbint_LookupName},
754         {"WBINT_SID2UID", NDR_WBINT_SID2UID, api_wbint_Sid2Uid},
755         {"WBINT_SID2GID", NDR_WBINT_SID2GID, api_wbint_Sid2Gid},
756         {"WBINT_UID2SID", NDR_WBINT_UID2SID, api_wbint_Uid2Sid},
757         {"WBINT_GID2SID", NDR_WBINT_GID2SID, api_wbint_Gid2Sid},
758         {"WBINT_QUERYUSER", NDR_WBINT_QUERYUSER, api_wbint_QueryUser},
759         {"WBINT_LOOKUPUSERALIASES", NDR_WBINT_LOOKUPUSERALIASES, api_wbint_LookupUserAliases},
760 };
761
762 void wbint_get_pipe_fns(struct api_struct **fns, int *n_fns)
763 {
764         *fns = api_wbint_cmds;
765         *n_fns = sizeof(api_wbint_cmds) / sizeof(struct api_struct);
766 }
767
768 NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)
769 {
770         if (cli->pipes_struct == NULL) {
771                 return NT_STATUS_INVALID_PARAMETER;
772         }
773
774         switch (opnum)
775         {
776                 case NDR_WBINT_PING: {
777                         struct wbint_Ping *r = (struct wbint_Ping *)_r;
778                         ZERO_STRUCT(r->out);
779                         r->out.out_data = talloc_zero(mem_ctx, uint32_t);
780                         if (r->out.out_data == NULL) {
781                         return NT_STATUS_NO_MEMORY;
782                         }
783
784                         _wbint_Ping(cli->pipes_struct, r);
785                         return NT_STATUS_OK;
786                 }
787
788                 case NDR_WBINT_LOOKUPSID: {
789                         struct wbint_LookupSid *r = (struct wbint_LookupSid *)_r;
790                         ZERO_STRUCT(r->out);
791                         r->out.type = talloc_zero(mem_ctx, enum lsa_SidType);
792                         if (r->out.type == NULL) {
793                         return NT_STATUS_NO_MEMORY;
794                         }
795
796                         r->out.domain = talloc_zero(mem_ctx, const char *);
797                         if (r->out.domain == NULL) {
798                         return NT_STATUS_NO_MEMORY;
799                         }
800
801                         r->out.name = talloc_zero(mem_ctx, const char *);
802                         if (r->out.name == NULL) {
803                         return NT_STATUS_NO_MEMORY;
804                         }
805
806                         r->out.result = _wbint_LookupSid(cli->pipes_struct, r);
807                         return NT_STATUS_OK;
808                 }
809
810                 case NDR_WBINT_LOOKUPNAME: {
811                         struct wbint_LookupName *r = (struct wbint_LookupName *)_r;
812                         ZERO_STRUCT(r->out);
813                         r->out.type = talloc_zero(mem_ctx, enum lsa_SidType);
814                         if (r->out.type == NULL) {
815                         return NT_STATUS_NO_MEMORY;
816                         }
817
818                         r->out.sid = talloc_zero(mem_ctx, struct dom_sid);
819                         if (r->out.sid == NULL) {
820                         return NT_STATUS_NO_MEMORY;
821                         }
822
823                         r->out.result = _wbint_LookupName(cli->pipes_struct, r);
824                         return NT_STATUS_OK;
825                 }
826
827                 case NDR_WBINT_SID2UID: {
828                         struct wbint_Sid2Uid *r = (struct wbint_Sid2Uid *)_r;
829                         ZERO_STRUCT(r->out);
830                         r->out.uid = talloc_zero(mem_ctx, uint64_t);
831                         if (r->out.uid == NULL) {
832                         return NT_STATUS_NO_MEMORY;
833                         }
834
835                         r->out.result = _wbint_Sid2Uid(cli->pipes_struct, r);
836                         return NT_STATUS_OK;
837                 }
838
839                 case NDR_WBINT_SID2GID: {
840                         struct wbint_Sid2Gid *r = (struct wbint_Sid2Gid *)_r;
841                         ZERO_STRUCT(r->out);
842                         r->out.gid = talloc_zero(mem_ctx, uint64_t);
843                         if (r->out.gid == NULL) {
844                         return NT_STATUS_NO_MEMORY;
845                         }
846
847                         r->out.result = _wbint_Sid2Gid(cli->pipes_struct, r);
848                         return NT_STATUS_OK;
849                 }
850
851                 case NDR_WBINT_UID2SID: {
852                         struct wbint_Uid2Sid *r = (struct wbint_Uid2Sid *)_r;
853                         ZERO_STRUCT(r->out);
854                         r->out.sid = talloc_zero(mem_ctx, struct dom_sid);
855                         if (r->out.sid == NULL) {
856                         return NT_STATUS_NO_MEMORY;
857                         }
858
859                         r->out.result = _wbint_Uid2Sid(cli->pipes_struct, r);
860                         return NT_STATUS_OK;
861                 }
862
863                 case NDR_WBINT_GID2SID: {
864                         struct wbint_Gid2Sid *r = (struct wbint_Gid2Sid *)_r;
865                         ZERO_STRUCT(r->out);
866                         r->out.sid = talloc_zero(mem_ctx, struct dom_sid);
867                         if (r->out.sid == NULL) {
868                         return NT_STATUS_NO_MEMORY;
869                         }
870
871                         r->out.result = _wbint_Gid2Sid(cli->pipes_struct, r);
872                         return NT_STATUS_OK;
873                 }
874
875                 case NDR_WBINT_QUERYUSER: {
876                         struct wbint_QueryUser *r = (struct wbint_QueryUser *)_r;
877                         ZERO_STRUCT(r->out);
878                         r->out.info = talloc_zero(mem_ctx, struct wbint_userinfo);
879                         if (r->out.info == NULL) {
880                         return NT_STATUS_NO_MEMORY;
881                         }
882
883                         r->out.result = _wbint_QueryUser(cli->pipes_struct, r);
884                         return NT_STATUS_OK;
885                 }
886
887                 case NDR_WBINT_LOOKUPUSERALIASES: {
888                         struct wbint_LookupUserAliases *r = (struct wbint_LookupUserAliases *)_r;
889                         ZERO_STRUCT(r->out);
890                         r->out.rids = talloc_zero(mem_ctx, struct wbint_RidArray);
891                         if (r->out.rids == NULL) {
892                         return NT_STATUS_NO_MEMORY;
893                         }
894
895                         r->out.result = _wbint_LookupUserAliases(cli->pipes_struct, r);
896                         return NT_STATUS_OK;
897                 }
898
899                 default:
900                         return NT_STATUS_NOT_IMPLEMENTED;
901         }
902 }
903
904 NTSTATUS rpc_wbint_init(void)
905 {
906         return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "wbint", "wbint", &ndr_table_wbint, api_wbint_cmds, sizeof(api_wbint_cmds) / sizeof(struct api_struct));
907 }