s3:winbind: Add async wb_sid2gid
[kai/samba-autobuild/.git] / source3 / librpc / gen_ndr / cli_wbint.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * client auto-generated by pidl. DO NOT MODIFY!
4  */
5
6 #include "includes.h"
7 #include "librpc/gen_ndr/cli_wbint.h"
8
9 struct rpccli_wbint_Ping_state {
10         struct wbint_Ping orig;
11         struct wbint_Ping tmp;
12         TALLOC_CTX *out_mem_ctx;
13         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14 };
15
16 static void rpccli_wbint_Ping_done(struct tevent_req *subreq);
17
18 struct tevent_req *rpccli_wbint_Ping_send(TALLOC_CTX *mem_ctx,
19                                           struct tevent_context *ev,
20                                           struct rpc_pipe_client *cli,
21                                           uint32_t _in_data /* [in]  */,
22                                           uint32_t *_out_data /* [out] [ref] */)
23 {
24         struct tevent_req *req;
25         struct rpccli_wbint_Ping_state *state;
26         struct tevent_req *subreq;
27
28         req = tevent_req_create(mem_ctx, &state,
29                                 struct rpccli_wbint_Ping_state);
30         if (req == NULL) {
31                 return NULL;
32         }
33         state->out_mem_ctx = NULL;
34         state->dispatch_recv = cli->dispatch_recv;
35
36         /* In parameters */
37         state->orig.in.in_data = _in_data;
38
39         /* Out parameters */
40         state->orig.out.out_data = _out_data;
41
42         if (DEBUGLEVEL >= 10) {
43                 NDR_PRINT_IN_DEBUG(wbint_Ping, &state->orig);
44         }
45
46         state->out_mem_ctx = talloc_named_const(state, 0,
47                              "rpccli_wbint_Ping_out_memory");
48         if (tevent_req_nomem(state->out_mem_ctx, req)) {
49                 return tevent_req_post(req, ev);
50         }
51
52         /* make a temporary copy, that we pass to the dispatch function */
53         state->tmp = state->orig;
54
55         subreq = cli->dispatch_send(state, ev, cli,
56                                     &ndr_table_wbint,
57                                     NDR_WBINT_PING,
58                                     &state->tmp);
59         if (tevent_req_nomem(subreq, req)) {
60                 return tevent_req_post(req, ev);
61         }
62         tevent_req_set_callback(subreq, rpccli_wbint_Ping_done, req);
63         return req;
64 }
65
66 static void rpccli_wbint_Ping_done(struct tevent_req *subreq)
67 {
68         struct tevent_req *req = tevent_req_callback_data(
69                 subreq, struct tevent_req);
70         struct rpccli_wbint_Ping_state *state = tevent_req_data(
71                 req, struct rpccli_wbint_Ping_state);
72         NTSTATUS status;
73         TALLOC_CTX *mem_ctx;
74
75         if (state->out_mem_ctx) {
76                 mem_ctx = state->out_mem_ctx;
77         } else {
78                 mem_ctx = state;
79         }
80
81         status = state->dispatch_recv(subreq, mem_ctx);
82         TALLOC_FREE(subreq);
83         if (!NT_STATUS_IS_OK(status)) {
84                 tevent_req_nterror(req, status);
85                 return;
86         }
87
88         /* Copy out parameters */
89         *state->orig.out.out_data = *state->tmp.out.out_data;
90
91         /* Reset temporary structure */
92         ZERO_STRUCT(state->tmp);
93
94         if (DEBUGLEVEL >= 10) {
95                 NDR_PRINT_OUT_DEBUG(wbint_Ping, &state->orig);
96         }
97
98         tevent_req_done(req);
99 }
100
101 NTSTATUS rpccli_wbint_Ping_recv(struct tevent_req *req,
102                                 TALLOC_CTX *mem_ctx)
103 {
104         struct rpccli_wbint_Ping_state *state = tevent_req_data(
105                 req, struct rpccli_wbint_Ping_state);
106         NTSTATUS status;
107
108         if (tevent_req_is_nterror(req, &status)) {
109                 tevent_req_received(req);
110                 return status;
111         }
112
113         /* Steal possbile out parameters to the callers context */
114         talloc_steal(mem_ctx, state->out_mem_ctx);
115
116         tevent_req_received(req);
117         return NT_STATUS_OK;
118 }
119
120 NTSTATUS rpccli_wbint_Ping(struct rpc_pipe_client *cli,
121                            TALLOC_CTX *mem_ctx,
122                            uint32_t in_data /* [in]  */,
123                            uint32_t *out_data /* [out] [ref] */)
124 {
125         struct wbint_Ping r;
126         NTSTATUS status;
127
128         /* In parameters */
129         r.in.in_data = in_data;
130
131         if (DEBUGLEVEL >= 10) {
132                 NDR_PRINT_IN_DEBUG(wbint_Ping, &r);
133         }
134
135         status = cli->dispatch(cli,
136                                 mem_ctx,
137                                 &ndr_table_wbint,
138                                 NDR_WBINT_PING,
139                                 &r);
140
141         if (!NT_STATUS_IS_OK(status)) {
142                 return status;
143         }
144
145         if (DEBUGLEVEL >= 10) {
146                 NDR_PRINT_OUT_DEBUG(wbint_Ping, &r);
147         }
148
149         if (NT_STATUS_IS_ERR(status)) {
150                 return status;
151         }
152
153         /* Return variables */
154         *out_data = *r.out.out_data;
155
156         /* Return result */
157         return NT_STATUS_OK;
158 }
159
160 struct rpccli_wbint_LookupSid_state {
161         struct wbint_LookupSid orig;
162         struct wbint_LookupSid tmp;
163         TALLOC_CTX *out_mem_ctx;
164         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
165 };
166
167 static void rpccli_wbint_LookupSid_done(struct tevent_req *subreq);
168
169 struct tevent_req *rpccli_wbint_LookupSid_send(TALLOC_CTX *mem_ctx,
170                                                struct tevent_context *ev,
171                                                struct rpc_pipe_client *cli,
172                                                struct dom_sid *_sid /* [in] [ref] */,
173                                                enum lsa_SidType *_type /* [out] [ref] */,
174                                                const char **_domain /* [out] [ref,charset(UTF8)] */,
175                                                const char **_name /* [out] [ref,charset(UTF8)] */)
176 {
177         struct tevent_req *req;
178         struct rpccli_wbint_LookupSid_state *state;
179         struct tevent_req *subreq;
180
181         req = tevent_req_create(mem_ctx, &state,
182                                 struct rpccli_wbint_LookupSid_state);
183         if (req == NULL) {
184                 return NULL;
185         }
186         state->out_mem_ctx = NULL;
187         state->dispatch_recv = cli->dispatch_recv;
188
189         /* In parameters */
190         state->orig.in.sid = _sid;
191
192         /* Out parameters */
193         state->orig.out.type = _type;
194         state->orig.out.domain = _domain;
195         state->orig.out.name = _name;
196
197         /* Result */
198         ZERO_STRUCT(state->orig.out.result);
199
200         if (DEBUGLEVEL >= 10) {
201                 NDR_PRINT_IN_DEBUG(wbint_LookupSid, &state->orig);
202         }
203
204         state->out_mem_ctx = talloc_named_const(state, 0,
205                              "rpccli_wbint_LookupSid_out_memory");
206         if (tevent_req_nomem(state->out_mem_ctx, req)) {
207                 return tevent_req_post(req, ev);
208         }
209
210         /* make a temporary copy, that we pass to the dispatch function */
211         state->tmp = state->orig;
212
213         subreq = cli->dispatch_send(state, ev, cli,
214                                     &ndr_table_wbint,
215                                     NDR_WBINT_LOOKUPSID,
216                                     &state->tmp);
217         if (tevent_req_nomem(subreq, req)) {
218                 return tevent_req_post(req, ev);
219         }
220         tevent_req_set_callback(subreq, rpccli_wbint_LookupSid_done, req);
221         return req;
222 }
223
224 static void rpccli_wbint_LookupSid_done(struct tevent_req *subreq)
225 {
226         struct tevent_req *req = tevent_req_callback_data(
227                 subreq, struct tevent_req);
228         struct rpccli_wbint_LookupSid_state *state = tevent_req_data(
229                 req, struct rpccli_wbint_LookupSid_state);
230         NTSTATUS status;
231         TALLOC_CTX *mem_ctx;
232
233         if (state->out_mem_ctx) {
234                 mem_ctx = state->out_mem_ctx;
235         } else {
236                 mem_ctx = state;
237         }
238
239         status = state->dispatch_recv(subreq, mem_ctx);
240         TALLOC_FREE(subreq);
241         if (!NT_STATUS_IS_OK(status)) {
242                 tevent_req_nterror(req, status);
243                 return;
244         }
245
246         /* Copy out parameters */
247         *state->orig.out.type = *state->tmp.out.type;
248         *state->orig.out.domain = *state->tmp.out.domain;
249         *state->orig.out.name = *state->tmp.out.name;
250
251         /* Copy result */
252         state->orig.out.result = state->tmp.out.result;
253
254         /* Reset temporary structure */
255         ZERO_STRUCT(state->tmp);
256
257         if (DEBUGLEVEL >= 10) {
258                 NDR_PRINT_OUT_DEBUG(wbint_LookupSid, &state->orig);
259         }
260
261         tevent_req_done(req);
262 }
263
264 NTSTATUS rpccli_wbint_LookupSid_recv(struct tevent_req *req,
265                                      TALLOC_CTX *mem_ctx,
266                                      NTSTATUS *result)
267 {
268         struct rpccli_wbint_LookupSid_state *state = tevent_req_data(
269                 req, struct rpccli_wbint_LookupSid_state);
270         NTSTATUS status;
271
272         if (tevent_req_is_nterror(req, &status)) {
273                 tevent_req_received(req);
274                 return status;
275         }
276
277         /* Steal possbile out parameters to the callers context */
278         talloc_steal(mem_ctx, state->out_mem_ctx);
279
280         /* Return result */
281         *result = state->orig.out.result;
282
283         tevent_req_received(req);
284         return NT_STATUS_OK;
285 }
286
287 NTSTATUS rpccli_wbint_LookupSid(struct rpc_pipe_client *cli,
288                                 TALLOC_CTX *mem_ctx,
289                                 struct dom_sid *sid /* [in] [ref] */,
290                                 enum lsa_SidType *type /* [out] [ref] */,
291                                 const char **domain /* [out] [ref,charset(UTF8)] */,
292                                 const char **name /* [out] [ref,charset(UTF8)] */)
293 {
294         struct wbint_LookupSid r;
295         NTSTATUS status;
296
297         /* In parameters */
298         r.in.sid = sid;
299
300         if (DEBUGLEVEL >= 10) {
301                 NDR_PRINT_IN_DEBUG(wbint_LookupSid, &r);
302         }
303
304         status = cli->dispatch(cli,
305                                 mem_ctx,
306                                 &ndr_table_wbint,
307                                 NDR_WBINT_LOOKUPSID,
308                                 &r);
309
310         if (!NT_STATUS_IS_OK(status)) {
311                 return status;
312         }
313
314         if (DEBUGLEVEL >= 10) {
315                 NDR_PRINT_OUT_DEBUG(wbint_LookupSid, &r);
316         }
317
318         if (NT_STATUS_IS_ERR(status)) {
319                 return status;
320         }
321
322         /* Return variables */
323         *type = *r.out.type;
324         *domain = *r.out.domain;
325         *name = *r.out.name;
326
327         /* Return result */
328         return r.out.result;
329 }
330
331 struct rpccli_wbint_LookupName_state {
332         struct wbint_LookupName orig;
333         struct wbint_LookupName tmp;
334         TALLOC_CTX *out_mem_ctx;
335         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
336 };
337
338 static void rpccli_wbint_LookupName_done(struct tevent_req *subreq);
339
340 struct tevent_req *rpccli_wbint_LookupName_send(TALLOC_CTX *mem_ctx,
341                                                 struct tevent_context *ev,
342                                                 struct rpc_pipe_client *cli,
343                                                 const char *_domain /* [in] [ref,charset(UTF8)] */,
344                                                 const char *_name /* [in] [ref,charset(UTF8)] */,
345                                                 uint32_t _flags /* [in]  */,
346                                                 enum lsa_SidType *_type /* [out] [ref] */,
347                                                 struct dom_sid *_sid /* [out] [ref] */)
348 {
349         struct tevent_req *req;
350         struct rpccli_wbint_LookupName_state *state;
351         struct tevent_req *subreq;
352
353         req = tevent_req_create(mem_ctx, &state,
354                                 struct rpccli_wbint_LookupName_state);
355         if (req == NULL) {
356                 return NULL;
357         }
358         state->out_mem_ctx = NULL;
359         state->dispatch_recv = cli->dispatch_recv;
360
361         /* In parameters */
362         state->orig.in.domain = _domain;
363         state->orig.in.name = _name;
364         state->orig.in.flags = _flags;
365
366         /* Out parameters */
367         state->orig.out.type = _type;
368         state->orig.out.sid = _sid;
369
370         /* Result */
371         ZERO_STRUCT(state->orig.out.result);
372
373         if (DEBUGLEVEL >= 10) {
374                 NDR_PRINT_IN_DEBUG(wbint_LookupName, &state->orig);
375         }
376
377         state->out_mem_ctx = talloc_named_const(state, 0,
378                              "rpccli_wbint_LookupName_out_memory");
379         if (tevent_req_nomem(state->out_mem_ctx, req)) {
380                 return tevent_req_post(req, ev);
381         }
382
383         /* make a temporary copy, that we pass to the dispatch function */
384         state->tmp = state->orig;
385
386         subreq = cli->dispatch_send(state, ev, cli,
387                                     &ndr_table_wbint,
388                                     NDR_WBINT_LOOKUPNAME,
389                                     &state->tmp);
390         if (tevent_req_nomem(subreq, req)) {
391                 return tevent_req_post(req, ev);
392         }
393         tevent_req_set_callback(subreq, rpccli_wbint_LookupName_done, req);
394         return req;
395 }
396
397 static void rpccli_wbint_LookupName_done(struct tevent_req *subreq)
398 {
399         struct tevent_req *req = tevent_req_callback_data(
400                 subreq, struct tevent_req);
401         struct rpccli_wbint_LookupName_state *state = tevent_req_data(
402                 req, struct rpccli_wbint_LookupName_state);
403         NTSTATUS status;
404         TALLOC_CTX *mem_ctx;
405
406         if (state->out_mem_ctx) {
407                 mem_ctx = state->out_mem_ctx;
408         } else {
409                 mem_ctx = state;
410         }
411
412         status = state->dispatch_recv(subreq, mem_ctx);
413         TALLOC_FREE(subreq);
414         if (!NT_STATUS_IS_OK(status)) {
415                 tevent_req_nterror(req, status);
416                 return;
417         }
418
419         /* Copy out parameters */
420         *state->orig.out.type = *state->tmp.out.type;
421         *state->orig.out.sid = *state->tmp.out.sid;
422
423         /* Copy result */
424         state->orig.out.result = state->tmp.out.result;
425
426         /* Reset temporary structure */
427         ZERO_STRUCT(state->tmp);
428
429         if (DEBUGLEVEL >= 10) {
430                 NDR_PRINT_OUT_DEBUG(wbint_LookupName, &state->orig);
431         }
432
433         tevent_req_done(req);
434 }
435
436 NTSTATUS rpccli_wbint_LookupName_recv(struct tevent_req *req,
437                                       TALLOC_CTX *mem_ctx,
438                                       NTSTATUS *result)
439 {
440         struct rpccli_wbint_LookupName_state *state = tevent_req_data(
441                 req, struct rpccli_wbint_LookupName_state);
442         NTSTATUS status;
443
444         if (tevent_req_is_nterror(req, &status)) {
445                 tevent_req_received(req);
446                 return status;
447         }
448
449         /* Steal possbile out parameters to the callers context */
450         talloc_steal(mem_ctx, state->out_mem_ctx);
451
452         /* Return result */
453         *result = state->orig.out.result;
454
455         tevent_req_received(req);
456         return NT_STATUS_OK;
457 }
458
459 NTSTATUS rpccli_wbint_LookupName(struct rpc_pipe_client *cli,
460                                  TALLOC_CTX *mem_ctx,
461                                  const char *domain /* [in] [ref,charset(UTF8)] */,
462                                  const char *name /* [in] [ref,charset(UTF8)] */,
463                                  uint32_t flags /* [in]  */,
464                                  enum lsa_SidType *type /* [out] [ref] */,
465                                  struct dom_sid *sid /* [out] [ref] */)
466 {
467         struct wbint_LookupName r;
468         NTSTATUS status;
469
470         /* In parameters */
471         r.in.domain = domain;
472         r.in.name = name;
473         r.in.flags = flags;
474
475         if (DEBUGLEVEL >= 10) {
476                 NDR_PRINT_IN_DEBUG(wbint_LookupName, &r);
477         }
478
479         status = cli->dispatch(cli,
480                                 mem_ctx,
481                                 &ndr_table_wbint,
482                                 NDR_WBINT_LOOKUPNAME,
483                                 &r);
484
485         if (!NT_STATUS_IS_OK(status)) {
486                 return status;
487         }
488
489         if (DEBUGLEVEL >= 10) {
490                 NDR_PRINT_OUT_DEBUG(wbint_LookupName, &r);
491         }
492
493         if (NT_STATUS_IS_ERR(status)) {
494                 return status;
495         }
496
497         /* Return variables */
498         *type = *r.out.type;
499         *sid = *r.out.sid;
500
501         /* Return result */
502         return r.out.result;
503 }
504
505 struct rpccli_wbint_Sid2Uid_state {
506         struct wbint_Sid2Uid orig;
507         struct wbint_Sid2Uid tmp;
508         TALLOC_CTX *out_mem_ctx;
509         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
510 };
511
512 static void rpccli_wbint_Sid2Uid_done(struct tevent_req *subreq);
513
514 struct tevent_req *rpccli_wbint_Sid2Uid_send(TALLOC_CTX *mem_ctx,
515                                              struct tevent_context *ev,
516                                              struct rpc_pipe_client *cli,
517                                              const char *_dom_name /* [in] [unique,charset(UTF8)] */,
518                                              struct dom_sid *_sid /* [in] [ref] */,
519                                              uint64_t *_uid /* [out] [ref] */)
520 {
521         struct tevent_req *req;
522         struct rpccli_wbint_Sid2Uid_state *state;
523         struct tevent_req *subreq;
524
525         req = tevent_req_create(mem_ctx, &state,
526                                 struct rpccli_wbint_Sid2Uid_state);
527         if (req == NULL) {
528                 return NULL;
529         }
530         state->out_mem_ctx = NULL;
531         state->dispatch_recv = cli->dispatch_recv;
532
533         /* In parameters */
534         state->orig.in.dom_name = _dom_name;
535         state->orig.in.sid = _sid;
536
537         /* Out parameters */
538         state->orig.out.uid = _uid;
539
540         /* Result */
541         ZERO_STRUCT(state->orig.out.result);
542
543         if (DEBUGLEVEL >= 10) {
544                 NDR_PRINT_IN_DEBUG(wbint_Sid2Uid, &state->orig);
545         }
546
547         state->out_mem_ctx = talloc_named_const(state, 0,
548                              "rpccli_wbint_Sid2Uid_out_memory");
549         if (tevent_req_nomem(state->out_mem_ctx, req)) {
550                 return tevent_req_post(req, ev);
551         }
552
553         /* make a temporary copy, that we pass to the dispatch function */
554         state->tmp = state->orig;
555
556         subreq = cli->dispatch_send(state, ev, cli,
557                                     &ndr_table_wbint,
558                                     NDR_WBINT_SID2UID,
559                                     &state->tmp);
560         if (tevent_req_nomem(subreq, req)) {
561                 return tevent_req_post(req, ev);
562         }
563         tevent_req_set_callback(subreq, rpccli_wbint_Sid2Uid_done, req);
564         return req;
565 }
566
567 static void rpccli_wbint_Sid2Uid_done(struct tevent_req *subreq)
568 {
569         struct tevent_req *req = tevent_req_callback_data(
570                 subreq, struct tevent_req);
571         struct rpccli_wbint_Sid2Uid_state *state = tevent_req_data(
572                 req, struct rpccli_wbint_Sid2Uid_state);
573         NTSTATUS status;
574         TALLOC_CTX *mem_ctx;
575
576         if (state->out_mem_ctx) {
577                 mem_ctx = state->out_mem_ctx;
578         } else {
579                 mem_ctx = state;
580         }
581
582         status = state->dispatch_recv(subreq, mem_ctx);
583         TALLOC_FREE(subreq);
584         if (!NT_STATUS_IS_OK(status)) {
585                 tevent_req_nterror(req, status);
586                 return;
587         }
588
589         /* Copy out parameters */
590         *state->orig.out.uid = *state->tmp.out.uid;
591
592         /* Copy result */
593         state->orig.out.result = state->tmp.out.result;
594
595         /* Reset temporary structure */
596         ZERO_STRUCT(state->tmp);
597
598         if (DEBUGLEVEL >= 10) {
599                 NDR_PRINT_OUT_DEBUG(wbint_Sid2Uid, &state->orig);
600         }
601
602         tevent_req_done(req);
603 }
604
605 NTSTATUS rpccli_wbint_Sid2Uid_recv(struct tevent_req *req,
606                                    TALLOC_CTX *mem_ctx,
607                                    NTSTATUS *result)
608 {
609         struct rpccli_wbint_Sid2Uid_state *state = tevent_req_data(
610                 req, struct rpccli_wbint_Sid2Uid_state);
611         NTSTATUS status;
612
613         if (tevent_req_is_nterror(req, &status)) {
614                 tevent_req_received(req);
615                 return status;
616         }
617
618         /* Steal possbile out parameters to the callers context */
619         talloc_steal(mem_ctx, state->out_mem_ctx);
620
621         /* Return result */
622         *result = state->orig.out.result;
623
624         tevent_req_received(req);
625         return NT_STATUS_OK;
626 }
627
628 NTSTATUS rpccli_wbint_Sid2Uid(struct rpc_pipe_client *cli,
629                               TALLOC_CTX *mem_ctx,
630                               const char *dom_name /* [in] [unique,charset(UTF8)] */,
631                               struct dom_sid *sid /* [in] [ref] */,
632                               uint64_t *uid /* [out] [ref] */)
633 {
634         struct wbint_Sid2Uid r;
635         NTSTATUS status;
636
637         /* In parameters */
638         r.in.dom_name = dom_name;
639         r.in.sid = sid;
640
641         if (DEBUGLEVEL >= 10) {
642                 NDR_PRINT_IN_DEBUG(wbint_Sid2Uid, &r);
643         }
644
645         status = cli->dispatch(cli,
646                                 mem_ctx,
647                                 &ndr_table_wbint,
648                                 NDR_WBINT_SID2UID,
649                                 &r);
650
651         if (!NT_STATUS_IS_OK(status)) {
652                 return status;
653         }
654
655         if (DEBUGLEVEL >= 10) {
656                 NDR_PRINT_OUT_DEBUG(wbint_Sid2Uid, &r);
657         }
658
659         if (NT_STATUS_IS_ERR(status)) {
660                 return status;
661         }
662
663         /* Return variables */
664         *uid = *r.out.uid;
665
666         /* Return result */
667         return r.out.result;
668 }
669
670 struct rpccli_wbint_Sid2Gid_state {
671         struct wbint_Sid2Gid orig;
672         struct wbint_Sid2Gid tmp;
673         TALLOC_CTX *out_mem_ctx;
674         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
675 };
676
677 static void rpccli_wbint_Sid2Gid_done(struct tevent_req *subreq);
678
679 struct tevent_req *rpccli_wbint_Sid2Gid_send(TALLOC_CTX *mem_ctx,
680                                              struct tevent_context *ev,
681                                              struct rpc_pipe_client *cli,
682                                              const char *_dom_name /* [in] [unique,charset(UTF8)] */,
683                                              struct dom_sid *_sid /* [in] [ref] */,
684                                              uint64_t *_gid /* [out] [ref] */)
685 {
686         struct tevent_req *req;
687         struct rpccli_wbint_Sid2Gid_state *state;
688         struct tevent_req *subreq;
689
690         req = tevent_req_create(mem_ctx, &state,
691                                 struct rpccli_wbint_Sid2Gid_state);
692         if (req == NULL) {
693                 return NULL;
694         }
695         state->out_mem_ctx = NULL;
696         state->dispatch_recv = cli->dispatch_recv;
697
698         /* In parameters */
699         state->orig.in.dom_name = _dom_name;
700         state->orig.in.sid = _sid;
701
702         /* Out parameters */
703         state->orig.out.gid = _gid;
704
705         /* Result */
706         ZERO_STRUCT(state->orig.out.result);
707
708         if (DEBUGLEVEL >= 10) {
709                 NDR_PRINT_IN_DEBUG(wbint_Sid2Gid, &state->orig);
710         }
711
712         state->out_mem_ctx = talloc_named_const(state, 0,
713                              "rpccli_wbint_Sid2Gid_out_memory");
714         if (tevent_req_nomem(state->out_mem_ctx, req)) {
715                 return tevent_req_post(req, ev);
716         }
717
718         /* make a temporary copy, that we pass to the dispatch function */
719         state->tmp = state->orig;
720
721         subreq = cli->dispatch_send(state, ev, cli,
722                                     &ndr_table_wbint,
723                                     NDR_WBINT_SID2GID,
724                                     &state->tmp);
725         if (tevent_req_nomem(subreq, req)) {
726                 return tevent_req_post(req, ev);
727         }
728         tevent_req_set_callback(subreq, rpccli_wbint_Sid2Gid_done, req);
729         return req;
730 }
731
732 static void rpccli_wbint_Sid2Gid_done(struct tevent_req *subreq)
733 {
734         struct tevent_req *req = tevent_req_callback_data(
735                 subreq, struct tevent_req);
736         struct rpccli_wbint_Sid2Gid_state *state = tevent_req_data(
737                 req, struct rpccli_wbint_Sid2Gid_state);
738         NTSTATUS status;
739         TALLOC_CTX *mem_ctx;
740
741         if (state->out_mem_ctx) {
742                 mem_ctx = state->out_mem_ctx;
743         } else {
744                 mem_ctx = state;
745         }
746
747         status = state->dispatch_recv(subreq, mem_ctx);
748         TALLOC_FREE(subreq);
749         if (!NT_STATUS_IS_OK(status)) {
750                 tevent_req_nterror(req, status);
751                 return;
752         }
753
754         /* Copy out parameters */
755         *state->orig.out.gid = *state->tmp.out.gid;
756
757         /* Copy result */
758         state->orig.out.result = state->tmp.out.result;
759
760         /* Reset temporary structure */
761         ZERO_STRUCT(state->tmp);
762
763         if (DEBUGLEVEL >= 10) {
764                 NDR_PRINT_OUT_DEBUG(wbint_Sid2Gid, &state->orig);
765         }
766
767         tevent_req_done(req);
768 }
769
770 NTSTATUS rpccli_wbint_Sid2Gid_recv(struct tevent_req *req,
771                                    TALLOC_CTX *mem_ctx,
772                                    NTSTATUS *result)
773 {
774         struct rpccli_wbint_Sid2Gid_state *state = tevent_req_data(
775                 req, struct rpccli_wbint_Sid2Gid_state);
776         NTSTATUS status;
777
778         if (tevent_req_is_nterror(req, &status)) {
779                 tevent_req_received(req);
780                 return status;
781         }
782
783         /* Steal possbile out parameters to the callers context */
784         talloc_steal(mem_ctx, state->out_mem_ctx);
785
786         /* Return result */
787         *result = state->orig.out.result;
788
789         tevent_req_received(req);
790         return NT_STATUS_OK;
791 }
792
793 NTSTATUS rpccli_wbint_Sid2Gid(struct rpc_pipe_client *cli,
794                               TALLOC_CTX *mem_ctx,
795                               const char *dom_name /* [in] [unique,charset(UTF8)] */,
796                               struct dom_sid *sid /* [in] [ref] */,
797                               uint64_t *gid /* [out] [ref] */)
798 {
799         struct wbint_Sid2Gid r;
800         NTSTATUS status;
801
802         /* In parameters */
803         r.in.dom_name = dom_name;
804         r.in.sid = sid;
805
806         if (DEBUGLEVEL >= 10) {
807                 NDR_PRINT_IN_DEBUG(wbint_Sid2Gid, &r);
808         }
809
810         status = cli->dispatch(cli,
811                                 mem_ctx,
812                                 &ndr_table_wbint,
813                                 NDR_WBINT_SID2GID,
814                                 &r);
815
816         if (!NT_STATUS_IS_OK(status)) {
817                 return status;
818         }
819
820         if (DEBUGLEVEL >= 10) {
821                 NDR_PRINT_OUT_DEBUG(wbint_Sid2Gid, &r);
822         }
823
824         if (NT_STATUS_IS_ERR(status)) {
825                 return status;
826         }
827
828         /* Return variables */
829         *gid = *r.out.gid;
830
831         /* Return result */
832         return r.out.result;
833 }
834