72f5f74864ae00d2893d849a441cfbdbc20f5508
[samba.git] / librpc / gen_ndr / cli_samr.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_samr.h"
8
9 struct rpccli_samr_Connect_state {
10         struct samr_Connect orig;
11         struct samr_Connect 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_samr_Connect_done(struct tevent_req *subreq);
17
18 struct tevent_req *rpccli_samr_Connect_send(TALLOC_CTX *mem_ctx,
19                                             struct tevent_context *ev,
20                                             struct rpc_pipe_client *cli,
21                                             uint16_t *_system_name /* [in] [unique] */,
22                                             uint32_t _access_mask /* [in]  */,
23                                             struct policy_handle *_connect_handle /* [out] [ref] */)
24 {
25         struct tevent_req *req;
26         struct rpccli_samr_Connect_state *state;
27         struct tevent_req *subreq;
28
29         req = tevent_req_create(mem_ctx, &state,
30                                 struct rpccli_samr_Connect_state);
31         if (req == NULL) {
32                 return NULL;
33         }
34         state->out_mem_ctx = NULL;
35         state->dispatch_recv = cli->dispatch_recv;
36
37         /* In parameters */
38         state->orig.in.system_name = _system_name;
39         state->orig.in.access_mask = _access_mask;
40
41         /* Out parameters */
42         state->orig.out.connect_handle = _connect_handle;
43
44         /* Result */
45         ZERO_STRUCT(state->orig.out.result);
46
47         if (DEBUGLEVEL >= 10) {
48                 NDR_PRINT_IN_DEBUG(samr_Connect, &state->orig);
49         }
50
51         state->out_mem_ctx = talloc_named_const(state, 0,
52                              "rpccli_samr_Connect_out_memory");
53         if (tevent_req_nomem(state->out_mem_ctx, req)) {
54                 return tevent_req_post(req, ev);
55         }
56
57         /* make a temporary copy, that we pass to the dispatch function */
58         state->tmp = state->orig;
59
60         subreq = cli->dispatch_send(state, ev, cli,
61                                     &ndr_table_samr,
62                                     NDR_SAMR_CONNECT,
63                                     &state->tmp);
64         if (tevent_req_nomem(subreq, req)) {
65                 return tevent_req_post(req, ev);
66         }
67         tevent_req_set_callback(subreq, rpccli_samr_Connect_done, req);
68         return req;
69 }
70
71 static void rpccli_samr_Connect_done(struct tevent_req *subreq)
72 {
73         struct tevent_req *req = tevent_req_callback_data(
74                 subreq, struct tevent_req);
75         struct rpccli_samr_Connect_state *state = tevent_req_data(
76                 req, struct rpccli_samr_Connect_state);
77         NTSTATUS status;
78         TALLOC_CTX *mem_ctx;
79
80         if (state->out_mem_ctx) {
81                 mem_ctx = state->out_mem_ctx;
82         } else {
83                 mem_ctx = state;
84         }
85
86         status = state->dispatch_recv(subreq, mem_ctx);
87         TALLOC_FREE(subreq);
88         if (!NT_STATUS_IS_OK(status)) {
89                 tevent_req_nterror(req, status);
90                 return;
91         }
92
93         /* Copy out parameters */
94         *state->orig.out.connect_handle = *state->tmp.out.connect_handle;
95
96         /* Copy result */
97         state->orig.out.result = state->tmp.out.result;
98
99         /* Reset temporary structure */
100         ZERO_STRUCT(state->tmp);
101
102         if (DEBUGLEVEL >= 10) {
103                 NDR_PRINT_OUT_DEBUG(samr_Connect, &state->orig);
104         }
105
106         tevent_req_done(req);
107 }
108
109 NTSTATUS rpccli_samr_Connect_recv(struct tevent_req *req,
110                                   TALLOC_CTX *mem_ctx,
111                                   NTSTATUS *result)
112 {
113         struct rpccli_samr_Connect_state *state = tevent_req_data(
114                 req, struct rpccli_samr_Connect_state);
115         NTSTATUS status;
116
117         if (tevent_req_is_nterror(req, &status)) {
118                 tevent_req_received(req);
119                 return status;
120         }
121
122         /* Steal possbile out parameters to the callers context */
123         talloc_steal(mem_ctx, state->out_mem_ctx);
124
125         /* Return result */
126         *result = state->orig.out.result;
127
128         tevent_req_received(req);
129         return NT_STATUS_OK;
130 }
131
132 NTSTATUS rpccli_samr_Connect(struct rpc_pipe_client *cli,
133                              TALLOC_CTX *mem_ctx,
134                              uint16_t *system_name /* [in] [unique] */,
135                              uint32_t access_mask /* [in]  */,
136                              struct policy_handle *connect_handle /* [out] [ref] */)
137 {
138         struct samr_Connect r;
139         NTSTATUS status;
140
141         /* In parameters */
142         r.in.system_name = system_name;
143         r.in.access_mask = access_mask;
144
145         if (DEBUGLEVEL >= 10) {
146                 NDR_PRINT_IN_DEBUG(samr_Connect, &r);
147         }
148
149         status = cli->dispatch(cli,
150                                 mem_ctx,
151                                 &ndr_table_samr,
152                                 NDR_SAMR_CONNECT,
153                                 &r);
154
155         if (!NT_STATUS_IS_OK(status)) {
156                 return status;
157         }
158
159         if (DEBUGLEVEL >= 10) {
160                 NDR_PRINT_OUT_DEBUG(samr_Connect, &r);
161         }
162
163         if (NT_STATUS_IS_ERR(status)) {
164                 return status;
165         }
166
167         /* Return variables */
168         *connect_handle = *r.out.connect_handle;
169
170         /* Return result */
171         return r.out.result;
172 }
173
174 struct rpccli_samr_Close_state {
175         struct samr_Close orig;
176         struct samr_Close tmp;
177         TALLOC_CTX *out_mem_ctx;
178         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
179 };
180
181 static void rpccli_samr_Close_done(struct tevent_req *subreq);
182
183 struct tevent_req *rpccli_samr_Close_send(TALLOC_CTX *mem_ctx,
184                                           struct tevent_context *ev,
185                                           struct rpc_pipe_client *cli,
186                                           struct policy_handle *_handle /* [in,out] [ref] */)
187 {
188         struct tevent_req *req;
189         struct rpccli_samr_Close_state *state;
190         struct tevent_req *subreq;
191
192         req = tevent_req_create(mem_ctx, &state,
193                                 struct rpccli_samr_Close_state);
194         if (req == NULL) {
195                 return NULL;
196         }
197         state->out_mem_ctx = NULL;
198         state->dispatch_recv = cli->dispatch_recv;
199
200         /* In parameters */
201         state->orig.in.handle = _handle;
202
203         /* Out parameters */
204         state->orig.out.handle = _handle;
205
206         /* Result */
207         ZERO_STRUCT(state->orig.out.result);
208
209         if (DEBUGLEVEL >= 10) {
210                 NDR_PRINT_IN_DEBUG(samr_Close, &state->orig);
211         }
212
213         state->out_mem_ctx = talloc_named_const(state, 0,
214                              "rpccli_samr_Close_out_memory");
215         if (tevent_req_nomem(state->out_mem_ctx, req)) {
216                 return tevent_req_post(req, ev);
217         }
218
219         /* make a temporary copy, that we pass to the dispatch function */
220         state->tmp = state->orig;
221
222         subreq = cli->dispatch_send(state, ev, cli,
223                                     &ndr_table_samr,
224                                     NDR_SAMR_CLOSE,
225                                     &state->tmp);
226         if (tevent_req_nomem(subreq, req)) {
227                 return tevent_req_post(req, ev);
228         }
229         tevent_req_set_callback(subreq, rpccli_samr_Close_done, req);
230         return req;
231 }
232
233 static void rpccli_samr_Close_done(struct tevent_req *subreq)
234 {
235         struct tevent_req *req = tevent_req_callback_data(
236                 subreq, struct tevent_req);
237         struct rpccli_samr_Close_state *state = tevent_req_data(
238                 req, struct rpccli_samr_Close_state);
239         NTSTATUS status;
240         TALLOC_CTX *mem_ctx;
241
242         if (state->out_mem_ctx) {
243                 mem_ctx = state->out_mem_ctx;
244         } else {
245                 mem_ctx = state;
246         }
247
248         status = state->dispatch_recv(subreq, mem_ctx);
249         TALLOC_FREE(subreq);
250         if (!NT_STATUS_IS_OK(status)) {
251                 tevent_req_nterror(req, status);
252                 return;
253         }
254
255         /* Copy out parameters */
256         *state->orig.out.handle = *state->tmp.out.handle;
257
258         /* Copy result */
259         state->orig.out.result = state->tmp.out.result;
260
261         /* Reset temporary structure */
262         ZERO_STRUCT(state->tmp);
263
264         if (DEBUGLEVEL >= 10) {
265                 NDR_PRINT_OUT_DEBUG(samr_Close, &state->orig);
266         }
267
268         tevent_req_done(req);
269 }
270
271 NTSTATUS rpccli_samr_Close_recv(struct tevent_req *req,
272                                 TALLOC_CTX *mem_ctx,
273                                 NTSTATUS *result)
274 {
275         struct rpccli_samr_Close_state *state = tevent_req_data(
276                 req, struct rpccli_samr_Close_state);
277         NTSTATUS status;
278
279         if (tevent_req_is_nterror(req, &status)) {
280                 tevent_req_received(req);
281                 return status;
282         }
283
284         /* Steal possbile out parameters to the callers context */
285         talloc_steal(mem_ctx, state->out_mem_ctx);
286
287         /* Return result */
288         *result = state->orig.out.result;
289
290         tevent_req_received(req);
291         return NT_STATUS_OK;
292 }
293
294 NTSTATUS rpccli_samr_Close(struct rpc_pipe_client *cli,
295                            TALLOC_CTX *mem_ctx,
296                            struct policy_handle *handle /* [in,out] [ref] */)
297 {
298         struct samr_Close r;
299         NTSTATUS status;
300
301         /* In parameters */
302         r.in.handle = handle;
303
304         if (DEBUGLEVEL >= 10) {
305                 NDR_PRINT_IN_DEBUG(samr_Close, &r);
306         }
307
308         status = cli->dispatch(cli,
309                                 mem_ctx,
310                                 &ndr_table_samr,
311                                 NDR_SAMR_CLOSE,
312                                 &r);
313
314         if (!NT_STATUS_IS_OK(status)) {
315                 return status;
316         }
317
318         if (DEBUGLEVEL >= 10) {
319                 NDR_PRINT_OUT_DEBUG(samr_Close, &r);
320         }
321
322         if (NT_STATUS_IS_ERR(status)) {
323                 return status;
324         }
325
326         /* Return variables */
327         *handle = *r.out.handle;
328
329         /* Return result */
330         return r.out.result;
331 }
332
333 struct rpccli_samr_SetSecurity_state {
334         struct samr_SetSecurity orig;
335         struct samr_SetSecurity tmp;
336         TALLOC_CTX *out_mem_ctx;
337         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
338 };
339
340 static void rpccli_samr_SetSecurity_done(struct tevent_req *subreq);
341
342 struct tevent_req *rpccli_samr_SetSecurity_send(TALLOC_CTX *mem_ctx,
343                                                 struct tevent_context *ev,
344                                                 struct rpc_pipe_client *cli,
345                                                 struct policy_handle *_handle /* [in] [ref] */,
346                                                 uint32_t _sec_info /* [in]  */,
347                                                 struct sec_desc_buf *_sdbuf /* [in] [ref] */)
348 {
349         struct tevent_req *req;
350         struct rpccli_samr_SetSecurity_state *state;
351         struct tevent_req *subreq;
352
353         req = tevent_req_create(mem_ctx, &state,
354                                 struct rpccli_samr_SetSecurity_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.handle = _handle;
363         state->orig.in.sec_info = _sec_info;
364         state->orig.in.sdbuf = _sdbuf;
365
366         /* Out parameters */
367
368         /* Result */
369         ZERO_STRUCT(state->orig.out.result);
370
371         if (DEBUGLEVEL >= 10) {
372                 NDR_PRINT_IN_DEBUG(samr_SetSecurity, &state->orig);
373         }
374
375         /* make a temporary copy, that we pass to the dispatch function */
376         state->tmp = state->orig;
377
378         subreq = cli->dispatch_send(state, ev, cli,
379                                     &ndr_table_samr,
380                                     NDR_SAMR_SETSECURITY,
381                                     &state->tmp);
382         if (tevent_req_nomem(subreq, req)) {
383                 return tevent_req_post(req, ev);
384         }
385         tevent_req_set_callback(subreq, rpccli_samr_SetSecurity_done, req);
386         return req;
387 }
388
389 static void rpccli_samr_SetSecurity_done(struct tevent_req *subreq)
390 {
391         struct tevent_req *req = tevent_req_callback_data(
392                 subreq, struct tevent_req);
393         struct rpccli_samr_SetSecurity_state *state = tevent_req_data(
394                 req, struct rpccli_samr_SetSecurity_state);
395         NTSTATUS status;
396         TALLOC_CTX *mem_ctx;
397
398         if (state->out_mem_ctx) {
399                 mem_ctx = state->out_mem_ctx;
400         } else {
401                 mem_ctx = state;
402         }
403
404         status = state->dispatch_recv(subreq, mem_ctx);
405         TALLOC_FREE(subreq);
406         if (!NT_STATUS_IS_OK(status)) {
407                 tevent_req_nterror(req, status);
408                 return;
409         }
410
411         /* Copy out parameters */
412
413         /* Copy result */
414         state->orig.out.result = state->tmp.out.result;
415
416         /* Reset temporary structure */
417         ZERO_STRUCT(state->tmp);
418
419         if (DEBUGLEVEL >= 10) {
420                 NDR_PRINT_OUT_DEBUG(samr_SetSecurity, &state->orig);
421         }
422
423         tevent_req_done(req);
424 }
425
426 NTSTATUS rpccli_samr_SetSecurity_recv(struct tevent_req *req,
427                                       TALLOC_CTX *mem_ctx,
428                                       NTSTATUS *result)
429 {
430         struct rpccli_samr_SetSecurity_state *state = tevent_req_data(
431                 req, struct rpccli_samr_SetSecurity_state);
432         NTSTATUS status;
433
434         if (tevent_req_is_nterror(req, &status)) {
435                 tevent_req_received(req);
436                 return status;
437         }
438
439         /* Steal possbile out parameters to the callers context */
440         talloc_steal(mem_ctx, state->out_mem_ctx);
441
442         /* Return result */
443         *result = state->orig.out.result;
444
445         tevent_req_received(req);
446         return NT_STATUS_OK;
447 }
448
449 NTSTATUS rpccli_samr_SetSecurity(struct rpc_pipe_client *cli,
450                                  TALLOC_CTX *mem_ctx,
451                                  struct policy_handle *handle /* [in] [ref] */,
452                                  uint32_t sec_info /* [in]  */,
453                                  struct sec_desc_buf *sdbuf /* [in] [ref] */)
454 {
455         struct samr_SetSecurity r;
456         NTSTATUS status;
457
458         /* In parameters */
459         r.in.handle = handle;
460         r.in.sec_info = sec_info;
461         r.in.sdbuf = sdbuf;
462
463         if (DEBUGLEVEL >= 10) {
464                 NDR_PRINT_IN_DEBUG(samr_SetSecurity, &r);
465         }
466
467         status = cli->dispatch(cli,
468                                 mem_ctx,
469                                 &ndr_table_samr,
470                                 NDR_SAMR_SETSECURITY,
471                                 &r);
472
473         if (!NT_STATUS_IS_OK(status)) {
474                 return status;
475         }
476
477         if (DEBUGLEVEL >= 10) {
478                 NDR_PRINT_OUT_DEBUG(samr_SetSecurity, &r);
479         }
480
481         if (NT_STATUS_IS_ERR(status)) {
482                 return status;
483         }
484
485         /* Return variables */
486
487         /* Return result */
488         return r.out.result;
489 }
490
491 struct rpccli_samr_QuerySecurity_state {
492         struct samr_QuerySecurity orig;
493         struct samr_QuerySecurity tmp;
494         TALLOC_CTX *out_mem_ctx;
495         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
496 };
497
498 static void rpccli_samr_QuerySecurity_done(struct tevent_req *subreq);
499
500 struct tevent_req *rpccli_samr_QuerySecurity_send(TALLOC_CTX *mem_ctx,
501                                                   struct tevent_context *ev,
502                                                   struct rpc_pipe_client *cli,
503                                                   struct policy_handle *_handle /* [in] [ref] */,
504                                                   uint32_t _sec_info /* [in]  */,
505                                                   struct sec_desc_buf **_sdbuf /* [out] [ref] */)
506 {
507         struct tevent_req *req;
508         struct rpccli_samr_QuerySecurity_state *state;
509         struct tevent_req *subreq;
510
511         req = tevent_req_create(mem_ctx, &state,
512                                 struct rpccli_samr_QuerySecurity_state);
513         if (req == NULL) {
514                 return NULL;
515         }
516         state->out_mem_ctx = NULL;
517         state->dispatch_recv = cli->dispatch_recv;
518
519         /* In parameters */
520         state->orig.in.handle = _handle;
521         state->orig.in.sec_info = _sec_info;
522
523         /* Out parameters */
524         state->orig.out.sdbuf = _sdbuf;
525
526         /* Result */
527         ZERO_STRUCT(state->orig.out.result);
528
529         if (DEBUGLEVEL >= 10) {
530                 NDR_PRINT_IN_DEBUG(samr_QuerySecurity, &state->orig);
531         }
532
533         state->out_mem_ctx = talloc_named_const(state, 0,
534                              "rpccli_samr_QuerySecurity_out_memory");
535         if (tevent_req_nomem(state->out_mem_ctx, req)) {
536                 return tevent_req_post(req, ev);
537         }
538
539         /* make a temporary copy, that we pass to the dispatch function */
540         state->tmp = state->orig;
541
542         subreq = cli->dispatch_send(state, ev, cli,
543                                     &ndr_table_samr,
544                                     NDR_SAMR_QUERYSECURITY,
545                                     &state->tmp);
546         if (tevent_req_nomem(subreq, req)) {
547                 return tevent_req_post(req, ev);
548         }
549         tevent_req_set_callback(subreq, rpccli_samr_QuerySecurity_done, req);
550         return req;
551 }
552
553 static void rpccli_samr_QuerySecurity_done(struct tevent_req *subreq)
554 {
555         struct tevent_req *req = tevent_req_callback_data(
556                 subreq, struct tevent_req);
557         struct rpccli_samr_QuerySecurity_state *state = tevent_req_data(
558                 req, struct rpccli_samr_QuerySecurity_state);
559         NTSTATUS status;
560         TALLOC_CTX *mem_ctx;
561
562         if (state->out_mem_ctx) {
563                 mem_ctx = state->out_mem_ctx;
564         } else {
565                 mem_ctx = state;
566         }
567
568         status = state->dispatch_recv(subreq, mem_ctx);
569         TALLOC_FREE(subreq);
570         if (!NT_STATUS_IS_OK(status)) {
571                 tevent_req_nterror(req, status);
572                 return;
573         }
574
575         /* Copy out parameters */
576         *state->orig.out.sdbuf = *state->tmp.out.sdbuf;
577
578         /* Copy result */
579         state->orig.out.result = state->tmp.out.result;
580
581         /* Reset temporary structure */
582         ZERO_STRUCT(state->tmp);
583
584         if (DEBUGLEVEL >= 10) {
585                 NDR_PRINT_OUT_DEBUG(samr_QuerySecurity, &state->orig);
586         }
587
588         tevent_req_done(req);
589 }
590
591 NTSTATUS rpccli_samr_QuerySecurity_recv(struct tevent_req *req,
592                                         TALLOC_CTX *mem_ctx,
593                                         NTSTATUS *result)
594 {
595         struct rpccli_samr_QuerySecurity_state *state = tevent_req_data(
596                 req, struct rpccli_samr_QuerySecurity_state);
597         NTSTATUS status;
598
599         if (tevent_req_is_nterror(req, &status)) {
600                 tevent_req_received(req);
601                 return status;
602         }
603
604         /* Steal possbile out parameters to the callers context */
605         talloc_steal(mem_ctx, state->out_mem_ctx);
606
607         /* Return result */
608         *result = state->orig.out.result;
609
610         tevent_req_received(req);
611         return NT_STATUS_OK;
612 }
613
614 NTSTATUS rpccli_samr_QuerySecurity(struct rpc_pipe_client *cli,
615                                    TALLOC_CTX *mem_ctx,
616                                    struct policy_handle *handle /* [in] [ref] */,
617                                    uint32_t sec_info /* [in]  */,
618                                    struct sec_desc_buf **sdbuf /* [out] [ref] */)
619 {
620         struct samr_QuerySecurity r;
621         NTSTATUS status;
622
623         /* In parameters */
624         r.in.handle = handle;
625         r.in.sec_info = sec_info;
626
627         if (DEBUGLEVEL >= 10) {
628                 NDR_PRINT_IN_DEBUG(samr_QuerySecurity, &r);
629         }
630
631         status = cli->dispatch(cli,
632                                 mem_ctx,
633                                 &ndr_table_samr,
634                                 NDR_SAMR_QUERYSECURITY,
635                                 &r);
636
637         if (!NT_STATUS_IS_OK(status)) {
638                 return status;
639         }
640
641         if (DEBUGLEVEL >= 10) {
642                 NDR_PRINT_OUT_DEBUG(samr_QuerySecurity, &r);
643         }
644
645         if (NT_STATUS_IS_ERR(status)) {
646                 return status;
647         }
648
649         /* Return variables */
650         *sdbuf = *r.out.sdbuf;
651
652         /* Return result */
653         return r.out.result;
654 }
655
656 struct rpccli_samr_Shutdown_state {
657         struct samr_Shutdown orig;
658         struct samr_Shutdown tmp;
659         TALLOC_CTX *out_mem_ctx;
660         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
661 };
662
663 static void rpccli_samr_Shutdown_done(struct tevent_req *subreq);
664
665 struct tevent_req *rpccli_samr_Shutdown_send(TALLOC_CTX *mem_ctx,
666                                              struct tevent_context *ev,
667                                              struct rpc_pipe_client *cli,
668                                              struct policy_handle *_connect_handle /* [in] [ref] */)
669 {
670         struct tevent_req *req;
671         struct rpccli_samr_Shutdown_state *state;
672         struct tevent_req *subreq;
673
674         req = tevent_req_create(mem_ctx, &state,
675                                 struct rpccli_samr_Shutdown_state);
676         if (req == NULL) {
677                 return NULL;
678         }
679         state->out_mem_ctx = NULL;
680         state->dispatch_recv = cli->dispatch_recv;
681
682         /* In parameters */
683         state->orig.in.connect_handle = _connect_handle;
684
685         /* Out parameters */
686
687         /* Result */
688         ZERO_STRUCT(state->orig.out.result);
689
690         if (DEBUGLEVEL >= 10) {
691                 NDR_PRINT_IN_DEBUG(samr_Shutdown, &state->orig);
692         }
693
694         /* make a temporary copy, that we pass to the dispatch function */
695         state->tmp = state->orig;
696
697         subreq = cli->dispatch_send(state, ev, cli,
698                                     &ndr_table_samr,
699                                     NDR_SAMR_SHUTDOWN,
700                                     &state->tmp);
701         if (tevent_req_nomem(subreq, req)) {
702                 return tevent_req_post(req, ev);
703         }
704         tevent_req_set_callback(subreq, rpccli_samr_Shutdown_done, req);
705         return req;
706 }
707
708 static void rpccli_samr_Shutdown_done(struct tevent_req *subreq)
709 {
710         struct tevent_req *req = tevent_req_callback_data(
711                 subreq, struct tevent_req);
712         struct rpccli_samr_Shutdown_state *state = tevent_req_data(
713                 req, struct rpccli_samr_Shutdown_state);
714         NTSTATUS status;
715         TALLOC_CTX *mem_ctx;
716
717         if (state->out_mem_ctx) {
718                 mem_ctx = state->out_mem_ctx;
719         } else {
720                 mem_ctx = state;
721         }
722
723         status = state->dispatch_recv(subreq, mem_ctx);
724         TALLOC_FREE(subreq);
725         if (!NT_STATUS_IS_OK(status)) {
726                 tevent_req_nterror(req, status);
727                 return;
728         }
729
730         /* Copy out parameters */
731
732         /* Copy result */
733         state->orig.out.result = state->tmp.out.result;
734
735         /* Reset temporary structure */
736         ZERO_STRUCT(state->tmp);
737
738         if (DEBUGLEVEL >= 10) {
739                 NDR_PRINT_OUT_DEBUG(samr_Shutdown, &state->orig);
740         }
741
742         tevent_req_done(req);
743 }
744
745 NTSTATUS rpccli_samr_Shutdown_recv(struct tevent_req *req,
746                                    TALLOC_CTX *mem_ctx,
747                                    NTSTATUS *result)
748 {
749         struct rpccli_samr_Shutdown_state *state = tevent_req_data(
750                 req, struct rpccli_samr_Shutdown_state);
751         NTSTATUS status;
752
753         if (tevent_req_is_nterror(req, &status)) {
754                 tevent_req_received(req);
755                 return status;
756         }
757
758         /* Steal possbile out parameters to the callers context */
759         talloc_steal(mem_ctx, state->out_mem_ctx);
760
761         /* Return result */
762         *result = state->orig.out.result;
763
764         tevent_req_received(req);
765         return NT_STATUS_OK;
766 }
767
768 NTSTATUS rpccli_samr_Shutdown(struct rpc_pipe_client *cli,
769                               TALLOC_CTX *mem_ctx,
770                               struct policy_handle *connect_handle /* [in] [ref] */)
771 {
772         struct samr_Shutdown r;
773         NTSTATUS status;
774
775         /* In parameters */
776         r.in.connect_handle = connect_handle;
777
778         if (DEBUGLEVEL >= 10) {
779                 NDR_PRINT_IN_DEBUG(samr_Shutdown, &r);
780         }
781
782         status = cli->dispatch(cli,
783                                 mem_ctx,
784                                 &ndr_table_samr,
785                                 NDR_SAMR_SHUTDOWN,
786                                 &r);
787
788         if (!NT_STATUS_IS_OK(status)) {
789                 return status;
790         }
791
792         if (DEBUGLEVEL >= 10) {
793                 NDR_PRINT_OUT_DEBUG(samr_Shutdown, &r);
794         }
795
796         if (NT_STATUS_IS_ERR(status)) {
797                 return status;
798         }
799
800         /* Return variables */
801
802         /* Return result */
803         return r.out.result;
804 }
805
806 struct rpccli_samr_LookupDomain_state {
807         struct samr_LookupDomain orig;
808         struct samr_LookupDomain tmp;
809         TALLOC_CTX *out_mem_ctx;
810         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
811 };
812
813 static void rpccli_samr_LookupDomain_done(struct tevent_req *subreq);
814
815 struct tevent_req *rpccli_samr_LookupDomain_send(TALLOC_CTX *mem_ctx,
816                                                  struct tevent_context *ev,
817                                                  struct rpc_pipe_client *cli,
818                                                  struct policy_handle *_connect_handle /* [in] [ref] */,
819                                                  struct lsa_String *_domain_name /* [in] [ref] */,
820                                                  struct dom_sid2 **_sid /* [out] [ref] */)
821 {
822         struct tevent_req *req;
823         struct rpccli_samr_LookupDomain_state *state;
824         struct tevent_req *subreq;
825
826         req = tevent_req_create(mem_ctx, &state,
827                                 struct rpccli_samr_LookupDomain_state);
828         if (req == NULL) {
829                 return NULL;
830         }
831         state->out_mem_ctx = NULL;
832         state->dispatch_recv = cli->dispatch_recv;
833
834         /* In parameters */
835         state->orig.in.connect_handle = _connect_handle;
836         state->orig.in.domain_name = _domain_name;
837
838         /* Out parameters */
839         state->orig.out.sid = _sid;
840
841         /* Result */
842         ZERO_STRUCT(state->orig.out.result);
843
844         if (DEBUGLEVEL >= 10) {
845                 NDR_PRINT_IN_DEBUG(samr_LookupDomain, &state->orig);
846         }
847
848         state->out_mem_ctx = talloc_named_const(state, 0,
849                              "rpccli_samr_LookupDomain_out_memory");
850         if (tevent_req_nomem(state->out_mem_ctx, req)) {
851                 return tevent_req_post(req, ev);
852         }
853
854         /* make a temporary copy, that we pass to the dispatch function */
855         state->tmp = state->orig;
856
857         subreq = cli->dispatch_send(state, ev, cli,
858                                     &ndr_table_samr,
859                                     NDR_SAMR_LOOKUPDOMAIN,
860                                     &state->tmp);
861         if (tevent_req_nomem(subreq, req)) {
862                 return tevent_req_post(req, ev);
863         }
864         tevent_req_set_callback(subreq, rpccli_samr_LookupDomain_done, req);
865         return req;
866 }
867
868 static void rpccli_samr_LookupDomain_done(struct tevent_req *subreq)
869 {
870         struct tevent_req *req = tevent_req_callback_data(
871                 subreq, struct tevent_req);
872         struct rpccli_samr_LookupDomain_state *state = tevent_req_data(
873                 req, struct rpccli_samr_LookupDomain_state);
874         NTSTATUS status;
875         TALLOC_CTX *mem_ctx;
876
877         if (state->out_mem_ctx) {
878                 mem_ctx = state->out_mem_ctx;
879         } else {
880                 mem_ctx = state;
881         }
882
883         status = state->dispatch_recv(subreq, mem_ctx);
884         TALLOC_FREE(subreq);
885         if (!NT_STATUS_IS_OK(status)) {
886                 tevent_req_nterror(req, status);
887                 return;
888         }
889
890         /* Copy out parameters */
891         *state->orig.out.sid = *state->tmp.out.sid;
892
893         /* Copy result */
894         state->orig.out.result = state->tmp.out.result;
895
896         /* Reset temporary structure */
897         ZERO_STRUCT(state->tmp);
898
899         if (DEBUGLEVEL >= 10) {
900                 NDR_PRINT_OUT_DEBUG(samr_LookupDomain, &state->orig);
901         }
902
903         tevent_req_done(req);
904 }
905
906 NTSTATUS rpccli_samr_LookupDomain_recv(struct tevent_req *req,
907                                        TALLOC_CTX *mem_ctx,
908                                        NTSTATUS *result)
909 {
910         struct rpccli_samr_LookupDomain_state *state = tevent_req_data(
911                 req, struct rpccli_samr_LookupDomain_state);
912         NTSTATUS status;
913
914         if (tevent_req_is_nterror(req, &status)) {
915                 tevent_req_received(req);
916                 return status;
917         }
918
919         /* Steal possbile out parameters to the callers context */
920         talloc_steal(mem_ctx, state->out_mem_ctx);
921
922         /* Return result */
923         *result = state->orig.out.result;
924
925         tevent_req_received(req);
926         return NT_STATUS_OK;
927 }
928
929 NTSTATUS rpccli_samr_LookupDomain(struct rpc_pipe_client *cli,
930                                   TALLOC_CTX *mem_ctx,
931                                   struct policy_handle *connect_handle /* [in] [ref] */,
932                                   struct lsa_String *domain_name /* [in] [ref] */,
933                                   struct dom_sid2 **sid /* [out] [ref] */)
934 {
935         struct samr_LookupDomain r;
936         NTSTATUS status;
937
938         /* In parameters */
939         r.in.connect_handle = connect_handle;
940         r.in.domain_name = domain_name;
941
942         if (DEBUGLEVEL >= 10) {
943                 NDR_PRINT_IN_DEBUG(samr_LookupDomain, &r);
944         }
945
946         status = cli->dispatch(cli,
947                                 mem_ctx,
948                                 &ndr_table_samr,
949                                 NDR_SAMR_LOOKUPDOMAIN,
950                                 &r);
951
952         if (!NT_STATUS_IS_OK(status)) {
953                 return status;
954         }
955
956         if (DEBUGLEVEL >= 10) {
957                 NDR_PRINT_OUT_DEBUG(samr_LookupDomain, &r);
958         }
959
960         if (NT_STATUS_IS_ERR(status)) {
961                 return status;
962         }
963
964         /* Return variables */
965         *sid = *r.out.sid;
966
967         /* Return result */
968         return r.out.result;
969 }
970
971 struct rpccli_samr_EnumDomains_state {
972         struct samr_EnumDomains orig;
973         struct samr_EnumDomains tmp;
974         TALLOC_CTX *out_mem_ctx;
975         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
976 };
977
978 static void rpccli_samr_EnumDomains_done(struct tevent_req *subreq);
979
980 struct tevent_req *rpccli_samr_EnumDomains_send(TALLOC_CTX *mem_ctx,
981                                                 struct tevent_context *ev,
982                                                 struct rpc_pipe_client *cli,
983                                                 struct policy_handle *_connect_handle /* [in] [ref] */,
984                                                 uint32_t *_resume_handle /* [in,out] [ref] */,
985                                                 struct samr_SamArray **_sam /* [out] [ref] */,
986                                                 uint32_t _buf_size /* [in]  */,
987                                                 uint32_t *_num_entries /* [out] [ref] */)
988 {
989         struct tevent_req *req;
990         struct rpccli_samr_EnumDomains_state *state;
991         struct tevent_req *subreq;
992
993         req = tevent_req_create(mem_ctx, &state,
994                                 struct rpccli_samr_EnumDomains_state);
995         if (req == NULL) {
996                 return NULL;
997         }
998         state->out_mem_ctx = NULL;
999         state->dispatch_recv = cli->dispatch_recv;
1000
1001         /* In parameters */
1002         state->orig.in.connect_handle = _connect_handle;
1003         state->orig.in.resume_handle = _resume_handle;
1004         state->orig.in.buf_size = _buf_size;
1005
1006         /* Out parameters */
1007         state->orig.out.resume_handle = _resume_handle;
1008         state->orig.out.sam = _sam;
1009         state->orig.out.num_entries = _num_entries;
1010
1011         /* Result */
1012         ZERO_STRUCT(state->orig.out.result);
1013
1014         if (DEBUGLEVEL >= 10) {
1015                 NDR_PRINT_IN_DEBUG(samr_EnumDomains, &state->orig);
1016         }
1017
1018         state->out_mem_ctx = talloc_named_const(state, 0,
1019                              "rpccli_samr_EnumDomains_out_memory");
1020         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1021                 return tevent_req_post(req, ev);
1022         }
1023
1024         /* make a temporary copy, that we pass to the dispatch function */
1025         state->tmp = state->orig;
1026
1027         subreq = cli->dispatch_send(state, ev, cli,
1028                                     &ndr_table_samr,
1029                                     NDR_SAMR_ENUMDOMAINS,
1030                                     &state->tmp);
1031         if (tevent_req_nomem(subreq, req)) {
1032                 return tevent_req_post(req, ev);
1033         }
1034         tevent_req_set_callback(subreq, rpccli_samr_EnumDomains_done, req);
1035         return req;
1036 }
1037
1038 static void rpccli_samr_EnumDomains_done(struct tevent_req *subreq)
1039 {
1040         struct tevent_req *req = tevent_req_callback_data(
1041                 subreq, struct tevent_req);
1042         struct rpccli_samr_EnumDomains_state *state = tevent_req_data(
1043                 req, struct rpccli_samr_EnumDomains_state);
1044         NTSTATUS status;
1045         TALLOC_CTX *mem_ctx;
1046
1047         if (state->out_mem_ctx) {
1048                 mem_ctx = state->out_mem_ctx;
1049         } else {
1050                 mem_ctx = state;
1051         }
1052
1053         status = state->dispatch_recv(subreq, mem_ctx);
1054         TALLOC_FREE(subreq);
1055         if (!NT_STATUS_IS_OK(status)) {
1056                 tevent_req_nterror(req, status);
1057                 return;
1058         }
1059
1060         /* Copy out parameters */
1061         *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
1062         *state->orig.out.sam = *state->tmp.out.sam;
1063         *state->orig.out.num_entries = *state->tmp.out.num_entries;
1064
1065         /* Copy result */
1066         state->orig.out.result = state->tmp.out.result;
1067
1068         /* Reset temporary structure */
1069         ZERO_STRUCT(state->tmp);
1070
1071         if (DEBUGLEVEL >= 10) {
1072                 NDR_PRINT_OUT_DEBUG(samr_EnumDomains, &state->orig);
1073         }
1074
1075         tevent_req_done(req);
1076 }
1077
1078 NTSTATUS rpccli_samr_EnumDomains_recv(struct tevent_req *req,
1079                                       TALLOC_CTX *mem_ctx,
1080                                       NTSTATUS *result)
1081 {
1082         struct rpccli_samr_EnumDomains_state *state = tevent_req_data(
1083                 req, struct rpccli_samr_EnumDomains_state);
1084         NTSTATUS status;
1085
1086         if (tevent_req_is_nterror(req, &status)) {
1087                 tevent_req_received(req);
1088                 return status;
1089         }
1090
1091         /* Steal possbile out parameters to the callers context */
1092         talloc_steal(mem_ctx, state->out_mem_ctx);
1093
1094         /* Return result */
1095         *result = state->orig.out.result;
1096
1097         tevent_req_received(req);
1098         return NT_STATUS_OK;
1099 }
1100
1101 NTSTATUS rpccli_samr_EnumDomains(struct rpc_pipe_client *cli,
1102                                  TALLOC_CTX *mem_ctx,
1103                                  struct policy_handle *connect_handle /* [in] [ref] */,
1104                                  uint32_t *resume_handle /* [in,out] [ref] */,
1105                                  struct samr_SamArray **sam /* [out] [ref] */,
1106                                  uint32_t buf_size /* [in]  */,
1107                                  uint32_t *num_entries /* [out] [ref] */)
1108 {
1109         struct samr_EnumDomains r;
1110         NTSTATUS status;
1111
1112         /* In parameters */
1113         r.in.connect_handle = connect_handle;
1114         r.in.resume_handle = resume_handle;
1115         r.in.buf_size = buf_size;
1116
1117         if (DEBUGLEVEL >= 10) {
1118                 NDR_PRINT_IN_DEBUG(samr_EnumDomains, &r);
1119         }
1120
1121         status = cli->dispatch(cli,
1122                                 mem_ctx,
1123                                 &ndr_table_samr,
1124                                 NDR_SAMR_ENUMDOMAINS,
1125                                 &r);
1126
1127         if (!NT_STATUS_IS_OK(status)) {
1128                 return status;
1129         }
1130
1131         if (DEBUGLEVEL >= 10) {
1132                 NDR_PRINT_OUT_DEBUG(samr_EnumDomains, &r);
1133         }
1134
1135         if (NT_STATUS_IS_ERR(status)) {
1136                 return status;
1137         }
1138
1139         /* Return variables */
1140         *resume_handle = *r.out.resume_handle;
1141         *sam = *r.out.sam;
1142         *num_entries = *r.out.num_entries;
1143
1144         /* Return result */
1145         return r.out.result;
1146 }
1147
1148 struct rpccli_samr_OpenDomain_state {
1149         struct samr_OpenDomain orig;
1150         struct samr_OpenDomain tmp;
1151         TALLOC_CTX *out_mem_ctx;
1152         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1153 };
1154
1155 static void rpccli_samr_OpenDomain_done(struct tevent_req *subreq);
1156
1157 struct tevent_req *rpccli_samr_OpenDomain_send(TALLOC_CTX *mem_ctx,
1158                                                struct tevent_context *ev,
1159                                                struct rpc_pipe_client *cli,
1160                                                struct policy_handle *_connect_handle /* [in] [ref] */,
1161                                                uint32_t _access_mask /* [in]  */,
1162                                                struct dom_sid2 *_sid /* [in] [ref] */,
1163                                                struct policy_handle *_domain_handle /* [out] [ref] */)
1164 {
1165         struct tevent_req *req;
1166         struct rpccli_samr_OpenDomain_state *state;
1167         struct tevent_req *subreq;
1168
1169         req = tevent_req_create(mem_ctx, &state,
1170                                 struct rpccli_samr_OpenDomain_state);
1171         if (req == NULL) {
1172                 return NULL;
1173         }
1174         state->out_mem_ctx = NULL;
1175         state->dispatch_recv = cli->dispatch_recv;
1176
1177         /* In parameters */
1178         state->orig.in.connect_handle = _connect_handle;
1179         state->orig.in.access_mask = _access_mask;
1180         state->orig.in.sid = _sid;
1181
1182         /* Out parameters */
1183         state->orig.out.domain_handle = _domain_handle;
1184
1185         /* Result */
1186         ZERO_STRUCT(state->orig.out.result);
1187
1188         if (DEBUGLEVEL >= 10) {
1189                 NDR_PRINT_IN_DEBUG(samr_OpenDomain, &state->orig);
1190         }
1191
1192         state->out_mem_ctx = talloc_named_const(state, 0,
1193                              "rpccli_samr_OpenDomain_out_memory");
1194         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1195                 return tevent_req_post(req, ev);
1196         }
1197
1198         /* make a temporary copy, that we pass to the dispatch function */
1199         state->tmp = state->orig;
1200
1201         subreq = cli->dispatch_send(state, ev, cli,
1202                                     &ndr_table_samr,
1203                                     NDR_SAMR_OPENDOMAIN,
1204                                     &state->tmp);
1205         if (tevent_req_nomem(subreq, req)) {
1206                 return tevent_req_post(req, ev);
1207         }
1208         tevent_req_set_callback(subreq, rpccli_samr_OpenDomain_done, req);
1209         return req;
1210 }
1211
1212 static void rpccli_samr_OpenDomain_done(struct tevent_req *subreq)
1213 {
1214         struct tevent_req *req = tevent_req_callback_data(
1215                 subreq, struct tevent_req);
1216         struct rpccli_samr_OpenDomain_state *state = tevent_req_data(
1217                 req, struct rpccli_samr_OpenDomain_state);
1218         NTSTATUS status;
1219         TALLOC_CTX *mem_ctx;
1220
1221         if (state->out_mem_ctx) {
1222                 mem_ctx = state->out_mem_ctx;
1223         } else {
1224                 mem_ctx = state;
1225         }
1226
1227         status = state->dispatch_recv(subreq, mem_ctx);
1228         TALLOC_FREE(subreq);
1229         if (!NT_STATUS_IS_OK(status)) {
1230                 tevent_req_nterror(req, status);
1231                 return;
1232         }
1233
1234         /* Copy out parameters */
1235         *state->orig.out.domain_handle = *state->tmp.out.domain_handle;
1236
1237         /* Copy result */
1238         state->orig.out.result = state->tmp.out.result;
1239
1240         /* Reset temporary structure */
1241         ZERO_STRUCT(state->tmp);
1242
1243         if (DEBUGLEVEL >= 10) {
1244                 NDR_PRINT_OUT_DEBUG(samr_OpenDomain, &state->orig);
1245         }
1246
1247         tevent_req_done(req);
1248 }
1249
1250 NTSTATUS rpccli_samr_OpenDomain_recv(struct tevent_req *req,
1251                                      TALLOC_CTX *mem_ctx,
1252                                      NTSTATUS *result)
1253 {
1254         struct rpccli_samr_OpenDomain_state *state = tevent_req_data(
1255                 req, struct rpccli_samr_OpenDomain_state);
1256         NTSTATUS status;
1257
1258         if (tevent_req_is_nterror(req, &status)) {
1259                 tevent_req_received(req);
1260                 return status;
1261         }
1262
1263         /* Steal possbile out parameters to the callers context */
1264         talloc_steal(mem_ctx, state->out_mem_ctx);
1265
1266         /* Return result */
1267         *result = state->orig.out.result;
1268
1269         tevent_req_received(req);
1270         return NT_STATUS_OK;
1271 }
1272
1273 NTSTATUS rpccli_samr_OpenDomain(struct rpc_pipe_client *cli,
1274                                 TALLOC_CTX *mem_ctx,
1275                                 struct policy_handle *connect_handle /* [in] [ref] */,
1276                                 uint32_t access_mask /* [in]  */,
1277                                 struct dom_sid2 *sid /* [in] [ref] */,
1278                                 struct policy_handle *domain_handle /* [out] [ref] */)
1279 {
1280         struct samr_OpenDomain r;
1281         NTSTATUS status;
1282
1283         /* In parameters */
1284         r.in.connect_handle = connect_handle;
1285         r.in.access_mask = access_mask;
1286         r.in.sid = sid;
1287
1288         if (DEBUGLEVEL >= 10) {
1289                 NDR_PRINT_IN_DEBUG(samr_OpenDomain, &r);
1290         }
1291
1292         status = cli->dispatch(cli,
1293                                 mem_ctx,
1294                                 &ndr_table_samr,
1295                                 NDR_SAMR_OPENDOMAIN,
1296                                 &r);
1297
1298         if (!NT_STATUS_IS_OK(status)) {
1299                 return status;
1300         }
1301
1302         if (DEBUGLEVEL >= 10) {
1303                 NDR_PRINT_OUT_DEBUG(samr_OpenDomain, &r);
1304         }
1305
1306         if (NT_STATUS_IS_ERR(status)) {
1307                 return status;
1308         }
1309
1310         /* Return variables */
1311         *domain_handle = *r.out.domain_handle;
1312
1313         /* Return result */
1314         return r.out.result;
1315 }
1316
1317 struct rpccli_samr_QueryDomainInfo_state {
1318         struct samr_QueryDomainInfo orig;
1319         struct samr_QueryDomainInfo tmp;
1320         TALLOC_CTX *out_mem_ctx;
1321         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1322 };
1323
1324 static void rpccli_samr_QueryDomainInfo_done(struct tevent_req *subreq);
1325
1326 struct tevent_req *rpccli_samr_QueryDomainInfo_send(TALLOC_CTX *mem_ctx,
1327                                                     struct tevent_context *ev,
1328                                                     struct rpc_pipe_client *cli,
1329                                                     struct policy_handle *_domain_handle /* [in] [ref] */,
1330                                                     enum samr_DomainInfoClass _level /* [in]  */,
1331                                                     union samr_DomainInfo **_info /* [out] [ref,switch_is(level)] */)
1332 {
1333         struct tevent_req *req;
1334         struct rpccli_samr_QueryDomainInfo_state *state;
1335         struct tevent_req *subreq;
1336
1337         req = tevent_req_create(mem_ctx, &state,
1338                                 struct rpccli_samr_QueryDomainInfo_state);
1339         if (req == NULL) {
1340                 return NULL;
1341         }
1342         state->out_mem_ctx = NULL;
1343         state->dispatch_recv = cli->dispatch_recv;
1344
1345         /* In parameters */
1346         state->orig.in.domain_handle = _domain_handle;
1347         state->orig.in.level = _level;
1348
1349         /* Out parameters */
1350         state->orig.out.info = _info;
1351
1352         /* Result */
1353         ZERO_STRUCT(state->orig.out.result);
1354
1355         if (DEBUGLEVEL >= 10) {
1356                 NDR_PRINT_IN_DEBUG(samr_QueryDomainInfo, &state->orig);
1357         }
1358
1359         state->out_mem_ctx = talloc_named_const(state, 0,
1360                              "rpccli_samr_QueryDomainInfo_out_memory");
1361         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1362                 return tevent_req_post(req, ev);
1363         }
1364
1365         /* make a temporary copy, that we pass to the dispatch function */
1366         state->tmp = state->orig;
1367
1368         subreq = cli->dispatch_send(state, ev, cli,
1369                                     &ndr_table_samr,
1370                                     NDR_SAMR_QUERYDOMAININFO,
1371                                     &state->tmp);
1372         if (tevent_req_nomem(subreq, req)) {
1373                 return tevent_req_post(req, ev);
1374         }
1375         tevent_req_set_callback(subreq, rpccli_samr_QueryDomainInfo_done, req);
1376         return req;
1377 }
1378
1379 static void rpccli_samr_QueryDomainInfo_done(struct tevent_req *subreq)
1380 {
1381         struct tevent_req *req = tevent_req_callback_data(
1382                 subreq, struct tevent_req);
1383         struct rpccli_samr_QueryDomainInfo_state *state = tevent_req_data(
1384                 req, struct rpccli_samr_QueryDomainInfo_state);
1385         NTSTATUS status;
1386         TALLOC_CTX *mem_ctx;
1387
1388         if (state->out_mem_ctx) {
1389                 mem_ctx = state->out_mem_ctx;
1390         } else {
1391                 mem_ctx = state;
1392         }
1393
1394         status = state->dispatch_recv(subreq, mem_ctx);
1395         TALLOC_FREE(subreq);
1396         if (!NT_STATUS_IS_OK(status)) {
1397                 tevent_req_nterror(req, status);
1398                 return;
1399         }
1400
1401         /* Copy out parameters */
1402         *state->orig.out.info = *state->tmp.out.info;
1403
1404         /* Copy result */
1405         state->orig.out.result = state->tmp.out.result;
1406
1407         /* Reset temporary structure */
1408         ZERO_STRUCT(state->tmp);
1409
1410         if (DEBUGLEVEL >= 10) {
1411                 NDR_PRINT_OUT_DEBUG(samr_QueryDomainInfo, &state->orig);
1412         }
1413
1414         tevent_req_done(req);
1415 }
1416
1417 NTSTATUS rpccli_samr_QueryDomainInfo_recv(struct tevent_req *req,
1418                                           TALLOC_CTX *mem_ctx,
1419                                           NTSTATUS *result)
1420 {
1421         struct rpccli_samr_QueryDomainInfo_state *state = tevent_req_data(
1422                 req, struct rpccli_samr_QueryDomainInfo_state);
1423         NTSTATUS status;
1424
1425         if (tevent_req_is_nterror(req, &status)) {
1426                 tevent_req_received(req);
1427                 return status;
1428         }
1429
1430         /* Steal possbile out parameters to the callers context */
1431         talloc_steal(mem_ctx, state->out_mem_ctx);
1432
1433         /* Return result */
1434         *result = state->orig.out.result;
1435
1436         tevent_req_received(req);
1437         return NT_STATUS_OK;
1438 }
1439
1440 NTSTATUS rpccli_samr_QueryDomainInfo(struct rpc_pipe_client *cli,
1441                                      TALLOC_CTX *mem_ctx,
1442                                      struct policy_handle *domain_handle /* [in] [ref] */,
1443                                      enum samr_DomainInfoClass level /* [in]  */,
1444                                      union samr_DomainInfo **info /* [out] [ref,switch_is(level)] */)
1445 {
1446         struct samr_QueryDomainInfo r;
1447         NTSTATUS status;
1448
1449         /* In parameters */
1450         r.in.domain_handle = domain_handle;
1451         r.in.level = level;
1452
1453         if (DEBUGLEVEL >= 10) {
1454                 NDR_PRINT_IN_DEBUG(samr_QueryDomainInfo, &r);
1455         }
1456
1457         status = cli->dispatch(cli,
1458                                 mem_ctx,
1459                                 &ndr_table_samr,
1460                                 NDR_SAMR_QUERYDOMAININFO,
1461                                 &r);
1462
1463         if (!NT_STATUS_IS_OK(status)) {
1464                 return status;
1465         }
1466
1467         if (DEBUGLEVEL >= 10) {
1468                 NDR_PRINT_OUT_DEBUG(samr_QueryDomainInfo, &r);
1469         }
1470
1471         if (NT_STATUS_IS_ERR(status)) {
1472                 return status;
1473         }
1474
1475         /* Return variables */
1476         *info = *r.out.info;
1477
1478         /* Return result */
1479         return r.out.result;
1480 }
1481
1482 struct rpccli_samr_SetDomainInfo_state {
1483         struct samr_SetDomainInfo orig;
1484         struct samr_SetDomainInfo tmp;
1485         TALLOC_CTX *out_mem_ctx;
1486         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1487 };
1488
1489 static void rpccli_samr_SetDomainInfo_done(struct tevent_req *subreq);
1490
1491 struct tevent_req *rpccli_samr_SetDomainInfo_send(TALLOC_CTX *mem_ctx,
1492                                                   struct tevent_context *ev,
1493                                                   struct rpc_pipe_client *cli,
1494                                                   struct policy_handle *_domain_handle /* [in] [ref] */,
1495                                                   enum samr_DomainInfoClass _level /* [in]  */,
1496                                                   union samr_DomainInfo *_info /* [in] [ref,switch_is(level)] */)
1497 {
1498         struct tevent_req *req;
1499         struct rpccli_samr_SetDomainInfo_state *state;
1500         struct tevent_req *subreq;
1501
1502         req = tevent_req_create(mem_ctx, &state,
1503                                 struct rpccli_samr_SetDomainInfo_state);
1504         if (req == NULL) {
1505                 return NULL;
1506         }
1507         state->out_mem_ctx = NULL;
1508         state->dispatch_recv = cli->dispatch_recv;
1509
1510         /* In parameters */
1511         state->orig.in.domain_handle = _domain_handle;
1512         state->orig.in.level = _level;
1513         state->orig.in.info = _info;
1514
1515         /* Out parameters */
1516
1517         /* Result */
1518         ZERO_STRUCT(state->orig.out.result);
1519
1520         if (DEBUGLEVEL >= 10) {
1521                 NDR_PRINT_IN_DEBUG(samr_SetDomainInfo, &state->orig);
1522         }
1523
1524         /* make a temporary copy, that we pass to the dispatch function */
1525         state->tmp = state->orig;
1526
1527         subreq = cli->dispatch_send(state, ev, cli,
1528                                     &ndr_table_samr,
1529                                     NDR_SAMR_SETDOMAININFO,
1530                                     &state->tmp);
1531         if (tevent_req_nomem(subreq, req)) {
1532                 return tevent_req_post(req, ev);
1533         }
1534         tevent_req_set_callback(subreq, rpccli_samr_SetDomainInfo_done, req);
1535         return req;
1536 }
1537
1538 static void rpccli_samr_SetDomainInfo_done(struct tevent_req *subreq)
1539 {
1540         struct tevent_req *req = tevent_req_callback_data(
1541                 subreq, struct tevent_req);
1542         struct rpccli_samr_SetDomainInfo_state *state = tevent_req_data(
1543                 req, struct rpccli_samr_SetDomainInfo_state);
1544         NTSTATUS status;
1545         TALLOC_CTX *mem_ctx;
1546
1547         if (state->out_mem_ctx) {
1548                 mem_ctx = state->out_mem_ctx;
1549         } else {
1550                 mem_ctx = state;
1551         }
1552
1553         status = state->dispatch_recv(subreq, mem_ctx);
1554         TALLOC_FREE(subreq);
1555         if (!NT_STATUS_IS_OK(status)) {
1556                 tevent_req_nterror(req, status);
1557                 return;
1558         }
1559
1560         /* Copy out parameters */
1561
1562         /* Copy result */
1563         state->orig.out.result = state->tmp.out.result;
1564
1565         /* Reset temporary structure */
1566         ZERO_STRUCT(state->tmp);
1567
1568         if (DEBUGLEVEL >= 10) {
1569                 NDR_PRINT_OUT_DEBUG(samr_SetDomainInfo, &state->orig);
1570         }
1571
1572         tevent_req_done(req);
1573 }
1574
1575 NTSTATUS rpccli_samr_SetDomainInfo_recv(struct tevent_req *req,
1576                                         TALLOC_CTX *mem_ctx,
1577                                         NTSTATUS *result)
1578 {
1579         struct rpccli_samr_SetDomainInfo_state *state = tevent_req_data(
1580                 req, struct rpccli_samr_SetDomainInfo_state);
1581         NTSTATUS status;
1582
1583         if (tevent_req_is_nterror(req, &status)) {
1584                 tevent_req_received(req);
1585                 return status;
1586         }
1587
1588         /* Steal possbile out parameters to the callers context */
1589         talloc_steal(mem_ctx, state->out_mem_ctx);
1590
1591         /* Return result */
1592         *result = state->orig.out.result;
1593
1594         tevent_req_received(req);
1595         return NT_STATUS_OK;
1596 }
1597
1598 NTSTATUS rpccli_samr_SetDomainInfo(struct rpc_pipe_client *cli,
1599                                    TALLOC_CTX *mem_ctx,
1600                                    struct policy_handle *domain_handle /* [in] [ref] */,
1601                                    enum samr_DomainInfoClass level /* [in]  */,
1602                                    union samr_DomainInfo *info /* [in] [ref,switch_is(level)] */)
1603 {
1604         struct samr_SetDomainInfo r;
1605         NTSTATUS status;
1606
1607         /* In parameters */
1608         r.in.domain_handle = domain_handle;
1609         r.in.level = level;
1610         r.in.info = info;
1611
1612         if (DEBUGLEVEL >= 10) {
1613                 NDR_PRINT_IN_DEBUG(samr_SetDomainInfo, &r);
1614         }
1615
1616         status = cli->dispatch(cli,
1617                                 mem_ctx,
1618                                 &ndr_table_samr,
1619                                 NDR_SAMR_SETDOMAININFO,
1620                                 &r);
1621
1622         if (!NT_STATUS_IS_OK(status)) {
1623                 return status;
1624         }
1625
1626         if (DEBUGLEVEL >= 10) {
1627                 NDR_PRINT_OUT_DEBUG(samr_SetDomainInfo, &r);
1628         }
1629
1630         if (NT_STATUS_IS_ERR(status)) {
1631                 return status;
1632         }
1633
1634         /* Return variables */
1635
1636         /* Return result */
1637         return r.out.result;
1638 }
1639
1640 struct rpccli_samr_CreateDomainGroup_state {
1641         struct samr_CreateDomainGroup orig;
1642         struct samr_CreateDomainGroup tmp;
1643         TALLOC_CTX *out_mem_ctx;
1644         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1645 };
1646
1647 static void rpccli_samr_CreateDomainGroup_done(struct tevent_req *subreq);
1648
1649 struct tevent_req *rpccli_samr_CreateDomainGroup_send(TALLOC_CTX *mem_ctx,
1650                                                       struct tevent_context *ev,
1651                                                       struct rpc_pipe_client *cli,
1652                                                       struct policy_handle *_domain_handle /* [in] [ref] */,
1653                                                       struct lsa_String *_name /* [in] [ref] */,
1654                                                       uint32_t _access_mask /* [in]  */,
1655                                                       struct policy_handle *_group_handle /* [out] [ref] */,
1656                                                       uint32_t *_rid /* [out] [ref] */)
1657 {
1658         struct tevent_req *req;
1659         struct rpccli_samr_CreateDomainGroup_state *state;
1660         struct tevent_req *subreq;
1661
1662         req = tevent_req_create(mem_ctx, &state,
1663                                 struct rpccli_samr_CreateDomainGroup_state);
1664         if (req == NULL) {
1665                 return NULL;
1666         }
1667         state->out_mem_ctx = NULL;
1668         state->dispatch_recv = cli->dispatch_recv;
1669
1670         /* In parameters */
1671         state->orig.in.domain_handle = _domain_handle;
1672         state->orig.in.name = _name;
1673         state->orig.in.access_mask = _access_mask;
1674
1675         /* Out parameters */
1676         state->orig.out.group_handle = _group_handle;
1677         state->orig.out.rid = _rid;
1678
1679         /* Result */
1680         ZERO_STRUCT(state->orig.out.result);
1681
1682         if (DEBUGLEVEL >= 10) {
1683                 NDR_PRINT_IN_DEBUG(samr_CreateDomainGroup, &state->orig);
1684         }
1685
1686         state->out_mem_ctx = talloc_named_const(state, 0,
1687                              "rpccli_samr_CreateDomainGroup_out_memory");
1688         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1689                 return tevent_req_post(req, ev);
1690         }
1691
1692         /* make a temporary copy, that we pass to the dispatch function */
1693         state->tmp = state->orig;
1694
1695         subreq = cli->dispatch_send(state, ev, cli,
1696                                     &ndr_table_samr,
1697                                     NDR_SAMR_CREATEDOMAINGROUP,
1698                                     &state->tmp);
1699         if (tevent_req_nomem(subreq, req)) {
1700                 return tevent_req_post(req, ev);
1701         }
1702         tevent_req_set_callback(subreq, rpccli_samr_CreateDomainGroup_done, req);
1703         return req;
1704 }
1705
1706 static void rpccli_samr_CreateDomainGroup_done(struct tevent_req *subreq)
1707 {
1708         struct tevent_req *req = tevent_req_callback_data(
1709                 subreq, struct tevent_req);
1710         struct rpccli_samr_CreateDomainGroup_state *state = tevent_req_data(
1711                 req, struct rpccli_samr_CreateDomainGroup_state);
1712         NTSTATUS status;
1713         TALLOC_CTX *mem_ctx;
1714
1715         if (state->out_mem_ctx) {
1716                 mem_ctx = state->out_mem_ctx;
1717         } else {
1718                 mem_ctx = state;
1719         }
1720
1721         status = state->dispatch_recv(subreq, mem_ctx);
1722         TALLOC_FREE(subreq);
1723         if (!NT_STATUS_IS_OK(status)) {
1724                 tevent_req_nterror(req, status);
1725                 return;
1726         }
1727
1728         /* Copy out parameters */
1729         *state->orig.out.group_handle = *state->tmp.out.group_handle;
1730         *state->orig.out.rid = *state->tmp.out.rid;
1731
1732         /* Copy result */
1733         state->orig.out.result = state->tmp.out.result;
1734
1735         /* Reset temporary structure */
1736         ZERO_STRUCT(state->tmp);
1737
1738         if (DEBUGLEVEL >= 10) {
1739                 NDR_PRINT_OUT_DEBUG(samr_CreateDomainGroup, &state->orig);
1740         }
1741
1742         tevent_req_done(req);
1743 }
1744
1745 NTSTATUS rpccli_samr_CreateDomainGroup_recv(struct tevent_req *req,
1746                                             TALLOC_CTX *mem_ctx,
1747                                             NTSTATUS *result)
1748 {
1749         struct rpccli_samr_CreateDomainGroup_state *state = tevent_req_data(
1750                 req, struct rpccli_samr_CreateDomainGroup_state);
1751         NTSTATUS status;
1752
1753         if (tevent_req_is_nterror(req, &status)) {
1754                 tevent_req_received(req);
1755                 return status;
1756         }
1757
1758         /* Steal possbile out parameters to the callers context */
1759         talloc_steal(mem_ctx, state->out_mem_ctx);
1760
1761         /* Return result */
1762         *result = state->orig.out.result;
1763
1764         tevent_req_received(req);
1765         return NT_STATUS_OK;
1766 }
1767
1768 NTSTATUS rpccli_samr_CreateDomainGroup(struct rpc_pipe_client *cli,
1769                                        TALLOC_CTX *mem_ctx,
1770                                        struct policy_handle *domain_handle /* [in] [ref] */,
1771                                        struct lsa_String *name /* [in] [ref] */,
1772                                        uint32_t access_mask /* [in]  */,
1773                                        struct policy_handle *group_handle /* [out] [ref] */,
1774                                        uint32_t *rid /* [out] [ref] */)
1775 {
1776         struct samr_CreateDomainGroup r;
1777         NTSTATUS status;
1778
1779         /* In parameters */
1780         r.in.domain_handle = domain_handle;
1781         r.in.name = name;
1782         r.in.access_mask = access_mask;
1783
1784         if (DEBUGLEVEL >= 10) {
1785                 NDR_PRINT_IN_DEBUG(samr_CreateDomainGroup, &r);
1786         }
1787
1788         status = cli->dispatch(cli,
1789                                 mem_ctx,
1790                                 &ndr_table_samr,
1791                                 NDR_SAMR_CREATEDOMAINGROUP,
1792                                 &r);
1793
1794         if (!NT_STATUS_IS_OK(status)) {
1795                 return status;
1796         }
1797
1798         if (DEBUGLEVEL >= 10) {
1799                 NDR_PRINT_OUT_DEBUG(samr_CreateDomainGroup, &r);
1800         }
1801
1802         if (NT_STATUS_IS_ERR(status)) {
1803                 return status;
1804         }
1805
1806         /* Return variables */
1807         *group_handle = *r.out.group_handle;
1808         *rid = *r.out.rid;
1809
1810         /* Return result */
1811         return r.out.result;
1812 }
1813
1814 struct rpccli_samr_EnumDomainGroups_state {
1815         struct samr_EnumDomainGroups orig;
1816         struct samr_EnumDomainGroups tmp;
1817         TALLOC_CTX *out_mem_ctx;
1818         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1819 };
1820
1821 static void rpccli_samr_EnumDomainGroups_done(struct tevent_req *subreq);
1822
1823 struct tevent_req *rpccli_samr_EnumDomainGroups_send(TALLOC_CTX *mem_ctx,
1824                                                      struct tevent_context *ev,
1825                                                      struct rpc_pipe_client *cli,
1826                                                      struct policy_handle *_domain_handle /* [in] [ref] */,
1827                                                      uint32_t *_resume_handle /* [in,out] [ref] */,
1828                                                      struct samr_SamArray **_sam /* [out] [ref] */,
1829                                                      uint32_t _max_size /* [in]  */,
1830                                                      uint32_t *_num_entries /* [out] [ref] */)
1831 {
1832         struct tevent_req *req;
1833         struct rpccli_samr_EnumDomainGroups_state *state;
1834         struct tevent_req *subreq;
1835
1836         req = tevent_req_create(mem_ctx, &state,
1837                                 struct rpccli_samr_EnumDomainGroups_state);
1838         if (req == NULL) {
1839                 return NULL;
1840         }
1841         state->out_mem_ctx = NULL;
1842         state->dispatch_recv = cli->dispatch_recv;
1843
1844         /* In parameters */
1845         state->orig.in.domain_handle = _domain_handle;
1846         state->orig.in.resume_handle = _resume_handle;
1847         state->orig.in.max_size = _max_size;
1848
1849         /* Out parameters */
1850         state->orig.out.resume_handle = _resume_handle;
1851         state->orig.out.sam = _sam;
1852         state->orig.out.num_entries = _num_entries;
1853
1854         /* Result */
1855         ZERO_STRUCT(state->orig.out.result);
1856
1857         if (DEBUGLEVEL >= 10) {
1858                 NDR_PRINT_IN_DEBUG(samr_EnumDomainGroups, &state->orig);
1859         }
1860
1861         state->out_mem_ctx = talloc_named_const(state, 0,
1862                              "rpccli_samr_EnumDomainGroups_out_memory");
1863         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1864                 return tevent_req_post(req, ev);
1865         }
1866
1867         /* make a temporary copy, that we pass to the dispatch function */
1868         state->tmp = state->orig;
1869
1870         subreq = cli->dispatch_send(state, ev, cli,
1871                                     &ndr_table_samr,
1872                                     NDR_SAMR_ENUMDOMAINGROUPS,
1873                                     &state->tmp);
1874         if (tevent_req_nomem(subreq, req)) {
1875                 return tevent_req_post(req, ev);
1876         }
1877         tevent_req_set_callback(subreq, rpccli_samr_EnumDomainGroups_done, req);
1878         return req;
1879 }
1880
1881 static void rpccli_samr_EnumDomainGroups_done(struct tevent_req *subreq)
1882 {
1883         struct tevent_req *req = tevent_req_callback_data(
1884                 subreq, struct tevent_req);
1885         struct rpccli_samr_EnumDomainGroups_state *state = tevent_req_data(
1886                 req, struct rpccli_samr_EnumDomainGroups_state);
1887         NTSTATUS status;
1888         TALLOC_CTX *mem_ctx;
1889
1890         if (state->out_mem_ctx) {
1891                 mem_ctx = state->out_mem_ctx;
1892         } else {
1893                 mem_ctx = state;
1894         }
1895
1896         status = state->dispatch_recv(subreq, mem_ctx);
1897         TALLOC_FREE(subreq);
1898         if (!NT_STATUS_IS_OK(status)) {
1899                 tevent_req_nterror(req, status);
1900                 return;
1901         }
1902
1903         /* Copy out parameters */
1904         *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
1905         *state->orig.out.sam = *state->tmp.out.sam;
1906         *state->orig.out.num_entries = *state->tmp.out.num_entries;
1907
1908         /* Copy result */
1909         state->orig.out.result = state->tmp.out.result;
1910
1911         /* Reset temporary structure */
1912         ZERO_STRUCT(state->tmp);
1913
1914         if (DEBUGLEVEL >= 10) {
1915                 NDR_PRINT_OUT_DEBUG(samr_EnumDomainGroups, &state->orig);
1916         }
1917
1918         tevent_req_done(req);
1919 }
1920
1921 NTSTATUS rpccli_samr_EnumDomainGroups_recv(struct tevent_req *req,
1922                                            TALLOC_CTX *mem_ctx,
1923                                            NTSTATUS *result)
1924 {
1925         struct rpccli_samr_EnumDomainGroups_state *state = tevent_req_data(
1926                 req, struct rpccli_samr_EnumDomainGroups_state);
1927         NTSTATUS status;
1928
1929         if (tevent_req_is_nterror(req, &status)) {
1930                 tevent_req_received(req);
1931                 return status;
1932         }
1933
1934         /* Steal possbile out parameters to the callers context */
1935         talloc_steal(mem_ctx, state->out_mem_ctx);
1936
1937         /* Return result */
1938         *result = state->orig.out.result;
1939
1940         tevent_req_received(req);
1941         return NT_STATUS_OK;
1942 }
1943
1944 NTSTATUS rpccli_samr_EnumDomainGroups(struct rpc_pipe_client *cli,
1945                                       TALLOC_CTX *mem_ctx,
1946                                       struct policy_handle *domain_handle /* [in] [ref] */,
1947                                       uint32_t *resume_handle /* [in,out] [ref] */,
1948                                       struct samr_SamArray **sam /* [out] [ref] */,
1949                                       uint32_t max_size /* [in]  */,
1950                                       uint32_t *num_entries /* [out] [ref] */)
1951 {
1952         struct samr_EnumDomainGroups r;
1953         NTSTATUS status;
1954
1955         /* In parameters */
1956         r.in.domain_handle = domain_handle;
1957         r.in.resume_handle = resume_handle;
1958         r.in.max_size = max_size;
1959
1960         if (DEBUGLEVEL >= 10) {
1961                 NDR_PRINT_IN_DEBUG(samr_EnumDomainGroups, &r);
1962         }
1963
1964         status = cli->dispatch(cli,
1965                                 mem_ctx,
1966                                 &ndr_table_samr,
1967                                 NDR_SAMR_ENUMDOMAINGROUPS,
1968                                 &r);
1969
1970         if (!NT_STATUS_IS_OK(status)) {
1971                 return status;
1972         }
1973
1974         if (DEBUGLEVEL >= 10) {
1975                 NDR_PRINT_OUT_DEBUG(samr_EnumDomainGroups, &r);
1976         }
1977
1978         if (NT_STATUS_IS_ERR(status)) {
1979                 return status;
1980         }
1981
1982         /* Return variables */
1983         *resume_handle = *r.out.resume_handle;
1984         *sam = *r.out.sam;
1985         *num_entries = *r.out.num_entries;
1986
1987         /* Return result */
1988         return r.out.result;
1989 }
1990
1991 struct rpccli_samr_CreateUser_state {
1992         struct samr_CreateUser orig;
1993         struct samr_CreateUser tmp;
1994         TALLOC_CTX *out_mem_ctx;
1995         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1996 };
1997
1998 static void rpccli_samr_CreateUser_done(struct tevent_req *subreq);
1999
2000 struct tevent_req *rpccli_samr_CreateUser_send(TALLOC_CTX *mem_ctx,
2001                                                struct tevent_context *ev,
2002                                                struct rpc_pipe_client *cli,
2003                                                struct policy_handle *_domain_handle /* [in] [ref] */,
2004                                                struct lsa_String *_account_name /* [in] [ref] */,
2005                                                uint32_t _access_mask /* [in]  */,
2006                                                struct policy_handle *_user_handle /* [out] [ref] */,
2007                                                uint32_t *_rid /* [out] [ref] */)
2008 {
2009         struct tevent_req *req;
2010         struct rpccli_samr_CreateUser_state *state;
2011         struct tevent_req *subreq;
2012
2013         req = tevent_req_create(mem_ctx, &state,
2014                                 struct rpccli_samr_CreateUser_state);
2015         if (req == NULL) {
2016                 return NULL;
2017         }
2018         state->out_mem_ctx = NULL;
2019         state->dispatch_recv = cli->dispatch_recv;
2020
2021         /* In parameters */
2022         state->orig.in.domain_handle = _domain_handle;
2023         state->orig.in.account_name = _account_name;
2024         state->orig.in.access_mask = _access_mask;
2025
2026         /* Out parameters */
2027         state->orig.out.user_handle = _user_handle;
2028         state->orig.out.rid = _rid;
2029
2030         /* Result */
2031         ZERO_STRUCT(state->orig.out.result);
2032
2033         if (DEBUGLEVEL >= 10) {
2034                 NDR_PRINT_IN_DEBUG(samr_CreateUser, &state->orig);
2035         }
2036
2037         state->out_mem_ctx = talloc_named_const(state, 0,
2038                              "rpccli_samr_CreateUser_out_memory");
2039         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2040                 return tevent_req_post(req, ev);
2041         }
2042
2043         /* make a temporary copy, that we pass to the dispatch function */
2044         state->tmp = state->orig;
2045
2046         subreq = cli->dispatch_send(state, ev, cli,
2047                                     &ndr_table_samr,
2048                                     NDR_SAMR_CREATEUSER,
2049                                     &state->tmp);
2050         if (tevent_req_nomem(subreq, req)) {
2051                 return tevent_req_post(req, ev);
2052         }
2053         tevent_req_set_callback(subreq, rpccli_samr_CreateUser_done, req);
2054         return req;
2055 }
2056
2057 static void rpccli_samr_CreateUser_done(struct tevent_req *subreq)
2058 {
2059         struct tevent_req *req = tevent_req_callback_data(
2060                 subreq, struct tevent_req);
2061         struct rpccli_samr_CreateUser_state *state = tevent_req_data(
2062                 req, struct rpccli_samr_CreateUser_state);
2063         NTSTATUS status;
2064         TALLOC_CTX *mem_ctx;
2065
2066         if (state->out_mem_ctx) {
2067                 mem_ctx = state->out_mem_ctx;
2068         } else {
2069                 mem_ctx = state;
2070         }
2071
2072         status = state->dispatch_recv(subreq, mem_ctx);
2073         TALLOC_FREE(subreq);
2074         if (!NT_STATUS_IS_OK(status)) {
2075                 tevent_req_nterror(req, status);
2076                 return;
2077         }
2078
2079         /* Copy out parameters */
2080         *state->orig.out.user_handle = *state->tmp.out.user_handle;
2081         *state->orig.out.rid = *state->tmp.out.rid;
2082
2083         /* Copy result */
2084         state->orig.out.result = state->tmp.out.result;
2085
2086         /* Reset temporary structure */
2087         ZERO_STRUCT(state->tmp);
2088
2089         if (DEBUGLEVEL >= 10) {
2090                 NDR_PRINT_OUT_DEBUG(samr_CreateUser, &state->orig);
2091         }
2092
2093         tevent_req_done(req);
2094 }
2095
2096 NTSTATUS rpccli_samr_CreateUser_recv(struct tevent_req *req,
2097                                      TALLOC_CTX *mem_ctx,
2098                                      NTSTATUS *result)
2099 {
2100         struct rpccli_samr_CreateUser_state *state = tevent_req_data(
2101                 req, struct rpccli_samr_CreateUser_state);
2102         NTSTATUS status;
2103
2104         if (tevent_req_is_nterror(req, &status)) {
2105                 tevent_req_received(req);
2106                 return status;
2107         }
2108
2109         /* Steal possbile out parameters to the callers context */
2110         talloc_steal(mem_ctx, state->out_mem_ctx);
2111
2112         /* Return result */
2113         *result = state->orig.out.result;
2114
2115         tevent_req_received(req);
2116         return NT_STATUS_OK;
2117 }
2118
2119 NTSTATUS rpccli_samr_CreateUser(struct rpc_pipe_client *cli,
2120                                 TALLOC_CTX *mem_ctx,
2121                                 struct policy_handle *domain_handle /* [in] [ref] */,
2122                                 struct lsa_String *account_name /* [in] [ref] */,
2123                                 uint32_t access_mask /* [in]  */,
2124                                 struct policy_handle *user_handle /* [out] [ref] */,
2125                                 uint32_t *rid /* [out] [ref] */)
2126 {
2127         struct samr_CreateUser r;
2128         NTSTATUS status;
2129
2130         /* In parameters */
2131         r.in.domain_handle = domain_handle;
2132         r.in.account_name = account_name;
2133         r.in.access_mask = access_mask;
2134
2135         if (DEBUGLEVEL >= 10) {
2136                 NDR_PRINT_IN_DEBUG(samr_CreateUser, &r);
2137         }
2138
2139         status = cli->dispatch(cli,
2140                                 mem_ctx,
2141                                 &ndr_table_samr,
2142                                 NDR_SAMR_CREATEUSER,
2143                                 &r);
2144
2145         if (!NT_STATUS_IS_OK(status)) {
2146                 return status;
2147         }
2148
2149         if (DEBUGLEVEL >= 10) {
2150                 NDR_PRINT_OUT_DEBUG(samr_CreateUser, &r);
2151         }
2152
2153         if (NT_STATUS_IS_ERR(status)) {
2154                 return status;
2155         }
2156
2157         /* Return variables */
2158         *user_handle = *r.out.user_handle;
2159         *rid = *r.out.rid;
2160
2161         /* Return result */
2162         return r.out.result;
2163 }
2164
2165 struct rpccli_samr_EnumDomainUsers_state {
2166         struct samr_EnumDomainUsers orig;
2167         struct samr_EnumDomainUsers tmp;
2168         TALLOC_CTX *out_mem_ctx;
2169         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2170 };
2171
2172 static void rpccli_samr_EnumDomainUsers_done(struct tevent_req *subreq);
2173
2174 struct tevent_req *rpccli_samr_EnumDomainUsers_send(TALLOC_CTX *mem_ctx,
2175                                                     struct tevent_context *ev,
2176                                                     struct rpc_pipe_client *cli,
2177                                                     struct policy_handle *_domain_handle /* [in] [ref] */,
2178                                                     uint32_t *_resume_handle /* [in,out] [ref] */,
2179                                                     uint32_t _acct_flags /* [in]  */,
2180                                                     struct samr_SamArray **_sam /* [out] [ref] */,
2181                                                     uint32_t _max_size /* [in]  */,
2182                                                     uint32_t *_num_entries /* [out] [ref] */)
2183 {
2184         struct tevent_req *req;
2185         struct rpccli_samr_EnumDomainUsers_state *state;
2186         struct tevent_req *subreq;
2187
2188         req = tevent_req_create(mem_ctx, &state,
2189                                 struct rpccli_samr_EnumDomainUsers_state);
2190         if (req == NULL) {
2191                 return NULL;
2192         }
2193         state->out_mem_ctx = NULL;
2194         state->dispatch_recv = cli->dispatch_recv;
2195
2196         /* In parameters */
2197         state->orig.in.domain_handle = _domain_handle;
2198         state->orig.in.resume_handle = _resume_handle;
2199         state->orig.in.acct_flags = _acct_flags;
2200         state->orig.in.max_size = _max_size;
2201
2202         /* Out parameters */
2203         state->orig.out.resume_handle = _resume_handle;
2204         state->orig.out.sam = _sam;
2205         state->orig.out.num_entries = _num_entries;
2206
2207         /* Result */
2208         ZERO_STRUCT(state->orig.out.result);
2209
2210         if (DEBUGLEVEL >= 10) {
2211                 NDR_PRINT_IN_DEBUG(samr_EnumDomainUsers, &state->orig);
2212         }
2213
2214         state->out_mem_ctx = talloc_named_const(state, 0,
2215                              "rpccli_samr_EnumDomainUsers_out_memory");
2216         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2217                 return tevent_req_post(req, ev);
2218         }
2219
2220         /* make a temporary copy, that we pass to the dispatch function */
2221         state->tmp = state->orig;
2222
2223         subreq = cli->dispatch_send(state, ev, cli,
2224                                     &ndr_table_samr,
2225                                     NDR_SAMR_ENUMDOMAINUSERS,
2226                                     &state->tmp);
2227         if (tevent_req_nomem(subreq, req)) {
2228                 return tevent_req_post(req, ev);
2229         }
2230         tevent_req_set_callback(subreq, rpccli_samr_EnumDomainUsers_done, req);
2231         return req;
2232 }
2233
2234 static void rpccli_samr_EnumDomainUsers_done(struct tevent_req *subreq)
2235 {
2236         struct tevent_req *req = tevent_req_callback_data(
2237                 subreq, struct tevent_req);
2238         struct rpccli_samr_EnumDomainUsers_state *state = tevent_req_data(
2239                 req, struct rpccli_samr_EnumDomainUsers_state);
2240         NTSTATUS status;
2241         TALLOC_CTX *mem_ctx;
2242
2243         if (state->out_mem_ctx) {
2244                 mem_ctx = state->out_mem_ctx;
2245         } else {
2246                 mem_ctx = state;
2247         }
2248
2249         status = state->dispatch_recv(subreq, mem_ctx);
2250         TALLOC_FREE(subreq);
2251         if (!NT_STATUS_IS_OK(status)) {
2252                 tevent_req_nterror(req, status);
2253                 return;
2254         }
2255
2256         /* Copy out parameters */
2257         *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
2258         *state->orig.out.sam = *state->tmp.out.sam;
2259         *state->orig.out.num_entries = *state->tmp.out.num_entries;
2260
2261         /* Copy result */
2262         state->orig.out.result = state->tmp.out.result;
2263
2264         /* Reset temporary structure */
2265         ZERO_STRUCT(state->tmp);
2266
2267         if (DEBUGLEVEL >= 10) {
2268                 NDR_PRINT_OUT_DEBUG(samr_EnumDomainUsers, &state->orig);
2269         }
2270
2271         tevent_req_done(req);
2272 }
2273
2274 NTSTATUS rpccli_samr_EnumDomainUsers_recv(struct tevent_req *req,
2275                                           TALLOC_CTX *mem_ctx,
2276                                           NTSTATUS *result)
2277 {
2278         struct rpccli_samr_EnumDomainUsers_state *state = tevent_req_data(
2279                 req, struct rpccli_samr_EnumDomainUsers_state);
2280         NTSTATUS status;
2281
2282         if (tevent_req_is_nterror(req, &status)) {
2283                 tevent_req_received(req);
2284                 return status;
2285         }
2286
2287         /* Steal possbile out parameters to the callers context */
2288         talloc_steal(mem_ctx, state->out_mem_ctx);
2289
2290         /* Return result */
2291         *result = state->orig.out.result;
2292
2293         tevent_req_received(req);
2294         return NT_STATUS_OK;
2295 }
2296
2297 NTSTATUS rpccli_samr_EnumDomainUsers(struct rpc_pipe_client *cli,
2298                                      TALLOC_CTX *mem_ctx,
2299                                      struct policy_handle *domain_handle /* [in] [ref] */,
2300                                      uint32_t *resume_handle /* [in,out] [ref] */,
2301                                      uint32_t acct_flags /* [in]  */,
2302                                      struct samr_SamArray **sam /* [out] [ref] */,
2303                                      uint32_t max_size /* [in]  */,
2304                                      uint32_t *num_entries /* [out] [ref] */)
2305 {
2306         struct samr_EnumDomainUsers r;
2307         NTSTATUS status;
2308
2309         /* In parameters */
2310         r.in.domain_handle = domain_handle;
2311         r.in.resume_handle = resume_handle;
2312         r.in.acct_flags = acct_flags;
2313         r.in.max_size = max_size;
2314
2315         if (DEBUGLEVEL >= 10) {
2316                 NDR_PRINT_IN_DEBUG(samr_EnumDomainUsers, &r);
2317         }
2318
2319         status = cli->dispatch(cli,
2320                                 mem_ctx,
2321                                 &ndr_table_samr,
2322                                 NDR_SAMR_ENUMDOMAINUSERS,
2323                                 &r);
2324
2325         if (!NT_STATUS_IS_OK(status)) {
2326                 return status;
2327         }
2328
2329         if (DEBUGLEVEL >= 10) {
2330                 NDR_PRINT_OUT_DEBUG(samr_EnumDomainUsers, &r);
2331         }
2332
2333         if (NT_STATUS_IS_ERR(status)) {
2334                 return status;
2335         }
2336
2337         /* Return variables */
2338         *resume_handle = *r.out.resume_handle;
2339         *sam = *r.out.sam;
2340         *num_entries = *r.out.num_entries;
2341
2342         /* Return result */
2343         return r.out.result;
2344 }
2345
2346 struct rpccli_samr_CreateDomAlias_state {
2347         struct samr_CreateDomAlias orig;
2348         struct samr_CreateDomAlias tmp;
2349         TALLOC_CTX *out_mem_ctx;
2350         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2351 };
2352
2353 static void rpccli_samr_CreateDomAlias_done(struct tevent_req *subreq);
2354
2355 struct tevent_req *rpccli_samr_CreateDomAlias_send(TALLOC_CTX *mem_ctx,
2356                                                    struct tevent_context *ev,
2357                                                    struct rpc_pipe_client *cli,
2358                                                    struct policy_handle *_domain_handle /* [in] [ref] */,
2359                                                    struct lsa_String *_alias_name /* [in] [ref] */,
2360                                                    uint32_t _access_mask /* [in]  */,
2361                                                    struct policy_handle *_alias_handle /* [out] [ref] */,
2362                                                    uint32_t *_rid /* [out] [ref] */)
2363 {
2364         struct tevent_req *req;
2365         struct rpccli_samr_CreateDomAlias_state *state;
2366         struct tevent_req *subreq;
2367
2368         req = tevent_req_create(mem_ctx, &state,
2369                                 struct rpccli_samr_CreateDomAlias_state);
2370         if (req == NULL) {
2371                 return NULL;
2372         }
2373         state->out_mem_ctx = NULL;
2374         state->dispatch_recv = cli->dispatch_recv;
2375
2376         /* In parameters */
2377         state->orig.in.domain_handle = _domain_handle;
2378         state->orig.in.alias_name = _alias_name;
2379         state->orig.in.access_mask = _access_mask;
2380
2381         /* Out parameters */
2382         state->orig.out.alias_handle = _alias_handle;
2383         state->orig.out.rid = _rid;
2384
2385         /* Result */
2386         ZERO_STRUCT(state->orig.out.result);
2387
2388         if (DEBUGLEVEL >= 10) {
2389                 NDR_PRINT_IN_DEBUG(samr_CreateDomAlias, &state->orig);
2390         }
2391
2392         state->out_mem_ctx = talloc_named_const(state, 0,
2393                              "rpccli_samr_CreateDomAlias_out_memory");
2394         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2395                 return tevent_req_post(req, ev);
2396         }
2397
2398         /* make a temporary copy, that we pass to the dispatch function */
2399         state->tmp = state->orig;
2400
2401         subreq = cli->dispatch_send(state, ev, cli,
2402                                     &ndr_table_samr,
2403                                     NDR_SAMR_CREATEDOMALIAS,
2404                                     &state->tmp);
2405         if (tevent_req_nomem(subreq, req)) {
2406                 return tevent_req_post(req, ev);
2407         }
2408         tevent_req_set_callback(subreq, rpccli_samr_CreateDomAlias_done, req);
2409         return req;
2410 }
2411
2412 static void rpccli_samr_CreateDomAlias_done(struct tevent_req *subreq)
2413 {
2414         struct tevent_req *req = tevent_req_callback_data(
2415                 subreq, struct tevent_req);
2416         struct rpccli_samr_CreateDomAlias_state *state = tevent_req_data(
2417                 req, struct rpccli_samr_CreateDomAlias_state);
2418         NTSTATUS status;
2419         TALLOC_CTX *mem_ctx;
2420
2421         if (state->out_mem_ctx) {
2422                 mem_ctx = state->out_mem_ctx;
2423         } else {
2424                 mem_ctx = state;
2425         }
2426
2427         status = state->dispatch_recv(subreq, mem_ctx);
2428         TALLOC_FREE(subreq);
2429         if (!NT_STATUS_IS_OK(status)) {
2430                 tevent_req_nterror(req, status);
2431                 return;
2432         }
2433
2434         /* Copy out parameters */
2435         *state->orig.out.alias_handle = *state->tmp.out.alias_handle;
2436         *state->orig.out.rid = *state->tmp.out.rid;
2437
2438         /* Copy result */
2439         state->orig.out.result = state->tmp.out.result;
2440
2441         /* Reset temporary structure */
2442         ZERO_STRUCT(state->tmp);
2443
2444         if (DEBUGLEVEL >= 10) {
2445                 NDR_PRINT_OUT_DEBUG(samr_CreateDomAlias, &state->orig);
2446         }
2447
2448         tevent_req_done(req);
2449 }
2450
2451 NTSTATUS rpccli_samr_CreateDomAlias_recv(struct tevent_req *req,
2452                                          TALLOC_CTX *mem_ctx,
2453                                          NTSTATUS *result)
2454 {
2455         struct rpccli_samr_CreateDomAlias_state *state = tevent_req_data(
2456                 req, struct rpccli_samr_CreateDomAlias_state);
2457         NTSTATUS status;
2458
2459         if (tevent_req_is_nterror(req, &status)) {
2460                 tevent_req_received(req);
2461                 return status;
2462         }
2463
2464         /* Steal possbile out parameters to the callers context */
2465         talloc_steal(mem_ctx, state->out_mem_ctx);
2466
2467         /* Return result */
2468         *result = state->orig.out.result;
2469
2470         tevent_req_received(req);
2471         return NT_STATUS_OK;
2472 }
2473
2474 NTSTATUS rpccli_samr_CreateDomAlias(struct rpc_pipe_client *cli,
2475                                     TALLOC_CTX *mem_ctx,
2476                                     struct policy_handle *domain_handle /* [in] [ref] */,
2477                                     struct lsa_String *alias_name /* [in] [ref] */,
2478                                     uint32_t access_mask /* [in]  */,
2479                                     struct policy_handle *alias_handle /* [out] [ref] */,
2480                                     uint32_t *rid /* [out] [ref] */)
2481 {
2482         struct samr_CreateDomAlias r;
2483         NTSTATUS status;
2484
2485         /* In parameters */
2486         r.in.domain_handle = domain_handle;
2487         r.in.alias_name = alias_name;
2488         r.in.access_mask = access_mask;
2489
2490         if (DEBUGLEVEL >= 10) {
2491                 NDR_PRINT_IN_DEBUG(samr_CreateDomAlias, &r);
2492         }
2493
2494         status = cli->dispatch(cli,
2495                                 mem_ctx,
2496                                 &ndr_table_samr,
2497                                 NDR_SAMR_CREATEDOMALIAS,
2498                                 &r);
2499
2500         if (!NT_STATUS_IS_OK(status)) {
2501                 return status;
2502         }
2503
2504         if (DEBUGLEVEL >= 10) {
2505                 NDR_PRINT_OUT_DEBUG(samr_CreateDomAlias, &r);
2506         }
2507
2508         if (NT_STATUS_IS_ERR(status)) {
2509                 return status;
2510         }
2511
2512         /* Return variables */
2513         *alias_handle = *r.out.alias_handle;
2514         *rid = *r.out.rid;
2515
2516         /* Return result */
2517         return r.out.result;
2518 }
2519
2520 struct rpccli_samr_EnumDomainAliases_state {
2521         struct samr_EnumDomainAliases orig;
2522         struct samr_EnumDomainAliases tmp;
2523         TALLOC_CTX *out_mem_ctx;
2524         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2525 };
2526
2527 static void rpccli_samr_EnumDomainAliases_done(struct tevent_req *subreq);
2528
2529 struct tevent_req *rpccli_samr_EnumDomainAliases_send(TALLOC_CTX *mem_ctx,
2530                                                       struct tevent_context *ev,
2531                                                       struct rpc_pipe_client *cli,
2532                                                       struct policy_handle *_domain_handle /* [in] [ref] */,
2533                                                       uint32_t *_resume_handle /* [in,out] [ref] */,
2534                                                       struct samr_SamArray **_sam /* [out] [ref] */,
2535                                                       uint32_t _max_size /* [in]  */,
2536                                                       uint32_t *_num_entries /* [out] [ref] */)
2537 {
2538         struct tevent_req *req;
2539         struct rpccli_samr_EnumDomainAliases_state *state;
2540         struct tevent_req *subreq;
2541
2542         req = tevent_req_create(mem_ctx, &state,
2543                                 struct rpccli_samr_EnumDomainAliases_state);
2544         if (req == NULL) {
2545                 return NULL;
2546         }
2547         state->out_mem_ctx = NULL;
2548         state->dispatch_recv = cli->dispatch_recv;
2549
2550         /* In parameters */
2551         state->orig.in.domain_handle = _domain_handle;
2552         state->orig.in.resume_handle = _resume_handle;
2553         state->orig.in.max_size = _max_size;
2554
2555         /* Out parameters */
2556         state->orig.out.resume_handle = _resume_handle;
2557         state->orig.out.sam = _sam;
2558         state->orig.out.num_entries = _num_entries;
2559
2560         /* Result */
2561         ZERO_STRUCT(state->orig.out.result);
2562
2563         if (DEBUGLEVEL >= 10) {
2564                 NDR_PRINT_IN_DEBUG(samr_EnumDomainAliases, &state->orig);
2565         }
2566
2567         state->out_mem_ctx = talloc_named_const(state, 0,
2568                              "rpccli_samr_EnumDomainAliases_out_memory");
2569         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2570                 return tevent_req_post(req, ev);
2571         }
2572
2573         /* make a temporary copy, that we pass to the dispatch function */
2574         state->tmp = state->orig;
2575
2576         subreq = cli->dispatch_send(state, ev, cli,
2577                                     &ndr_table_samr,
2578                                     NDR_SAMR_ENUMDOMAINALIASES,
2579                                     &state->tmp);
2580         if (tevent_req_nomem(subreq, req)) {
2581                 return tevent_req_post(req, ev);
2582         }
2583         tevent_req_set_callback(subreq, rpccli_samr_EnumDomainAliases_done, req);
2584         return req;
2585 }
2586
2587 static void rpccli_samr_EnumDomainAliases_done(struct tevent_req *subreq)
2588 {
2589         struct tevent_req *req = tevent_req_callback_data(
2590                 subreq, struct tevent_req);
2591         struct rpccli_samr_EnumDomainAliases_state *state = tevent_req_data(
2592                 req, struct rpccli_samr_EnumDomainAliases_state);
2593         NTSTATUS status;
2594         TALLOC_CTX *mem_ctx;
2595
2596         if (state->out_mem_ctx) {
2597                 mem_ctx = state->out_mem_ctx;
2598         } else {
2599                 mem_ctx = state;
2600         }
2601
2602         status = state->dispatch_recv(subreq, mem_ctx);
2603         TALLOC_FREE(subreq);
2604         if (!NT_STATUS_IS_OK(status)) {
2605                 tevent_req_nterror(req, status);
2606                 return;
2607         }
2608
2609         /* Copy out parameters */
2610         *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
2611         *state->orig.out.sam = *state->tmp.out.sam;
2612         *state->orig.out.num_entries = *state->tmp.out.num_entries;
2613
2614         /* Copy result */
2615         state->orig.out.result = state->tmp.out.result;
2616
2617         /* Reset temporary structure */
2618         ZERO_STRUCT(state->tmp);
2619
2620         if (DEBUGLEVEL >= 10) {
2621                 NDR_PRINT_OUT_DEBUG(samr_EnumDomainAliases, &state->orig);
2622         }
2623
2624         tevent_req_done(req);
2625 }
2626
2627 NTSTATUS rpccli_samr_EnumDomainAliases_recv(struct tevent_req *req,
2628                                             TALLOC_CTX *mem_ctx,
2629                                             NTSTATUS *result)
2630 {
2631         struct rpccli_samr_EnumDomainAliases_state *state = tevent_req_data(
2632                 req, struct rpccli_samr_EnumDomainAliases_state);
2633         NTSTATUS status;
2634
2635         if (tevent_req_is_nterror(req, &status)) {
2636                 tevent_req_received(req);
2637                 return status;
2638         }
2639
2640         /* Steal possbile out parameters to the callers context */
2641         talloc_steal(mem_ctx, state->out_mem_ctx);
2642
2643         /* Return result */
2644         *result = state->orig.out.result;
2645
2646         tevent_req_received(req);
2647         return NT_STATUS_OK;
2648 }
2649
2650 NTSTATUS rpccli_samr_EnumDomainAliases(struct rpc_pipe_client *cli,
2651                                        TALLOC_CTX *mem_ctx,
2652                                        struct policy_handle *domain_handle /* [in] [ref] */,
2653                                        uint32_t *resume_handle /* [in,out] [ref] */,
2654                                        struct samr_SamArray **sam /* [out] [ref] */,
2655                                        uint32_t max_size /* [in]  */,
2656                                        uint32_t *num_entries /* [out] [ref] */)
2657 {
2658         struct samr_EnumDomainAliases r;
2659         NTSTATUS status;
2660
2661         /* In parameters */
2662         r.in.domain_handle = domain_handle;
2663         r.in.resume_handle = resume_handle;
2664         r.in.max_size = max_size;
2665
2666         if (DEBUGLEVEL >= 10) {
2667                 NDR_PRINT_IN_DEBUG(samr_EnumDomainAliases, &r);
2668         }
2669
2670         status = cli->dispatch(cli,
2671                                 mem_ctx,
2672                                 &ndr_table_samr,
2673                                 NDR_SAMR_ENUMDOMAINALIASES,
2674                                 &r);
2675
2676         if (!NT_STATUS_IS_OK(status)) {
2677                 return status;
2678         }
2679
2680         if (DEBUGLEVEL >= 10) {
2681                 NDR_PRINT_OUT_DEBUG(samr_EnumDomainAliases, &r);
2682         }
2683
2684         if (NT_STATUS_IS_ERR(status)) {
2685                 return status;
2686         }
2687
2688         /* Return variables */
2689         *resume_handle = *r.out.resume_handle;
2690         *sam = *r.out.sam;
2691         *num_entries = *r.out.num_entries;
2692
2693         /* Return result */
2694         return r.out.result;
2695 }
2696
2697 struct rpccli_samr_GetAliasMembership_state {
2698         struct samr_GetAliasMembership orig;
2699         struct samr_GetAliasMembership tmp;
2700         TALLOC_CTX *out_mem_ctx;
2701         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2702 };
2703
2704 static void rpccli_samr_GetAliasMembership_done(struct tevent_req *subreq);
2705
2706 struct tevent_req *rpccli_samr_GetAliasMembership_send(TALLOC_CTX *mem_ctx,
2707                                                        struct tevent_context *ev,
2708                                                        struct rpc_pipe_client *cli,
2709                                                        struct policy_handle *_domain_handle /* [in] [ref] */,
2710                                                        struct lsa_SidArray *_sids /* [in] [ref] */,
2711                                                        struct samr_Ids *_rids /* [out] [ref] */)
2712 {
2713         struct tevent_req *req;
2714         struct rpccli_samr_GetAliasMembership_state *state;
2715         struct tevent_req *subreq;
2716
2717         req = tevent_req_create(mem_ctx, &state,
2718                                 struct rpccli_samr_GetAliasMembership_state);
2719         if (req == NULL) {
2720                 return NULL;
2721         }
2722         state->out_mem_ctx = NULL;
2723         state->dispatch_recv = cli->dispatch_recv;
2724
2725         /* In parameters */
2726         state->orig.in.domain_handle = _domain_handle;
2727         state->orig.in.sids = _sids;
2728
2729         /* Out parameters */
2730         state->orig.out.rids = _rids;
2731
2732         /* Result */
2733         ZERO_STRUCT(state->orig.out.result);
2734
2735         if (DEBUGLEVEL >= 10) {
2736                 NDR_PRINT_IN_DEBUG(samr_GetAliasMembership, &state->orig);
2737         }
2738
2739         state->out_mem_ctx = talloc_named_const(state, 0,
2740                              "rpccli_samr_GetAliasMembership_out_memory");
2741         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2742                 return tevent_req_post(req, ev);
2743         }
2744
2745         /* make a temporary copy, that we pass to the dispatch function */
2746         state->tmp = state->orig;
2747
2748         subreq = cli->dispatch_send(state, ev, cli,
2749                                     &ndr_table_samr,
2750                                     NDR_SAMR_GETALIASMEMBERSHIP,
2751                                     &state->tmp);
2752         if (tevent_req_nomem(subreq, req)) {
2753                 return tevent_req_post(req, ev);
2754         }
2755         tevent_req_set_callback(subreq, rpccli_samr_GetAliasMembership_done, req);
2756         return req;
2757 }
2758
2759 static void rpccli_samr_GetAliasMembership_done(struct tevent_req *subreq)
2760 {
2761         struct tevent_req *req = tevent_req_callback_data(
2762                 subreq, struct tevent_req);
2763         struct rpccli_samr_GetAliasMembership_state *state = tevent_req_data(
2764                 req, struct rpccli_samr_GetAliasMembership_state);
2765         NTSTATUS status;
2766         TALLOC_CTX *mem_ctx;
2767
2768         if (state->out_mem_ctx) {
2769                 mem_ctx = state->out_mem_ctx;
2770         } else {
2771                 mem_ctx = state;
2772         }
2773
2774         status = state->dispatch_recv(subreq, mem_ctx);
2775         TALLOC_FREE(subreq);
2776         if (!NT_STATUS_IS_OK(status)) {
2777                 tevent_req_nterror(req, status);
2778                 return;
2779         }
2780
2781         /* Copy out parameters */
2782         *state->orig.out.rids = *state->tmp.out.rids;
2783
2784         /* Copy result */
2785         state->orig.out.result = state->tmp.out.result;
2786
2787         /* Reset temporary structure */
2788         ZERO_STRUCT(state->tmp);
2789
2790         if (DEBUGLEVEL >= 10) {
2791                 NDR_PRINT_OUT_DEBUG(samr_GetAliasMembership, &state->orig);
2792         }
2793
2794         tevent_req_done(req);
2795 }
2796
2797 NTSTATUS rpccli_samr_GetAliasMembership_recv(struct tevent_req *req,
2798                                              TALLOC_CTX *mem_ctx,
2799                                              NTSTATUS *result)
2800 {
2801         struct rpccli_samr_GetAliasMembership_state *state = tevent_req_data(
2802                 req, struct rpccli_samr_GetAliasMembership_state);
2803         NTSTATUS status;
2804
2805         if (tevent_req_is_nterror(req, &status)) {
2806                 tevent_req_received(req);
2807                 return status;
2808         }
2809
2810         /* Steal possbile out parameters to the callers context */
2811         talloc_steal(mem_ctx, state->out_mem_ctx);
2812
2813         /* Return result */
2814         *result = state->orig.out.result;
2815
2816         tevent_req_received(req);
2817         return NT_STATUS_OK;
2818 }
2819
2820 NTSTATUS rpccli_samr_GetAliasMembership(struct rpc_pipe_client *cli,
2821                                         TALLOC_CTX *mem_ctx,
2822                                         struct policy_handle *domain_handle /* [in] [ref] */,
2823                                         struct lsa_SidArray *sids /* [in] [ref] */,
2824                                         struct samr_Ids *rids /* [out] [ref] */)
2825 {
2826         struct samr_GetAliasMembership r;
2827         NTSTATUS status;
2828
2829         /* In parameters */
2830         r.in.domain_handle = domain_handle;
2831         r.in.sids = sids;
2832
2833         if (DEBUGLEVEL >= 10) {
2834                 NDR_PRINT_IN_DEBUG(samr_GetAliasMembership, &r);
2835         }
2836
2837         status = cli->dispatch(cli,
2838                                 mem_ctx,
2839                                 &ndr_table_samr,
2840                                 NDR_SAMR_GETALIASMEMBERSHIP,
2841                                 &r);
2842
2843         if (!NT_STATUS_IS_OK(status)) {
2844                 return status;
2845         }
2846
2847         if (DEBUGLEVEL >= 10) {
2848                 NDR_PRINT_OUT_DEBUG(samr_GetAliasMembership, &r);
2849         }
2850
2851         if (NT_STATUS_IS_ERR(status)) {
2852                 return status;
2853         }
2854
2855         /* Return variables */
2856         *rids = *r.out.rids;
2857
2858         /* Return result */
2859         return r.out.result;
2860 }
2861
2862 struct rpccli_samr_LookupNames_state {
2863         struct samr_LookupNames orig;
2864         struct samr_LookupNames tmp;
2865         TALLOC_CTX *out_mem_ctx;
2866         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2867 };
2868
2869 static void rpccli_samr_LookupNames_done(struct tevent_req *subreq);
2870
2871 struct tevent_req *rpccli_samr_LookupNames_send(TALLOC_CTX *mem_ctx,
2872                                                 struct tevent_context *ev,
2873                                                 struct rpc_pipe_client *cli,
2874                                                 struct policy_handle *_domain_handle /* [in] [ref] */,
2875                                                 uint32_t _num_names /* [in] [range(0,1000)] */,
2876                                                 struct lsa_String *_names /* [in] [length_is(num_names),size_is(1000)] */,
2877                                                 struct samr_Ids *_rids /* [out] [ref] */,
2878                                                 struct samr_Ids *_types /* [out] [ref] */)
2879 {
2880         struct tevent_req *req;
2881         struct rpccli_samr_LookupNames_state *state;
2882         struct tevent_req *subreq;
2883
2884         req = tevent_req_create(mem_ctx, &state,
2885                                 struct rpccli_samr_LookupNames_state);
2886         if (req == NULL) {
2887                 return NULL;
2888         }
2889         state->out_mem_ctx = NULL;
2890         state->dispatch_recv = cli->dispatch_recv;
2891
2892         /* In parameters */
2893         state->orig.in.domain_handle = _domain_handle;
2894         state->orig.in.num_names = _num_names;
2895         state->orig.in.names = _names;
2896
2897         /* Out parameters */
2898         state->orig.out.rids = _rids;
2899         state->orig.out.types = _types;
2900
2901         /* Result */
2902         ZERO_STRUCT(state->orig.out.result);
2903
2904         if (DEBUGLEVEL >= 10) {
2905                 NDR_PRINT_IN_DEBUG(samr_LookupNames, &state->orig);
2906         }
2907
2908         state->out_mem_ctx = talloc_named_const(state, 0,
2909                              "rpccli_samr_LookupNames_out_memory");
2910         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2911                 return tevent_req_post(req, ev);
2912         }
2913
2914         /* make a temporary copy, that we pass to the dispatch function */
2915         state->tmp = state->orig;
2916
2917         subreq = cli->dispatch_send(state, ev, cli,
2918                                     &ndr_table_samr,
2919                                     NDR_SAMR_LOOKUPNAMES,
2920                                     &state->tmp);
2921         if (tevent_req_nomem(subreq, req)) {
2922                 return tevent_req_post(req, ev);
2923         }
2924         tevent_req_set_callback(subreq, rpccli_samr_LookupNames_done, req);
2925         return req;
2926 }
2927
2928 static void rpccli_samr_LookupNames_done(struct tevent_req *subreq)
2929 {
2930         struct tevent_req *req = tevent_req_callback_data(
2931                 subreq, struct tevent_req);
2932         struct rpccli_samr_LookupNames_state *state = tevent_req_data(
2933                 req, struct rpccli_samr_LookupNames_state);
2934         NTSTATUS status;
2935         TALLOC_CTX *mem_ctx;
2936
2937         if (state->out_mem_ctx) {
2938                 mem_ctx = state->out_mem_ctx;
2939         } else {
2940                 mem_ctx = state;
2941         }
2942
2943         status = state->dispatch_recv(subreq, mem_ctx);
2944         TALLOC_FREE(subreq);
2945         if (!NT_STATUS_IS_OK(status)) {
2946                 tevent_req_nterror(req, status);
2947                 return;
2948         }
2949
2950         /* Copy out parameters */
2951         *state->orig.out.rids = *state->tmp.out.rids;
2952         *state->orig.out.types = *state->tmp.out.types;
2953
2954         /* Copy result */
2955         state->orig.out.result = state->tmp.out.result;
2956
2957         /* Reset temporary structure */
2958         ZERO_STRUCT(state->tmp);
2959
2960         if (DEBUGLEVEL >= 10) {
2961                 NDR_PRINT_OUT_DEBUG(samr_LookupNames, &state->orig);
2962         }
2963
2964         tevent_req_done(req);
2965 }
2966
2967 NTSTATUS rpccli_samr_LookupNames_recv(struct tevent_req *req,
2968                                       TALLOC_CTX *mem_ctx,
2969                                       NTSTATUS *result)
2970 {
2971         struct rpccli_samr_LookupNames_state *state = tevent_req_data(
2972                 req, struct rpccli_samr_LookupNames_state);
2973         NTSTATUS status;
2974
2975         if (tevent_req_is_nterror(req, &status)) {
2976                 tevent_req_received(req);
2977                 return status;
2978         }
2979
2980         /* Steal possbile out parameters to the callers context */
2981         talloc_steal(mem_ctx, state->out_mem_ctx);
2982
2983         /* Return result */
2984         *result = state->orig.out.result;
2985
2986         tevent_req_received(req);
2987         return NT_STATUS_OK;
2988 }
2989
2990 NTSTATUS rpccli_samr_LookupNames(struct rpc_pipe_client *cli,
2991                                  TALLOC_CTX *mem_ctx,
2992                                  struct policy_handle *domain_handle /* [in] [ref] */,
2993                                  uint32_t num_names /* [in] [range(0,1000)] */,
2994                                  struct lsa_String *names /* [in] [length_is(num_names),size_is(1000)] */,
2995                                  struct samr_Ids *rids /* [out] [ref] */,
2996                                  struct samr_Ids *types /* [out] [ref] */)
2997 {
2998         struct samr_LookupNames r;
2999         NTSTATUS status;
3000
3001         /* In parameters */
3002         r.in.domain_handle = domain_handle;
3003         r.in.num_names = num_names;
3004         r.in.names = names;
3005
3006         if (DEBUGLEVEL >= 10) {
3007                 NDR_PRINT_IN_DEBUG(samr_LookupNames, &r);
3008         }
3009
3010         status = cli->dispatch(cli,
3011                                 mem_ctx,
3012                                 &ndr_table_samr,
3013                                 NDR_SAMR_LOOKUPNAMES,
3014                                 &r);
3015
3016         if (!NT_STATUS_IS_OK(status)) {
3017                 return status;
3018         }
3019
3020         if (DEBUGLEVEL >= 10) {
3021                 NDR_PRINT_OUT_DEBUG(samr_LookupNames, &r);
3022         }
3023
3024         if (NT_STATUS_IS_ERR(status)) {
3025                 return status;
3026         }
3027
3028         /* Return variables */
3029         *rids = *r.out.rids;
3030         *types = *r.out.types;
3031
3032         /* Return result */
3033         return r.out.result;
3034 }
3035
3036 struct rpccli_samr_LookupRids_state {
3037         struct samr_LookupRids orig;
3038         struct samr_LookupRids tmp;
3039         TALLOC_CTX *out_mem_ctx;
3040         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3041 };
3042
3043 static void rpccli_samr_LookupRids_done(struct tevent_req *subreq);
3044
3045 struct tevent_req *rpccli_samr_LookupRids_send(TALLOC_CTX *mem_ctx,
3046                                                struct tevent_context *ev,
3047                                                struct rpc_pipe_client *cli,
3048                                                struct policy_handle *_domain_handle /* [in] [ref] */,
3049                                                uint32_t _num_rids /* [in] [range(0,1000)] */,
3050                                                uint32_t *_rids /* [in] [length_is(num_rids),size_is(1000)] */,
3051                                                struct lsa_Strings *_names /* [out] [ref] */,
3052                                                struct samr_Ids *_types /* [out] [ref] */)
3053 {
3054         struct tevent_req *req;
3055         struct rpccli_samr_LookupRids_state *state;
3056         struct tevent_req *subreq;
3057
3058         req = tevent_req_create(mem_ctx, &state,
3059                                 struct rpccli_samr_LookupRids_state);
3060         if (req == NULL) {
3061                 return NULL;
3062         }
3063         state->out_mem_ctx = NULL;
3064         state->dispatch_recv = cli->dispatch_recv;
3065
3066         /* In parameters */
3067         state->orig.in.domain_handle = _domain_handle;
3068         state->orig.in.num_rids = _num_rids;
3069         state->orig.in.rids = _rids;
3070
3071         /* Out parameters */
3072         state->orig.out.names = _names;
3073         state->orig.out.types = _types;
3074
3075         /* Result */
3076         ZERO_STRUCT(state->orig.out.result);
3077
3078         if (DEBUGLEVEL >= 10) {
3079                 NDR_PRINT_IN_DEBUG(samr_LookupRids, &state->orig);
3080         }
3081
3082         state->out_mem_ctx = talloc_named_const(state, 0,
3083                              "rpccli_samr_LookupRids_out_memory");
3084         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3085                 return tevent_req_post(req, ev);
3086         }
3087
3088         /* make a temporary copy, that we pass to the dispatch function */
3089         state->tmp = state->orig;
3090
3091         subreq = cli->dispatch_send(state, ev, cli,
3092                                     &ndr_table_samr,
3093                                     NDR_SAMR_LOOKUPRIDS,
3094                                     &state->tmp);
3095         if (tevent_req_nomem(subreq, req)) {
3096                 return tevent_req_post(req, ev);
3097         }
3098         tevent_req_set_callback(subreq, rpccli_samr_LookupRids_done, req);
3099         return req;
3100 }
3101
3102 static void rpccli_samr_LookupRids_done(struct tevent_req *subreq)
3103 {
3104         struct tevent_req *req = tevent_req_callback_data(
3105                 subreq, struct tevent_req);
3106         struct rpccli_samr_LookupRids_state *state = tevent_req_data(
3107                 req, struct rpccli_samr_LookupRids_state);
3108         NTSTATUS status;
3109         TALLOC_CTX *mem_ctx;
3110
3111         if (state->out_mem_ctx) {
3112                 mem_ctx = state->out_mem_ctx;
3113         } else {
3114                 mem_ctx = state;
3115         }
3116
3117         status = state->dispatch_recv(subreq, mem_ctx);
3118         TALLOC_FREE(subreq);
3119         if (!NT_STATUS_IS_OK(status)) {
3120                 tevent_req_nterror(req, status);
3121                 return;
3122         }
3123
3124         /* Copy out parameters */
3125         *state->orig.out.names = *state->tmp.out.names;
3126         *state->orig.out.types = *state->tmp.out.types;
3127
3128         /* Copy result */
3129         state->orig.out.result = state->tmp.out.result;
3130
3131         /* Reset temporary structure */
3132         ZERO_STRUCT(state->tmp);
3133
3134         if (DEBUGLEVEL >= 10) {
3135                 NDR_PRINT_OUT_DEBUG(samr_LookupRids, &state->orig);
3136         }
3137
3138         tevent_req_done(req);
3139 }
3140
3141 NTSTATUS rpccli_samr_LookupRids_recv(struct tevent_req *req,
3142                                      TALLOC_CTX *mem_ctx,
3143                                      NTSTATUS *result)
3144 {
3145         struct rpccli_samr_LookupRids_state *state = tevent_req_data(
3146                 req, struct rpccli_samr_LookupRids_state);
3147         NTSTATUS status;
3148
3149         if (tevent_req_is_nterror(req, &status)) {
3150                 tevent_req_received(req);
3151                 return status;
3152         }
3153
3154         /* Steal possbile out parameters to the callers context */
3155         talloc_steal(mem_ctx, state->out_mem_ctx);
3156
3157         /* Return result */
3158         *result = state->orig.out.result;
3159
3160         tevent_req_received(req);
3161         return NT_STATUS_OK;
3162 }
3163
3164 NTSTATUS rpccli_samr_LookupRids(struct rpc_pipe_client *cli,
3165                                 TALLOC_CTX *mem_ctx,
3166                                 struct policy_handle *domain_handle /* [in] [ref] */,
3167                                 uint32_t num_rids /* [in] [range(0,1000)] */,
3168                                 uint32_t *rids /* [in] [length_is(num_rids),size_is(1000)] */,
3169                                 struct lsa_Strings *names /* [out] [ref] */,
3170                                 struct samr_Ids *types /* [out] [ref] */)
3171 {
3172         struct samr_LookupRids r;
3173         NTSTATUS status;
3174
3175         /* In parameters */
3176         r.in.domain_handle = domain_handle;
3177         r.in.num_rids = num_rids;
3178         r.in.rids = rids;
3179
3180         if (DEBUGLEVEL >= 10) {
3181                 NDR_PRINT_IN_DEBUG(samr_LookupRids, &r);
3182         }
3183
3184         status = cli->dispatch(cli,
3185                                 mem_ctx,
3186                                 &ndr_table_samr,
3187                                 NDR_SAMR_LOOKUPRIDS,
3188                                 &r);
3189
3190         if (!NT_STATUS_IS_OK(status)) {
3191                 return status;
3192         }
3193
3194         if (DEBUGLEVEL >= 10) {
3195                 NDR_PRINT_OUT_DEBUG(samr_LookupRids, &r);
3196         }
3197
3198         if (NT_STATUS_IS_ERR(status)) {
3199                 return status;
3200         }
3201
3202         /* Return variables */
3203         *names = *r.out.names;
3204         *types = *r.out.types;
3205
3206         /* Return result */
3207         return r.out.result;
3208 }
3209
3210 struct rpccli_samr_OpenGroup_state {
3211         struct samr_OpenGroup orig;
3212         struct samr_OpenGroup tmp;
3213         TALLOC_CTX *out_mem_ctx;
3214         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3215 };
3216
3217 static void rpccli_samr_OpenGroup_done(struct tevent_req *subreq);
3218
3219 struct tevent_req *rpccli_samr_OpenGroup_send(TALLOC_CTX *mem_ctx,
3220                                               struct tevent_context *ev,
3221                                               struct rpc_pipe_client *cli,
3222                                               struct policy_handle *_domain_handle /* [in] [ref] */,
3223                                               uint32_t _access_mask /* [in]  */,
3224                                               uint32_t _rid /* [in]  */,
3225                                               struct policy_handle *_group_handle /* [out] [ref] */)
3226 {
3227         struct tevent_req *req;
3228         struct rpccli_samr_OpenGroup_state *state;
3229         struct tevent_req *subreq;
3230
3231         req = tevent_req_create(mem_ctx, &state,
3232                                 struct rpccli_samr_OpenGroup_state);
3233         if (req == NULL) {
3234                 return NULL;
3235         }
3236         state->out_mem_ctx = NULL;
3237         state->dispatch_recv = cli->dispatch_recv;
3238
3239         /* In parameters */
3240         state->orig.in.domain_handle = _domain_handle;
3241         state->orig.in.access_mask = _access_mask;
3242         state->orig.in.rid = _rid;
3243
3244         /* Out parameters */
3245         state->orig.out.group_handle = _group_handle;
3246
3247         /* Result */
3248         ZERO_STRUCT(state->orig.out.result);
3249
3250         if (DEBUGLEVEL >= 10) {
3251                 NDR_PRINT_IN_DEBUG(samr_OpenGroup, &state->orig);
3252         }
3253
3254         state->out_mem_ctx = talloc_named_const(state, 0,
3255                              "rpccli_samr_OpenGroup_out_memory");
3256         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3257                 return tevent_req_post(req, ev);
3258         }
3259
3260         /* make a temporary copy, that we pass to the dispatch function */
3261         state->tmp = state->orig;
3262
3263         subreq = cli->dispatch_send(state, ev, cli,
3264                                     &ndr_table_samr,
3265                                     NDR_SAMR_OPENGROUP,
3266                                     &state->tmp);
3267         if (tevent_req_nomem(subreq, req)) {
3268                 return tevent_req_post(req, ev);
3269         }
3270         tevent_req_set_callback(subreq, rpccli_samr_OpenGroup_done, req);
3271         return req;
3272 }
3273
3274 static void rpccli_samr_OpenGroup_done(struct tevent_req *subreq)
3275 {
3276         struct tevent_req *req = tevent_req_callback_data(
3277                 subreq, struct tevent_req);
3278         struct rpccli_samr_OpenGroup_state *state = tevent_req_data(
3279                 req, struct rpccli_samr_OpenGroup_state);
3280         NTSTATUS status;
3281         TALLOC_CTX *mem_ctx;
3282
3283         if (state->out_mem_ctx) {
3284                 mem_ctx = state->out_mem_ctx;
3285         } else {
3286                 mem_ctx = state;
3287         }
3288
3289         status = state->dispatch_recv(subreq, mem_ctx);
3290         TALLOC_FREE(subreq);
3291         if (!NT_STATUS_IS_OK(status)) {
3292                 tevent_req_nterror(req, status);
3293                 return;
3294         }
3295
3296         /* Copy out parameters */
3297         *state->orig.out.group_handle = *state->tmp.out.group_handle;
3298
3299         /* Copy result */
3300         state->orig.out.result = state->tmp.out.result;
3301
3302         /* Reset temporary structure */
3303         ZERO_STRUCT(state->tmp);
3304
3305         if (DEBUGLEVEL >= 10) {
3306                 NDR_PRINT_OUT_DEBUG(samr_OpenGroup, &state->orig);
3307         }
3308
3309         tevent_req_done(req);
3310 }
3311
3312 NTSTATUS rpccli_samr_OpenGroup_recv(struct tevent_req *req,
3313                                     TALLOC_CTX *mem_ctx,
3314                                     NTSTATUS *result)
3315 {
3316         struct rpccli_samr_OpenGroup_state *state = tevent_req_data(
3317                 req, struct rpccli_samr_OpenGroup_state);
3318         NTSTATUS status;
3319
3320         if (tevent_req_is_nterror(req, &status)) {
3321                 tevent_req_received(req);
3322                 return status;
3323         }
3324
3325         /* Steal possbile out parameters to the callers context */
3326         talloc_steal(mem_ctx, state->out_mem_ctx);
3327
3328         /* Return result */
3329         *result = state->orig.out.result;
3330
3331         tevent_req_received(req);
3332         return NT_STATUS_OK;
3333 }
3334
3335 NTSTATUS rpccli_samr_OpenGroup(struct rpc_pipe_client *cli,
3336                                TALLOC_CTX *mem_ctx,
3337                                struct policy_handle *domain_handle /* [in] [ref] */,
3338                                uint32_t access_mask /* [in]  */,
3339                                uint32_t rid /* [in]  */,
3340                                struct policy_handle *group_handle /* [out] [ref] */)
3341 {
3342         struct samr_OpenGroup r;
3343         NTSTATUS status;
3344
3345         /* In parameters */
3346         r.in.domain_handle = domain_handle;
3347         r.in.access_mask = access_mask;
3348         r.in.rid = rid;
3349
3350         if (DEBUGLEVEL >= 10) {
3351                 NDR_PRINT_IN_DEBUG(samr_OpenGroup, &r);
3352         }
3353
3354         status = cli->dispatch(cli,
3355                                 mem_ctx,
3356                                 &ndr_table_samr,
3357                                 NDR_SAMR_OPENGROUP,
3358                                 &r);
3359
3360         if (!NT_STATUS_IS_OK(status)) {
3361                 return status;
3362         }
3363
3364         if (DEBUGLEVEL >= 10) {
3365                 NDR_PRINT_OUT_DEBUG(samr_OpenGroup, &r);
3366         }
3367
3368         if (NT_STATUS_IS_ERR(status)) {
3369                 return status;
3370         }
3371
3372         /* Return variables */
3373         *group_handle = *r.out.group_handle;
3374
3375         /* Return result */
3376         return r.out.result;
3377 }
3378
3379 struct rpccli_samr_QueryGroupInfo_state {
3380         struct samr_QueryGroupInfo orig;
3381         struct samr_QueryGroupInfo tmp;
3382         TALLOC_CTX *out_mem_ctx;
3383         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3384 };
3385
3386 static void rpccli_samr_QueryGroupInfo_done(struct tevent_req *subreq);
3387
3388 struct tevent_req *rpccli_samr_QueryGroupInfo_send(TALLOC_CTX *mem_ctx,
3389                                                    struct tevent_context *ev,
3390                                                    struct rpc_pipe_client *cli,
3391                                                    struct policy_handle *_group_handle /* [in] [ref] */,
3392                                                    enum samr_GroupInfoEnum _level /* [in]  */,
3393                                                    union samr_GroupInfo **_info /* [out] [ref,switch_is(level)] */)
3394 {
3395         struct tevent_req *req;
3396         struct rpccli_samr_QueryGroupInfo_state *state;
3397         struct tevent_req *subreq;
3398
3399         req = tevent_req_create(mem_ctx, &state,
3400                                 struct rpccli_samr_QueryGroupInfo_state);
3401         if (req == NULL) {
3402                 return NULL;
3403         }
3404         state->out_mem_ctx = NULL;
3405         state->dispatch_recv = cli->dispatch_recv;
3406
3407         /* In parameters */
3408         state->orig.in.group_handle = _group_handle;
3409         state->orig.in.level = _level;
3410
3411         /* Out parameters */
3412         state->orig.out.info = _info;
3413
3414         /* Result */
3415         ZERO_STRUCT(state->orig.out.result);
3416
3417         if (DEBUGLEVEL >= 10) {
3418                 NDR_PRINT_IN_DEBUG(samr_QueryGroupInfo, &state->orig);
3419         }
3420
3421         state->out_mem_ctx = talloc_named_const(state, 0,
3422                              "rpccli_samr_QueryGroupInfo_out_memory");
3423         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3424                 return tevent_req_post(req, ev);
3425         }
3426
3427         /* make a temporary copy, that we pass to the dispatch function */
3428         state->tmp = state->orig;
3429
3430         subreq = cli->dispatch_send(state, ev, cli,
3431                                     &ndr_table_samr,
3432                                     NDR_SAMR_QUERYGROUPINFO,
3433                                     &state->tmp);
3434         if (tevent_req_nomem(subreq, req)) {
3435                 return tevent_req_post(req, ev);
3436         }
3437         tevent_req_set_callback(subreq, rpccli_samr_QueryGroupInfo_done, req);
3438         return req;
3439 }
3440
3441 static void rpccli_samr_QueryGroupInfo_done(struct tevent_req *subreq)
3442 {
3443         struct tevent_req *req = tevent_req_callback_data(
3444                 subreq, struct tevent_req);
3445         struct rpccli_samr_QueryGroupInfo_state *state = tevent_req_data(
3446                 req, struct rpccli_samr_QueryGroupInfo_state);
3447         NTSTATUS status;
3448         TALLOC_CTX *mem_ctx;
3449
3450         if (state->out_mem_ctx) {
3451                 mem_ctx = state->out_mem_ctx;
3452         } else {
3453                 mem_ctx = state;
3454         }
3455
3456         status = state->dispatch_recv(subreq, mem_ctx);
3457         TALLOC_FREE(subreq);
3458         if (!NT_STATUS_IS_OK(status)) {
3459                 tevent_req_nterror(req, status);
3460                 return;
3461         }
3462
3463         /* Copy out parameters */
3464         *state->orig.out.info = *state->tmp.out.info;
3465
3466         /* Copy result */
3467         state->orig.out.result = state->tmp.out.result;
3468
3469         /* Reset temporary structure */
3470         ZERO_STRUCT(state->tmp);
3471
3472         if (DEBUGLEVEL >= 10) {
3473                 NDR_PRINT_OUT_DEBUG(samr_QueryGroupInfo, &state->orig);
3474         }
3475
3476         tevent_req_done(req);
3477 }
3478
3479 NTSTATUS rpccli_samr_QueryGroupInfo_recv(struct tevent_req *req,
3480                                          TALLOC_CTX *mem_ctx,
3481                                          NTSTATUS *result)
3482 {
3483         struct rpccli_samr_QueryGroupInfo_state *state = tevent_req_data(
3484                 req, struct rpccli_samr_QueryGroupInfo_state);
3485         NTSTATUS status;
3486
3487         if (tevent_req_is_nterror(req, &status)) {
3488                 tevent_req_received(req);
3489                 return status;
3490         }
3491
3492         /* Steal possbile out parameters to the callers context */
3493         talloc_steal(mem_ctx, state->out_mem_ctx);
3494
3495         /* Return result */
3496         *result = state->orig.out.result;
3497
3498         tevent_req_received(req);
3499         return NT_STATUS_OK;
3500 }
3501
3502 NTSTATUS rpccli_samr_QueryGroupInfo(struct rpc_pipe_client *cli,
3503                                     TALLOC_CTX *mem_ctx,
3504                                     struct policy_handle *group_handle /* [in] [ref] */,
3505                                     enum samr_GroupInfoEnum level /* [in]  */,
3506                                     union samr_GroupInfo **info /* [out] [ref,switch_is(level)] */)
3507 {
3508         struct samr_QueryGroupInfo r;
3509         NTSTATUS status;
3510
3511         /* In parameters */
3512         r.in.group_handle = group_handle;
3513         r.in.level = level;
3514
3515         if (DEBUGLEVEL >= 10) {
3516                 NDR_PRINT_IN_DEBUG(samr_QueryGroupInfo, &r);
3517         }
3518
3519         status = cli->dispatch(cli,
3520                                 mem_ctx,
3521                                 &ndr_table_samr,
3522                                 NDR_SAMR_QUERYGROUPINFO,
3523                                 &r);
3524
3525         if (!NT_STATUS_IS_OK(status)) {
3526                 return status;
3527         }
3528
3529         if (DEBUGLEVEL >= 10) {
3530                 NDR_PRINT_OUT_DEBUG(samr_QueryGroupInfo, &r);
3531         }
3532
3533         if (NT_STATUS_IS_ERR(status)) {
3534                 return status;
3535         }
3536
3537         /* Return variables */
3538         *info = *r.out.info;
3539
3540         /* Return result */
3541         return r.out.result;
3542 }
3543
3544 struct rpccli_samr_SetGroupInfo_state {
3545         struct samr_SetGroupInfo orig;
3546         struct samr_SetGroupInfo tmp;
3547         TALLOC_CTX *out_mem_ctx;
3548         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3549 };
3550
3551 static void rpccli_samr_SetGroupInfo_done(struct tevent_req *subreq);
3552
3553 struct tevent_req *rpccli_samr_SetGroupInfo_send(TALLOC_CTX *mem_ctx,
3554                                                  struct tevent_context *ev,
3555                                                  struct rpc_pipe_client *cli,
3556                                                  struct policy_handle *_group_handle /* [in] [ref] */,
3557                                                  enum samr_GroupInfoEnum _level /* [in]  */,
3558                                                  union samr_GroupInfo *_info /* [in] [ref,switch_is(level)] */)
3559 {
3560         struct tevent_req *req;
3561         struct rpccli_samr_SetGroupInfo_state *state;
3562         struct tevent_req *subreq;
3563
3564         req = tevent_req_create(mem_ctx, &state,
3565                                 struct rpccli_samr_SetGroupInfo_state);
3566         if (req == NULL) {
3567                 return NULL;
3568         }
3569         state->out_mem_ctx = NULL;
3570         state->dispatch_recv = cli->dispatch_recv;
3571
3572         /* In parameters */
3573         state->orig.in.group_handle = _group_handle;
3574         state->orig.in.level = _level;
3575         state->orig.in.info = _info;
3576
3577         /* Out parameters */
3578
3579         /* Result */
3580         ZERO_STRUCT(state->orig.out.result);
3581
3582         if (DEBUGLEVEL >= 10) {
3583                 NDR_PRINT_IN_DEBUG(samr_SetGroupInfo, &state->orig);
3584         }
3585
3586         /* make a temporary copy, that we pass to the dispatch function */
3587         state->tmp = state->orig;
3588
3589         subreq = cli->dispatch_send(state, ev, cli,
3590                                     &ndr_table_samr,
3591                                     NDR_SAMR_SETGROUPINFO,
3592                                     &state->tmp);
3593         if (tevent_req_nomem(subreq, req)) {
3594                 return tevent_req_post(req, ev);
3595         }
3596         tevent_req_set_callback(subreq, rpccli_samr_SetGroupInfo_done, req);
3597         return req;
3598 }
3599
3600 static void rpccli_samr_SetGroupInfo_done(struct tevent_req *subreq)
3601 {
3602         struct tevent_req *req = tevent_req_callback_data(
3603                 subreq, struct tevent_req);
3604         struct rpccli_samr_SetGroupInfo_state *state = tevent_req_data(
3605                 req, struct rpccli_samr_SetGroupInfo_state);
3606         NTSTATUS status;
3607         TALLOC_CTX *mem_ctx;
3608
3609         if (state->out_mem_ctx) {
3610                 mem_ctx = state->out_mem_ctx;
3611         } else {
3612                 mem_ctx = state;
3613         }
3614
3615         status = state->dispatch_recv(subreq, mem_ctx);
3616         TALLOC_FREE(subreq);
3617         if (!NT_STATUS_IS_OK(status)) {
3618                 tevent_req_nterror(req, status);
3619                 return;
3620         }
3621
3622         /* Copy out parameters */
3623
3624         /* Copy result */
3625         state->orig.out.result = state->tmp.out.result;
3626
3627         /* Reset temporary structure */
3628         ZERO_STRUCT(state->tmp);
3629
3630         if (DEBUGLEVEL >= 10) {
3631                 NDR_PRINT_OUT_DEBUG(samr_SetGroupInfo, &state->orig);
3632         }
3633
3634         tevent_req_done(req);
3635 }
3636
3637 NTSTATUS rpccli_samr_SetGroupInfo_recv(struct tevent_req *req,
3638                                        TALLOC_CTX *mem_ctx,
3639                                        NTSTATUS *result)
3640 {
3641         struct rpccli_samr_SetGroupInfo_state *state = tevent_req_data(
3642                 req, struct rpccli_samr_SetGroupInfo_state);
3643         NTSTATUS status;
3644
3645         if (tevent_req_is_nterror(req, &status)) {
3646                 tevent_req_received(req);
3647                 return status;
3648         }
3649
3650         /* Steal possbile out parameters to the callers context */
3651         talloc_steal(mem_ctx, state->out_mem_ctx);
3652
3653         /* Return result */
3654         *result = state->orig.out.result;
3655
3656         tevent_req_received(req);
3657         return NT_STATUS_OK;
3658 }
3659
3660 NTSTATUS rpccli_samr_SetGroupInfo(struct rpc_pipe_client *cli,
3661                                   TALLOC_CTX *mem_ctx,
3662                                   struct policy_handle *group_handle /* [in] [ref] */,
3663                                   enum samr_GroupInfoEnum level /* [in]  */,
3664                                   union samr_GroupInfo *info /* [in] [ref,switch_is(level)] */)
3665 {
3666         struct samr_SetGroupInfo r;
3667         NTSTATUS status;
3668
3669         /* In parameters */
3670         r.in.group_handle = group_handle;
3671         r.in.level = level;
3672         r.in.info = info;
3673
3674         if (DEBUGLEVEL >= 10) {
3675                 NDR_PRINT_IN_DEBUG(samr_SetGroupInfo, &r);
3676         }
3677
3678         status = cli->dispatch(cli,
3679                                 mem_ctx,
3680                                 &ndr_table_samr,
3681                                 NDR_SAMR_SETGROUPINFO,
3682                                 &r);
3683
3684         if (!NT_STATUS_IS_OK(status)) {
3685                 return status;
3686         }
3687
3688         if (DEBUGLEVEL >= 10) {
3689                 NDR_PRINT_OUT_DEBUG(samr_SetGroupInfo, &r);
3690         }
3691
3692         if (NT_STATUS_IS_ERR(status)) {
3693                 return status;
3694         }
3695
3696         /* Return variables */
3697
3698         /* Return result */
3699         return r.out.result;
3700 }
3701
3702 struct rpccli_samr_AddGroupMember_state {
3703         struct samr_AddGroupMember orig;
3704         struct samr_AddGroupMember tmp;
3705         TALLOC_CTX *out_mem_ctx;
3706         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3707 };
3708
3709 static void rpccli_samr_AddGroupMember_done(struct tevent_req *subreq);
3710
3711 struct tevent_req *rpccli_samr_AddGroupMember_send(TALLOC_CTX *mem_ctx,
3712                                                    struct tevent_context *ev,
3713                                                    struct rpc_pipe_client *cli,
3714                                                    struct policy_handle *_group_handle /* [in] [ref] */,
3715                                                    uint32_t _rid /* [in]  */,
3716                                                    uint32_t _flags /* [in]  */)
3717 {
3718         struct tevent_req *req;
3719         struct rpccli_samr_AddGroupMember_state *state;
3720         struct tevent_req *subreq;
3721
3722         req = tevent_req_create(mem_ctx, &state,
3723                                 struct rpccli_samr_AddGroupMember_state);
3724         if (req == NULL) {
3725                 return NULL;
3726         }
3727         state->out_mem_ctx = NULL;
3728         state->dispatch_recv = cli->dispatch_recv;
3729
3730         /* In parameters */
3731         state->orig.in.group_handle = _group_handle;
3732         state->orig.in.rid = _rid;
3733         state->orig.in.flags = _flags;
3734
3735         /* Out parameters */
3736
3737         /* Result */
3738         ZERO_STRUCT(state->orig.out.result);
3739
3740         if (DEBUGLEVEL >= 10) {
3741                 NDR_PRINT_IN_DEBUG(samr_AddGroupMember, &state->orig);
3742         }
3743
3744         /* make a temporary copy, that we pass to the dispatch function */
3745         state->tmp = state->orig;
3746
3747         subreq = cli->dispatch_send(state, ev, cli,
3748                                     &ndr_table_samr,
3749                                     NDR_SAMR_ADDGROUPMEMBER,
3750                                     &state->tmp);
3751         if (tevent_req_nomem(subreq, req)) {
3752                 return tevent_req_post(req, ev);
3753         }
3754         tevent_req_set_callback(subreq, rpccli_samr_AddGroupMember_done, req);
3755         return req;
3756 }
3757
3758 static void rpccli_samr_AddGroupMember_done(struct tevent_req *subreq)
3759 {
3760         struct tevent_req *req = tevent_req_callback_data(
3761                 subreq, struct tevent_req);
3762         struct rpccli_samr_AddGroupMember_state *state = tevent_req_data(
3763                 req, struct rpccli_samr_AddGroupMember_state);
3764         NTSTATUS status;
3765         TALLOC_CTX *mem_ctx;
3766
3767         if (state->out_mem_ctx) {
3768                 mem_ctx = state->out_mem_ctx;
3769         } else {
3770                 mem_ctx = state;
3771         }
3772
3773         status = state->dispatch_recv(subreq, mem_ctx);
3774         TALLOC_FREE(subreq);
3775         if (!NT_STATUS_IS_OK(status)) {
3776                 tevent_req_nterror(req, status);
3777                 return;
3778         }
3779
3780         /* Copy out parameters */
3781
3782         /* Copy result */
3783         state->orig.out.result = state->tmp.out.result;
3784
3785         /* Reset temporary structure */
3786         ZERO_STRUCT(state->tmp);
3787
3788         if (DEBUGLEVEL >= 10) {
3789                 NDR_PRINT_OUT_DEBUG(samr_AddGroupMember, &state->orig);
3790         }
3791
3792         tevent_req_done(req);
3793 }
3794
3795 NTSTATUS rpccli_samr_AddGroupMember_recv(struct tevent_req *req,
3796                                          TALLOC_CTX *mem_ctx,
3797                                          NTSTATUS *result)
3798 {
3799         struct rpccli_samr_AddGroupMember_state *state = tevent_req_data(
3800                 req, struct rpccli_samr_AddGroupMember_state);
3801         NTSTATUS status;
3802
3803         if (tevent_req_is_nterror(req, &status)) {
3804                 tevent_req_received(req);
3805                 return status;
3806         }
3807
3808         /* Steal possbile out parameters to the callers context */
3809         talloc_steal(mem_ctx, state->out_mem_ctx);
3810
3811         /* Return result */
3812         *result = state->orig.out.result;
3813
3814         tevent_req_received(req);
3815         return NT_STATUS_OK;
3816 }
3817
3818 NTSTATUS rpccli_samr_AddGroupMember(struct rpc_pipe_client *cli,
3819                                     TALLOC_CTX *mem_ctx,
3820                                     struct policy_handle *group_handle /* [in] [ref] */,
3821                                     uint32_t rid /* [in]  */,
3822                                     uint32_t flags /* [in]  */)
3823 {
3824         struct samr_AddGroupMember r;
3825         NTSTATUS status;
3826
3827         /* In parameters */
3828         r.in.group_handle = group_handle;
3829         r.in.rid = rid;
3830         r.in.flags = flags;
3831
3832         if (DEBUGLEVEL >= 10) {
3833                 NDR_PRINT_IN_DEBUG(samr_AddGroupMember, &r);
3834         }
3835
3836         status = cli->dispatch(cli,
3837                                 mem_ctx,
3838                                 &ndr_table_samr,
3839                                 NDR_SAMR_ADDGROUPMEMBER,
3840                                 &r);
3841
3842         if (!NT_STATUS_IS_OK(status)) {
3843                 return status;
3844         }
3845
3846         if (DEBUGLEVEL >= 10) {
3847                 NDR_PRINT_OUT_DEBUG(samr_AddGroupMember, &r);
3848         }
3849
3850         if (NT_STATUS_IS_ERR(status)) {
3851                 return status;
3852         }
3853
3854         /* Return variables */
3855
3856         /* Return result */
3857         return r.out.result;
3858 }
3859
3860 struct rpccli_samr_DeleteDomainGroup_state {
3861         struct samr_DeleteDomainGroup orig;
3862         struct samr_DeleteDomainGroup tmp;
3863         TALLOC_CTX *out_mem_ctx;
3864         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3865 };
3866
3867 static void rpccli_samr_DeleteDomainGroup_done(struct tevent_req *subreq);
3868
3869 struct tevent_req *rpccli_samr_DeleteDomainGroup_send(TALLOC_CTX *mem_ctx,
3870                                                       struct tevent_context *ev,
3871                                                       struct rpc_pipe_client *cli,
3872                                                       struct policy_handle *_group_handle /* [in,out] [ref] */)
3873 {
3874         struct tevent_req *req;
3875         struct rpccli_samr_DeleteDomainGroup_state *state;
3876         struct tevent_req *subreq;
3877
3878         req = tevent_req_create(mem_ctx, &state,
3879                                 struct rpccli_samr_DeleteDomainGroup_state);
3880         if (req == NULL) {
3881                 return NULL;
3882         }
3883         state->out_mem_ctx = NULL;
3884         state->dispatch_recv = cli->dispatch_recv;
3885
3886         /* In parameters */
3887         state->orig.in.group_handle = _group_handle;
3888
3889         /* Out parameters */
3890         state->orig.out.group_handle = _group_handle;
3891
3892         /* Result */
3893         ZERO_STRUCT(state->orig.out.result);
3894
3895         if (DEBUGLEVEL >= 10) {
3896                 NDR_PRINT_IN_DEBUG(samr_DeleteDomainGroup, &state->orig);
3897         }
3898
3899         state->out_mem_ctx = talloc_named_const(state, 0,
3900                              "rpccli_samr_DeleteDomainGroup_out_memory");
3901         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3902                 return tevent_req_post(req, ev);
3903         }
3904
3905         /* make a temporary copy, that we pass to the dispatch function */
3906         state->tmp = state->orig;
3907
3908         subreq = cli->dispatch_send(state, ev, cli,
3909                                     &ndr_table_samr,
3910                                     NDR_SAMR_DELETEDOMAINGROUP,
3911                                     &state->tmp);
3912         if (tevent_req_nomem(subreq, req)) {
3913                 return tevent_req_post(req, ev);
3914         }
3915         tevent_req_set_callback(subreq, rpccli_samr_DeleteDomainGroup_done, req);
3916         return req;
3917 }
3918
3919 static void rpccli_samr_DeleteDomainGroup_done(struct tevent_req *subreq)
3920 {
3921         struct tevent_req *req = tevent_req_callback_data(
3922                 subreq, struct tevent_req);
3923         struct rpccli_samr_DeleteDomainGroup_state *state = tevent_req_data(
3924                 req, struct rpccli_samr_DeleteDomainGroup_state);
3925         NTSTATUS status;
3926         TALLOC_CTX *mem_ctx;
3927
3928         if (state->out_mem_ctx) {
3929                 mem_ctx = state->out_mem_ctx;
3930         } else {
3931                 mem_ctx = state;
3932         }
3933
3934         status = state->dispatch_recv(subreq, mem_ctx);
3935         TALLOC_FREE(subreq);
3936         if (!NT_STATUS_IS_OK(status)) {
3937                 tevent_req_nterror(req, status);
3938                 return;
3939         }
3940
3941         /* Copy out parameters */
3942         *state->orig.out.group_handle = *state->tmp.out.group_handle;
3943
3944         /* Copy result */
3945         state->orig.out.result = state->tmp.out.result;
3946
3947         /* Reset temporary structure */
3948         ZERO_STRUCT(state->tmp);
3949
3950         if (DEBUGLEVEL >= 10) {
3951                 NDR_PRINT_OUT_DEBUG(samr_DeleteDomainGroup, &state->orig);
3952         }
3953
3954         tevent_req_done(req);
3955 }
3956
3957 NTSTATUS rpccli_samr_DeleteDomainGroup_recv(struct tevent_req *req,
3958                                             TALLOC_CTX *mem_ctx,
3959                                             NTSTATUS *result)
3960 {
3961         struct rpccli_samr_DeleteDomainGroup_state *state = tevent_req_data(
3962                 req, struct rpccli_samr_DeleteDomainGroup_state);
3963         NTSTATUS status;
3964
3965         if (tevent_req_is_nterror(req, &status)) {
3966                 tevent_req_received(req);
3967                 return status;
3968         }
3969
3970         /* Steal possbile out parameters to the callers context */
3971         talloc_steal(mem_ctx, state->out_mem_ctx);
3972
3973         /* Return result */
3974         *result = state->orig.out.result;
3975
3976         tevent_req_received(req);
3977         return NT_STATUS_OK;
3978 }
3979
3980 NTSTATUS rpccli_samr_DeleteDomainGroup(struct rpc_pipe_client *cli,
3981                                        TALLOC_CTX *mem_ctx,
3982                                        struct policy_handle *group_handle /* [in,out] [ref] */)
3983 {
3984         struct samr_DeleteDomainGroup r;
3985         NTSTATUS status;
3986
3987         /* In parameters */
3988         r.in.group_handle = group_handle;
3989
3990         if (DEBUGLEVEL >= 10) {
3991                 NDR_PRINT_IN_DEBUG(samr_DeleteDomainGroup, &r);
3992         }
3993
3994         status = cli->dispatch(cli,
3995                                 mem_ctx,
3996                                 &ndr_table_samr,
3997                                 NDR_SAMR_DELETEDOMAINGROUP,
3998                                 &r);
3999
4000         if (!NT_STATUS_IS_OK(status)) {
4001                 return status;
4002         }
4003
4004         if (DEBUGLEVEL >= 10) {
4005                 NDR_PRINT_OUT_DEBUG(samr_DeleteDomainGroup, &r);
4006         }
4007
4008         if (NT_STATUS_IS_ERR(status)) {
4009                 return status;
4010         }
4011
4012         /* Return variables */
4013         *group_handle = *r.out.group_handle;
4014
4015         /* Return result */
4016         return r.out.result;
4017 }
4018
4019 struct rpccli_samr_DeleteGroupMember_state {
4020         struct samr_DeleteGroupMember orig;
4021         struct samr_DeleteGroupMember tmp;
4022         TALLOC_CTX *out_mem_ctx;
4023         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4024 };
4025
4026 static void rpccli_samr_DeleteGroupMember_done(struct tevent_req *subreq);
4027
4028 struct tevent_req *rpccli_samr_DeleteGroupMember_send(TALLOC_CTX *mem_ctx,
4029                                                       struct tevent_context *ev,
4030                                                       struct rpc_pipe_client *cli,
4031                                                       struct policy_handle *_group_handle /* [in] [ref] */,
4032                                                       uint32_t _rid /* [in]  */)
4033 {
4034         struct tevent_req *req;
4035         struct rpccli_samr_DeleteGroupMember_state *state;
4036         struct tevent_req *subreq;
4037
4038         req = tevent_req_create(mem_ctx, &state,
4039                                 struct rpccli_samr_DeleteGroupMember_state);
4040         if (req == NULL) {
4041                 return NULL;
4042         }
4043         state->out_mem_ctx = NULL;
4044         state->dispatch_recv = cli->dispatch_recv;
4045
4046         /* In parameters */
4047         state->orig.in.group_handle = _group_handle;
4048         state->orig.in.rid = _rid;
4049
4050         /* Out parameters */
4051
4052         /* Result */
4053         ZERO_STRUCT(state->orig.out.result);
4054
4055         if (DEBUGLEVEL >= 10) {
4056                 NDR_PRINT_IN_DEBUG(samr_DeleteGroupMember, &state->orig);
4057         }
4058
4059         /* make a temporary copy, that we pass to the dispatch function */
4060         state->tmp = state->orig;
4061
4062         subreq = cli->dispatch_send(state, ev, cli,
4063                                     &ndr_table_samr,
4064                                     NDR_SAMR_DELETEGROUPMEMBER,
4065                                     &state->tmp);
4066         if (tevent_req_nomem(subreq, req)) {
4067                 return tevent_req_post(req, ev);
4068         }
4069         tevent_req_set_callback(subreq, rpccli_samr_DeleteGroupMember_done, req);
4070         return req;
4071 }
4072
4073 static void rpccli_samr_DeleteGroupMember_done(struct tevent_req *subreq)
4074 {
4075         struct tevent_req *req = tevent_req_callback_data(
4076                 subreq, struct tevent_req);
4077         struct rpccli_samr_DeleteGroupMember_state *state = tevent_req_data(
4078                 req, struct rpccli_samr_DeleteGroupMember_state);
4079         NTSTATUS status;
4080         TALLOC_CTX *mem_ctx;
4081
4082         if (state->out_mem_ctx) {
4083                 mem_ctx = state->out_mem_ctx;
4084         } else {
4085                 mem_ctx = state;
4086         }
4087
4088         status = state->dispatch_recv(subreq, mem_ctx);
4089         TALLOC_FREE(subreq);
4090         if (!NT_STATUS_IS_OK(status)) {
4091                 tevent_req_nterror(req, status);
4092                 return;
4093         }
4094
4095         /* Copy out parameters */
4096
4097         /* Copy result */
4098         state->orig.out.result = state->tmp.out.result;
4099
4100         /* Reset temporary structure */
4101         ZERO_STRUCT(state->tmp);
4102
4103         if (DEBUGLEVEL >= 10) {
4104                 NDR_PRINT_OUT_DEBUG(samr_DeleteGroupMember, &state->orig);
4105         }
4106
4107         tevent_req_done(req);
4108 }
4109
4110 NTSTATUS rpccli_samr_DeleteGroupMember_recv(struct tevent_req *req,
4111                                             TALLOC_CTX *mem_ctx,
4112                                             NTSTATUS *result)
4113 {
4114         struct rpccli_samr_DeleteGroupMember_state *state = tevent_req_data(
4115                 req, struct rpccli_samr_DeleteGroupMember_state);
4116         NTSTATUS status;
4117
4118         if (tevent_req_is_nterror(req, &status)) {
4119                 tevent_req_received(req);
4120                 return status;
4121         }
4122
4123         /* Steal possbile out parameters to the callers context */
4124         talloc_steal(mem_ctx, state->out_mem_ctx);
4125
4126         /* Return result */
4127         *result = state->orig.out.result;
4128
4129         tevent_req_received(req);
4130         return NT_STATUS_OK;
4131 }
4132
4133 NTSTATUS rpccli_samr_DeleteGroupMember(struct rpc_pipe_client *cli,
4134                                        TALLOC_CTX *mem_ctx,
4135                                        struct policy_handle *group_handle /* [in] [ref] */,
4136                                        uint32_t rid /* [in]  */)
4137 {
4138         struct samr_DeleteGroupMember r;
4139         NTSTATUS status;
4140
4141         /* In parameters */
4142         r.in.group_handle = group_handle;
4143         r.in.rid = rid;
4144
4145         if (DEBUGLEVEL >= 10) {
4146                 NDR_PRINT_IN_DEBUG(samr_DeleteGroupMember, &r);
4147         }
4148
4149         status = cli->dispatch(cli,
4150                                 mem_ctx,
4151                                 &ndr_table_samr,
4152                                 NDR_SAMR_DELETEGROUPMEMBER,
4153                                 &r);
4154
4155         if (!NT_STATUS_IS_OK(status)) {
4156                 return status;
4157         }
4158
4159         if (DEBUGLEVEL >= 10) {
4160                 NDR_PRINT_OUT_DEBUG(samr_DeleteGroupMember, &r);
4161         }
4162
4163         if (NT_STATUS_IS_ERR(status)) {
4164                 return status;
4165         }
4166
4167         /* Return variables */
4168
4169         /* Return result */
4170         return r.out.result;
4171 }
4172
4173 struct rpccli_samr_QueryGroupMember_state {
4174         struct samr_QueryGroupMember orig;
4175         struct samr_QueryGroupMember tmp;
4176         TALLOC_CTX *out_mem_ctx;
4177         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4178 };
4179
4180 static void rpccli_samr_QueryGroupMember_done(struct tevent_req *subreq);
4181
4182 struct tevent_req *rpccli_samr_QueryGroupMember_send(TALLOC_CTX *mem_ctx,
4183                                                      struct tevent_context *ev,
4184                                                      struct rpc_pipe_client *cli,
4185                                                      struct policy_handle *_group_handle /* [in] [ref] */,
4186                                                      struct samr_RidTypeArray **_rids /* [out] [ref] */)
4187 {
4188         struct tevent_req *req;
4189         struct rpccli_samr_QueryGroupMember_state *state;
4190         struct tevent_req *subreq;
4191
4192         req = tevent_req_create(mem_ctx, &state,
4193                                 struct rpccli_samr_QueryGroupMember_state);
4194         if (req == NULL) {
4195                 return NULL;
4196         }
4197         state->out_mem_ctx = NULL;
4198         state->dispatch_recv = cli->dispatch_recv;
4199
4200         /* In parameters */
4201         state->orig.in.group_handle = _group_handle;
4202
4203         /* Out parameters */
4204         state->orig.out.rids = _rids;
4205
4206         /* Result */
4207         ZERO_STRUCT(state->orig.out.result);
4208
4209         if (DEBUGLEVEL >= 10) {
4210                 NDR_PRINT_IN_DEBUG(samr_QueryGroupMember, &state->orig);
4211         }
4212
4213         state->out_mem_ctx = talloc_named_const(state, 0,
4214                              "rpccli_samr_QueryGroupMember_out_memory");
4215         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4216                 return tevent_req_post(req, ev);
4217         }
4218
4219         /* make a temporary copy, that we pass to the dispatch function */
4220         state->tmp = state->orig;
4221
4222         subreq = cli->dispatch_send(state, ev, cli,
4223                                     &ndr_table_samr,
4224                                     NDR_SAMR_QUERYGROUPMEMBER,
4225                                     &state->tmp);
4226         if (tevent_req_nomem(subreq, req)) {
4227                 return tevent_req_post(req, ev);
4228         }
4229         tevent_req_set_callback(subreq, rpccli_samr_QueryGroupMember_done, req);
4230         return req;
4231 }
4232
4233 static void rpccli_samr_QueryGroupMember_done(struct tevent_req *subreq)
4234 {
4235         struct tevent_req *req = tevent_req_callback_data(
4236                 subreq, struct tevent_req);
4237         struct rpccli_samr_QueryGroupMember_state *state = tevent_req_data(
4238                 req, struct rpccli_samr_QueryGroupMember_state);
4239         NTSTATUS status;
4240         TALLOC_CTX *mem_ctx;
4241
4242         if (state->out_mem_ctx) {
4243                 mem_ctx = state->out_mem_ctx;
4244         } else {
4245                 mem_ctx = state;
4246         }
4247
4248         status = state->dispatch_recv(subreq, mem_ctx);
4249         TALLOC_FREE(subreq);
4250         if (!NT_STATUS_IS_OK(status)) {
4251                 tevent_req_nterror(req, status);
4252                 return;
4253         }
4254
4255         /* Copy out parameters */
4256         *state->orig.out.rids = *state->tmp.out.rids;
4257
4258         /* Copy result */
4259         state->orig.out.result = state->tmp.out.result;
4260
4261         /* Reset temporary structure */
4262         ZERO_STRUCT(state->tmp);
4263
4264         if (DEBUGLEVEL >= 10) {
4265                 NDR_PRINT_OUT_DEBUG(samr_QueryGroupMember, &state->orig);
4266         }
4267
4268         tevent_req_done(req);
4269 }
4270
4271 NTSTATUS rpccli_samr_QueryGroupMember_recv(struct tevent_req *req,
4272                                            TALLOC_CTX *mem_ctx,
4273                                            NTSTATUS *result)
4274 {
4275         struct rpccli_samr_QueryGroupMember_state *state = tevent_req_data(
4276                 req, struct rpccli_samr_QueryGroupMember_state);
4277         NTSTATUS status;
4278
4279         if (tevent_req_is_nterror(req, &status)) {
4280                 tevent_req_received(req);
4281                 return status;
4282         }
4283
4284         /* Steal possbile out parameters to the callers context */
4285         talloc_steal(mem_ctx, state->out_mem_ctx);
4286
4287         /* Return result */
4288         *result = state->orig.out.result;
4289
4290         tevent_req_received(req);
4291         return NT_STATUS_OK;
4292 }
4293
4294 NTSTATUS rpccli_samr_QueryGroupMember(struct rpc_pipe_client *cli,
4295                                       TALLOC_CTX *mem_ctx,
4296                                       struct policy_handle *group_handle /* [in] [ref] */,
4297                                       struct samr_RidTypeArray **rids /* [out] [ref] */)
4298 {
4299         struct samr_QueryGroupMember r;
4300         NTSTATUS status;
4301
4302         /* In parameters */
4303         r.in.group_handle = group_handle;
4304
4305         if (DEBUGLEVEL >= 10) {
4306                 NDR_PRINT_IN_DEBUG(samr_QueryGroupMember, &r);
4307         }
4308
4309         status = cli->dispatch(cli,
4310                                 mem_ctx,
4311                                 &ndr_table_samr,
4312                                 NDR_SAMR_QUERYGROUPMEMBER,
4313                                 &r);
4314
4315         if (!NT_STATUS_IS_OK(status)) {
4316                 return status;
4317         }
4318
4319         if (DEBUGLEVEL >= 10) {
4320                 NDR_PRINT_OUT_DEBUG(samr_QueryGroupMember, &r);
4321         }
4322
4323         if (NT_STATUS_IS_ERR(status)) {
4324                 return status;
4325         }
4326
4327         /* Return variables */
4328         *rids = *r.out.rids;
4329
4330         /* Return result */
4331         return r.out.result;
4332 }
4333
4334 struct rpccli_samr_SetMemberAttributesOfGroup_state {
4335         struct samr_SetMemberAttributesOfGroup orig;
4336         struct samr_SetMemberAttributesOfGroup tmp;
4337         TALLOC_CTX *out_mem_ctx;
4338         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4339 };
4340
4341 static void rpccli_samr_SetMemberAttributesOfGroup_done(struct tevent_req *subreq);
4342
4343 struct tevent_req *rpccli_samr_SetMemberAttributesOfGroup_send(TALLOC_CTX *mem_ctx,
4344                                                                struct tevent_context *ev,
4345                                                                struct rpc_pipe_client *cli,
4346                                                                struct policy_handle *_group_handle /* [in] [ref] */,
4347                                                                uint32_t _unknown1 /* [in]  */,
4348                                                                uint32_t _unknown2 /* [in]  */)
4349 {
4350         struct tevent_req *req;
4351         struct rpccli_samr_SetMemberAttributesOfGroup_state *state;
4352         struct tevent_req *subreq;
4353
4354         req = tevent_req_create(mem_ctx, &state,
4355                                 struct rpccli_samr_SetMemberAttributesOfGroup_state);
4356         if (req == NULL) {
4357                 return NULL;
4358         }
4359         state->out_mem_ctx = NULL;
4360         state->dispatch_recv = cli->dispatch_recv;
4361
4362         /* In parameters */
4363         state->orig.in.group_handle = _group_handle;
4364         state->orig.in.unknown1 = _unknown1;
4365         state->orig.in.unknown2 = _unknown2;
4366
4367         /* Out parameters */
4368
4369         /* Result */
4370         ZERO_STRUCT(state->orig.out.result);
4371
4372         if (DEBUGLEVEL >= 10) {
4373                 NDR_PRINT_IN_DEBUG(samr_SetMemberAttributesOfGroup, &state->orig);
4374         }
4375
4376         /* make a temporary copy, that we pass to the dispatch function */
4377         state->tmp = state->orig;
4378
4379         subreq = cli->dispatch_send(state, ev, cli,
4380                                     &ndr_table_samr,
4381                                     NDR_SAMR_SETMEMBERATTRIBUTESOFGROUP,
4382                                     &state->tmp);
4383         if (tevent_req_nomem(subreq, req)) {
4384                 return tevent_req_post(req, ev);
4385         }
4386         tevent_req_set_callback(subreq, rpccli_samr_SetMemberAttributesOfGroup_done, req);
4387         return req;
4388 }
4389
4390 static void rpccli_samr_SetMemberAttributesOfGroup_done(struct tevent_req *subreq)
4391 {
4392         struct tevent_req *req = tevent_req_callback_data(
4393                 subreq, struct tevent_req);
4394         struct rpccli_samr_SetMemberAttributesOfGroup_state *state = tevent_req_data(
4395                 req, struct rpccli_samr_SetMemberAttributesOfGroup_state);
4396         NTSTATUS status;
4397         TALLOC_CTX *mem_ctx;
4398
4399         if (state->out_mem_ctx) {
4400                 mem_ctx = state->out_mem_ctx;
4401         } else {
4402                 mem_ctx = state;
4403         }
4404
4405         status = state->dispatch_recv(subreq, mem_ctx);
4406         TALLOC_FREE(subreq);
4407         if (!NT_STATUS_IS_OK(status)) {
4408                 tevent_req_nterror(req, status);
4409                 return;
4410         }
4411
4412         /* Copy out parameters */
4413
4414         /* Copy result */
4415         state->orig.out.result = state->tmp.out.result;
4416
4417         /* Reset temporary structure */
4418         ZERO_STRUCT(state->tmp);
4419
4420         if (DEBUGLEVEL >= 10) {
4421                 NDR_PRINT_OUT_DEBUG(samr_SetMemberAttributesOfGroup, &state->orig);
4422         }
4423
4424         tevent_req_done(req);
4425 }
4426
4427 NTSTATUS rpccli_samr_SetMemberAttributesOfGroup_recv(struct tevent_req *req,
4428                                                      TALLOC_CTX *mem_ctx,
4429                                                      NTSTATUS *result)
4430 {
4431         struct rpccli_samr_SetMemberAttributesOfGroup_state *state = tevent_req_data(
4432                 req, struct rpccli_samr_SetMemberAttributesOfGroup_state);
4433         NTSTATUS status;
4434
4435         if (tevent_req_is_nterror(req, &status)) {
4436                 tevent_req_received(req);
4437                 return status;
4438         }
4439
4440         /* Steal possbile out parameters to the callers context */
4441         talloc_steal(mem_ctx, state->out_mem_ctx);
4442
4443         /* Return result */
4444         *result = state->orig.out.result;
4445
4446         tevent_req_received(req);
4447         return NT_STATUS_OK;
4448 }
4449
4450 NTSTATUS rpccli_samr_SetMemberAttributesOfGroup(struct rpc_pipe_client *cli,
4451                                                 TALLOC_CTX *mem_ctx,
4452                                                 struct policy_handle *group_handle /* [in] [ref] */,
4453                                                 uint32_t unknown1 /* [in]  */,
4454                                                 uint32_t unknown2 /* [in]  */)
4455 {
4456         struct samr_SetMemberAttributesOfGroup r;
4457         NTSTATUS status;
4458
4459         /* In parameters */
4460         r.in.group_handle = group_handle;
4461         r.in.unknown1 = unknown1;
4462         r.in.unknown2 = unknown2;
4463
4464         if (DEBUGLEVEL >= 10) {
4465                 NDR_PRINT_IN_DEBUG(samr_SetMemberAttributesOfGroup, &r);
4466         }
4467
4468         status = cli->dispatch(cli,
4469                                 mem_ctx,
4470                                 &ndr_table_samr,
4471                                 NDR_SAMR_SETMEMBERATTRIBUTESOFGROUP,
4472                                 &r);
4473
4474         if (!NT_STATUS_IS_OK(status)) {
4475                 return status;
4476         }
4477
4478         if (DEBUGLEVEL >= 10) {
4479                 NDR_PRINT_OUT_DEBUG(samr_SetMemberAttributesOfGroup, &r);
4480         }
4481
4482         if (NT_STATUS_IS_ERR(status)) {
4483                 return status;
4484         }
4485
4486         /* Return variables */
4487
4488         /* Return result */
4489         return r.out.result;
4490 }
4491
4492 struct rpccli_samr_OpenAlias_state {
4493         struct samr_OpenAlias orig;
4494         struct samr_OpenAlias tmp;
4495         TALLOC_CTX *out_mem_ctx;
4496         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4497 };
4498
4499 static void rpccli_samr_OpenAlias_done(struct tevent_req *subreq);
4500
4501 struct tevent_req *rpccli_samr_OpenAlias_send(TALLOC_CTX *mem_ctx,
4502                                               struct tevent_context *ev,
4503                                               struct rpc_pipe_client *cli,
4504                                               struct policy_handle *_domain_handle /* [in] [ref] */,
4505                                               uint32_t _access_mask /* [in]  */,
4506                                               uint32_t _rid /* [in]  */,
4507                                               struct policy_handle *_alias_handle /* [out] [ref] */)
4508 {
4509         struct tevent_req *req;
4510         struct rpccli_samr_OpenAlias_state *state;
4511         struct tevent_req *subreq;
4512
4513         req = tevent_req_create(mem_ctx, &state,
4514                                 struct rpccli_samr_OpenAlias_state);
4515         if (req == NULL) {
4516                 return NULL;
4517         }
4518         state->out_mem_ctx = NULL;
4519         state->dispatch_recv = cli->dispatch_recv;
4520
4521         /* In parameters */
4522         state->orig.in.domain_handle = _domain_handle;
4523         state->orig.in.access_mask = _access_mask;
4524         state->orig.in.rid = _rid;
4525
4526         /* Out parameters */
4527         state->orig.out.alias_handle = _alias_handle;
4528
4529         /* Result */
4530         ZERO_STRUCT(state->orig.out.result);
4531
4532         if (DEBUGLEVEL >= 10) {
4533                 NDR_PRINT_IN_DEBUG(samr_OpenAlias, &state->orig);
4534         }
4535
4536         state->out_mem_ctx = talloc_named_const(state, 0,
4537                              "rpccli_samr_OpenAlias_out_memory");
4538         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4539                 return tevent_req_post(req, ev);
4540         }
4541
4542         /* make a temporary copy, that we pass to the dispatch function */
4543         state->tmp = state->orig;
4544
4545         subreq = cli->dispatch_send(state, ev, cli,
4546                                     &ndr_table_samr,
4547                                     NDR_SAMR_OPENALIAS,
4548                                     &state->tmp);
4549         if (tevent_req_nomem(subreq, req)) {
4550                 return tevent_req_post(req, ev);
4551         }
4552         tevent_req_set_callback(subreq, rpccli_samr_OpenAlias_done, req);
4553         return req;
4554 }
4555
4556 static void rpccli_samr_OpenAlias_done(struct tevent_req *subreq)
4557 {
4558         struct tevent_req *req = tevent_req_callback_data(
4559                 subreq, struct tevent_req);
4560         struct rpccli_samr_OpenAlias_state *state = tevent_req_data(
4561                 req, struct rpccli_samr_OpenAlias_state);
4562         NTSTATUS status;
4563         TALLOC_CTX *mem_ctx;
4564
4565         if (state->out_mem_ctx) {
4566                 mem_ctx = state->out_mem_ctx;
4567         } else {
4568                 mem_ctx = state;
4569         }
4570
4571         status = state->dispatch_recv(subreq, mem_ctx);
4572         TALLOC_FREE(subreq);
4573         if (!NT_STATUS_IS_OK(status)) {
4574                 tevent_req_nterror(req, status);
4575                 return;
4576         }
4577
4578         /* Copy out parameters */
4579         *state->orig.out.alias_handle = *state->tmp.out.alias_handle;
4580
4581         /* Copy result */
4582         state->orig.out.result = state->tmp.out.result;
4583
4584         /* Reset temporary structure */
4585         ZERO_STRUCT(state->tmp);
4586
4587         if (DEBUGLEVEL >= 10) {
4588                 NDR_PRINT_OUT_DEBUG(samr_OpenAlias, &state->orig);
4589         }
4590
4591         tevent_req_done(req);
4592 }
4593
4594 NTSTATUS rpccli_samr_OpenAlias_recv(struct tevent_req *req,
4595                                     TALLOC_CTX *mem_ctx,
4596                                     NTSTATUS *result)
4597 {
4598         struct rpccli_samr_OpenAlias_state *state = tevent_req_data(
4599                 req, struct rpccli_samr_OpenAlias_state);
4600         NTSTATUS status;
4601
4602         if (tevent_req_is_nterror(req, &status)) {
4603                 tevent_req_received(req);
4604                 return status;
4605         }
4606
4607         /* Steal possbile out parameters to the callers context */
4608         talloc_steal(mem_ctx, state->out_mem_ctx);
4609
4610         /* Return result */
4611         *result = state->orig.out.result;
4612
4613         tevent_req_received(req);
4614         return NT_STATUS_OK;
4615 }
4616
4617 NTSTATUS rpccli_samr_OpenAlias(struct rpc_pipe_client *cli,
4618                                TALLOC_CTX *mem_ctx,
4619                                struct policy_handle *domain_handle /* [in] [ref] */,
4620                                uint32_t access_mask /* [in]  */,
4621                                uint32_t rid /* [in]  */,
4622                                struct policy_handle *alias_handle /* [out] [ref] */)
4623 {
4624         struct samr_OpenAlias r;
4625         NTSTATUS status;
4626
4627         /* In parameters */
4628         r.in.domain_handle = domain_handle;
4629         r.in.access_mask = access_mask;
4630         r.in.rid = rid;
4631
4632         if (DEBUGLEVEL >= 10) {
4633                 NDR_PRINT_IN_DEBUG(samr_OpenAlias, &r);
4634         }
4635
4636         status = cli->dispatch(cli,
4637                                 mem_ctx,
4638                                 &ndr_table_samr,
4639                                 NDR_SAMR_OPENALIAS,
4640                                 &r);
4641
4642         if (!NT_STATUS_IS_OK(status)) {
4643                 return status;
4644         }
4645
4646         if (DEBUGLEVEL >= 10) {
4647                 NDR_PRINT_OUT_DEBUG(samr_OpenAlias, &r);
4648         }
4649
4650         if (NT_STATUS_IS_ERR(status)) {
4651                 return status;
4652         }
4653
4654         /* Return variables */
4655         *alias_handle = *r.out.alias_handle;
4656
4657         /* Return result */
4658         return r.out.result;
4659 }
4660
4661 struct rpccli_samr_QueryAliasInfo_state {
4662         struct samr_QueryAliasInfo orig;
4663         struct samr_QueryAliasInfo tmp;
4664         TALLOC_CTX *out_mem_ctx;
4665         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4666 };
4667
4668 static void rpccli_samr_QueryAliasInfo_done(struct tevent_req *subreq);
4669
4670 struct tevent_req *rpccli_samr_QueryAliasInfo_send(TALLOC_CTX *mem_ctx,
4671                                                    struct tevent_context *ev,
4672                                                    struct rpc_pipe_client *cli,
4673                                                    struct policy_handle *_alias_handle /* [in] [ref] */,
4674                                                    enum samr_AliasInfoEnum _level /* [in]  */,
4675                                                    union samr_AliasInfo **_info /* [out] [ref,switch_is(level)] */)
4676 {
4677         struct tevent_req *req;
4678         struct rpccli_samr_QueryAliasInfo_state *state;
4679         struct tevent_req *subreq;
4680
4681         req = tevent_req_create(mem_ctx, &state,
4682                                 struct rpccli_samr_QueryAliasInfo_state);
4683         if (req == NULL) {
4684                 return NULL;
4685         }
4686         state->out_mem_ctx = NULL;
4687         state->dispatch_recv = cli->dispatch_recv;
4688
4689         /* In parameters */
4690         state->orig.in.alias_handle = _alias_handle;
4691         state->orig.in.level = _level;
4692
4693         /* Out parameters */
4694         state->orig.out.info = _info;
4695
4696         /* Result */
4697         ZERO_STRUCT(state->orig.out.result);
4698
4699         if (DEBUGLEVEL >= 10) {
4700                 NDR_PRINT_IN_DEBUG(samr_QueryAliasInfo, &state->orig);
4701         }
4702
4703         state->out_mem_ctx = talloc_named_const(state, 0,
4704                              "rpccli_samr_QueryAliasInfo_out_memory");
4705         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4706                 return tevent_req_post(req, ev);
4707         }
4708
4709         /* make a temporary copy, that we pass to the dispatch function */
4710         state->tmp = state->orig;
4711
4712         subreq = cli->dispatch_send(state, ev, cli,
4713                                     &ndr_table_samr,
4714                                     NDR_SAMR_QUERYALIASINFO,
4715                                     &state->tmp);
4716         if (tevent_req_nomem(subreq, req)) {
4717                 return tevent_req_post(req, ev);
4718         }
4719         tevent_req_set_callback(subreq, rpccli_samr_QueryAliasInfo_done, req);
4720         return req;
4721 }
4722
4723 static void rpccli_samr_QueryAliasInfo_done(struct tevent_req *subreq)
4724 {
4725         struct tevent_req *req = tevent_req_callback_data(
4726                 subreq, struct tevent_req);
4727         struct rpccli_samr_QueryAliasInfo_state *state = tevent_req_data(
4728                 req, struct rpccli_samr_QueryAliasInfo_state);
4729         NTSTATUS status;
4730         TALLOC_CTX *mem_ctx;
4731
4732         if (state->out_mem_ctx) {
4733                 mem_ctx = state->out_mem_ctx;
4734         } else {
4735                 mem_ctx = state;
4736         }
4737
4738         status = state->dispatch_recv(subreq, mem_ctx);
4739         TALLOC_FREE(subreq);
4740         if (!NT_STATUS_IS_OK(status)) {
4741                 tevent_req_nterror(req, status);
4742                 return;
4743         }
4744
4745         /* Copy out parameters */
4746         *state->orig.out.info = *state->tmp.out.info;
4747
4748         /* Copy result */
4749         state->orig.out.result = state->tmp.out.result;
4750
4751         /* Reset temporary structure */
4752         ZERO_STRUCT(state->tmp);
4753
4754         if (DEBUGLEVEL >= 10) {
4755                 NDR_PRINT_OUT_DEBUG(samr_QueryAliasInfo, &state->orig);
4756         }
4757
4758         tevent_req_done(req);
4759 }
4760
4761 NTSTATUS rpccli_samr_QueryAliasInfo_recv(struct tevent_req *req,
4762                                          TALLOC_CTX *mem_ctx,
4763                                          NTSTATUS *result)
4764 {
4765         struct rpccli_samr_QueryAliasInfo_state *state = tevent_req_data(
4766                 req, struct rpccli_samr_QueryAliasInfo_state);
4767         NTSTATUS status;
4768
4769         if (tevent_req_is_nterror(req, &status)) {
4770                 tevent_req_received(req);
4771                 return status;
4772         }
4773
4774         /* Steal possbile out parameters to the callers context */
4775         talloc_steal(mem_ctx, state->out_mem_ctx);
4776
4777         /* Return result */
4778         *result = state->orig.out.result;
4779
4780         tevent_req_received(req);
4781         return NT_STATUS_OK;
4782 }
4783
4784 NTSTATUS rpccli_samr_QueryAliasInfo(struct rpc_pipe_client *cli,
4785                                     TALLOC_CTX *mem_ctx,
4786                                     struct policy_handle *alias_handle /* [in] [ref] */,
4787                                     enum samr_AliasInfoEnum level /* [in]  */,
4788                                     union samr_AliasInfo **info /* [out] [ref,switch_is(level)] */)
4789 {
4790         struct samr_QueryAliasInfo r;
4791         NTSTATUS status;
4792
4793         /* In parameters */
4794         r.in.alias_handle = alias_handle;
4795         r.in.level = level;
4796
4797         if (DEBUGLEVEL >= 10) {
4798                 NDR_PRINT_IN_DEBUG(samr_QueryAliasInfo, &r);
4799         }
4800
4801         status = cli->dispatch(cli,
4802                                 mem_ctx,
4803                                 &ndr_table_samr,
4804                                 NDR_SAMR_QUERYALIASINFO,
4805                                 &r);
4806
4807         if (!NT_STATUS_IS_OK(status)) {
4808                 return status;
4809         }
4810
4811         if (DEBUGLEVEL >= 10) {
4812                 NDR_PRINT_OUT_DEBUG(samr_QueryAliasInfo, &r);
4813         }
4814
4815         if (NT_STATUS_IS_ERR(status)) {
4816                 return status;
4817         }
4818
4819         /* Return variables */
4820         *info = *r.out.info;
4821
4822         /* Return result */
4823         return r.out.result;
4824 }
4825
4826 struct rpccli_samr_SetAliasInfo_state {
4827         struct samr_SetAliasInfo orig;
4828         struct samr_SetAliasInfo tmp;
4829         TALLOC_CTX *out_mem_ctx;
4830         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4831 };
4832
4833 static void rpccli_samr_SetAliasInfo_done(struct tevent_req *subreq);
4834
4835 struct tevent_req *rpccli_samr_SetAliasInfo_send(TALLOC_CTX *mem_ctx,
4836                                                  struct tevent_context *ev,
4837                                                  struct rpc_pipe_client *cli,
4838                                                  struct policy_handle *_alias_handle /* [in] [ref] */,
4839                                                  enum samr_AliasInfoEnum _level /* [in]  */,
4840                                                  union samr_AliasInfo *_info /* [in] [ref,switch_is(level)] */)
4841 {
4842         struct tevent_req *req;
4843         struct rpccli_samr_SetAliasInfo_state *state;
4844         struct tevent_req *subreq;
4845
4846         req = tevent_req_create(mem_ctx, &state,
4847                                 struct rpccli_samr_SetAliasInfo_state);
4848         if (req == NULL) {
4849                 return NULL;
4850         }
4851         state->out_mem_ctx = NULL;
4852         state->dispatch_recv = cli->dispatch_recv;
4853
4854         /* In parameters */
4855         state->orig.in.alias_handle = _alias_handle;
4856         state->orig.in.level = _level;
4857         state->orig.in.info = _info;
4858
4859         /* Out parameters */
4860
4861         /* Result */
4862         ZERO_STRUCT(state->orig.out.result);
4863
4864         if (DEBUGLEVEL >= 10) {
4865                 NDR_PRINT_IN_DEBUG(samr_SetAliasInfo, &state->orig);
4866         }
4867
4868         /* make a temporary copy, that we pass to the dispatch function */
4869         state->tmp = state->orig;
4870
4871         subreq = cli->dispatch_send(state, ev, cli,
4872                                     &ndr_table_samr,
4873                                     NDR_SAMR_SETALIASINFO,
4874                                     &state->tmp);
4875         if (tevent_req_nomem(subreq, req)) {
4876                 return tevent_req_post(req, ev);
4877         }
4878         tevent_req_set_callback(subreq, rpccli_samr_SetAliasInfo_done, req);
4879         return req;
4880 }
4881
4882 static void rpccli_samr_SetAliasInfo_done(struct tevent_req *subreq)
4883 {
4884         struct tevent_req *req = tevent_req_callback_data(
4885                 subreq, struct tevent_req);
4886         struct rpccli_samr_SetAliasInfo_state *state = tevent_req_data(
4887                 req, struct rpccli_samr_SetAliasInfo_state);
4888         NTSTATUS status;
4889         TALLOC_CTX *mem_ctx;
4890
4891         if (state->out_mem_ctx) {
4892                 mem_ctx = state->out_mem_ctx;
4893         } else {
4894                 mem_ctx = state;
4895         }
4896
4897         status = state->dispatch_recv(subreq, mem_ctx);
4898         TALLOC_FREE(subreq);
4899         if (!NT_STATUS_IS_OK(status)) {
4900                 tevent_req_nterror(req, status);
4901                 return;
4902         }
4903
4904         /* Copy out parameters */
4905
4906         /* Copy result */
4907         state->orig.out.result = state->tmp.out.result;
4908
4909         /* Reset temporary structure */
4910         ZERO_STRUCT(state->tmp);
4911
4912         if (DEBUGLEVEL >= 10) {
4913                 NDR_PRINT_OUT_DEBUG(samr_SetAliasInfo, &state->orig);
4914         }
4915
4916         tevent_req_done(req);
4917 }
4918
4919 NTSTATUS rpccli_samr_SetAliasInfo_recv(struct tevent_req *req,
4920                                        TALLOC_CTX *mem_ctx,
4921                                        NTSTATUS *result)
4922 {
4923         struct rpccli_samr_SetAliasInfo_state *state = tevent_req_data(
4924                 req, struct rpccli_samr_SetAliasInfo_state);
4925         NTSTATUS status;
4926
4927         if (tevent_req_is_nterror(req, &status)) {
4928                 tevent_req_received(req);
4929                 return status;
4930         }
4931
4932         /* Steal possbile out parameters to the callers context */
4933         talloc_steal(mem_ctx, state->out_mem_ctx);
4934
4935         /* Return result */
4936         *result = state->orig.out.result;
4937
4938         tevent_req_received(req);
4939         return NT_STATUS_OK;
4940 }
4941
4942 NTSTATUS rpccli_samr_SetAliasInfo(struct rpc_pipe_client *cli,
4943                                   TALLOC_CTX *mem_ctx,
4944                                   struct policy_handle *alias_handle /* [in] [ref] */,
4945                                   enum samr_AliasInfoEnum level /* [in]  */,
4946                                   union samr_AliasInfo *info /* [in] [ref,switch_is(level)] */)
4947 {
4948         struct samr_SetAliasInfo r;
4949         NTSTATUS status;
4950
4951         /* In parameters */
4952         r.in.alias_handle = alias_handle;
4953         r.in.level = level;
4954         r.in.info = info;
4955
4956         if (DEBUGLEVEL >= 10) {
4957                 NDR_PRINT_IN_DEBUG(samr_SetAliasInfo, &r);
4958         }
4959
4960         status = cli->dispatch(cli,
4961                                 mem_ctx,
4962                                 &ndr_table_samr,
4963                                 NDR_SAMR_SETALIASINFO,
4964                                 &r);
4965
4966         if (!NT_STATUS_IS_OK(status)) {
4967                 return status;
4968         }
4969
4970         if (DEBUGLEVEL >= 10) {
4971                 NDR_PRINT_OUT_DEBUG(samr_SetAliasInfo, &r);
4972         }
4973
4974         if (NT_STATUS_IS_ERR(status)) {
4975                 return status;
4976         }
4977
4978         /* Return variables */
4979
4980         /* Return result */
4981         return r.out.result;
4982 }
4983
4984 struct rpccli_samr_DeleteDomAlias_state {
4985         struct samr_DeleteDomAlias orig;
4986         struct samr_DeleteDomAlias tmp;
4987         TALLOC_CTX *out_mem_ctx;
4988         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4989 };
4990
4991 static void rpccli_samr_DeleteDomAlias_done(struct tevent_req *subreq);
4992
4993 struct tevent_req *rpccli_samr_DeleteDomAlias_send(TALLOC_CTX *mem_ctx,
4994                                                    struct tevent_context *ev,
4995                                                    struct rpc_pipe_client *cli,
4996                                                    struct policy_handle *_alias_handle /* [in,out] [ref] */)
4997 {
4998         struct tevent_req *req;
4999         struct rpccli_samr_DeleteDomAlias_state *state;
5000         struct tevent_req *subreq;
5001
5002         req = tevent_req_create(mem_ctx, &state,
5003                                 struct rpccli_samr_DeleteDomAlias_state);
5004         if (req == NULL) {
5005                 return NULL;
5006         }
5007         state->out_mem_ctx = NULL;
5008         state->dispatch_recv = cli->dispatch_recv;
5009
5010         /* In parameters */
5011         state->orig.in.alias_handle = _alias_handle;
5012
5013         /* Out parameters */
5014         state->orig.out.alias_handle = _alias_handle;
5015
5016         /* Result */
5017         ZERO_STRUCT(state->orig.out.result);
5018
5019         if (DEBUGLEVEL >= 10) {
5020                 NDR_PRINT_IN_DEBUG(samr_DeleteDomAlias, &state->orig);
5021         }
5022
5023         state->out_mem_ctx = talloc_named_const(state, 0,
5024                              "rpccli_samr_DeleteDomAlias_out_memory");
5025         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5026                 return tevent_req_post(req, ev);
5027         }
5028
5029         /* make a temporary copy, that we pass to the dispatch function */
5030         state->tmp = state->orig;
5031
5032         subreq = cli->dispatch_send(state, ev, cli,
5033                                     &ndr_table_samr,
5034                                     NDR_SAMR_DELETEDOMALIAS,
5035                                     &state->tmp);
5036         if (tevent_req_nomem(subreq, req)) {
5037                 return tevent_req_post(req, ev);
5038         }
5039         tevent_req_set_callback(subreq, rpccli_samr_DeleteDomAlias_done, req);
5040         return req;
5041 }
5042
5043 static void rpccli_samr_DeleteDomAlias_done(struct tevent_req *subreq)
5044 {
5045         struct tevent_req *req = tevent_req_callback_data(
5046                 subreq, struct tevent_req);
5047         struct rpccli_samr_DeleteDomAlias_state *state = tevent_req_data(
5048                 req, struct rpccli_samr_DeleteDomAlias_state);
5049         NTSTATUS status;
5050         TALLOC_CTX *mem_ctx;
5051
5052         if (state->out_mem_ctx) {
5053                 mem_ctx = state->out_mem_ctx;
5054         } else {
5055                 mem_ctx = state;
5056         }
5057
5058         status = state->dispatch_recv(subreq, mem_ctx);
5059         TALLOC_FREE(subreq);
5060         if (!NT_STATUS_IS_OK(status)) {
5061                 tevent_req_nterror(req, status);
5062                 return;
5063         }
5064
5065         /* Copy out parameters */
5066         *state->orig.out.alias_handle = *state->tmp.out.alias_handle;
5067
5068         /* Copy result */
5069         state->orig.out.result = state->tmp.out.result;
5070
5071         /* Reset temporary structure */
5072         ZERO_STRUCT(state->tmp);
5073
5074         if (DEBUGLEVEL >= 10) {
5075                 NDR_PRINT_OUT_DEBUG(samr_DeleteDomAlias, &state->orig);
5076         }
5077
5078         tevent_req_done(req);
5079 }
5080
5081 NTSTATUS rpccli_samr_DeleteDomAlias_recv(struct tevent_req *req,
5082                                          TALLOC_CTX *mem_ctx,
5083                                          NTSTATUS *result)
5084 {
5085         struct rpccli_samr_DeleteDomAlias_state *state = tevent_req_data(
5086                 req, struct rpccli_samr_DeleteDomAlias_state);
5087         NTSTATUS status;
5088
5089         if (tevent_req_is_nterror(req, &status)) {
5090                 tevent_req_received(req);
5091                 return status;
5092         }
5093
5094         /* Steal possbile out parameters to the callers context */
5095         talloc_steal(mem_ctx, state->out_mem_ctx);
5096
5097         /* Return result */
5098         *result = state->orig.out.result;
5099
5100         tevent_req_received(req);
5101         return NT_STATUS_OK;
5102 }
5103
5104 NTSTATUS rpccli_samr_DeleteDomAlias(struct rpc_pipe_client *cli,
5105                                     TALLOC_CTX *mem_ctx,
5106                                     struct policy_handle *alias_handle /* [in,out] [ref] */)
5107 {
5108         struct samr_DeleteDomAlias r;
5109         NTSTATUS status;
5110
5111         /* In parameters */
5112         r.in.alias_handle = alias_handle;
5113
5114         if (DEBUGLEVEL >= 10) {
5115                 NDR_PRINT_IN_DEBUG(samr_DeleteDomAlias, &r);
5116         }
5117
5118         status = cli->dispatch(cli,
5119                                 mem_ctx,
5120                                 &ndr_table_samr,
5121                                 NDR_SAMR_DELETEDOMALIAS,
5122                                 &r);
5123
5124         if (!NT_STATUS_IS_OK(status)) {
5125                 return status;
5126         }
5127
5128         if (DEBUGLEVEL >= 10) {
5129                 NDR_PRINT_OUT_DEBUG(samr_DeleteDomAlias, &r);
5130         }
5131
5132         if (NT_STATUS_IS_ERR(status)) {
5133                 return status;
5134         }
5135
5136         /* Return variables */
5137         *alias_handle = *r.out.alias_handle;
5138
5139         /* Return result */
5140         return r.out.result;
5141 }
5142
5143 struct rpccli_samr_AddAliasMember_state {
5144         struct samr_AddAliasMember orig;
5145         struct samr_AddAliasMember tmp;
5146         TALLOC_CTX *out_mem_ctx;
5147         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5148 };
5149
5150 static void rpccli_samr_AddAliasMember_done(struct tevent_req *subreq);
5151
5152 struct tevent_req *rpccli_samr_AddAliasMember_send(TALLOC_CTX *mem_ctx,
5153                                                    struct tevent_context *ev,
5154                                                    struct rpc_pipe_client *cli,
5155                                                    struct policy_handle *_alias_handle /* [in] [ref] */,
5156                                                    struct dom_sid2 *_sid /* [in] [ref] */)
5157 {
5158         struct tevent_req *req;
5159         struct rpccli_samr_AddAliasMember_state *state;
5160         struct tevent_req *subreq;
5161
5162         req = tevent_req_create(mem_ctx, &state,
5163                                 struct rpccli_samr_AddAliasMember_state);
5164         if (req == NULL) {
5165                 return NULL;
5166         }
5167         state->out_mem_ctx = NULL;
5168         state->dispatch_recv = cli->dispatch_recv;
5169
5170         /* In parameters */
5171         state->orig.in.alias_handle = _alias_handle;
5172         state->orig.in.sid = _sid;
5173
5174         /* Out parameters */
5175
5176         /* Result */
5177         ZERO_STRUCT(state->orig.out.result);
5178
5179         if (DEBUGLEVEL >= 10) {
5180                 NDR_PRINT_IN_DEBUG(samr_AddAliasMember, &state->orig);
5181         }
5182
5183         /* make a temporary copy, that we pass to the dispatch function */
5184         state->tmp = state->orig;
5185
5186         subreq = cli->dispatch_send(state, ev, cli,
5187                                     &ndr_table_samr,
5188                                     NDR_SAMR_ADDALIASMEMBER,
5189                                     &state->tmp);
5190         if (tevent_req_nomem(subreq, req)) {
5191                 return tevent_req_post(req, ev);
5192         }
5193         tevent_req_set_callback(subreq, rpccli_samr_AddAliasMember_done, req);
5194         return req;
5195 }
5196
5197 static void rpccli_samr_AddAliasMember_done(struct tevent_req *subreq)
5198 {
5199         struct tevent_req *req = tevent_req_callback_data(
5200                 subreq, struct tevent_req);
5201         struct rpccli_samr_AddAliasMember_state *state = tevent_req_data(
5202                 req, struct rpccli_samr_AddAliasMember_state);
5203         NTSTATUS status;
5204         TALLOC_CTX *mem_ctx;
5205
5206         if (state->out_mem_ctx) {
5207                 mem_ctx = state->out_mem_ctx;
5208         } else {
5209                 mem_ctx = state;
5210         }
5211
5212         status = state->dispatch_recv(subreq, mem_ctx);
5213         TALLOC_FREE(subreq);
5214         if (!NT_STATUS_IS_OK(status)) {
5215                 tevent_req_nterror(req, status);
5216                 return;
5217         }
5218
5219         /* Copy out parameters */
5220
5221         /* Copy result */
5222         state->orig.out.result = state->tmp.out.result;
5223
5224         /* Reset temporary structure */
5225         ZERO_STRUCT(state->tmp);
5226
5227         if (DEBUGLEVEL >= 10) {
5228                 NDR_PRINT_OUT_DEBUG(samr_AddAliasMember, &state->orig);
5229         }
5230
5231         tevent_req_done(req);
5232 }
5233
5234 NTSTATUS rpccli_samr_AddAliasMember_recv(struct tevent_req *req,
5235                                          TALLOC_CTX *mem_ctx,
5236                                          NTSTATUS *result)
5237 {
5238         struct rpccli_samr_AddAliasMember_state *state = tevent_req_data(
5239                 req, struct rpccli_samr_AddAliasMember_state);
5240         NTSTATUS status;
5241
5242         if (tevent_req_is_nterror(req, &status)) {
5243                 tevent_req_received(req);
5244                 return status;
5245         }
5246
5247         /* Steal possbile out parameters to the callers context */
5248         talloc_steal(mem_ctx, state->out_mem_ctx);
5249
5250         /* Return result */
5251         *result = state->orig.out.result;
5252
5253         tevent_req_received(req);
5254         return NT_STATUS_OK;
5255 }
5256
5257 NTSTATUS rpccli_samr_AddAliasMember(struct rpc_pipe_client *cli,
5258                                     TALLOC_CTX *mem_ctx,
5259                                     struct policy_handle *alias_handle /* [in] [ref] */,
5260                                     struct dom_sid2 *sid /* [in] [ref] */)
5261 {
5262         struct samr_AddAliasMember r;
5263         NTSTATUS status;
5264
5265         /* In parameters */
5266         r.in.alias_handle = alias_handle;
5267         r.in.sid = sid;
5268
5269         if (DEBUGLEVEL >= 10) {
5270                 NDR_PRINT_IN_DEBUG(samr_AddAliasMember, &r);
5271         }
5272
5273         status = cli->dispatch(cli,
5274                                 mem_ctx,
5275                                 &ndr_table_samr,
5276                                 NDR_SAMR_ADDALIASMEMBER,
5277                                 &r);
5278
5279         if (!NT_STATUS_IS_OK(status)) {
5280                 return status;
5281         }
5282
5283         if (DEBUGLEVEL >= 10) {
5284                 NDR_PRINT_OUT_DEBUG(samr_AddAliasMember, &r);
5285         }
5286
5287         if (NT_STATUS_IS_ERR(status)) {
5288                 return status;
5289         }
5290
5291         /* Return variables */
5292
5293         /* Return result */
5294         return r.out.result;
5295 }
5296
5297 struct rpccli_samr_DeleteAliasMember_state {
5298         struct samr_DeleteAliasMember orig;
5299         struct samr_DeleteAliasMember tmp;
5300         TALLOC_CTX *out_mem_ctx;
5301         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5302 };
5303
5304 static void rpccli_samr_DeleteAliasMember_done(struct tevent_req *subreq);
5305
5306 struct tevent_req *rpccli_samr_DeleteAliasMember_send(TALLOC_CTX *mem_ctx,
5307                                                       struct tevent_context *ev,
5308                                                       struct rpc_pipe_client *cli,
5309                                                       struct policy_handle *_alias_handle /* [in] [ref] */,
5310                                                       struct dom_sid2 *_sid /* [in] [ref] */)
5311 {
5312         struct tevent_req *req;
5313         struct rpccli_samr_DeleteAliasMember_state *state;
5314         struct tevent_req *subreq;
5315
5316         req = tevent_req_create(mem_ctx, &state,
5317                                 struct rpccli_samr_DeleteAliasMember_state);
5318         if (req == NULL) {
5319                 return NULL;
5320         }
5321         state->out_mem_ctx = NULL;
5322         state->dispatch_recv = cli->dispatch_recv;
5323
5324         /* In parameters */
5325         state->orig.in.alias_handle = _alias_handle;
5326         state->orig.in.sid = _sid;
5327
5328         /* Out parameters */
5329
5330         /* Result */
5331         ZERO_STRUCT(state->orig.out.result);
5332
5333         if (DEBUGLEVEL >= 10) {
5334                 NDR_PRINT_IN_DEBUG(samr_DeleteAliasMember, &state->orig);
5335         }
5336
5337         /* make a temporary copy, that we pass to the dispatch function */
5338         state->tmp = state->orig;
5339
5340         subreq = cli->dispatch_send(state, ev, cli,
5341                                     &ndr_table_samr,
5342                                     NDR_SAMR_DELETEALIASMEMBER,
5343                                     &state->tmp);
5344         if (tevent_req_nomem(subreq, req)) {
5345                 return tevent_req_post(req, ev);
5346         }
5347         tevent_req_set_callback(subreq, rpccli_samr_DeleteAliasMember_done, req);
5348         return req;
5349 }
5350
5351 static void rpccli_samr_DeleteAliasMember_done(struct tevent_req *subreq)
5352 {
5353         struct tevent_req *req = tevent_req_callback_data(
5354                 subreq, struct tevent_req);
5355         struct rpccli_samr_DeleteAliasMember_state *state = tevent_req_data(
5356                 req, struct rpccli_samr_DeleteAliasMember_state);
5357         NTSTATUS status;
5358         TALLOC_CTX *mem_ctx;
5359
5360         if (state->out_mem_ctx) {
5361                 mem_ctx = state->out_mem_ctx;
5362         } else {
5363                 mem_ctx = state;
5364         }
5365
5366         status = state->dispatch_recv(subreq, mem_ctx);
5367         TALLOC_FREE(subreq);
5368         if (!NT_STATUS_IS_OK(status)) {
5369                 tevent_req_nterror(req, status);
5370                 return;
5371         }
5372
5373         /* Copy out parameters */
5374
5375         /* Copy result */
5376         state->orig.out.result = state->tmp.out.result;
5377
5378         /* Reset temporary structure */
5379         ZERO_STRUCT(state->tmp);
5380
5381         if (DEBUGLEVEL >= 10) {
5382                 NDR_PRINT_OUT_DEBUG(samr_DeleteAliasMember, &state->orig);
5383         }
5384
5385         tevent_req_done(req);
5386 }
5387
5388 NTSTATUS rpccli_samr_DeleteAliasMember_recv(struct tevent_req *req,
5389                                             TALLOC_CTX *mem_ctx,
5390                                             NTSTATUS *result)
5391 {
5392         struct rpccli_samr_DeleteAliasMember_state *state = tevent_req_data(
5393                 req, struct rpccli_samr_DeleteAliasMember_state);
5394         NTSTATUS status;
5395
5396         if (tevent_req_is_nterror(req, &status)) {
5397                 tevent_req_received(req);
5398                 return status;
5399         }
5400
5401         /* Steal possbile out parameters to the callers context */
5402         talloc_steal(mem_ctx, state->out_mem_ctx);
5403
5404         /* Return result */
5405         *result = state->orig.out.result;
5406
5407         tevent_req_received(req);
5408         return NT_STATUS_OK;
5409 }
5410
5411 NTSTATUS rpccli_samr_DeleteAliasMember(struct rpc_pipe_client *cli,
5412                                        TALLOC_CTX *mem_ctx,
5413                                        struct policy_handle *alias_handle /* [in] [ref] */,
5414                                        struct dom_sid2 *sid /* [in] [ref] */)
5415 {
5416         struct samr_DeleteAliasMember r;
5417         NTSTATUS status;
5418
5419         /* In parameters */
5420         r.in.alias_handle = alias_handle;
5421         r.in.sid = sid;
5422
5423         if (DEBUGLEVEL >= 10) {
5424                 NDR_PRINT_IN_DEBUG(samr_DeleteAliasMember, &r);
5425         }
5426
5427         status = cli->dispatch(cli,
5428                                 mem_ctx,
5429                                 &ndr_table_samr,
5430                                 NDR_SAMR_DELETEALIASMEMBER,
5431                                 &r);
5432
5433         if (!NT_STATUS_IS_OK(status)) {
5434                 return status;
5435         }
5436
5437         if (DEBUGLEVEL >= 10) {
5438                 NDR_PRINT_OUT_DEBUG(samr_DeleteAliasMember, &r);
5439         }
5440
5441         if (NT_STATUS_IS_ERR(status)) {
5442                 return status;
5443         }
5444
5445         /* Return variables */
5446
5447         /* Return result */
5448         return r.out.result;
5449 }
5450
5451 struct rpccli_samr_GetMembersInAlias_state {
5452         struct samr_GetMembersInAlias orig;
5453         struct samr_GetMembersInAlias tmp;
5454         TALLOC_CTX *out_mem_ctx;
5455         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5456 };
5457
5458 static void rpccli_samr_GetMembersInAlias_done(struct tevent_req *subreq);
5459
5460 struct tevent_req *rpccli_samr_GetMembersInAlias_send(TALLOC_CTX *mem_ctx,
5461                                                       struct tevent_context *ev,
5462                                                       struct rpc_pipe_client *cli,
5463                                                       struct policy_handle *_alias_handle /* [in] [ref] */,
5464                                                       struct lsa_SidArray *_sids /* [out] [ref] */)
5465 {
5466         struct tevent_req *req;
5467         struct rpccli_samr_GetMembersInAlias_state *state;
5468         struct tevent_req *subreq;
5469
5470         req = tevent_req_create(mem_ctx, &state,
5471                                 struct rpccli_samr_GetMembersInAlias_state);
5472         if (req == NULL) {
5473                 return NULL;
5474         }
5475         state->out_mem_ctx = NULL;
5476         state->dispatch_recv = cli->dispatch_recv;
5477
5478         /* In parameters */
5479         state->orig.in.alias_handle = _alias_handle;
5480
5481         /* Out parameters */
5482         state->orig.out.sids = _sids;
5483
5484         /* Result */
5485         ZERO_STRUCT(state->orig.out.result);
5486
5487         if (DEBUGLEVEL >= 10) {
5488                 NDR_PRINT_IN_DEBUG(samr_GetMembersInAlias, &state->orig);
5489         }
5490
5491         state->out_mem_ctx = talloc_named_const(state, 0,
5492                              "rpccli_samr_GetMembersInAlias_out_memory");
5493         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5494                 return tevent_req_post(req, ev);
5495         }
5496
5497         /* make a temporary copy, that we pass to the dispatch function */
5498         state->tmp = state->orig;
5499
5500         subreq = cli->dispatch_send(state, ev, cli,
5501                                     &ndr_table_samr,
5502                                     NDR_SAMR_GETMEMBERSINALIAS,
5503                                     &state->tmp);
5504         if (tevent_req_nomem(subreq, req)) {
5505                 return tevent_req_post(req, ev);
5506         }
5507         tevent_req_set_callback(subreq, rpccli_samr_GetMembersInAlias_done, req);
5508         return req;
5509 }
5510
5511 static void rpccli_samr_GetMembersInAlias_done(struct tevent_req *subreq)
5512 {
5513         struct tevent_req *req = tevent_req_callback_data(
5514                 subreq, struct tevent_req);
5515         struct rpccli_samr_GetMembersInAlias_state *state = tevent_req_data(
5516                 req, struct rpccli_samr_GetMembersInAlias_state);
5517         NTSTATUS status;
5518         TALLOC_CTX *mem_ctx;
5519
5520         if (state->out_mem_ctx) {
5521                 mem_ctx = state->out_mem_ctx;
5522         } else {
5523                 mem_ctx = state;
5524         }
5525
5526         status = state->dispatch_recv(subreq, mem_ctx);
5527         TALLOC_FREE(subreq);
5528         if (!NT_STATUS_IS_OK(status)) {
5529                 tevent_req_nterror(req, status);
5530                 return;
5531         }
5532
5533         /* Copy out parameters */
5534         *state->orig.out.sids = *state->tmp.out.sids;
5535
5536         /* Copy result */
5537         state->orig.out.result = state->tmp.out.result;
5538
5539         /* Reset temporary structure */
5540         ZERO_STRUCT(state->tmp);
5541
5542         if (DEBUGLEVEL >= 10) {
5543                 NDR_PRINT_OUT_DEBUG(samr_GetMembersInAlias, &state->orig);
5544         }
5545
5546         tevent_req_done(req);
5547 }
5548
5549 NTSTATUS rpccli_samr_GetMembersInAlias_recv(struct tevent_req *req,
5550                                             TALLOC_CTX *mem_ctx,
5551                                             NTSTATUS *result)
5552 {
5553         struct rpccli_samr_GetMembersInAlias_state *state = tevent_req_data(
5554                 req, struct rpccli_samr_GetMembersInAlias_state);
5555         NTSTATUS status;
5556
5557         if (tevent_req_is_nterror(req, &status)) {
5558                 tevent_req_received(req);
5559                 return status;
5560         }
5561
5562         /* Steal possbile out parameters to the callers context */
5563         talloc_steal(mem_ctx, state->out_mem_ctx);
5564
5565         /* Return result */
5566         *result = state->orig.out.result;
5567
5568         tevent_req_received(req);
5569         return NT_STATUS_OK;
5570 }
5571
5572 NTSTATUS rpccli_samr_GetMembersInAlias(struct rpc_pipe_client *cli,
5573                                        TALLOC_CTX *mem_ctx,
5574                                        struct policy_handle *alias_handle /* [in] [ref] */,
5575                                        struct lsa_SidArray *sids /* [out] [ref] */)
5576 {
5577         struct samr_GetMembersInAlias r;
5578         NTSTATUS status;
5579
5580         /* In parameters */
5581         r.in.alias_handle = alias_handle;
5582
5583         if (DEBUGLEVEL >= 10) {
5584                 NDR_PRINT_IN_DEBUG(samr_GetMembersInAlias, &r);
5585         }
5586
5587         status = cli->dispatch(cli,
5588                                 mem_ctx,
5589                                 &ndr_table_samr,
5590                                 NDR_SAMR_GETMEMBERSINALIAS,
5591                                 &r);
5592
5593         if (!NT_STATUS_IS_OK(status)) {
5594                 return status;
5595         }
5596
5597         if (DEBUGLEVEL >= 10) {
5598                 NDR_PRINT_OUT_DEBUG(samr_GetMembersInAlias, &r);
5599         }
5600
5601         if (NT_STATUS_IS_ERR(status)) {
5602                 return status;
5603         }
5604
5605         /* Return variables */
5606         *sids = *r.out.sids;
5607
5608         /* Return result */
5609         return r.out.result;
5610 }
5611
5612 struct rpccli_samr_OpenUser_state {
5613         struct samr_OpenUser orig;
5614         struct samr_OpenUser tmp;
5615         TALLOC_CTX *out_mem_ctx;
5616         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5617 };
5618
5619 static void rpccli_samr_OpenUser_done(struct tevent_req *subreq);
5620
5621 struct tevent_req *rpccli_samr_OpenUser_send(TALLOC_CTX *mem_ctx,
5622                                              struct tevent_context *ev,
5623                                              struct rpc_pipe_client *cli,
5624                                              struct policy_handle *_domain_handle /* [in] [ref] */,
5625                                              uint32_t _access_mask /* [in]  */,
5626                                              uint32_t _rid /* [in]  */,
5627                                              struct policy_handle *_user_handle /* [out] [ref] */)
5628 {
5629         struct tevent_req *req;
5630         struct rpccli_samr_OpenUser_state *state;
5631         struct tevent_req *subreq;
5632
5633         req = tevent_req_create(mem_ctx, &state,
5634                                 struct rpccli_samr_OpenUser_state);
5635         if (req == NULL) {
5636                 return NULL;
5637         }
5638         state->out_mem_ctx = NULL;
5639         state->dispatch_recv = cli->dispatch_recv;
5640
5641         /* In parameters */
5642         state->orig.in.domain_handle = _domain_handle;
5643         state->orig.in.access_mask = _access_mask;
5644         state->orig.in.rid = _rid;
5645
5646         /* Out parameters */
5647         state->orig.out.user_handle = _user_handle;
5648
5649         /* Result */
5650         ZERO_STRUCT(state->orig.out.result);
5651
5652         if (DEBUGLEVEL >= 10) {
5653                 NDR_PRINT_IN_DEBUG(samr_OpenUser, &state->orig);
5654         }
5655
5656         state->out_mem_ctx = talloc_named_const(state, 0,
5657                              "rpccli_samr_OpenUser_out_memory");
5658         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5659                 return tevent_req_post(req, ev);
5660         }
5661
5662         /* make a temporary copy, that we pass to the dispatch function */
5663         state->tmp = state->orig;
5664
5665         subreq = cli->dispatch_send(state, ev, cli,
5666                                     &ndr_table_samr,
5667                                     NDR_SAMR_OPENUSER,
5668                                     &state->tmp);
5669         if (tevent_req_nomem(subreq, req)) {
5670                 return tevent_req_post(req, ev);
5671         }
5672         tevent_req_set_callback(subreq, rpccli_samr_OpenUser_done, req);
5673         return req;
5674 }
5675
5676 static void rpccli_samr_OpenUser_done(struct tevent_req *subreq)
5677 {
5678         struct tevent_req *req = tevent_req_callback_data(
5679                 subreq, struct tevent_req);
5680         struct rpccli_samr_OpenUser_state *state = tevent_req_data(
5681                 req, struct rpccli_samr_OpenUser_state);
5682         NTSTATUS status;
5683         TALLOC_CTX *mem_ctx;
5684
5685         if (state->out_mem_ctx) {
5686                 mem_ctx = state->out_mem_ctx;
5687         } else {
5688                 mem_ctx = state;
5689         }
5690
5691         status = state->dispatch_recv(subreq, mem_ctx);
5692         TALLOC_FREE(subreq);
5693         if (!NT_STATUS_IS_OK(status)) {
5694                 tevent_req_nterror(req, status);
5695                 return;
5696         }
5697
5698         /* Copy out parameters */
5699         *state->orig.out.user_handle = *state->tmp.out.user_handle;
5700
5701         /* Copy result */
5702         state->orig.out.result = state->tmp.out.result;
5703
5704         /* Reset temporary structure */
5705         ZERO_STRUCT(state->tmp);
5706
5707         if (DEBUGLEVEL >= 10) {
5708                 NDR_PRINT_OUT_DEBUG(samr_OpenUser, &state->orig);
5709         }
5710
5711         tevent_req_done(req);
5712 }
5713
5714 NTSTATUS rpccli_samr_OpenUser_recv(struct tevent_req *req,
5715                                    TALLOC_CTX *mem_ctx,
5716                                    NTSTATUS *result)
5717 {
5718         struct rpccli_samr_OpenUser_state *state = tevent_req_data(
5719                 req, struct rpccli_samr_OpenUser_state);
5720         NTSTATUS status;
5721
5722         if (tevent_req_is_nterror(req, &status)) {
5723                 tevent_req_received(req);
5724                 return status;
5725         }
5726
5727         /* Steal possbile out parameters to the callers context */
5728         talloc_steal(mem_ctx, state->out_mem_ctx);
5729
5730         /* Return result */
5731         *result = state->orig.out.result;
5732
5733         tevent_req_received(req);
5734         return NT_STATUS_OK;
5735 }
5736
5737 NTSTATUS rpccli_samr_OpenUser(struct rpc_pipe_client *cli,
5738                               TALLOC_CTX *mem_ctx,
5739                               struct policy_handle *domain_handle /* [in] [ref] */,
5740                               uint32_t access_mask /* [in]  */,
5741                               uint32_t rid /* [in]  */,
5742                               struct policy_handle *user_handle /* [out] [ref] */)
5743 {
5744         struct samr_OpenUser r;
5745         NTSTATUS status;
5746
5747         /* In parameters */
5748         r.in.domain_handle = domain_handle;
5749         r.in.access_mask = access_mask;
5750         r.in.rid = rid;
5751
5752         if (DEBUGLEVEL >= 10) {
5753                 NDR_PRINT_IN_DEBUG(samr_OpenUser, &r);
5754         }
5755
5756         status = cli->dispatch(cli,
5757                                 mem_ctx,
5758                                 &ndr_table_samr,
5759                                 NDR_SAMR_OPENUSER,
5760                                 &r);
5761
5762         if (!NT_STATUS_IS_OK(status)) {
5763                 return status;
5764         }
5765
5766         if (DEBUGLEVEL >= 10) {
5767                 NDR_PRINT_OUT_DEBUG(samr_OpenUser, &r);
5768         }
5769
5770         if (NT_STATUS_IS_ERR(status)) {
5771                 return status;
5772         }
5773
5774         /* Return variables */
5775         *user_handle = *r.out.user_handle;
5776
5777         /* Return result */
5778         return r.out.result;
5779 }
5780
5781 struct rpccli_samr_DeleteUser_state {
5782         struct samr_DeleteUser orig;
5783         struct samr_DeleteUser tmp;
5784         TALLOC_CTX *out_mem_ctx;
5785         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5786 };
5787
5788 static void rpccli_samr_DeleteUser_done(struct tevent_req *subreq);
5789
5790 struct tevent_req *rpccli_samr_DeleteUser_send(TALLOC_CTX *mem_ctx,
5791                                                struct tevent_context *ev,
5792                                                struct rpc_pipe_client *cli,
5793                                                struct policy_handle *_user_handle /* [in,out] [ref] */)
5794 {
5795         struct tevent_req *req;
5796         struct rpccli_samr_DeleteUser_state *state;
5797         struct tevent_req *subreq;
5798
5799         req = tevent_req_create(mem_ctx, &state,
5800                                 struct rpccli_samr_DeleteUser_state);
5801         if (req == NULL) {
5802                 return NULL;
5803         }
5804         state->out_mem_ctx = NULL;
5805         state->dispatch_recv = cli->dispatch_recv;
5806
5807         /* In parameters */
5808         state->orig.in.user_handle = _user_handle;
5809
5810         /* Out parameters */
5811         state->orig.out.user_handle = _user_handle;
5812
5813         /* Result */
5814         ZERO_STRUCT(state->orig.out.result);
5815
5816         if (DEBUGLEVEL >= 10) {
5817                 NDR_PRINT_IN_DEBUG(samr_DeleteUser, &state->orig);
5818         }
5819
5820         state->out_mem_ctx = talloc_named_const(state, 0,
5821                              "rpccli_samr_DeleteUser_out_memory");
5822         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5823                 return tevent_req_post(req, ev);
5824         }
5825
5826         /* make a temporary copy, that we pass to the dispatch function */
5827         state->tmp = state->orig;
5828
5829         subreq = cli->dispatch_send(state, ev, cli,
5830                                     &ndr_table_samr,
5831                                     NDR_SAMR_DELETEUSER,
5832                                     &state->tmp);
5833         if (tevent_req_nomem(subreq, req)) {
5834                 return tevent_req_post(req, ev);
5835         }
5836         tevent_req_set_callback(subreq, rpccli_samr_DeleteUser_done, req);
5837         return req;
5838 }
5839
5840 static void rpccli_samr_DeleteUser_done(struct tevent_req *subreq)
5841 {
5842         struct tevent_req *req = tevent_req_callback_data(
5843                 subreq, struct tevent_req);
5844         struct rpccli_samr_DeleteUser_state *state = tevent_req_data(
5845                 req, struct rpccli_samr_DeleteUser_state);
5846         NTSTATUS status;
5847         TALLOC_CTX *mem_ctx;
5848
5849         if (state->out_mem_ctx) {
5850                 mem_ctx = state->out_mem_ctx;
5851         } else {
5852                 mem_ctx = state;
5853         }
5854
5855         status = state->dispatch_recv(subreq, mem_ctx);
5856         TALLOC_FREE(subreq);
5857         if (!NT_STATUS_IS_OK(status)) {
5858                 tevent_req_nterror(req, status);
5859                 return;
5860         }
5861
5862         /* Copy out parameters */
5863         *state->orig.out.user_handle = *state->tmp.out.user_handle;
5864
5865         /* Copy result */
5866         state->orig.out.result = state->tmp.out.result;
5867
5868         /* Reset temporary structure */
5869         ZERO_STRUCT(state->tmp);
5870
5871         if (DEBUGLEVEL >= 10) {
5872                 NDR_PRINT_OUT_DEBUG(samr_DeleteUser, &state->orig);
5873         }
5874
5875         tevent_req_done(req);
5876 }
5877
5878 NTSTATUS rpccli_samr_DeleteUser_recv(struct tevent_req *req,
5879                                      TALLOC_CTX *mem_ctx,
5880                                      NTSTATUS *result)
5881 {
5882         struct rpccli_samr_DeleteUser_state *state = tevent_req_data(
5883                 req, struct rpccli_samr_DeleteUser_state);
5884         NTSTATUS status;
5885
5886         if (tevent_req_is_nterror(req, &status)) {
5887                 tevent_req_received(req);
5888                 return status;
5889         }
5890
5891         /* Steal possbile out parameters to the callers context */
5892         talloc_steal(mem_ctx, state->out_mem_ctx);
5893
5894         /* Return result */
5895         *result = state->orig.out.result;
5896
5897         tevent_req_received(req);
5898         return NT_STATUS_OK;
5899 }
5900
5901 NTSTATUS rpccli_samr_DeleteUser(struct rpc_pipe_client *cli,
5902                                 TALLOC_CTX *mem_ctx,
5903                                 struct policy_handle *user_handle /* [in,out] [ref] */)
5904 {
5905         struct samr_DeleteUser r;
5906         NTSTATUS status;
5907
5908         /* In parameters */
5909         r.in.user_handle = user_handle;
5910
5911         if (DEBUGLEVEL >= 10) {
5912                 NDR_PRINT_IN_DEBUG(samr_DeleteUser, &r);
5913         }
5914
5915         status = cli->dispatch(cli,
5916                                 mem_ctx,
5917                                 &ndr_table_samr,
5918                                 NDR_SAMR_DELETEUSER,
5919                                 &r);
5920
5921         if (!NT_STATUS_IS_OK(status)) {
5922                 return status;
5923         }
5924
5925         if (DEBUGLEVEL >= 10) {
5926                 NDR_PRINT_OUT_DEBUG(samr_DeleteUser, &r);
5927         }
5928
5929         if (NT_STATUS_IS_ERR(status)) {
5930                 return status;
5931         }
5932
5933         /* Return variables */
5934         *user_handle = *r.out.user_handle;
5935
5936         /* Return result */
5937         return r.out.result;
5938 }
5939
5940 struct rpccli_samr_QueryUserInfo_state {
5941         struct samr_QueryUserInfo orig;
5942         struct samr_QueryUserInfo tmp;
5943         TALLOC_CTX *out_mem_ctx;
5944         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5945 };
5946
5947 static void rpccli_samr_QueryUserInfo_done(struct tevent_req *subreq);
5948
5949 struct tevent_req *rpccli_samr_QueryUserInfo_send(TALLOC_CTX *mem_ctx,
5950                                                   struct tevent_context *ev,
5951                                                   struct rpc_pipe_client *cli,
5952                                                   struct policy_handle *_user_handle /* [in] [ref] */,
5953                                                   enum samr_UserInfoLevel _level /* [in]  */,
5954                                                   union samr_UserInfo **_info /* [out] [ref,switch_is(level)] */)
5955 {
5956         struct tevent_req *req;
5957         struct rpccli_samr_QueryUserInfo_state *state;
5958         struct tevent_req *subreq;
5959
5960         req = tevent_req_create(mem_ctx, &state,
5961                                 struct rpccli_samr_QueryUserInfo_state);
5962         if (req == NULL) {
5963                 return NULL;
5964         }
5965         state->out_mem_ctx = NULL;
5966         state->dispatch_recv = cli->dispatch_recv;
5967
5968         /* In parameters */
5969         state->orig.in.user_handle = _user_handle;
5970         state->orig.in.level = _level;
5971
5972         /* Out parameters */
5973         state->orig.out.info = _info;
5974
5975         /* Result */
5976         ZERO_STRUCT(state->orig.out.result);
5977
5978         if (DEBUGLEVEL >= 10) {
5979                 NDR_PRINT_IN_DEBUG(samr_QueryUserInfo, &state->orig);
5980         }
5981
5982         state->out_mem_ctx = talloc_named_const(state, 0,
5983                              "rpccli_samr_QueryUserInfo_out_memory");
5984         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5985                 return tevent_req_post(req, ev);
5986         }
5987
5988         /* make a temporary copy, that we pass to the dispatch function */
5989         state->tmp = state->orig;
5990
5991         subreq = cli->dispatch_send(state, ev, cli,
5992                                     &ndr_table_samr,
5993                                     NDR_SAMR_QUERYUSERINFO,
5994                                     &state->tmp);
5995         if (tevent_req_nomem(subreq, req)) {
5996                 return tevent_req_post(req, ev);
5997         }
5998         tevent_req_set_callback(subreq, rpccli_samr_QueryUserInfo_done, req);
5999         return req;
6000 }
6001
6002 static void rpccli_samr_QueryUserInfo_done(struct tevent_req *subreq)
6003 {
6004         struct tevent_req *req = tevent_req_callback_data(
6005                 subreq, struct tevent_req);
6006         struct rpccli_samr_QueryUserInfo_state *state = tevent_req_data(
6007                 req, struct rpccli_samr_QueryUserInfo_state);
6008         NTSTATUS status;
6009         TALLOC_CTX *mem_ctx;
6010
6011         if (state->out_mem_ctx) {
6012                 mem_ctx = state->out_mem_ctx;
6013         } else {
6014                 mem_ctx = state;
6015         }
6016
6017         status = state->dispatch_recv(subreq, mem_ctx);
6018         TALLOC_FREE(subreq);
6019         if (!NT_STATUS_IS_OK(status)) {
6020                 tevent_req_nterror(req, status);
6021                 return;
6022         }
6023
6024         /* Copy out parameters */
6025         *state->orig.out.info = *state->tmp.out.info;
6026
6027         /* Copy result */
6028         state->orig.out.result = state->tmp.out.result;
6029
6030         /* Reset temporary structure */
6031         ZERO_STRUCT(state->tmp);
6032
6033         if (DEBUGLEVEL >= 10) {
6034                 NDR_PRINT_OUT_DEBUG(samr_QueryUserInfo, &state->orig);
6035         }
6036
6037         tevent_req_done(req);
6038 }
6039
6040 NTSTATUS rpccli_samr_QueryUserInfo_recv(struct tevent_req *req,
6041                                         TALLOC_CTX *mem_ctx,
6042                                         NTSTATUS *result)
6043 {
6044         struct rpccli_samr_QueryUserInfo_state *state = tevent_req_data(
6045                 req, struct rpccli_samr_QueryUserInfo_state);
6046         NTSTATUS status;
6047
6048         if (tevent_req_is_nterror(req, &status)) {
6049                 tevent_req_received(req);
6050                 return status;
6051         }
6052
6053         /* Steal possbile out parameters to the callers context */
6054         talloc_steal(mem_ctx, state->out_mem_ctx);
6055
6056         /* Return result */
6057         *result = state->orig.out.result;
6058
6059         tevent_req_received(req);
6060         return NT_STATUS_OK;
6061 }
6062
6063 NTSTATUS rpccli_samr_QueryUserInfo(struct rpc_pipe_client *cli,
6064                                    TALLOC_CTX *mem_ctx,
6065                                    struct policy_handle *user_handle /* [in] [ref] */,
6066                                    enum samr_UserInfoLevel level /* [in]  */,
6067                                    union samr_UserInfo **info /* [out] [ref,switch_is(level)] */)
6068 {
6069         struct samr_QueryUserInfo r;
6070         NTSTATUS status;
6071
6072         /* In parameters */
6073         r.in.user_handle = user_handle;
6074         r.in.level = level;
6075
6076         if (DEBUGLEVEL >= 10) {
6077                 NDR_PRINT_IN_DEBUG(samr_QueryUserInfo, &r);
6078         }
6079
6080         status = cli->dispatch(cli,
6081                                 mem_ctx,
6082                                 &ndr_table_samr,
6083                                 NDR_SAMR_QUERYUSERINFO,
6084                                 &r);
6085
6086         if (!NT_STATUS_IS_OK(status)) {
6087                 return status;
6088         }
6089
6090         if (DEBUGLEVEL >= 10) {
6091                 NDR_PRINT_OUT_DEBUG(samr_QueryUserInfo, &r);
6092         }
6093
6094         if (NT_STATUS_IS_ERR(status)) {
6095                 return status;
6096         }
6097
6098         /* Return variables */
6099         *info = *r.out.info;
6100
6101         /* Return result */
6102         return r.out.result;
6103 }
6104
6105 struct rpccli_samr_SetUserInfo_state {
6106         struct samr_SetUserInfo orig;
6107         struct samr_SetUserInfo tmp;
6108         TALLOC_CTX *out_mem_ctx;
6109         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6110 };
6111
6112 static void rpccli_samr_SetUserInfo_done(struct tevent_req *subreq);
6113
6114 struct tevent_req *rpccli_samr_SetUserInfo_send(TALLOC_CTX *mem_ctx,
6115                                                 struct tevent_context *ev,
6116                                                 struct rpc_pipe_client *cli,
6117                                                 struct policy_handle *_user_handle /* [in] [ref] */,
6118                                                 enum samr_UserInfoLevel _level /* [in]  */,
6119                                                 union samr_UserInfo *_info /* [in] [ref,switch_is(level)] */)
6120 {
6121         struct tevent_req *req;
6122         struct rpccli_samr_SetUserInfo_state *state;
6123         struct tevent_req *subreq;
6124
6125         req = tevent_req_create(mem_ctx, &state,
6126                                 struct rpccli_samr_SetUserInfo_state);
6127         if (req == NULL) {
6128                 return NULL;
6129         }
6130         state->out_mem_ctx = NULL;
6131         state->dispatch_recv = cli->dispatch_recv;
6132
6133         /* In parameters */
6134         state->orig.in.user_handle = _user_handle;
6135         state->orig.in.level = _level;
6136         state->orig.in.info = _info;
6137
6138         /* Out parameters */
6139
6140         /* Result */
6141         ZERO_STRUCT(state->orig.out.result);
6142
6143         if (DEBUGLEVEL >= 10) {
6144                 NDR_PRINT_IN_DEBUG(samr_SetUserInfo, &state->orig);
6145         }
6146
6147         /* make a temporary copy, that we pass to the dispatch function */
6148         state->tmp = state->orig;
6149
6150         subreq = cli->dispatch_send(state, ev, cli,
6151                                     &ndr_table_samr,
6152                                     NDR_SAMR_SETUSERINFO,
6153                                     &state->tmp);
6154         if (tevent_req_nomem(subreq, req)) {
6155                 return tevent_req_post(req, ev);
6156         }
6157         tevent_req_set_callback(subreq, rpccli_samr_SetUserInfo_done, req);
6158         return req;
6159 }
6160
6161 static void rpccli_samr_SetUserInfo_done(struct tevent_req *subreq)
6162 {
6163         struct tevent_req *req = tevent_req_callback_data(
6164                 subreq, struct tevent_req);
6165         struct rpccli_samr_SetUserInfo_state *state = tevent_req_data(
6166                 req, struct rpccli_samr_SetUserInfo_state);
6167         NTSTATUS status;
6168         TALLOC_CTX *mem_ctx;
6169
6170         if (state->out_mem_ctx) {
6171                 mem_ctx = state->out_mem_ctx;
6172         } else {
6173                 mem_ctx = state;
6174         }
6175
6176         status = state->dispatch_recv(subreq, mem_ctx);
6177         TALLOC_FREE(subreq);
6178         if (!NT_STATUS_IS_OK(status)) {
6179                 tevent_req_nterror(req, status);
6180                 return;
6181         }
6182
6183         /* Copy out parameters */
6184
6185         /* Copy result */
6186         state->orig.out.result = state->tmp.out.result;
6187
6188         /* Reset temporary structure */
6189         ZERO_STRUCT(state->tmp);
6190
6191         if (DEBUGLEVEL >= 10) {
6192                 NDR_PRINT_OUT_DEBUG(samr_SetUserInfo, &state->orig);
6193         }
6194
6195         tevent_req_done(req);
6196 }
6197
6198 NTSTATUS rpccli_samr_SetUserInfo_recv(struct tevent_req *req,
6199                                       TALLOC_CTX *mem_ctx,
6200                                       NTSTATUS *result)
6201 {
6202         struct rpccli_samr_SetUserInfo_state *state = tevent_req_data(
6203                 req, struct rpccli_samr_SetUserInfo_state);
6204         NTSTATUS status;
6205
6206         if (tevent_req_is_nterror(req, &status)) {
6207                 tevent_req_received(req);
6208                 return status;
6209         }
6210
6211         /* Steal possbile out parameters to the callers context */
6212         talloc_steal(mem_ctx, state->out_mem_ctx);
6213
6214         /* Return result */
6215         *result = state->orig.out.result;
6216
6217         tevent_req_received(req);
6218         return NT_STATUS_OK;
6219 }
6220
6221 NTSTATUS rpccli_samr_SetUserInfo(struct rpc_pipe_client *cli,
6222                                  TALLOC_CTX *mem_ctx,
6223                                  struct policy_handle *user_handle /* [in] [ref] */,
6224                                  enum samr_UserInfoLevel level /* [in]  */,
6225                                  union samr_UserInfo *info /* [in] [ref,switch_is(level)] */)
6226 {
6227         struct samr_SetUserInfo r;
6228         NTSTATUS status;
6229
6230         /* In parameters */
6231         r.in.user_handle = user_handle;
6232         r.in.level = level;
6233         r.in.info = info;
6234
6235         if (DEBUGLEVEL >= 10) {
6236                 NDR_PRINT_IN_DEBUG(samr_SetUserInfo, &r);
6237         }
6238
6239         status = cli->dispatch(cli,
6240                                 mem_ctx,
6241                                 &ndr_table_samr,
6242                                 NDR_SAMR_SETUSERINFO,
6243                                 &r);
6244
6245         if (!NT_STATUS_IS_OK(status)) {
6246                 return status;
6247         }
6248
6249         if (DEBUGLEVEL >= 10) {
6250                 NDR_PRINT_OUT_DEBUG(samr_SetUserInfo, &r);
6251         }
6252
6253         if (NT_STATUS_IS_ERR(status)) {
6254                 return status;
6255         }
6256
6257         /* Return variables */
6258
6259         /* Return result */
6260         return r.out.result;
6261 }
6262
6263 struct rpccli_samr_ChangePasswordUser_state {
6264         struct samr_ChangePasswordUser orig;
6265         struct samr_ChangePasswordUser tmp;
6266         TALLOC_CTX *out_mem_ctx;
6267         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6268 };
6269
6270 static void rpccli_samr_ChangePasswordUser_done(struct tevent_req *subreq);
6271
6272 struct tevent_req *rpccli_samr_ChangePasswordUser_send(TALLOC_CTX *mem_ctx,
6273                                                        struct tevent_context *ev,
6274                                                        struct rpc_pipe_client *cli,
6275                                                        struct policy_handle *_user_handle /* [in] [ref] */,
6276                                                        uint8_t _lm_present /* [in]  */,
6277                                                        struct samr_Password *_old_lm_crypted /* [in] [unique] */,
6278                                                        struct samr_Password *_new_lm_crypted /* [in] [unique] */,
6279                                                        uint8_t _nt_present /* [in]  */,
6280                                                        struct samr_Password *_old_nt_crypted /* [in] [unique] */,
6281                                                        struct samr_Password *_new_nt_crypted /* [in] [unique] */,
6282                                                        uint8_t _cross1_present /* [in]  */,
6283                                                        struct samr_Password *_nt_cross /* [in] [unique] */,
6284                                                        uint8_t _cross2_present /* [in]  */,
6285                                                        struct samr_Password *_lm_cross /* [in] [unique] */)
6286 {
6287         struct tevent_req *req;
6288         struct rpccli_samr_ChangePasswordUser_state *state;
6289         struct tevent_req *subreq;
6290
6291         req = tevent_req_create(mem_ctx, &state,
6292                                 struct rpccli_samr_ChangePasswordUser_state);
6293         if (req == NULL) {
6294                 return NULL;
6295         }
6296         state->out_mem_ctx = NULL;
6297         state->dispatch_recv = cli->dispatch_recv;
6298
6299         /* In parameters */
6300         state->orig.in.user_handle = _user_handle;
6301         state->orig.in.lm_present = _lm_present;
6302         state->orig.in.old_lm_crypted = _old_lm_crypted;
6303         state->orig.in.new_lm_crypted = _new_lm_crypted;
6304         state->orig.in.nt_present = _nt_present;
6305         state->orig.in.old_nt_crypted = _old_nt_crypted;
6306         state->orig.in.new_nt_crypted = _new_nt_crypted;
6307         state->orig.in.cross1_present = _cross1_present;
6308         state->orig.in.nt_cross = _nt_cross;
6309         state->orig.in.cross2_present = _cross2_present;
6310         state->orig.in.lm_cross = _lm_cross;
6311
6312         /* Out parameters */
6313
6314         /* Result */
6315         ZERO_STRUCT(state->orig.out.result);
6316
6317         if (DEBUGLEVEL >= 10) {
6318                 NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser, &state->orig);
6319         }
6320
6321         /* make a temporary copy, that we pass to the dispatch function */
6322         state->tmp = state->orig;
6323
6324         subreq = cli->dispatch_send(state, ev, cli,
6325                                     &ndr_table_samr,
6326                                     NDR_SAMR_CHANGEPASSWORDUSER,
6327                                     &state->tmp);
6328         if (tevent_req_nomem(subreq, req)) {
6329                 return tevent_req_post(req, ev);
6330         }
6331         tevent_req_set_callback(subreq, rpccli_samr_ChangePasswordUser_done, req);
6332         return req;
6333 }
6334
6335 static void rpccli_samr_ChangePasswordUser_done(struct tevent_req *subreq)
6336 {
6337         struct tevent_req *req = tevent_req_callback_data(
6338                 subreq, struct tevent_req);
6339         struct rpccli_samr_ChangePasswordUser_state *state = tevent_req_data(
6340                 req, struct rpccli_samr_ChangePasswordUser_state);
6341         NTSTATUS status;
6342         TALLOC_CTX *mem_ctx;
6343
6344         if (state->out_mem_ctx) {
6345                 mem_ctx = state->out_mem_ctx;
6346         } else {
6347                 mem_ctx = state;
6348         }
6349
6350         status = state->dispatch_recv(subreq, mem_ctx);
6351         TALLOC_FREE(subreq);
6352         if (!NT_STATUS_IS_OK(status)) {
6353                 tevent_req_nterror(req, status);
6354                 return;
6355         }
6356
6357         /* Copy out parameters */
6358
6359         /* Copy result */
6360         state->orig.out.result = state->tmp.out.result;
6361
6362         /* Reset temporary structure */
6363         ZERO_STRUCT(state->tmp);
6364
6365         if (DEBUGLEVEL >= 10) {
6366                 NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser, &state->orig);
6367         }
6368
6369         tevent_req_done(req);
6370 }
6371
6372 NTSTATUS rpccli_samr_ChangePasswordUser_recv(struct tevent_req *req,
6373                                              TALLOC_CTX *mem_ctx,
6374                                              NTSTATUS *result)
6375 {
6376         struct rpccli_samr_ChangePasswordUser_state *state = tevent_req_data(
6377                 req, struct rpccli_samr_ChangePasswordUser_state);
6378         NTSTATUS status;
6379
6380         if (tevent_req_is_nterror(req, &status)) {
6381                 tevent_req_received(req);
6382                 return status;
6383         }
6384
6385         /* Steal possbile out parameters to the callers context */
6386         talloc_steal(mem_ctx, state->out_mem_ctx);
6387
6388         /* Return result */
6389         *result = state->orig.out.result;
6390
6391         tevent_req_received(req);
6392         return NT_STATUS_OK;
6393 }
6394
6395 NTSTATUS rpccli_samr_ChangePasswordUser(struct rpc_pipe_client *cli,
6396                                         TALLOC_CTX *mem_ctx,
6397                                         struct policy_handle *user_handle /* [in] [ref] */,
6398                                         uint8_t lm_present /* [in]  */,
6399                                         struct samr_Password *old_lm_crypted /* [in] [unique] */,
6400                                         struct samr_Password *new_lm_crypted /* [in] [unique] */,
6401                                         uint8_t nt_present /* [in]  */,
6402                                         struct samr_Password *old_nt_crypted /* [in] [unique] */,
6403                                         struct samr_Password *new_nt_crypted /* [in] [unique] */,
6404                                         uint8_t cross1_present /* [in]  */,
6405                                         struct samr_Password *nt_cross /* [in] [unique] */,
6406                                         uint8_t cross2_present /* [in]  */,
6407                                         struct samr_Password *lm_cross /* [in] [unique] */)
6408 {
6409         struct samr_ChangePasswordUser r;
6410         NTSTATUS status;
6411
6412         /* In parameters */
6413         r.in.user_handle = user_handle;
6414         r.in.lm_present = lm_present;
6415         r.in.old_lm_crypted = old_lm_crypted;
6416         r.in.new_lm_crypted = new_lm_crypted;
6417         r.in.nt_present = nt_present;
6418         r.in.old_nt_crypted = old_nt_crypted;
6419         r.in.new_nt_crypted = new_nt_crypted;
6420         r.in.cross1_present = cross1_present;
6421         r.in.nt_cross = nt_cross;
6422         r.in.cross2_present = cross2_present;
6423         r.in.lm_cross = lm_cross;
6424
6425         if (DEBUGLEVEL >= 10) {
6426                 NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser, &r);
6427         }
6428
6429         status = cli->dispatch(cli,
6430                                 mem_ctx,
6431                                 &ndr_table_samr,
6432                                 NDR_SAMR_CHANGEPASSWORDUSER,
6433                                 &r);
6434
6435         if (!NT_STATUS_IS_OK(status)) {
6436                 return status;
6437         }
6438
6439         if (DEBUGLEVEL >= 10) {
6440                 NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser, &r);
6441         }
6442
6443         if (NT_STATUS_IS_ERR(status)) {
6444                 return status;
6445         }
6446
6447         /* Return variables */
6448
6449         /* Return result */
6450         return r.out.result;
6451 }
6452
6453 struct rpccli_samr_GetGroupsForUser_state {
6454         struct samr_GetGroupsForUser orig;
6455         struct samr_GetGroupsForUser tmp;
6456         TALLOC_CTX *out_mem_ctx;
6457         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6458 };
6459
6460 static void rpccli_samr_GetGroupsForUser_done(struct tevent_req *subreq);
6461
6462 struct tevent_req *rpccli_samr_GetGroupsForUser_send(TALLOC_CTX *mem_ctx,
6463                                                      struct tevent_context *ev,
6464                                                      struct rpc_pipe_client *cli,
6465                                                      struct policy_handle *_user_handle /* [in] [ref] */,
6466                                                      struct samr_RidWithAttributeArray **_rids /* [out] [ref] */)
6467 {
6468         struct tevent_req *req;
6469         struct rpccli_samr_GetGroupsForUser_state *state;
6470         struct tevent_req *subreq;
6471
6472         req = tevent_req_create(mem_ctx, &state,
6473                                 struct rpccli_samr_GetGroupsForUser_state);
6474         if (req == NULL) {
6475                 return NULL;
6476         }
6477         state->out_mem_ctx = NULL;
6478         state->dispatch_recv = cli->dispatch_recv;
6479
6480         /* In parameters */
6481         state->orig.in.user_handle = _user_handle;
6482
6483         /* Out parameters */
6484         state->orig.out.rids = _rids;
6485
6486         /* Result */
6487         ZERO_STRUCT(state->orig.out.result);
6488
6489         if (DEBUGLEVEL >= 10) {
6490                 NDR_PRINT_IN_DEBUG(samr_GetGroupsForUser, &state->orig);
6491         }
6492
6493         state->out_mem_ctx = talloc_named_const(state, 0,
6494                              "rpccli_samr_GetGroupsForUser_out_memory");
6495         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6496                 return tevent_req_post(req, ev);
6497         }
6498
6499         /* make a temporary copy, that we pass to the dispatch function */
6500         state->tmp = state->orig;
6501
6502         subreq = cli->dispatch_send(state, ev, cli,
6503                                     &ndr_table_samr,
6504                                     NDR_SAMR_GETGROUPSFORUSER,
6505                                     &state->tmp);
6506         if (tevent_req_nomem(subreq, req)) {
6507                 return tevent_req_post(req, ev);
6508         }
6509         tevent_req_set_callback(subreq, rpccli_samr_GetGroupsForUser_done, req);
6510         return req;
6511 }
6512
6513 static void rpccli_samr_GetGroupsForUser_done(struct tevent_req *subreq)
6514 {
6515         struct tevent_req *req = tevent_req_callback_data(
6516                 subreq, struct tevent_req);
6517         struct rpccli_samr_GetGroupsForUser_state *state = tevent_req_data(
6518                 req, struct rpccli_samr_GetGroupsForUser_state);
6519         NTSTATUS status;
6520         TALLOC_CTX *mem_ctx;
6521
6522         if (state->out_mem_ctx) {
6523                 mem_ctx = state->out_mem_ctx;
6524         } else {
6525                 mem_ctx = state;
6526         }
6527
6528         status = state->dispatch_recv(subreq, mem_ctx);
6529         TALLOC_FREE(subreq);
6530         if (!NT_STATUS_IS_OK(status)) {
6531                 tevent_req_nterror(req, status);
6532                 return;
6533         }
6534
6535         /* Copy out parameters */
6536         *state->orig.out.rids = *state->tmp.out.rids;
6537
6538         /* Copy result */
6539         state->orig.out.result = state->tmp.out.result;
6540
6541         /* Reset temporary structure */
6542         ZERO_STRUCT(state->tmp);
6543
6544         if (DEBUGLEVEL >= 10) {
6545                 NDR_PRINT_OUT_DEBUG(samr_GetGroupsForUser, &state->orig);
6546         }
6547
6548         tevent_req_done(req);
6549 }
6550
6551 NTSTATUS rpccli_samr_GetGroupsForUser_recv(struct tevent_req *req,
6552                                            TALLOC_CTX *mem_ctx,
6553                                            NTSTATUS *result)
6554 {
6555         struct rpccli_samr_GetGroupsForUser_state *state = tevent_req_data(
6556                 req, struct rpccli_samr_GetGroupsForUser_state);
6557         NTSTATUS status;
6558
6559         if (tevent_req_is_nterror(req, &status)) {
6560                 tevent_req_received(req);
6561                 return status;
6562         }
6563
6564         /* Steal possbile out parameters to the callers context */
6565         talloc_steal(mem_ctx, state->out_mem_ctx);
6566
6567         /* Return result */
6568         *result = state->orig.out.result;
6569
6570         tevent_req_received(req);
6571         return NT_STATUS_OK;
6572 }
6573
6574 NTSTATUS rpccli_samr_GetGroupsForUser(struct rpc_pipe_client *cli,
6575                                       TALLOC_CTX *mem_ctx,
6576                                       struct policy_handle *user_handle /* [in] [ref] */,
6577                                       struct samr_RidWithAttributeArray **rids /* [out] [ref] */)
6578 {
6579         struct samr_GetGroupsForUser r;
6580         NTSTATUS status;
6581
6582         /* In parameters */
6583         r.in.user_handle = user_handle;
6584
6585         if (DEBUGLEVEL >= 10) {
6586                 NDR_PRINT_IN_DEBUG(samr_GetGroupsForUser, &r);
6587         }
6588
6589         status = cli->dispatch(cli,
6590                                 mem_ctx,
6591                                 &ndr_table_samr,
6592                                 NDR_SAMR_GETGROUPSFORUSER,
6593                                 &r);
6594
6595         if (!NT_STATUS_IS_OK(status)) {
6596                 return status;
6597         }
6598
6599         if (DEBUGLEVEL >= 10) {
6600                 NDR_PRINT_OUT_DEBUG(samr_GetGroupsForUser, &r);
6601         }
6602
6603         if (NT_STATUS_IS_ERR(status)) {
6604                 return status;
6605         }
6606
6607         /* Return variables */
6608         *rids = *r.out.rids;
6609
6610         /* Return result */
6611         return r.out.result;
6612 }
6613
6614 struct rpccli_samr_QueryDisplayInfo_state {
6615         struct samr_QueryDisplayInfo orig;
6616         struct samr_QueryDisplayInfo tmp;
6617         TALLOC_CTX *out_mem_ctx;
6618         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6619 };
6620
6621 static void rpccli_samr_QueryDisplayInfo_done(struct tevent_req *subreq);
6622
6623 struct tevent_req *rpccli_samr_QueryDisplayInfo_send(TALLOC_CTX *mem_ctx,
6624                                                      struct tevent_context *ev,
6625                                                      struct rpc_pipe_client *cli,
6626                                                      struct policy_handle *_domain_handle /* [in] [ref] */,
6627                                                      uint16_t _level /* [in]  */,
6628                                                      uint32_t _start_idx /* [in]  */,
6629                                                      uint32_t _max_entries /* [in]  */,
6630                                                      uint32_t _buf_size /* [in]  */,
6631                                                      uint32_t *_total_size /* [out] [ref] */,
6632                                                      uint32_t *_returned_size /* [out] [ref] */,
6633                                                      union samr_DispInfo *_info /* [out] [ref,switch_is(level)] */)
6634 {
6635         struct tevent_req *req;
6636         struct rpccli_samr_QueryDisplayInfo_state *state;
6637         struct tevent_req *subreq;
6638
6639         req = tevent_req_create(mem_ctx, &state,
6640                                 struct rpccli_samr_QueryDisplayInfo_state);
6641         if (req == NULL) {
6642                 return NULL;
6643         }
6644         state->out_mem_ctx = NULL;
6645         state->dispatch_recv = cli->dispatch_recv;
6646
6647         /* In parameters */
6648         state->orig.in.domain_handle = _domain_handle;
6649         state->orig.in.level = _level;
6650         state->orig.in.start_idx = _start_idx;
6651         state->orig.in.max_entries = _max_entries;
6652         state->orig.in.buf_size = _buf_size;
6653
6654         /* Out parameters */
6655         state->orig.out.total_size = _total_size;
6656         state->orig.out.returned_size = _returned_size;
6657         state->orig.out.info = _info;
6658
6659         /* Result */
6660         ZERO_STRUCT(state->orig.out.result);
6661
6662         if (DEBUGLEVEL >= 10) {
6663                 NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo, &state->orig);
6664         }
6665
6666         state->out_mem_ctx = talloc_named_const(state, 0,
6667                              "rpccli_samr_QueryDisplayInfo_out_memory");
6668         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6669                 return tevent_req_post(req, ev);
6670         }
6671
6672         /* make a temporary copy, that we pass to the dispatch function */
6673         state->tmp = state->orig;
6674
6675         subreq = cli->dispatch_send(state, ev, cli,
6676                                     &ndr_table_samr,
6677                                     NDR_SAMR_QUERYDISPLAYINFO,
6678                                     &state->tmp);
6679         if (tevent_req_nomem(subreq, req)) {
6680                 return tevent_req_post(req, ev);
6681         }
6682         tevent_req_set_callback(subreq, rpccli_samr_QueryDisplayInfo_done, req);
6683         return req;
6684 }
6685
6686 static void rpccli_samr_QueryDisplayInfo_done(struct tevent_req *subreq)
6687 {
6688         struct tevent_req *req = tevent_req_callback_data(
6689                 subreq, struct tevent_req);
6690         struct rpccli_samr_QueryDisplayInfo_state *state = tevent_req_data(
6691                 req, struct rpccli_samr_QueryDisplayInfo_state);
6692         NTSTATUS status;
6693         TALLOC_CTX *mem_ctx;
6694
6695         if (state->out_mem_ctx) {
6696                 mem_ctx = state->out_mem_ctx;
6697         } else {
6698                 mem_ctx = state;
6699         }
6700
6701         status = state->dispatch_recv(subreq, mem_ctx);
6702         TALLOC_FREE(subreq);
6703         if (!NT_STATUS_IS_OK(status)) {
6704                 tevent_req_nterror(req, status);
6705                 return;
6706         }
6707
6708         /* Copy out parameters */
6709         *state->orig.out.total_size = *state->tmp.out.total_size;
6710         *state->orig.out.returned_size = *state->tmp.out.returned_size;
6711         *state->orig.out.info = *state->tmp.out.info;
6712
6713         /* Copy result */
6714         state->orig.out.result = state->tmp.out.result;
6715
6716         /* Reset temporary structure */
6717         ZERO_STRUCT(state->tmp);
6718
6719         if (DEBUGLEVEL >= 10) {
6720                 NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo, &state->orig);
6721         }
6722
6723         tevent_req_done(req);
6724 }
6725
6726 NTSTATUS rpccli_samr_QueryDisplayInfo_recv(struct tevent_req *req,
6727                                            TALLOC_CTX *mem_ctx,
6728                                            NTSTATUS *result)
6729 {
6730         struct rpccli_samr_QueryDisplayInfo_state *state = tevent_req_data(
6731                 req, struct rpccli_samr_QueryDisplayInfo_state);
6732         NTSTATUS status;
6733
6734         if (tevent_req_is_nterror(req, &status)) {
6735                 tevent_req_received(req);
6736                 return status;
6737         }
6738
6739         /* Steal possbile out parameters to the callers context */
6740         talloc_steal(mem_ctx, state->out_mem_ctx);
6741
6742         /* Return result */
6743         *result = state->orig.out.result;
6744
6745         tevent_req_received(req);
6746         return NT_STATUS_OK;
6747 }
6748
6749 NTSTATUS rpccli_samr_QueryDisplayInfo(struct rpc_pipe_client *cli,
6750                                       TALLOC_CTX *mem_ctx,
6751                                       struct policy_handle *domain_handle /* [in] [ref] */,
6752                                       uint16_t level /* [in]  */,
6753                                       uint32_t start_idx /* [in]  */,
6754                                       uint32_t max_entries /* [in]  */,
6755                                       uint32_t buf_size /* [in]  */,
6756                                       uint32_t *total_size /* [out] [ref] */,
6757                                       uint32_t *returned_size /* [out] [ref] */,
6758                                       union samr_DispInfo *info /* [out] [ref,switch_is(level)] */)
6759 {
6760         struct samr_QueryDisplayInfo r;
6761         NTSTATUS status;
6762
6763         /* In parameters */
6764         r.in.domain_handle = domain_handle;
6765         r.in.level = level;
6766         r.in.start_idx = start_idx;
6767         r.in.max_entries = max_entries;
6768         r.in.buf_size = buf_size;
6769
6770         if (DEBUGLEVEL >= 10) {
6771                 NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo, &r);
6772         }
6773
6774         status = cli->dispatch(cli,
6775                                 mem_ctx,
6776                                 &ndr_table_samr,
6777                                 NDR_SAMR_QUERYDISPLAYINFO,
6778                                 &r);
6779
6780         if (!NT_STATUS_IS_OK(status)) {
6781                 return status;
6782         }
6783
6784         if (DEBUGLEVEL >= 10) {
6785                 NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo, &r);
6786         }
6787
6788         if (NT_STATUS_IS_ERR(status)) {
6789                 return status;
6790         }
6791
6792         /* Return variables */
6793         *total_size = *r.out.total_size;
6794         *returned_size = *r.out.returned_size;
6795         *info = *r.out.info;
6796
6797         /* Return result */
6798         return r.out.result;
6799 }
6800
6801 struct rpccli_samr_GetDisplayEnumerationIndex_state {
6802         struct samr_GetDisplayEnumerationIndex orig;
6803         struct samr_GetDisplayEnumerationIndex tmp;
6804         TALLOC_CTX *out_mem_ctx;
6805         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6806 };
6807
6808 static void rpccli_samr_GetDisplayEnumerationIndex_done(struct tevent_req *subreq);
6809
6810 struct tevent_req *rpccli_samr_GetDisplayEnumerationIndex_send(TALLOC_CTX *mem_ctx,
6811                                                                struct tevent_context *ev,
6812                                                                struct rpc_pipe_client *cli,
6813                                                                struct policy_handle *_domain_handle /* [in] [ref] */,
6814                                                                uint16_t _level /* [in]  */,
6815                                                                struct lsa_String *_name /* [in] [ref] */,
6816                                                                uint32_t *_idx /* [out] [ref] */)
6817 {
6818         struct tevent_req *req;
6819         struct rpccli_samr_GetDisplayEnumerationIndex_state *state;
6820         struct tevent_req *subreq;
6821
6822         req = tevent_req_create(mem_ctx, &state,
6823                                 struct rpccli_samr_GetDisplayEnumerationIndex_state);
6824         if (req == NULL) {
6825                 return NULL;
6826         }
6827         state->out_mem_ctx = NULL;
6828         state->dispatch_recv = cli->dispatch_recv;
6829
6830         /* In parameters */
6831         state->orig.in.domain_handle = _domain_handle;
6832         state->orig.in.level = _level;
6833         state->orig.in.name = _name;
6834
6835         /* Out parameters */
6836         state->orig.out.idx = _idx;
6837
6838         /* Result */
6839         ZERO_STRUCT(state->orig.out.result);
6840
6841         if (DEBUGLEVEL >= 10) {
6842                 NDR_PRINT_IN_DEBUG(samr_GetDisplayEnumerationIndex, &state->orig);
6843         }
6844
6845         state->out_mem_ctx = talloc_named_const(state, 0,
6846                              "rpccli_samr_GetDisplayEnumerationIndex_out_memory");
6847         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6848                 return tevent_req_post(req, ev);
6849         }
6850
6851         /* make a temporary copy, that we pass to the dispatch function */
6852         state->tmp = state->orig;
6853
6854         subreq = cli->dispatch_send(state, ev, cli,
6855                                     &ndr_table_samr,
6856                                     NDR_SAMR_GETDISPLAYENUMERATIONINDEX,
6857                                     &state->tmp);
6858         if (tevent_req_nomem(subreq, req)) {
6859                 return tevent_req_post(req, ev);
6860         }
6861         tevent_req_set_callback(subreq, rpccli_samr_GetDisplayEnumerationIndex_done, req);
6862         return req;
6863 }
6864
6865 static void rpccli_samr_GetDisplayEnumerationIndex_done(struct tevent_req *subreq)
6866 {
6867         struct tevent_req *req = tevent_req_callback_data(
6868                 subreq, struct tevent_req);
6869         struct rpccli_samr_GetDisplayEnumerationIndex_state *state = tevent_req_data(
6870                 req, struct rpccli_samr_GetDisplayEnumerationIndex_state);
6871         NTSTATUS status;
6872         TALLOC_CTX *mem_ctx;
6873
6874         if (state->out_mem_ctx) {
6875                 mem_ctx = state->out_mem_ctx;
6876         } else {
6877                 mem_ctx = state;
6878         }
6879
6880         status = state->dispatch_recv(subreq, mem_ctx);
6881         TALLOC_FREE(subreq);
6882         if (!NT_STATUS_IS_OK(status)) {
6883                 tevent_req_nterror(req, status);
6884                 return;
6885         }
6886
6887         /* Copy out parameters */
6888         *state->orig.out.idx = *state->tmp.out.idx;
6889
6890         /* Copy result */
6891         state->orig.out.result = state->tmp.out.result;
6892
6893         /* Reset temporary structure */
6894         ZERO_STRUCT(state->tmp);
6895
6896         if (DEBUGLEVEL >= 10) {
6897                 NDR_PRINT_OUT_DEBUG(samr_GetDisplayEnumerationIndex, &state->orig);
6898         }
6899
6900         tevent_req_done(req);
6901 }
6902
6903 NTSTATUS rpccli_samr_GetDisplayEnumerationIndex_recv(struct tevent_req *req,
6904                                                      TALLOC_CTX *mem_ctx,
6905                                                      NTSTATUS *result)
6906 {
6907         struct rpccli_samr_GetDisplayEnumerationIndex_state *state = tevent_req_data(
6908                 req, struct rpccli_samr_GetDisplayEnumerationIndex_state);
6909         NTSTATUS status;
6910
6911         if (tevent_req_is_nterror(req, &status)) {
6912                 tevent_req_received(req);
6913                 return status;
6914         }
6915
6916         /* Steal possbile out parameters to the callers context */
6917         talloc_steal(mem_ctx, state->out_mem_ctx);
6918
6919         /* Return result */
6920         *result = state->orig.out.result;
6921
6922         tevent_req_received(req);
6923         return NT_STATUS_OK;
6924 }
6925
6926 NTSTATUS rpccli_samr_GetDisplayEnumerationIndex(struct rpc_pipe_client *cli,
6927                                                 TALLOC_CTX *mem_ctx,
6928                                                 struct policy_handle *domain_handle /* [in] [ref] */,
6929                                                 uint16_t level /* [in]  */,
6930                                                 struct lsa_String *name /* [in] [ref] */,
6931                                                 uint32_t *idx /* [out] [ref] */)
6932 {
6933         struct samr_GetDisplayEnumerationIndex r;
6934         NTSTATUS status;
6935
6936         /* In parameters */
6937         r.in.domain_handle = domain_handle;
6938         r.in.level = level;
6939         r.in.name = name;
6940
6941         if (DEBUGLEVEL >= 10) {
6942                 NDR_PRINT_IN_DEBUG(samr_GetDisplayEnumerationIndex, &r);
6943         }
6944
6945         status = cli->dispatch(cli,
6946                                 mem_ctx,
6947                                 &ndr_table_samr,
6948                                 NDR_SAMR_GETDISPLAYENUMERATIONINDEX,
6949                                 &r);
6950
6951         if (!NT_STATUS_IS_OK(status)) {
6952                 return status;
6953         }
6954
6955         if (DEBUGLEVEL >= 10) {
6956                 NDR_PRINT_OUT_DEBUG(samr_GetDisplayEnumerationIndex, &r);
6957         }
6958
6959         if (NT_STATUS_IS_ERR(status)) {
6960                 return status;
6961         }
6962
6963         /* Return variables */
6964         *idx = *r.out.idx;
6965
6966         /* Return result */
6967         return r.out.result;
6968 }
6969
6970 struct rpccli_samr_TestPrivateFunctionsDomain_state {
6971         struct samr_TestPrivateFunctionsDomain orig;
6972         struct samr_TestPrivateFunctionsDomain tmp;
6973         TALLOC_CTX *out_mem_ctx;
6974         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6975 };
6976
6977 static void rpccli_samr_TestPrivateFunctionsDomain_done(struct tevent_req *subreq);
6978
6979 struct tevent_req *rpccli_samr_TestPrivateFunctionsDomain_send(TALLOC_CTX *mem_ctx,
6980                                                                struct tevent_context *ev,
6981                                                                struct rpc_pipe_client *cli,
6982                                                                struct policy_handle *_domain_handle /* [in] [ref] */)
6983 {
6984         struct tevent_req *req;
6985         struct rpccli_samr_TestPrivateFunctionsDomain_state *state;
6986         struct tevent_req *subreq;
6987
6988         req = tevent_req_create(mem_ctx, &state,
6989                                 struct rpccli_samr_TestPrivateFunctionsDomain_state);
6990         if (req == NULL) {
6991                 return NULL;
6992         }
6993         state->out_mem_ctx = NULL;
6994         state->dispatch_recv = cli->dispatch_recv;
6995
6996         /* In parameters */
6997         state->orig.in.domain_handle = _domain_handle;
6998
6999         /* Out parameters */
7000
7001         /* Result */
7002         ZERO_STRUCT(state->orig.out.result);
7003
7004         if (DEBUGLEVEL >= 10) {
7005                 NDR_PRINT_IN_DEBUG(samr_TestPrivateFunctionsDomain, &state->orig);
7006         }
7007
7008         /* make a temporary copy, that we pass to the dispatch function */
7009         state->tmp = state->orig;
7010
7011         subreq = cli->dispatch_send(state, ev, cli,
7012                                     &ndr_table_samr,
7013                                     NDR_SAMR_TESTPRIVATEFUNCTIONSDOMAIN,
7014                                     &state->tmp);
7015         if (tevent_req_nomem(subreq, req)) {
7016                 return tevent_req_post(req, ev);
7017         }
7018         tevent_req_set_callback(subreq, rpccli_samr_TestPrivateFunctionsDomain_done, req);
7019         return req;
7020 }
7021
7022 static void rpccli_samr_TestPrivateFunctionsDomain_done(struct tevent_req *subreq)
7023 {
7024         struct tevent_req *req = tevent_req_callback_data(
7025                 subreq, struct tevent_req);
7026         struct rpccli_samr_TestPrivateFunctionsDomain_state *state = tevent_req_data(
7027                 req, struct rpccli_samr_TestPrivateFunctionsDomain_state);
7028         NTSTATUS status;
7029         TALLOC_CTX *mem_ctx;
7030
7031         if (state->out_mem_ctx) {
7032                 mem_ctx = state->out_mem_ctx;
7033         } else {
7034                 mem_ctx = state;
7035         }
7036
7037         status = state->dispatch_recv(subreq, mem_ctx);
7038         TALLOC_FREE(subreq);
7039         if (!NT_STATUS_IS_OK(status)) {
7040                 tevent_req_nterror(req, status);
7041                 return;
7042         }
7043
7044         /* Copy out parameters */
7045
7046         /* Copy result */
7047         state->orig.out.result = state->tmp.out.result;
7048
7049         /* Reset temporary structure */
7050         ZERO_STRUCT(state->tmp);
7051
7052         if (DEBUGLEVEL >= 10) {
7053                 NDR_PRINT_OUT_DEBUG(samr_TestPrivateFunctionsDomain, &state->orig);
7054         }
7055
7056         tevent_req_done(req);
7057 }
7058
7059 NTSTATUS rpccli_samr_TestPrivateFunctionsDomain_recv(struct tevent_req *req,
7060                                                      TALLOC_CTX *mem_ctx,
7061                                                      NTSTATUS *result)
7062 {
7063         struct rpccli_samr_TestPrivateFunctionsDomain_state *state = tevent_req_data(
7064                 req, struct rpccli_samr_TestPrivateFunctionsDomain_state);
7065         NTSTATUS status;
7066
7067         if (tevent_req_is_nterror(req, &status)) {
7068                 tevent_req_received(req);
7069                 return status;
7070         }
7071
7072         /* Steal possbile out parameters to the callers context */
7073         talloc_steal(mem_ctx, state->out_mem_ctx);
7074
7075         /* Return result */
7076         *result = state->orig.out.result;
7077
7078         tevent_req_received(req);
7079         return NT_STATUS_OK;
7080 }
7081
7082 NTSTATUS rpccli_samr_TestPrivateFunctionsDomain(struct rpc_pipe_client *cli,
7083                                                 TALLOC_CTX *mem_ctx,
7084                                                 struct policy_handle *domain_handle /* [in] [ref] */)
7085 {
7086         struct samr_TestPrivateFunctionsDomain r;
7087         NTSTATUS status;
7088
7089         /* In parameters */
7090         r.in.domain_handle = domain_handle;
7091
7092         if (DEBUGLEVEL >= 10) {
7093                 NDR_PRINT_IN_DEBUG(samr_TestPrivateFunctionsDomain, &r);
7094         }
7095
7096         status = cli->dispatch(cli,
7097                                 mem_ctx,
7098                                 &ndr_table_samr,
7099                                 NDR_SAMR_TESTPRIVATEFUNCTIONSDOMAIN,
7100                                 &r);
7101
7102         if (!NT_STATUS_IS_OK(status)) {
7103                 return status;
7104         }
7105
7106         if (DEBUGLEVEL >= 10) {
7107                 NDR_PRINT_OUT_DEBUG(samr_TestPrivateFunctionsDomain, &r);
7108         }
7109
7110         if (NT_STATUS_IS_ERR(status)) {
7111                 return status;
7112         }
7113
7114         /* Return variables */
7115
7116         /* Return result */
7117         return r.out.result;
7118 }
7119
7120 struct rpccli_samr_TestPrivateFunctionsUser_state {
7121         struct samr_TestPrivateFunctionsUser orig;
7122         struct samr_TestPrivateFunctionsUser tmp;
7123         TALLOC_CTX *out_mem_ctx;
7124         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7125 };
7126
7127 static void rpccli_samr_TestPrivateFunctionsUser_done(struct tevent_req *subreq);
7128
7129 struct tevent_req *rpccli_samr_TestPrivateFunctionsUser_send(TALLOC_CTX *mem_ctx,
7130                                                              struct tevent_context *ev,
7131                                                              struct rpc_pipe_client *cli,
7132                                                              struct policy_handle *_user_handle /* [in] [ref] */)
7133 {
7134         struct tevent_req *req;
7135         struct rpccli_samr_TestPrivateFunctionsUser_state *state;
7136         struct tevent_req *subreq;
7137
7138         req = tevent_req_create(mem_ctx, &state,
7139                                 struct rpccli_samr_TestPrivateFunctionsUser_state);
7140         if (req == NULL) {
7141                 return NULL;
7142         }
7143         state->out_mem_ctx = NULL;
7144         state->dispatch_recv = cli->dispatch_recv;
7145
7146         /* In parameters */
7147         state->orig.in.user_handle = _user_handle;
7148
7149         /* Out parameters */
7150
7151         /* Result */
7152         ZERO_STRUCT(state->orig.out.result);
7153
7154         if (DEBUGLEVEL >= 10) {
7155                 NDR_PRINT_IN_DEBUG(samr_TestPrivateFunctionsUser, &state->orig);
7156         }
7157
7158         /* make a temporary copy, that we pass to the dispatch function */
7159         state->tmp = state->orig;
7160
7161         subreq = cli->dispatch_send(state, ev, cli,
7162                                     &ndr_table_samr,
7163                                     NDR_SAMR_TESTPRIVATEFUNCTIONSUSER,
7164                                     &state->tmp);
7165         if (tevent_req_nomem(subreq, req)) {
7166                 return tevent_req_post(req, ev);
7167         }
7168         tevent_req_set_callback(subreq, rpccli_samr_TestPrivateFunctionsUser_done, req);
7169         return req;
7170 }
7171
7172 static void rpccli_samr_TestPrivateFunctionsUser_done(struct tevent_req *subreq)
7173 {
7174         struct tevent_req *req = tevent_req_callback_data(
7175                 subreq, struct tevent_req);
7176         struct rpccli_samr_TestPrivateFunctionsUser_state *state = tevent_req_data(
7177                 req, struct rpccli_samr_TestPrivateFunctionsUser_state);
7178         NTSTATUS status;
7179         TALLOC_CTX *mem_ctx;
7180
7181         if (state->out_mem_ctx) {
7182                 mem_ctx = state->out_mem_ctx;
7183         } else {
7184                 mem_ctx = state;
7185         }
7186
7187         status = state->dispatch_recv(subreq, mem_ctx);
7188         TALLOC_FREE(subreq);
7189         if (!NT_STATUS_IS_OK(status)) {
7190                 tevent_req_nterror(req, status);
7191                 return;
7192         }
7193
7194         /* Copy out parameters */
7195
7196         /* Copy result */
7197         state->orig.out.result = state->tmp.out.result;
7198
7199         /* Reset temporary structure */
7200         ZERO_STRUCT(state->tmp);
7201
7202         if (DEBUGLEVEL >= 10) {
7203                 NDR_PRINT_OUT_DEBUG(samr_TestPrivateFunctionsUser, &state->orig);
7204         }
7205
7206         tevent_req_done(req);
7207 }
7208
7209 NTSTATUS rpccli_samr_TestPrivateFunctionsUser_recv(struct tevent_req *req,
7210                                                    TALLOC_CTX *mem_ctx,
7211                                                    NTSTATUS *result)
7212 {
7213         struct rpccli_samr_TestPrivateFunctionsUser_state *state = tevent_req_data(
7214                 req, struct rpccli_samr_TestPrivateFunctionsUser_state);
7215         NTSTATUS status;
7216
7217         if (tevent_req_is_nterror(req, &status)) {
7218                 tevent_req_received(req);
7219                 return status;
7220         }
7221
7222         /* Steal possbile out parameters to the callers context */
7223         talloc_steal(mem_ctx, state->out_mem_ctx);
7224
7225         /* Return result */
7226         *result = state->orig.out.result;
7227
7228         tevent_req_received(req);
7229         return NT_STATUS_OK;
7230 }
7231
7232 NTSTATUS rpccli_samr_TestPrivateFunctionsUser(struct rpc_pipe_client *cli,
7233                                               TALLOC_CTX *mem_ctx,
7234                                               struct policy_handle *user_handle /* [in] [ref] */)
7235 {
7236         struct samr_TestPrivateFunctionsUser r;
7237         NTSTATUS status;
7238
7239         /* In parameters */
7240         r.in.user_handle = user_handle;
7241
7242         if (DEBUGLEVEL >= 10) {
7243                 NDR_PRINT_IN_DEBUG(samr_TestPrivateFunctionsUser, &r);
7244         }
7245
7246         status = cli->dispatch(cli,
7247                                 mem_ctx,
7248                                 &ndr_table_samr,
7249                                 NDR_SAMR_TESTPRIVATEFUNCTIONSUSER,
7250                                 &r);
7251
7252         if (!NT_STATUS_IS_OK(status)) {
7253                 return status;
7254         }
7255
7256         if (DEBUGLEVEL >= 10) {
7257                 NDR_PRINT_OUT_DEBUG(samr_TestPrivateFunctionsUser, &r);
7258         }
7259
7260         if (NT_STATUS_IS_ERR(status)) {
7261                 return status;
7262         }
7263
7264         /* Return variables */
7265
7266         /* Return result */
7267         return r.out.result;
7268 }
7269
7270 struct rpccli_samr_GetUserPwInfo_state {
7271         struct samr_GetUserPwInfo orig;
7272         struct samr_GetUserPwInfo tmp;
7273         TALLOC_CTX *out_mem_ctx;
7274         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7275 };
7276
7277 static void rpccli_samr_GetUserPwInfo_done(struct tevent_req *subreq);
7278
7279 struct tevent_req *rpccli_samr_GetUserPwInfo_send(TALLOC_CTX *mem_ctx,
7280                                                   struct tevent_context *ev,
7281                                                   struct rpc_pipe_client *cli,
7282                                                   struct policy_handle *_user_handle /* [in] [ref] */,
7283                                                   struct samr_PwInfo *_info /* [out] [ref] */)
7284 {
7285         struct tevent_req *req;
7286         struct rpccli_samr_GetUserPwInfo_state *state;
7287         struct tevent_req *subreq;
7288
7289         req = tevent_req_create(mem_ctx, &state,
7290                                 struct rpccli_samr_GetUserPwInfo_state);
7291         if (req == NULL) {
7292                 return NULL;
7293         }
7294         state->out_mem_ctx = NULL;
7295         state->dispatch_recv = cli->dispatch_recv;
7296
7297         /* In parameters */
7298         state->orig.in.user_handle = _user_handle;
7299
7300         /* Out parameters */
7301         state->orig.out.info = _info;
7302
7303         /* Result */
7304         ZERO_STRUCT(state->orig.out.result);
7305
7306         if (DEBUGLEVEL >= 10) {
7307                 NDR_PRINT_IN_DEBUG(samr_GetUserPwInfo, &state->orig);
7308         }
7309
7310         state->out_mem_ctx = talloc_named_const(state, 0,
7311                              "rpccli_samr_GetUserPwInfo_out_memory");
7312         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7313                 return tevent_req_post(req, ev);
7314         }
7315
7316         /* make a temporary copy, that we pass to the dispatch function */
7317         state->tmp = state->orig;
7318
7319         subreq = cli->dispatch_send(state, ev, cli,
7320                                     &ndr_table_samr,
7321                                     NDR_SAMR_GETUSERPWINFO,
7322                                     &state->tmp);
7323         if (tevent_req_nomem(subreq, req)) {
7324                 return tevent_req_post(req, ev);
7325         }
7326         tevent_req_set_callback(subreq, rpccli_samr_GetUserPwInfo_done, req);
7327         return req;
7328 }
7329
7330 static void rpccli_samr_GetUserPwInfo_done(struct tevent_req *subreq)
7331 {
7332         struct tevent_req *req = tevent_req_callback_data(
7333                 subreq, struct tevent_req);
7334         struct rpccli_samr_GetUserPwInfo_state *state = tevent_req_data(
7335                 req, struct rpccli_samr_GetUserPwInfo_state);
7336         NTSTATUS status;
7337         TALLOC_CTX *mem_ctx;
7338
7339         if (state->out_mem_ctx) {
7340                 mem_ctx = state->out_mem_ctx;
7341         } else {
7342                 mem_ctx = state;
7343         }
7344
7345         status = state->dispatch_recv(subreq, mem_ctx);
7346         TALLOC_FREE(subreq);
7347         if (!NT_STATUS_IS_OK(status)) {
7348                 tevent_req_nterror(req, status);
7349                 return;
7350         }
7351
7352         /* Copy out parameters */
7353         *state->orig.out.info = *state->tmp.out.info;
7354
7355         /* Copy result */
7356         state->orig.out.result = state->tmp.out.result;
7357
7358         /* Reset temporary structure */
7359         ZERO_STRUCT(state->tmp);
7360
7361         if (DEBUGLEVEL >= 10) {
7362                 NDR_PRINT_OUT_DEBUG(samr_GetUserPwInfo, &state->orig);
7363         }
7364
7365         tevent_req_done(req);
7366 }
7367
7368 NTSTATUS rpccli_samr_GetUserPwInfo_recv(struct tevent_req *req,
7369                                         TALLOC_CTX *mem_ctx,
7370                                         NTSTATUS *result)
7371 {
7372         struct rpccli_samr_GetUserPwInfo_state *state = tevent_req_data(
7373                 req, struct rpccli_samr_GetUserPwInfo_state);
7374         NTSTATUS status;
7375
7376         if (tevent_req_is_nterror(req, &status)) {
7377                 tevent_req_received(req);
7378                 return status;
7379         }
7380
7381         /* Steal possbile out parameters to the callers context */
7382         talloc_steal(mem_ctx, state->out_mem_ctx);
7383
7384         /* Return result */
7385         *result = state->orig.out.result;
7386
7387         tevent_req_received(req);
7388         return NT_STATUS_OK;
7389 }
7390
7391 NTSTATUS rpccli_samr_GetUserPwInfo(struct rpc_pipe_client *cli,
7392                                    TALLOC_CTX *mem_ctx,
7393                                    struct policy_handle *user_handle /* [in] [ref] */,
7394                                    struct samr_PwInfo *info /* [out] [ref] */)
7395 {
7396         struct samr_GetUserPwInfo r;
7397         NTSTATUS status;
7398
7399         /* In parameters */
7400         r.in.user_handle = user_handle;
7401
7402         if (DEBUGLEVEL >= 10) {
7403                 NDR_PRINT_IN_DEBUG(samr_GetUserPwInfo, &r);
7404         }
7405
7406         status = cli->dispatch(cli,
7407                                 mem_ctx,
7408                                 &ndr_table_samr,
7409                                 NDR_SAMR_GETUSERPWINFO,
7410                                 &r);
7411
7412         if (!NT_STATUS_IS_OK(status)) {
7413                 return status;
7414         }
7415
7416         if (DEBUGLEVEL >= 10) {
7417                 NDR_PRINT_OUT_DEBUG(samr_GetUserPwInfo, &r);
7418         }
7419
7420         if (NT_STATUS_IS_ERR(status)) {
7421                 return status;
7422         }
7423
7424         /* Return variables */
7425         *info = *r.out.info;
7426
7427         /* Return result */
7428         return r.out.result;
7429 }
7430
7431 struct rpccli_samr_RemoveMemberFromForeignDomain_state {
7432         struct samr_RemoveMemberFromForeignDomain orig;
7433         struct samr_RemoveMemberFromForeignDomain tmp;
7434         TALLOC_CTX *out_mem_ctx;
7435         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7436 };
7437
7438 static void rpccli_samr_RemoveMemberFromForeignDomain_done(struct tevent_req *subreq);
7439
7440 struct tevent_req *rpccli_samr_RemoveMemberFromForeignDomain_send(TALLOC_CTX *mem_ctx,
7441                                                                   struct tevent_context *ev,
7442                                                                   struct rpc_pipe_client *cli,
7443                                                                   struct policy_handle *_domain_handle /* [in] [ref] */,
7444                                                                   struct dom_sid2 *_sid /* [in] [ref] */)
7445 {
7446         struct tevent_req *req;
7447         struct rpccli_samr_RemoveMemberFromForeignDomain_state *state;
7448         struct tevent_req *subreq;
7449
7450         req = tevent_req_create(mem_ctx, &state,
7451                                 struct rpccli_samr_RemoveMemberFromForeignDomain_state);
7452         if (req == NULL) {
7453                 return NULL;
7454         }
7455         state->out_mem_ctx = NULL;
7456         state->dispatch_recv = cli->dispatch_recv;
7457
7458         /* In parameters */
7459         state->orig.in.domain_handle = _domain_handle;
7460         state->orig.in.sid = _sid;
7461
7462         /* Out parameters */
7463
7464         /* Result */
7465         ZERO_STRUCT(state->orig.out.result);
7466
7467         if (DEBUGLEVEL >= 10) {
7468                 NDR_PRINT_IN_DEBUG(samr_RemoveMemberFromForeignDomain, &state->orig);
7469         }
7470
7471         /* make a temporary copy, that we pass to the dispatch function */
7472         state->tmp = state->orig;
7473
7474         subreq = cli->dispatch_send(state, ev, cli,
7475                                     &ndr_table_samr,
7476                                     NDR_SAMR_REMOVEMEMBERFROMFOREIGNDOMAIN,
7477                                     &state->tmp);
7478         if (tevent_req_nomem(subreq, req)) {
7479                 return tevent_req_post(req, ev);
7480         }
7481         tevent_req_set_callback(subreq, rpccli_samr_RemoveMemberFromForeignDomain_done, req);
7482         return req;
7483 }
7484
7485 static void rpccli_samr_RemoveMemberFromForeignDomain_done(struct tevent_req *subreq)
7486 {
7487         struct tevent_req *req = tevent_req_callback_data(
7488                 subreq, struct tevent_req);
7489         struct rpccli_samr_RemoveMemberFromForeignDomain_state *state = tevent_req_data(
7490                 req, struct rpccli_samr_RemoveMemberFromForeignDomain_state);
7491         NTSTATUS status;
7492         TALLOC_CTX *mem_ctx;
7493
7494         if (state->out_mem_ctx) {
7495                 mem_ctx = state->out_mem_ctx;
7496         } else {
7497                 mem_ctx = state;
7498         }
7499
7500         status = state->dispatch_recv(subreq, mem_ctx);
7501         TALLOC_FREE(subreq);
7502         if (!NT_STATUS_IS_OK(status)) {
7503                 tevent_req_nterror(req, status);
7504                 return;
7505         }
7506
7507         /* Copy out parameters */
7508
7509         /* Copy result */
7510         state->orig.out.result = state->tmp.out.result;
7511
7512         /* Reset temporary structure */
7513         ZERO_STRUCT(state->tmp);
7514
7515         if (DEBUGLEVEL >= 10) {
7516                 NDR_PRINT_OUT_DEBUG(samr_RemoveMemberFromForeignDomain, &state->orig);
7517         }
7518
7519         tevent_req_done(req);
7520 }
7521
7522 NTSTATUS rpccli_samr_RemoveMemberFromForeignDomain_recv(struct tevent_req *req,
7523                                                         TALLOC_CTX *mem_ctx,
7524                                                         NTSTATUS *result)
7525 {
7526         struct rpccli_samr_RemoveMemberFromForeignDomain_state *state = tevent_req_data(
7527                 req, struct rpccli_samr_RemoveMemberFromForeignDomain_state);
7528         NTSTATUS status;
7529
7530         if (tevent_req_is_nterror(req, &status)) {
7531                 tevent_req_received(req);
7532                 return status;
7533         }
7534
7535         /* Steal possbile out parameters to the callers context */
7536         talloc_steal(mem_ctx, state->out_mem_ctx);
7537
7538         /* Return result */
7539         *result = state->orig.out.result;
7540
7541         tevent_req_received(req);
7542         return NT_STATUS_OK;
7543 }
7544
7545 NTSTATUS rpccli_samr_RemoveMemberFromForeignDomain(struct rpc_pipe_client *cli,
7546                                                    TALLOC_CTX *mem_ctx,
7547                                                    struct policy_handle *domain_handle /* [in] [ref] */,
7548                                                    struct dom_sid2 *sid /* [in] [ref] */)
7549 {
7550         struct samr_RemoveMemberFromForeignDomain r;
7551         NTSTATUS status;
7552
7553         /* In parameters */
7554         r.in.domain_handle = domain_handle;
7555         r.in.sid = sid;
7556
7557         if (DEBUGLEVEL >= 10) {
7558                 NDR_PRINT_IN_DEBUG(samr_RemoveMemberFromForeignDomain, &r);
7559         }
7560
7561         status = cli->dispatch(cli,
7562                                 mem_ctx,
7563                                 &ndr_table_samr,
7564                                 NDR_SAMR_REMOVEMEMBERFROMFOREIGNDOMAIN,
7565                                 &r);
7566
7567         if (!NT_STATUS_IS_OK(status)) {
7568                 return status;
7569         }
7570
7571         if (DEBUGLEVEL >= 10) {
7572                 NDR_PRINT_OUT_DEBUG(samr_RemoveMemberFromForeignDomain, &r);
7573         }
7574
7575         if (NT_STATUS_IS_ERR(status)) {
7576                 return status;
7577         }
7578
7579         /* Return variables */
7580
7581         /* Return result */
7582         return r.out.result;
7583 }
7584
7585 struct rpccli_samr_QueryDomainInfo2_state {
7586         struct samr_QueryDomainInfo2 orig;
7587         struct samr_QueryDomainInfo2 tmp;
7588         TALLOC_CTX *out_mem_ctx;
7589         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7590 };
7591
7592 static void rpccli_samr_QueryDomainInfo2_done(struct tevent_req *subreq);
7593
7594 struct tevent_req *rpccli_samr_QueryDomainInfo2_send(TALLOC_CTX *mem_ctx,
7595                                                      struct tevent_context *ev,
7596                                                      struct rpc_pipe_client *cli,
7597                                                      struct policy_handle *_domain_handle /* [in] [ref] */,
7598                                                      enum samr_DomainInfoClass _level /* [in]  */,
7599                                                      union samr_DomainInfo **_info /* [out] [ref,switch_is(level)] */)
7600 {
7601         struct tevent_req *req;
7602         struct rpccli_samr_QueryDomainInfo2_state *state;
7603         struct tevent_req *subreq;
7604
7605         req = tevent_req_create(mem_ctx, &state,
7606                                 struct rpccli_samr_QueryDomainInfo2_state);
7607         if (req == NULL) {
7608                 return NULL;
7609         }
7610         state->out_mem_ctx = NULL;
7611         state->dispatch_recv = cli->dispatch_recv;
7612
7613         /* In parameters */
7614         state->orig.in.domain_handle = _domain_handle;
7615         state->orig.in.level = _level;
7616
7617         /* Out parameters */
7618         state->orig.out.info = _info;
7619
7620         /* Result */
7621         ZERO_STRUCT(state->orig.out.result);
7622
7623         if (DEBUGLEVEL >= 10) {
7624                 NDR_PRINT_IN_DEBUG(samr_QueryDomainInfo2, &state->orig);
7625         }
7626
7627         state->out_mem_ctx = talloc_named_const(state, 0,
7628                              "rpccli_samr_QueryDomainInfo2_out_memory");
7629         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7630                 return tevent_req_post(req, ev);
7631         }
7632
7633         /* make a temporary copy, that we pass to the dispatch function */
7634         state->tmp = state->orig;
7635
7636         subreq = cli->dispatch_send(state, ev, cli,
7637                                     &ndr_table_samr,
7638                                     NDR_SAMR_QUERYDOMAININFO2,
7639                                     &state->tmp);
7640         if (tevent_req_nomem(subreq, req)) {
7641                 return tevent_req_post(req, ev);
7642         }
7643         tevent_req_set_callback(subreq, rpccli_samr_QueryDomainInfo2_done, req);
7644         return req;
7645 }
7646
7647 static void rpccli_samr_QueryDomainInfo2_done(struct tevent_req *subreq)
7648 {
7649         struct tevent_req *req = tevent_req_callback_data(
7650                 subreq, struct tevent_req);
7651         struct rpccli_samr_QueryDomainInfo2_state *state = tevent_req_data(
7652                 req, struct rpccli_samr_QueryDomainInfo2_state);
7653         NTSTATUS status;
7654         TALLOC_CTX *mem_ctx;
7655
7656         if (state->out_mem_ctx) {
7657                 mem_ctx = state->out_mem_ctx;
7658         } else {
7659                 mem_ctx = state;
7660         }
7661
7662         status = state->dispatch_recv(subreq, mem_ctx);
7663         TALLOC_FREE(subreq);
7664         if (!NT_STATUS_IS_OK(status)) {
7665                 tevent_req_nterror(req, status);
7666                 return;
7667         }
7668
7669         /* Copy out parameters */
7670         *state->orig.out.info = *state->tmp.out.info;
7671
7672         /* Copy result */
7673         state->orig.out.result = state->tmp.out.result;
7674
7675         /* Reset temporary structure */
7676         ZERO_STRUCT(state->tmp);
7677
7678         if (DEBUGLEVEL >= 10) {
7679                 NDR_PRINT_OUT_DEBUG(samr_QueryDomainInfo2, &state->orig);
7680         }
7681
7682         tevent_req_done(req);
7683 }
7684
7685 NTSTATUS rpccli_samr_QueryDomainInfo2_recv(struct tevent_req *req,
7686                                            TALLOC_CTX *mem_ctx,
7687                                            NTSTATUS *result)
7688 {
7689         struct rpccli_samr_QueryDomainInfo2_state *state = tevent_req_data(
7690                 req, struct rpccli_samr_QueryDomainInfo2_state);
7691         NTSTATUS status;
7692
7693         if (tevent_req_is_nterror(req, &status)) {
7694                 tevent_req_received(req);
7695                 return status;
7696         }
7697
7698         /* Steal possbile out parameters to the callers context */
7699         talloc_steal(mem_ctx, state->out_mem_ctx);
7700
7701         /* Return result */
7702         *result = state->orig.out.result;
7703
7704         tevent_req_received(req);
7705         return NT_STATUS_OK;
7706 }
7707
7708 NTSTATUS rpccli_samr_QueryDomainInfo2(struct rpc_pipe_client *cli,
7709                                       TALLOC_CTX *mem_ctx,
7710                                       struct policy_handle *domain_handle /* [in] [ref] */,
7711                                       enum samr_DomainInfoClass level /* [in]  */,
7712                                       union samr_DomainInfo **info /* [out] [ref,switch_is(level)] */)
7713 {
7714         struct samr_QueryDomainInfo2 r;
7715         NTSTATUS status;
7716
7717         /* In parameters */
7718         r.in.domain_handle = domain_handle;
7719         r.in.level = level;
7720
7721         if (DEBUGLEVEL >= 10) {
7722                 NDR_PRINT_IN_DEBUG(samr_QueryDomainInfo2, &r);
7723         }
7724
7725         status = cli->dispatch(cli,
7726                                 mem_ctx,
7727                                 &ndr_table_samr,
7728                                 NDR_SAMR_QUERYDOMAININFO2,
7729                                 &r);
7730
7731         if (!NT_STATUS_IS_OK(status)) {
7732                 return status;
7733         }
7734
7735         if (DEBUGLEVEL >= 10) {
7736                 NDR_PRINT_OUT_DEBUG(samr_QueryDomainInfo2, &r);
7737         }
7738
7739         if (NT_STATUS_IS_ERR(status)) {
7740                 return status;
7741         }
7742
7743         /* Return variables */
7744         *info = *r.out.info;
7745
7746         /* Return result */
7747         return r.out.result;
7748 }
7749
7750 struct rpccli_samr_QueryUserInfo2_state {
7751         struct samr_QueryUserInfo2 orig;
7752         struct samr_QueryUserInfo2 tmp;
7753         TALLOC_CTX *out_mem_ctx;
7754         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7755 };
7756
7757 static void rpccli_samr_QueryUserInfo2_done(struct tevent_req *subreq);
7758
7759 struct tevent_req *rpccli_samr_QueryUserInfo2_send(TALLOC_CTX *mem_ctx,
7760                                                    struct tevent_context *ev,
7761                                                    struct rpc_pipe_client *cli,
7762                                                    struct policy_handle *_user_handle /* [in] [ref] */,
7763                                                    enum samr_UserInfoLevel _level /* [in]  */,
7764                                                    union samr_UserInfo **_info /* [out] [ref,switch_is(level)] */)
7765 {
7766         struct tevent_req *req;
7767         struct rpccli_samr_QueryUserInfo2_state *state;
7768         struct tevent_req *subreq;
7769
7770         req = tevent_req_create(mem_ctx, &state,
7771                                 struct rpccli_samr_QueryUserInfo2_state);
7772         if (req == NULL) {
7773                 return NULL;
7774         }
7775         state->out_mem_ctx = NULL;
7776         state->dispatch_recv = cli->dispatch_recv;
7777
7778         /* In parameters */
7779         state->orig.in.user_handle = _user_handle;
7780         state->orig.in.level = _level;
7781
7782         /* Out parameters */
7783         state->orig.out.info = _info;
7784
7785         /* Result */
7786         ZERO_STRUCT(state->orig.out.result);
7787
7788         if (DEBUGLEVEL >= 10) {
7789                 NDR_PRINT_IN_DEBUG(samr_QueryUserInfo2, &state->orig);
7790         }
7791
7792         state->out_mem_ctx = talloc_named_const(state, 0,
7793                              "rpccli_samr_QueryUserInfo2_out_memory");
7794         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7795                 return tevent_req_post(req, ev);
7796         }
7797
7798         /* make a temporary copy, that we pass to the dispatch function */
7799         state->tmp = state->orig;
7800
7801         subreq = cli->dispatch_send(state, ev, cli,
7802                                     &ndr_table_samr,
7803                                     NDR_SAMR_QUERYUSERINFO2,
7804                                     &state->tmp);
7805         if (tevent_req_nomem(subreq, req)) {
7806                 return tevent_req_post(req, ev);
7807         }
7808         tevent_req_set_callback(subreq, rpccli_samr_QueryUserInfo2_done, req);
7809         return req;
7810 }
7811
7812 static void rpccli_samr_QueryUserInfo2_done(struct tevent_req *subreq)
7813 {
7814         struct tevent_req *req = tevent_req_callback_data(
7815                 subreq, struct tevent_req);
7816         struct rpccli_samr_QueryUserInfo2_state *state = tevent_req_data(
7817                 req, struct rpccli_samr_QueryUserInfo2_state);
7818         NTSTATUS status;
7819         TALLOC_CTX *mem_ctx;
7820
7821         if (state->out_mem_ctx) {
7822                 mem_ctx = state->out_mem_ctx;
7823         } else {
7824                 mem_ctx = state;
7825         }
7826
7827         status = state->dispatch_recv(subreq, mem_ctx);
7828         TALLOC_FREE(subreq);
7829         if (!NT_STATUS_IS_OK(status)) {
7830                 tevent_req_nterror(req, status);
7831                 return;
7832         }
7833
7834         /* Copy out parameters */
7835         *state->orig.out.info = *state->tmp.out.info;
7836
7837         /* Copy result */
7838         state->orig.out.result = state->tmp.out.result;
7839
7840         /* Reset temporary structure */
7841         ZERO_STRUCT(state->tmp);
7842
7843         if (DEBUGLEVEL >= 10) {
7844                 NDR_PRINT_OUT_DEBUG(samr_QueryUserInfo2, &state->orig);
7845         }
7846
7847         tevent_req_done(req);
7848 }
7849
7850 NTSTATUS rpccli_samr_QueryUserInfo2_recv(struct tevent_req *req,
7851                                          TALLOC_CTX *mem_ctx,
7852                                          NTSTATUS *result)
7853 {
7854         struct rpccli_samr_QueryUserInfo2_state *state = tevent_req_data(
7855                 req, struct rpccli_samr_QueryUserInfo2_state);
7856         NTSTATUS status;
7857
7858         if (tevent_req_is_nterror(req, &status)) {
7859                 tevent_req_received(req);
7860                 return status;
7861         }
7862
7863         /* Steal possbile out parameters to the callers context */
7864         talloc_steal(mem_ctx, state->out_mem_ctx);
7865
7866         /* Return result */
7867         *result = state->orig.out.result;
7868
7869         tevent_req_received(req);
7870         return NT_STATUS_OK;
7871 }
7872
7873 NTSTATUS rpccli_samr_QueryUserInfo2(struct rpc_pipe_client *cli,
7874                                     TALLOC_CTX *mem_ctx,
7875                                     struct policy_handle *user_handle /* [in] [ref] */,
7876                                     enum samr_UserInfoLevel level /* [in]  */,
7877                                     union samr_UserInfo **info /* [out] [ref,switch_is(level)] */)
7878 {
7879         struct samr_QueryUserInfo2 r;
7880         NTSTATUS status;
7881
7882         /* In parameters */
7883         r.in.user_handle = user_handle;
7884         r.in.level = level;
7885
7886         if (DEBUGLEVEL >= 10) {
7887                 NDR_PRINT_IN_DEBUG(samr_QueryUserInfo2, &r);
7888         }
7889
7890         status = cli->dispatch(cli,
7891                                 mem_ctx,
7892                                 &ndr_table_samr,
7893                                 NDR_SAMR_QUERYUSERINFO2,
7894                                 &r);
7895
7896         if (!NT_STATUS_IS_OK(status)) {
7897                 return status;
7898         }
7899
7900         if (DEBUGLEVEL >= 10) {
7901                 NDR_PRINT_OUT_DEBUG(samr_QueryUserInfo2, &r);
7902         }
7903
7904         if (NT_STATUS_IS_ERR(status)) {
7905                 return status;
7906         }
7907
7908         /* Return variables */
7909         *info = *r.out.info;
7910
7911         /* Return result */
7912         return r.out.result;
7913 }
7914
7915 struct rpccli_samr_QueryDisplayInfo2_state {
7916         struct samr_QueryDisplayInfo2 orig;
7917         struct samr_QueryDisplayInfo2 tmp;
7918         TALLOC_CTX *out_mem_ctx;
7919         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7920 };
7921
7922 static void rpccli_samr_QueryDisplayInfo2_done(struct tevent_req *subreq);
7923
7924 struct tevent_req *rpccli_samr_QueryDisplayInfo2_send(TALLOC_CTX *mem_ctx,
7925                                                       struct tevent_context *ev,
7926                                                       struct rpc_pipe_client *cli,
7927                                                       struct policy_handle *_domain_handle /* [in] [ref] */,
7928                                                       uint16_t _level /* [in]  */,
7929                                                       uint32_t _start_idx /* [in]  */,
7930                                                       uint32_t _max_entries /* [in]  */,
7931                                                       uint32_t _buf_size /* [in]  */,
7932                                                       uint32_t *_total_size /* [out] [ref] */,
7933                                                       uint32_t *_returned_size /* [out] [ref] */,
7934                                                       union samr_DispInfo *_info /* [out] [ref,switch_is(level)] */)
7935 {
7936         struct tevent_req *req;
7937         struct rpccli_samr_QueryDisplayInfo2_state *state;
7938         struct tevent_req *subreq;
7939
7940         req = tevent_req_create(mem_ctx, &state,
7941                                 struct rpccli_samr_QueryDisplayInfo2_state);
7942         if (req == NULL) {
7943                 return NULL;
7944         }
7945         state->out_mem_ctx = NULL;
7946         state->dispatch_recv = cli->dispatch_recv;
7947
7948         /* In parameters */
7949         state->orig.in.domain_handle = _domain_handle;
7950         state->orig.in.level = _level;
7951         state->orig.in.start_idx = _start_idx;
7952         state->orig.in.max_entries = _max_entries;
7953         state->orig.in.buf_size = _buf_size;
7954
7955         /* Out parameters */
7956         state->orig.out.total_size = _total_size;
7957         state->orig.out.returned_size = _returned_size;
7958         state->orig.out.info = _info;
7959
7960         /* Result */
7961         ZERO_STRUCT(state->orig.out.result);
7962
7963         if (DEBUGLEVEL >= 10) {
7964                 NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo2, &state->orig);
7965         }
7966
7967         state->out_mem_ctx = talloc_named_const(state, 0,
7968                              "rpccli_samr_QueryDisplayInfo2_out_memory");
7969         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7970                 return tevent_req_post(req, ev);
7971         }
7972
7973         /* make a temporary copy, that we pass to the dispatch function */
7974         state->tmp = state->orig;
7975
7976         subreq = cli->dispatch_send(state, ev, cli,
7977                                     &ndr_table_samr,
7978                                     NDR_SAMR_QUERYDISPLAYINFO2,
7979                                     &state->tmp);
7980         if (tevent_req_nomem(subreq, req)) {
7981                 return tevent_req_post(req, ev);
7982         }
7983         tevent_req_set_callback(subreq, rpccli_samr_QueryDisplayInfo2_done, req);
7984         return req;
7985 }
7986
7987 static void rpccli_samr_QueryDisplayInfo2_done(struct tevent_req *subreq)
7988 {
7989         struct tevent_req *req = tevent_req_callback_data(
7990                 subreq, struct tevent_req);
7991         struct rpccli_samr_QueryDisplayInfo2_state *state = tevent_req_data(
7992                 req, struct rpccli_samr_QueryDisplayInfo2_state);
7993         NTSTATUS status;
7994         TALLOC_CTX *mem_ctx;
7995
7996         if (state->out_mem_ctx) {
7997                 mem_ctx = state->out_mem_ctx;
7998         } else {
7999                 mem_ctx = state;
8000         }
8001
8002         status = state->dispatch_recv(subreq, mem_ctx);
8003         TALLOC_FREE(subreq);
8004         if (!NT_STATUS_IS_OK(status)) {
8005                 tevent_req_nterror(req, status);
8006                 return;
8007         }
8008
8009         /* Copy out parameters */
8010         *state->orig.out.total_size = *state->tmp.out.total_size;
8011         *state->orig.out.returned_size = *state->tmp.out.returned_size;
8012         *state->orig.out.info = *state->tmp.out.info;
8013
8014         /* Copy result */
8015         state->orig.out.result = state->tmp.out.result;
8016
8017         /* Reset temporary structure */
8018         ZERO_STRUCT(state->tmp);
8019
8020         if (DEBUGLEVEL >= 10) {
8021                 NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo2, &state->orig);
8022         }
8023
8024         tevent_req_done(req);
8025 }
8026
8027 NTSTATUS rpccli_samr_QueryDisplayInfo2_recv(struct tevent_req *req,
8028                                             TALLOC_CTX *mem_ctx,
8029                                             NTSTATUS *result)
8030 {
8031         struct rpccli_samr_QueryDisplayInfo2_state *state = tevent_req_data(
8032                 req, struct rpccli_samr_QueryDisplayInfo2_state);
8033         NTSTATUS status;
8034
8035         if (tevent_req_is_nterror(req, &status)) {
8036                 tevent_req_received(req);
8037                 return status;
8038         }
8039
8040         /* Steal possbile out parameters to the callers context */
8041         talloc_steal(mem_ctx, state->out_mem_ctx);
8042
8043         /* Return result */
8044         *result = state->orig.out.result;
8045
8046         tevent_req_received(req);
8047         return NT_STATUS_OK;
8048 }
8049
8050 NTSTATUS rpccli_samr_QueryDisplayInfo2(struct rpc_pipe_client *cli,
8051                                        TALLOC_CTX *mem_ctx,
8052                                        struct policy_handle *domain_handle /* [in] [ref] */,
8053                                        uint16_t level /* [in]  */,
8054                                        uint32_t start_idx /* [in]  */,
8055                                        uint32_t max_entries /* [in]  */,
8056                                        uint32_t buf_size /* [in]  */,
8057                                        uint32_t *total_size /* [out] [ref] */,
8058                                        uint32_t *returned_size /* [out] [ref] */,
8059                                        union samr_DispInfo *info /* [out] [ref,switch_is(level)] */)
8060 {
8061         struct samr_QueryDisplayInfo2 r;
8062         NTSTATUS status;
8063
8064         /* In parameters */
8065         r.in.domain_handle = domain_handle;
8066         r.in.level = level;
8067         r.in.start_idx = start_idx;
8068         r.in.max_entries = max_entries;
8069         r.in.buf_size = buf_size;
8070
8071         if (DEBUGLEVEL >= 10) {
8072                 NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo2, &r);
8073         }
8074
8075         status = cli->dispatch(cli,
8076                                 mem_ctx,
8077                                 &ndr_table_samr,
8078                                 NDR_SAMR_QUERYDISPLAYINFO2,
8079                                 &r);
8080
8081         if (!NT_STATUS_IS_OK(status)) {
8082                 return status;
8083         }
8084
8085         if (DEBUGLEVEL >= 10) {
8086                 NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo2, &r);
8087         }
8088
8089         if (NT_STATUS_IS_ERR(status)) {
8090                 return status;
8091         }
8092
8093         /* Return variables */
8094         *total_size = *r.out.total_size;
8095         *returned_size = *r.out.returned_size;
8096         *info = *r.out.info;
8097
8098         /* Return result */
8099         return r.out.result;
8100 }
8101
8102 struct rpccli_samr_GetDisplayEnumerationIndex2_state {
8103         struct samr_GetDisplayEnumerationIndex2 orig;
8104         struct samr_GetDisplayEnumerationIndex2 tmp;
8105         TALLOC_CTX *out_mem_ctx;
8106         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8107 };
8108
8109 static void rpccli_samr_GetDisplayEnumerationIndex2_done(struct tevent_req *subreq);
8110
8111 struct tevent_req *rpccli_samr_GetDisplayEnumerationIndex2_send(TALLOC_CTX *mem_ctx,
8112                                                                 struct tevent_context *ev,
8113                                                                 struct rpc_pipe_client *cli,
8114                                                                 struct policy_handle *_domain_handle /* [in] [ref] */,
8115                                                                 uint16_t _level /* [in]  */,
8116                                                                 struct lsa_String *_name /* [in] [ref] */,
8117                                                                 uint32_t *_idx /* [out] [ref] */)
8118 {
8119         struct tevent_req *req;
8120         struct rpccli_samr_GetDisplayEnumerationIndex2_state *state;
8121         struct tevent_req *subreq;
8122
8123         req = tevent_req_create(mem_ctx, &state,
8124                                 struct rpccli_samr_GetDisplayEnumerationIndex2_state);
8125         if (req == NULL) {
8126                 return NULL;
8127         }
8128         state->out_mem_ctx = NULL;
8129         state->dispatch_recv = cli->dispatch_recv;
8130
8131         /* In parameters */
8132         state->orig.in.domain_handle = _domain_handle;
8133         state->orig.in.level = _level;
8134         state->orig.in.name = _name;
8135
8136         /* Out parameters */
8137         state->orig.out.idx = _idx;
8138
8139         /* Result */
8140         ZERO_STRUCT(state->orig.out.result);
8141
8142         if (DEBUGLEVEL >= 10) {
8143                 NDR_PRINT_IN_DEBUG(samr_GetDisplayEnumerationIndex2, &state->orig);
8144         }
8145
8146         state->out_mem_ctx = talloc_named_const(state, 0,
8147                              "rpccli_samr_GetDisplayEnumerationIndex2_out_memory");
8148         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8149                 return tevent_req_post(req, ev);
8150         }
8151
8152         /* make a temporary copy, that we pass to the dispatch function */
8153         state->tmp = state->orig;
8154
8155         subreq = cli->dispatch_send(state, ev, cli,
8156                                     &ndr_table_samr,
8157                                     NDR_SAMR_GETDISPLAYENUMERATIONINDEX2,
8158                                     &state->tmp);
8159         if (tevent_req_nomem(subreq, req)) {
8160                 return tevent_req_post(req, ev);
8161         }
8162         tevent_req_set_callback(subreq, rpccli_samr_GetDisplayEnumerationIndex2_done, req);
8163         return req;
8164 }
8165
8166 static void rpccli_samr_GetDisplayEnumerationIndex2_done(struct tevent_req *subreq)
8167 {
8168         struct tevent_req *req = tevent_req_callback_data(
8169                 subreq, struct tevent_req);
8170         struct rpccli_samr_GetDisplayEnumerationIndex2_state *state = tevent_req_data(
8171                 req, struct rpccli_samr_GetDisplayEnumerationIndex2_state);
8172         NTSTATUS status;
8173         TALLOC_CTX *mem_ctx;
8174
8175         if (state->out_mem_ctx) {
8176                 mem_ctx = state->out_mem_ctx;
8177         } else {
8178                 mem_ctx = state;
8179         }
8180
8181         status = state->dispatch_recv(subreq, mem_ctx);
8182         TALLOC_FREE(subreq);
8183         if (!NT_STATUS_IS_OK(status)) {
8184                 tevent_req_nterror(req, status);
8185                 return;
8186         }
8187
8188         /* Copy out parameters */
8189         *state->orig.out.idx = *state->tmp.out.idx;
8190
8191         /* Copy result */
8192         state->orig.out.result = state->tmp.out.result;
8193
8194         /* Reset temporary structure */
8195         ZERO_STRUCT(state->tmp);
8196
8197         if (DEBUGLEVEL >= 10) {
8198                 NDR_PRINT_OUT_DEBUG(samr_GetDisplayEnumerationIndex2, &state->orig);
8199         }
8200
8201         tevent_req_done(req);
8202 }
8203
8204 NTSTATUS rpccli_samr_GetDisplayEnumerationIndex2_recv(struct tevent_req *req,
8205                                                       TALLOC_CTX *mem_ctx,
8206                                                       NTSTATUS *result)
8207 {
8208         struct rpccli_samr_GetDisplayEnumerationIndex2_state *state = tevent_req_data(
8209                 req, struct rpccli_samr_GetDisplayEnumerationIndex2_state);
8210         NTSTATUS status;
8211
8212         if (tevent_req_is_nterror(req, &status)) {
8213                 tevent_req_received(req);
8214                 return status;
8215         }
8216
8217         /* Steal possbile out parameters to the callers context */
8218         talloc_steal(mem_ctx, state->out_mem_ctx);
8219
8220         /* Return result */
8221         *result = state->orig.out.result;
8222
8223         tevent_req_received(req);
8224         return NT_STATUS_OK;
8225 }
8226
8227 NTSTATUS rpccli_samr_GetDisplayEnumerationIndex2(struct rpc_pipe_client *cli,
8228                                                  TALLOC_CTX *mem_ctx,
8229                                                  struct policy_handle *domain_handle /* [in] [ref] */,
8230                                                  uint16_t level /* [in]  */,
8231                                                  struct lsa_String *name /* [in] [ref] */,
8232                                                  uint32_t *idx /* [out] [ref] */)
8233 {
8234         struct samr_GetDisplayEnumerationIndex2 r;
8235         NTSTATUS status;
8236
8237         /* In parameters */
8238         r.in.domain_handle = domain_handle;
8239         r.in.level = level;
8240         r.in.name = name;
8241
8242         if (DEBUGLEVEL >= 10) {
8243                 NDR_PRINT_IN_DEBUG(samr_GetDisplayEnumerationIndex2, &r);
8244         }
8245
8246         status = cli->dispatch(cli,
8247                                 mem_ctx,
8248                                 &ndr_table_samr,
8249                                 NDR_SAMR_GETDISPLAYENUMERATIONINDEX2,
8250                                 &r);
8251
8252         if (!NT_STATUS_IS_OK(status)) {
8253                 return status;
8254         }
8255
8256         if (DEBUGLEVEL >= 10) {
8257                 NDR_PRINT_OUT_DEBUG(samr_GetDisplayEnumerationIndex2, &r);
8258         }
8259
8260         if (NT_STATUS_IS_ERR(status)) {
8261                 return status;
8262         }
8263
8264         /* Return variables */
8265         *idx = *r.out.idx;
8266
8267         /* Return result */
8268         return r.out.result;
8269 }
8270
8271 struct rpccli_samr_CreateUser2_state {
8272         struct samr_CreateUser2 orig;
8273         struct samr_CreateUser2 tmp;
8274         TALLOC_CTX *out_mem_ctx;
8275         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8276 };
8277
8278 static void rpccli_samr_CreateUser2_done(struct tevent_req *subreq);
8279
8280 struct tevent_req *rpccli_samr_CreateUser2_send(TALLOC_CTX *mem_ctx,
8281                                                 struct tevent_context *ev,
8282                                                 struct rpc_pipe_client *cli,
8283                                                 struct policy_handle *_domain_handle /* [in] [ref] */,
8284                                                 struct lsa_String *_account_name /* [in] [ref] */,
8285                                                 uint32_t _acct_flags /* [in]  */,
8286                                                 uint32_t _access_mask /* [in]  */,
8287                                                 struct policy_handle *_user_handle /* [out] [ref] */,
8288                                                 uint32_t *_access_granted /* [out] [ref] */,
8289                                                 uint32_t *_rid /* [out] [ref] */)
8290 {
8291         struct tevent_req *req;
8292         struct rpccli_samr_CreateUser2_state *state;
8293         struct tevent_req *subreq;
8294
8295         req = tevent_req_create(mem_ctx, &state,
8296                                 struct rpccli_samr_CreateUser2_state);
8297         if (req == NULL) {
8298                 return NULL;
8299         }
8300         state->out_mem_ctx = NULL;
8301         state->dispatch_recv = cli->dispatch_recv;
8302
8303         /* In parameters */
8304         state->orig.in.domain_handle = _domain_handle;
8305         state->orig.in.account_name = _account_name;
8306         state->orig.in.acct_flags = _acct_flags;
8307         state->orig.in.access_mask = _access_mask;
8308
8309         /* Out parameters */
8310         state->orig.out.user_handle = _user_handle;
8311         state->orig.out.access_granted = _access_granted;
8312         state->orig.out.rid = _rid;
8313
8314         /* Result */
8315         ZERO_STRUCT(state->orig.out.result);
8316
8317         if (DEBUGLEVEL >= 10) {
8318                 NDR_PRINT_IN_DEBUG(samr_CreateUser2, &state->orig);
8319         }
8320
8321         state->out_mem_ctx = talloc_named_const(state, 0,
8322                              "rpccli_samr_CreateUser2_out_memory");
8323         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8324                 return tevent_req_post(req, ev);
8325         }
8326
8327         /* make a temporary copy, that we pass to the dispatch function */
8328         state->tmp = state->orig;
8329
8330         subreq = cli->dispatch_send(state, ev, cli,
8331                                     &ndr_table_samr,
8332                                     NDR_SAMR_CREATEUSER2,
8333                                     &state->tmp);
8334         if (tevent_req_nomem(subreq, req)) {
8335                 return tevent_req_post(req, ev);
8336         }
8337         tevent_req_set_callback(subreq, rpccli_samr_CreateUser2_done, req);
8338         return req;
8339 }
8340
8341 static void rpccli_samr_CreateUser2_done(struct tevent_req *subreq)
8342 {
8343         struct tevent_req *req = tevent_req_callback_data(
8344                 subreq, struct tevent_req);
8345         struct rpccli_samr_CreateUser2_state *state = tevent_req_data(
8346                 req, struct rpccli_samr_CreateUser2_state);
8347         NTSTATUS status;
8348         TALLOC_CTX *mem_ctx;
8349
8350         if (state->out_mem_ctx) {
8351                 mem_ctx = state->out_mem_ctx;
8352         } else {
8353                 mem_ctx = state;
8354         }
8355
8356         status = state->dispatch_recv(subreq, mem_ctx);
8357         TALLOC_FREE(subreq);
8358         if (!NT_STATUS_IS_OK(status)) {
8359                 tevent_req_nterror(req, status);
8360                 return;
8361         }
8362
8363         /* Copy out parameters */
8364         *state->orig.out.user_handle = *state->tmp.out.user_handle;
8365         *state->orig.out.access_granted = *state->tmp.out.access_granted;
8366         *state->orig.out.rid = *state->tmp.out.rid;
8367
8368         /* Copy result */
8369         state->orig.out.result = state->tmp.out.result;
8370
8371         /* Reset temporary structure */
8372         ZERO_STRUCT(state->tmp);
8373
8374         if (DEBUGLEVEL >= 10) {
8375                 NDR_PRINT_OUT_DEBUG(samr_CreateUser2, &state->orig);
8376         }
8377
8378         tevent_req_done(req);
8379 }
8380
8381 NTSTATUS rpccli_samr_CreateUser2_recv(struct tevent_req *req,
8382                                       TALLOC_CTX *mem_ctx,
8383                                       NTSTATUS *result)
8384 {
8385         struct rpccli_samr_CreateUser2_state *state = tevent_req_data(
8386                 req, struct rpccli_samr_CreateUser2_state);
8387         NTSTATUS status;
8388
8389         if (tevent_req_is_nterror(req, &status)) {
8390                 tevent_req_received(req);
8391                 return status;
8392         }
8393
8394         /* Steal possbile out parameters to the callers context */
8395         talloc_steal(mem_ctx, state->out_mem_ctx);
8396
8397         /* Return result */
8398         *result = state->orig.out.result;
8399
8400         tevent_req_received(req);
8401         return NT_STATUS_OK;
8402 }
8403
8404 NTSTATUS rpccli_samr_CreateUser2(struct rpc_pipe_client *cli,
8405                                  TALLOC_CTX *mem_ctx,
8406                                  struct policy_handle *domain_handle /* [in] [ref] */,
8407                                  struct lsa_String *account_name /* [in] [ref] */,
8408                                  uint32_t acct_flags /* [in]  */,
8409                                  uint32_t access_mask /* [in]  */,
8410                                  struct policy_handle *user_handle /* [out] [ref] */,
8411                                  uint32_t *access_granted /* [out] [ref] */,
8412                                  uint32_t *rid /* [out] [ref] */)
8413 {
8414         struct samr_CreateUser2 r;
8415         NTSTATUS status;
8416
8417         /* In parameters */
8418         r.in.domain_handle = domain_handle;
8419         r.in.account_name = account_name;
8420         r.in.acct_flags = acct_flags;
8421         r.in.access_mask = access_mask;
8422
8423         if (DEBUGLEVEL >= 10) {
8424                 NDR_PRINT_IN_DEBUG(samr_CreateUser2, &r);
8425         }
8426
8427         status = cli->dispatch(cli,
8428                                 mem_ctx,
8429                                 &ndr_table_samr,
8430                                 NDR_SAMR_CREATEUSER2,
8431                                 &r);
8432
8433         if (!NT_STATUS_IS_OK(status)) {
8434                 return status;
8435         }
8436
8437         if (DEBUGLEVEL >= 10) {
8438                 NDR_PRINT_OUT_DEBUG(samr_CreateUser2, &r);
8439         }
8440
8441         if (NT_STATUS_IS_ERR(status)) {
8442                 return status;
8443         }
8444
8445         /* Return variables */
8446         *user_handle = *r.out.user_handle;
8447         *access_granted = *r.out.access_granted;
8448         *rid = *r.out.rid;
8449
8450         /* Return result */
8451         return r.out.result;
8452 }
8453
8454 struct rpccli_samr_QueryDisplayInfo3_state {
8455         struct samr_QueryDisplayInfo3 orig;
8456         struct samr_QueryDisplayInfo3 tmp;
8457         TALLOC_CTX *out_mem_ctx;
8458         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8459 };
8460
8461 static void rpccli_samr_QueryDisplayInfo3_done(struct tevent_req *subreq);
8462
8463 struct tevent_req *rpccli_samr_QueryDisplayInfo3_send(TALLOC_CTX *mem_ctx,
8464                                                       struct tevent_context *ev,
8465                                                       struct rpc_pipe_client *cli,
8466                                                       struct policy_handle *_domain_handle /* [in] [ref] */,
8467                                                       uint16_t _level /* [in]  */,
8468                                                       uint32_t _start_idx /* [in]  */,
8469                                                       uint32_t _max_entries /* [in]  */,
8470                                                       uint32_t _buf_size /* [in]  */,
8471                                                       uint32_t *_total_size /* [out] [ref] */,
8472                                                       uint32_t *_returned_size /* [out] [ref] */,
8473                                                       union samr_DispInfo *_info /* [out] [ref,switch_is(level)] */)
8474 {
8475         struct tevent_req *req;
8476         struct rpccli_samr_QueryDisplayInfo3_state *state;
8477         struct tevent_req *subreq;
8478
8479         req = tevent_req_create(mem_ctx, &state,
8480                                 struct rpccli_samr_QueryDisplayInfo3_state);
8481         if (req == NULL) {
8482                 return NULL;
8483         }
8484         state->out_mem_ctx = NULL;
8485         state->dispatch_recv = cli->dispatch_recv;
8486
8487         /* In parameters */
8488         state->orig.in.domain_handle = _domain_handle;
8489         state->orig.in.level = _level;
8490         state->orig.in.start_idx = _start_idx;
8491         state->orig.in.max_entries = _max_entries;
8492         state->orig.in.buf_size = _buf_size;
8493
8494         /* Out parameters */
8495         state->orig.out.total_size = _total_size;
8496         state->orig.out.returned_size = _returned_size;
8497         state->orig.out.info = _info;
8498
8499         /* Result */
8500         ZERO_STRUCT(state->orig.out.result);
8501
8502         if (DEBUGLEVEL >= 10) {
8503                 NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo3, &state->orig);
8504         }
8505
8506         state->out_mem_ctx = talloc_named_const(state, 0,
8507                              "rpccli_samr_QueryDisplayInfo3_out_memory");
8508         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8509                 return tevent_req_post(req, ev);
8510         }
8511
8512         /* make a temporary copy, that we pass to the dispatch function */
8513         state->tmp = state->orig;
8514
8515         subreq = cli->dispatch_send(state, ev, cli,
8516                                     &ndr_table_samr,
8517                                     NDR_SAMR_QUERYDISPLAYINFO3,
8518                                     &state->tmp);
8519         if (tevent_req_nomem(subreq, req)) {
8520                 return tevent_req_post(req, ev);
8521         }
8522         tevent_req_set_callback(subreq, rpccli_samr_QueryDisplayInfo3_done, req);
8523         return req;
8524 }
8525
8526 static void rpccli_samr_QueryDisplayInfo3_done(struct tevent_req *subreq)
8527 {
8528         struct tevent_req *req = tevent_req_callback_data(
8529                 subreq, struct tevent_req);
8530         struct rpccli_samr_QueryDisplayInfo3_state *state = tevent_req_data(
8531                 req, struct rpccli_samr_QueryDisplayInfo3_state);
8532         NTSTATUS status;
8533         TALLOC_CTX *mem_ctx;
8534
8535         if (state->out_mem_ctx) {
8536                 mem_ctx = state->out_mem_ctx;
8537         } else {
8538                 mem_ctx = state;
8539         }
8540
8541         status = state->dispatch_recv(subreq, mem_ctx);
8542         TALLOC_FREE(subreq);
8543         if (!NT_STATUS_IS_OK(status)) {
8544                 tevent_req_nterror(req, status);
8545                 return;
8546         }
8547
8548         /* Copy out parameters */
8549         *state->orig.out.total_size = *state->tmp.out.total_size;
8550         *state->orig.out.returned_size = *state->tmp.out.returned_size;
8551         *state->orig.out.info = *state->tmp.out.info;
8552
8553         /* Copy result */
8554         state->orig.out.result = state->tmp.out.result;
8555
8556         /* Reset temporary structure */
8557         ZERO_STRUCT(state->tmp);
8558
8559         if (DEBUGLEVEL >= 10) {
8560                 NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo3, &state->orig);
8561         }
8562
8563         tevent_req_done(req);
8564 }
8565
8566 NTSTATUS rpccli_samr_QueryDisplayInfo3_recv(struct tevent_req *req,
8567                                             TALLOC_CTX *mem_ctx,
8568                                             NTSTATUS *result)
8569 {
8570         struct rpccli_samr_QueryDisplayInfo3_state *state = tevent_req_data(
8571                 req, struct rpccli_samr_QueryDisplayInfo3_state);
8572         NTSTATUS status;
8573
8574         if (tevent_req_is_nterror(req, &status)) {
8575                 tevent_req_received(req);
8576                 return status;
8577         }
8578
8579         /* Steal possbile out parameters to the callers context */
8580         talloc_steal(mem_ctx, state->out_mem_ctx);
8581
8582         /* Return result */
8583         *result = state->orig.out.result;
8584
8585         tevent_req_received(req);
8586         return NT_STATUS_OK;
8587 }
8588
8589 NTSTATUS rpccli_samr_QueryDisplayInfo3(struct rpc_pipe_client *cli,
8590                                        TALLOC_CTX *mem_ctx,
8591                                        struct policy_handle *domain_handle /* [in] [ref] */,
8592                                        uint16_t level /* [in]  */,
8593                                        uint32_t start_idx /* [in]  */,
8594                                        uint32_t max_entries /* [in]  */,
8595                                        uint32_t buf_size /* [in]  */,
8596                                        uint32_t *total_size /* [out] [ref] */,
8597                                        uint32_t *returned_size /* [out] [ref] */,
8598                                        union samr_DispInfo *info /* [out] [ref,switch_is(level)] */)
8599 {
8600         struct samr_QueryDisplayInfo3 r;
8601         NTSTATUS status;
8602
8603         /* In parameters */
8604         r.in.domain_handle = domain_handle;
8605         r.in.level = level;
8606         r.in.start_idx = start_idx;
8607         r.in.max_entries = max_entries;
8608         r.in.buf_size = buf_size;
8609
8610         if (DEBUGLEVEL >= 10) {
8611                 NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo3, &r);
8612         }
8613
8614         status = cli->dispatch(cli,
8615                                 mem_ctx,
8616                                 &ndr_table_samr,
8617                                 NDR_SAMR_QUERYDISPLAYINFO3,
8618                                 &r);
8619
8620         if (!NT_STATUS_IS_OK(status)) {
8621                 return status;
8622         }
8623
8624         if (DEBUGLEVEL >= 10) {
8625                 NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo3, &r);
8626         }
8627
8628         if (NT_STATUS_IS_ERR(status)) {
8629                 return status;
8630         }
8631
8632         /* Return variables */
8633         *total_size = *r.out.total_size;
8634         *returned_size = *r.out.returned_size;
8635         *info = *r.out.info;
8636
8637         /* Return result */
8638         return r.out.result;
8639 }
8640
8641 struct rpccli_samr_AddMultipleMembersToAlias_state {
8642         struct samr_AddMultipleMembersToAlias orig;
8643         struct samr_AddMultipleMembersToAlias tmp;
8644         TALLOC_CTX *out_mem_ctx;
8645         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8646 };
8647
8648 static void rpccli_samr_AddMultipleMembersToAlias_done(struct tevent_req *subreq);
8649
8650 struct tevent_req *rpccli_samr_AddMultipleMembersToAlias_send(TALLOC_CTX *mem_ctx,
8651                                                               struct tevent_context *ev,
8652                                                               struct rpc_pipe_client *cli,
8653                                                               struct policy_handle *_alias_handle /* [in] [ref] */,
8654                                                               struct lsa_SidArray *_sids /* [in] [ref] */)
8655 {
8656         struct tevent_req *req;
8657         struct rpccli_samr_AddMultipleMembersToAlias_state *state;
8658         struct tevent_req *subreq;
8659
8660         req = tevent_req_create(mem_ctx, &state,
8661                                 struct rpccli_samr_AddMultipleMembersToAlias_state);
8662         if (req == NULL) {
8663                 return NULL;
8664         }
8665         state->out_mem_ctx = NULL;
8666         state->dispatch_recv = cli->dispatch_recv;
8667
8668         /* In parameters */
8669         state->orig.in.alias_handle = _alias_handle;
8670         state->orig.in.sids = _sids;
8671
8672         /* Out parameters */
8673
8674         /* Result */
8675         ZERO_STRUCT(state->orig.out.result);
8676
8677         if (DEBUGLEVEL >= 10) {
8678                 NDR_PRINT_IN_DEBUG(samr_AddMultipleMembersToAlias, &state->orig);
8679         }
8680
8681         /* make a temporary copy, that we pass to the dispatch function */
8682         state->tmp = state->orig;
8683
8684         subreq = cli->dispatch_send(state, ev, cli,
8685                                     &ndr_table_samr,
8686                                     NDR_SAMR_ADDMULTIPLEMEMBERSTOALIAS,
8687                                     &state->tmp);
8688         if (tevent_req_nomem(subreq, req)) {
8689                 return tevent_req_post(req, ev);
8690         }
8691         tevent_req_set_callback(subreq, rpccli_samr_AddMultipleMembersToAlias_done, req);
8692         return req;
8693 }
8694
8695 static void rpccli_samr_AddMultipleMembersToAlias_done(struct tevent_req *subreq)
8696 {
8697         struct tevent_req *req = tevent_req_callback_data(
8698                 subreq, struct tevent_req);
8699         struct rpccli_samr_AddMultipleMembersToAlias_state *state = tevent_req_data(
8700                 req, struct rpccli_samr_AddMultipleMembersToAlias_state);
8701         NTSTATUS status;
8702         TALLOC_CTX *mem_ctx;
8703
8704         if (state->out_mem_ctx) {
8705                 mem_ctx = state->out_mem_ctx;
8706         } else {
8707                 mem_ctx = state;
8708         }
8709
8710         status = state->dispatch_recv(subreq, mem_ctx);
8711         TALLOC_FREE(subreq);
8712         if (!NT_STATUS_IS_OK(status)) {
8713                 tevent_req_nterror(req, status);
8714                 return;
8715         }
8716
8717         /* Copy out parameters */
8718
8719         /* Copy result */
8720         state->orig.out.result = state->tmp.out.result;
8721
8722         /* Reset temporary structure */
8723         ZERO_STRUCT(state->tmp);
8724
8725         if (DEBUGLEVEL >= 10) {
8726                 NDR_PRINT_OUT_DEBUG(samr_AddMultipleMembersToAlias, &state->orig);
8727         }
8728
8729         tevent_req_done(req);
8730 }
8731
8732 NTSTATUS rpccli_samr_AddMultipleMembersToAlias_recv(struct tevent_req *req,
8733                                                     TALLOC_CTX *mem_ctx,
8734                                                     NTSTATUS *result)
8735 {
8736         struct rpccli_samr_AddMultipleMembersToAlias_state *state = tevent_req_data(
8737                 req, struct rpccli_samr_AddMultipleMembersToAlias_state);
8738         NTSTATUS status;
8739
8740         if (tevent_req_is_nterror(req, &status)) {
8741                 tevent_req_received(req);
8742                 return status;
8743         }
8744
8745         /* Steal possbile out parameters to the callers context */
8746         talloc_steal(mem_ctx, state->out_mem_ctx);
8747
8748         /* Return result */
8749         *result = state->orig.out.result;
8750
8751         tevent_req_received(req);
8752         return NT_STATUS_OK;
8753 }
8754
8755 NTSTATUS rpccli_samr_AddMultipleMembersToAlias(struct rpc_pipe_client *cli,
8756                                                TALLOC_CTX *mem_ctx,
8757                                                struct policy_handle *alias_handle /* [in] [ref] */,
8758                                                struct lsa_SidArray *sids /* [in] [ref] */)
8759 {
8760         struct samr_AddMultipleMembersToAlias r;
8761         NTSTATUS status;
8762
8763         /* In parameters */
8764         r.in.alias_handle = alias_handle;
8765         r.in.sids = sids;
8766
8767         if (DEBUGLEVEL >= 10) {
8768                 NDR_PRINT_IN_DEBUG(samr_AddMultipleMembersToAlias, &r);
8769         }
8770
8771         status = cli->dispatch(cli,
8772                                 mem_ctx,
8773                                 &ndr_table_samr,
8774                                 NDR_SAMR_ADDMULTIPLEMEMBERSTOALIAS,
8775                                 &r);
8776
8777         if (!NT_STATUS_IS_OK(status)) {
8778                 return status;
8779         }
8780
8781         if (DEBUGLEVEL >= 10) {
8782                 NDR_PRINT_OUT_DEBUG(samr_AddMultipleMembersToAlias, &r);
8783         }
8784
8785         if (NT_STATUS_IS_ERR(status)) {
8786                 return status;
8787         }
8788
8789         /* Return variables */
8790
8791         /* Return result */
8792         return r.out.result;
8793 }
8794
8795 struct rpccli_samr_RemoveMultipleMembersFromAlias_state {
8796         struct samr_RemoveMultipleMembersFromAlias orig;
8797         struct samr_RemoveMultipleMembersFromAlias tmp;
8798         TALLOC_CTX *out_mem_ctx;
8799         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8800 };
8801
8802 static void rpccli_samr_RemoveMultipleMembersFromAlias_done(struct tevent_req *subreq);
8803
8804 struct tevent_req *rpccli_samr_RemoveMultipleMembersFromAlias_send(TALLOC_CTX *mem_ctx,
8805                                                                    struct tevent_context *ev,
8806                                                                    struct rpc_pipe_client *cli,
8807                                                                    struct policy_handle *_alias_handle /* [in] [ref] */,
8808                                                                    struct lsa_SidArray *_sids /* [in] [ref] */)
8809 {
8810         struct tevent_req *req;
8811         struct rpccli_samr_RemoveMultipleMembersFromAlias_state *state;
8812         struct tevent_req *subreq;
8813
8814         req = tevent_req_create(mem_ctx, &state,
8815                                 struct rpccli_samr_RemoveMultipleMembersFromAlias_state);
8816         if (req == NULL) {
8817                 return NULL;
8818         }
8819         state->out_mem_ctx = NULL;
8820         state->dispatch_recv = cli->dispatch_recv;
8821
8822         /* In parameters */
8823         state->orig.in.alias_handle = _alias_handle;
8824         state->orig.in.sids = _sids;
8825
8826         /* Out parameters */
8827
8828         /* Result */
8829         ZERO_STRUCT(state->orig.out.result);
8830
8831         if (DEBUGLEVEL >= 10) {
8832                 NDR_PRINT_IN_DEBUG(samr_RemoveMultipleMembersFromAlias, &state->orig);
8833         }
8834
8835         /* make a temporary copy, that we pass to the dispatch function */
8836         state->tmp = state->orig;
8837
8838         subreq = cli->dispatch_send(state, ev, cli,
8839                                     &ndr_table_samr,
8840                                     NDR_SAMR_REMOVEMULTIPLEMEMBERSFROMALIAS,
8841                                     &state->tmp);
8842         if (tevent_req_nomem(subreq, req)) {
8843                 return tevent_req_post(req, ev);
8844         }
8845         tevent_req_set_callback(subreq, rpccli_samr_RemoveMultipleMembersFromAlias_done, req);
8846         return req;
8847 }
8848
8849 static void rpccli_samr_RemoveMultipleMembersFromAlias_done(struct tevent_req *subreq)
8850 {
8851         struct tevent_req *req = tevent_req_callback_data(
8852                 subreq, struct tevent_req);
8853         struct rpccli_samr_RemoveMultipleMembersFromAlias_state *state = tevent_req_data(
8854                 req, struct rpccli_samr_RemoveMultipleMembersFromAlias_state);
8855         NTSTATUS status;
8856         TALLOC_CTX *mem_ctx;
8857
8858         if (state->out_mem_ctx) {
8859                 mem_ctx = state->out_mem_ctx;
8860         } else {
8861                 mem_ctx = state;
8862         }
8863
8864         status = state->dispatch_recv(subreq, mem_ctx);
8865         TALLOC_FREE(subreq);
8866         if (!NT_STATUS_IS_OK(status)) {
8867                 tevent_req_nterror(req, status);
8868                 return;
8869         }
8870
8871         /* Copy out parameters */
8872
8873         /* Copy result */
8874         state->orig.out.result = state->tmp.out.result;
8875
8876         /* Reset temporary structure */
8877         ZERO_STRUCT(state->tmp);
8878
8879         if (DEBUGLEVEL >= 10) {
8880                 NDR_PRINT_OUT_DEBUG(samr_RemoveMultipleMembersFromAlias, &state->orig);
8881         }
8882
8883         tevent_req_done(req);
8884 }
8885
8886 NTSTATUS rpccli_samr_RemoveMultipleMembersFromAlias_recv(struct tevent_req *req,
8887                                                          TALLOC_CTX *mem_ctx,
8888                                                          NTSTATUS *result)
8889 {
8890         struct rpccli_samr_RemoveMultipleMembersFromAlias_state *state = tevent_req_data(
8891                 req, struct rpccli_samr_RemoveMultipleMembersFromAlias_state);
8892         NTSTATUS status;
8893
8894         if (tevent_req_is_nterror(req, &status)) {
8895                 tevent_req_received(req);
8896                 return status;
8897         }
8898
8899         /* Steal possbile out parameters to the callers context */
8900         talloc_steal(mem_ctx, state->out_mem_ctx);
8901
8902         /* Return result */
8903         *result = state->orig.out.result;
8904
8905         tevent_req_received(req);
8906         return NT_STATUS_OK;
8907 }
8908
8909 NTSTATUS rpccli_samr_RemoveMultipleMembersFromAlias(struct rpc_pipe_client *cli,
8910                                                     TALLOC_CTX *mem_ctx,
8911                                                     struct policy_handle *alias_handle /* [in] [ref] */,
8912                                                     struct lsa_SidArray *sids /* [in] [ref] */)
8913 {
8914         struct samr_RemoveMultipleMembersFromAlias r;
8915         NTSTATUS status;
8916
8917         /* In parameters */
8918         r.in.alias_handle = alias_handle;
8919         r.in.sids = sids;
8920
8921         if (DEBUGLEVEL >= 10) {
8922                 NDR_PRINT_IN_DEBUG(samr_RemoveMultipleMembersFromAlias, &r);
8923         }
8924
8925         status = cli->dispatch(cli,
8926                                 mem_ctx,
8927                                 &ndr_table_samr,
8928                                 NDR_SAMR_REMOVEMULTIPLEMEMBERSFROMALIAS,
8929                                 &r);
8930
8931         if (!NT_STATUS_IS_OK(status)) {
8932                 return status;
8933         }
8934
8935         if (DEBUGLEVEL >= 10) {
8936                 NDR_PRINT_OUT_DEBUG(samr_RemoveMultipleMembersFromAlias, &r);
8937         }
8938
8939         if (NT_STATUS_IS_ERR(status)) {
8940                 return status;
8941         }
8942
8943         /* Return variables */
8944
8945         /* Return result */
8946         return r.out.result;
8947 }
8948
8949 struct rpccli_samr_OemChangePasswordUser2_state {
8950         struct samr_OemChangePasswordUser2 orig;
8951         struct samr_OemChangePasswordUser2 tmp;
8952         TALLOC_CTX *out_mem_ctx;
8953         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8954 };
8955
8956 static void rpccli_samr_OemChangePasswordUser2_done(struct tevent_req *subreq);
8957
8958 struct tevent_req *rpccli_samr_OemChangePasswordUser2_send(TALLOC_CTX *mem_ctx,
8959                                                            struct tevent_context *ev,
8960                                                            struct rpc_pipe_client *cli,
8961                                                            struct lsa_AsciiString *_server /* [in] [unique] */,
8962                                                            struct lsa_AsciiString *_account /* [in] [ref] */,
8963                                                            struct samr_CryptPassword *_password /* [in] [unique] */,
8964                                                            struct samr_Password *_hash /* [in] [unique] */)
8965 {
8966         struct tevent_req *req;
8967         struct rpccli_samr_OemChangePasswordUser2_state *state;
8968         struct tevent_req *subreq;
8969
8970         req = tevent_req_create(mem_ctx, &state,
8971                                 struct rpccli_samr_OemChangePasswordUser2_state);
8972         if (req == NULL) {
8973                 return NULL;
8974         }
8975         state->out_mem_ctx = NULL;
8976         state->dispatch_recv = cli->dispatch_recv;
8977
8978         /* In parameters */
8979         state->orig.in.server = _server;
8980         state->orig.in.account = _account;
8981         state->orig.in.password = _password;
8982         state->orig.in.hash = _hash;
8983
8984         /* Out parameters */
8985
8986         /* Result */
8987         ZERO_STRUCT(state->orig.out.result);
8988
8989         if (DEBUGLEVEL >= 10) {
8990                 NDR_PRINT_IN_DEBUG(samr_OemChangePasswordUser2, &state->orig);
8991         }
8992
8993         /* make a temporary copy, that we pass to the dispatch function */
8994         state->tmp = state->orig;
8995
8996         subreq = cli->dispatch_send(state, ev, cli,
8997                                     &ndr_table_samr,
8998                                     NDR_SAMR_OEMCHANGEPASSWORDUSER2,
8999                                     &state->tmp);
9000         if (tevent_req_nomem(subreq, req)) {
9001                 return tevent_req_post(req, ev);
9002         }
9003         tevent_req_set_callback(subreq, rpccli_samr_OemChangePasswordUser2_done, req);
9004         return req;
9005 }
9006
9007 static void rpccli_samr_OemChangePasswordUser2_done(struct tevent_req *subreq)
9008 {
9009         struct tevent_req *req = tevent_req_callback_data(
9010                 subreq, struct tevent_req);
9011         struct rpccli_samr_OemChangePasswordUser2_state *state = tevent_req_data(
9012                 req, struct rpccli_samr_OemChangePasswordUser2_state);
9013         NTSTATUS status;
9014         TALLOC_CTX *mem_ctx;
9015
9016         if (state->out_mem_ctx) {
9017                 mem_ctx = state->out_mem_ctx;
9018         } else {
9019                 mem_ctx = state;
9020         }
9021
9022         status = state->dispatch_recv(subreq, mem_ctx);
9023         TALLOC_FREE(subreq);
9024         if (!NT_STATUS_IS_OK(status)) {
9025                 tevent_req_nterror(req, status);
9026                 return;
9027         }
9028
9029         /* Copy out parameters */
9030
9031         /* Copy result */
9032         state->orig.out.result = state->tmp.out.result;
9033
9034         /* Reset temporary structure */
9035         ZERO_STRUCT(state->tmp);
9036
9037         if (DEBUGLEVEL >= 10) {
9038                 NDR_PRINT_OUT_DEBUG(samr_OemChangePasswordUser2, &state->orig);
9039         }
9040
9041         tevent_req_done(req);
9042 }
9043
9044 NTSTATUS rpccli_samr_OemChangePasswordUser2_recv(struct tevent_req *req,
9045                                                  TALLOC_CTX *mem_ctx,
9046                                                  NTSTATUS *result)
9047 {
9048         struct rpccli_samr_OemChangePasswordUser2_state *state = tevent_req_data(
9049                 req, struct rpccli_samr_OemChangePasswordUser2_state);
9050         NTSTATUS status;
9051
9052         if (tevent_req_is_nterror(req, &status)) {
9053                 tevent_req_received(req);
9054                 return status;
9055         }
9056
9057         /* Steal possbile out parameters to the callers context */
9058         talloc_steal(mem_ctx, state->out_mem_ctx);
9059
9060         /* Return result */
9061         *result = state->orig.out.result;
9062
9063         tevent_req_received(req);
9064         return NT_STATUS_OK;
9065 }
9066
9067 NTSTATUS rpccli_samr_OemChangePasswordUser2(struct rpc_pipe_client *cli,
9068                                             TALLOC_CTX *mem_ctx,
9069                                             struct lsa_AsciiString *server /* [in] [unique] */,
9070                                             struct lsa_AsciiString *account /* [in] [ref] */,
9071                                             struct samr_CryptPassword *password /* [in] [unique] */,
9072                                             struct samr_Password *hash /* [in] [unique] */)
9073 {
9074         struct samr_OemChangePasswordUser2 r;
9075         NTSTATUS status;
9076
9077         /* In parameters */
9078         r.in.server = server;
9079         r.in.account = account;
9080         r.in.password = password;
9081         r.in.hash = hash;
9082
9083         if (DEBUGLEVEL >= 10) {
9084                 NDR_PRINT_IN_DEBUG(samr_OemChangePasswordUser2, &r);
9085         }
9086
9087         status = cli->dispatch(cli,
9088                                 mem_ctx,
9089                                 &ndr_table_samr,
9090                                 NDR_SAMR_OEMCHANGEPASSWORDUSER2,
9091                                 &r);
9092
9093         if (!NT_STATUS_IS_OK(status)) {
9094                 return status;
9095         }
9096
9097         if (DEBUGLEVEL >= 10) {
9098                 NDR_PRINT_OUT_DEBUG(samr_OemChangePasswordUser2, &r);
9099         }
9100
9101         if (NT_STATUS_IS_ERR(status)) {
9102                 return status;
9103         }
9104
9105         /* Return variables */
9106
9107         /* Return result */
9108         return r.out.result;
9109 }
9110
9111 struct rpccli_samr_ChangePasswordUser2_state {
9112         struct samr_ChangePasswordUser2 orig;
9113         struct samr_ChangePasswordUser2 tmp;
9114         TALLOC_CTX *out_mem_ctx;
9115         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9116 };
9117
9118 static void rpccli_samr_ChangePasswordUser2_done(struct tevent_req *subreq);
9119
9120 struct tevent_req *rpccli_samr_ChangePasswordUser2_send(TALLOC_CTX *mem_ctx,
9121                                                         struct tevent_context *ev,
9122                                                         struct rpc_pipe_client *cli,
9123                                                         struct lsa_String *_server /* [in] [unique] */,
9124                                                         struct lsa_String *_account /* [in] [ref] */,
9125                                                         struct samr_CryptPassword *_nt_password /* [in] [unique] */,
9126                                                         struct samr_Password *_nt_verifier /* [in] [unique] */,
9127                                                         uint8_t _lm_change /* [in]  */,
9128                                                         struct samr_CryptPassword *_lm_password /* [in] [unique] */,
9129                                                         struct samr_Password *_lm_verifier /* [in] [unique] */)
9130 {
9131         struct tevent_req *req;
9132         struct rpccli_samr_ChangePasswordUser2_state *state;
9133         struct tevent_req *subreq;
9134
9135         req = tevent_req_create(mem_ctx, &state,
9136                                 struct rpccli_samr_ChangePasswordUser2_state);
9137         if (req == NULL) {
9138                 return NULL;
9139         }
9140         state->out_mem_ctx = NULL;
9141         state->dispatch_recv = cli->dispatch_recv;
9142
9143         /* In parameters */
9144         state->orig.in.server = _server;
9145         state->orig.in.account = _account;
9146         state->orig.in.nt_password = _nt_password;
9147         state->orig.in.nt_verifier = _nt_verifier;
9148         state->orig.in.lm_change = _lm_change;
9149         state->orig.in.lm_password = _lm_password;
9150         state->orig.in.lm_verifier = _lm_verifier;
9151
9152         /* Out parameters */
9153
9154         /* Result */
9155         ZERO_STRUCT(state->orig.out.result);
9156
9157         if (DEBUGLEVEL >= 10) {
9158                 NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser2, &state->orig);
9159         }
9160
9161         /* make a temporary copy, that we pass to the dispatch function */
9162         state->tmp = state->orig;
9163
9164         subreq = cli->dispatch_send(state, ev, cli,
9165                                     &ndr_table_samr,
9166                                     NDR_SAMR_CHANGEPASSWORDUSER2,
9167                                     &state->tmp);
9168         if (tevent_req_nomem(subreq, req)) {
9169                 return tevent_req_post(req, ev);
9170         }
9171         tevent_req_set_callback(subreq, rpccli_samr_ChangePasswordUser2_done, req);
9172         return req;
9173 }
9174
9175 static void rpccli_samr_ChangePasswordUser2_done(struct tevent_req *subreq)
9176 {
9177         struct tevent_req *req = tevent_req_callback_data(
9178                 subreq, struct tevent_req);
9179         struct rpccli_samr_ChangePasswordUser2_state *state = tevent_req_data(
9180                 req, struct rpccli_samr_ChangePasswordUser2_state);
9181         NTSTATUS status;
9182         TALLOC_CTX *mem_ctx;
9183
9184         if (state->out_mem_ctx) {
9185                 mem_ctx = state->out_mem_ctx;
9186         } else {
9187                 mem_ctx = state;
9188         }
9189
9190         status = state->dispatch_recv(subreq, mem_ctx);
9191         TALLOC_FREE(subreq);
9192         if (!NT_STATUS_IS_OK(status)) {
9193                 tevent_req_nterror(req, status);
9194                 return;
9195         }
9196
9197         /* Copy out parameters */
9198
9199         /* Copy result */
9200         state->orig.out.result = state->tmp.out.result;
9201
9202         /* Reset temporary structure */
9203         ZERO_STRUCT(state->tmp);
9204
9205         if (DEBUGLEVEL >= 10) {
9206                 NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser2, &state->orig);
9207         }
9208
9209         tevent_req_done(req);
9210 }
9211
9212 NTSTATUS rpccli_samr_ChangePasswordUser2_recv(struct tevent_req *req,
9213                                               TALLOC_CTX *mem_ctx,
9214                                               NTSTATUS *result)
9215 {
9216         struct rpccli_samr_ChangePasswordUser2_state *state = tevent_req_data(
9217                 req, struct rpccli_samr_ChangePasswordUser2_state);
9218         NTSTATUS status;
9219
9220         if (tevent_req_is_nterror(req, &status)) {
9221                 tevent_req_received(req);
9222                 return status;
9223         }
9224
9225         /* Steal possbile out parameters to the callers context */
9226         talloc_steal(mem_ctx, state->out_mem_ctx);
9227
9228         /* Return result */
9229         *result = state->orig.out.result;
9230
9231         tevent_req_received(req);
9232         return NT_STATUS_OK;
9233 }
9234
9235 NTSTATUS rpccli_samr_ChangePasswordUser2(struct rpc_pipe_client *cli,
9236                                          TALLOC_CTX *mem_ctx,
9237                                          struct lsa_String *server /* [in] [unique] */,
9238                                          struct lsa_String *account /* [in] [ref] */,
9239                                          struct samr_CryptPassword *nt_password /* [in] [unique] */,
9240                                          struct samr_Password *nt_verifier /* [in] [unique] */,
9241                                          uint8_t lm_change /* [in]  */,
9242                                          struct samr_CryptPassword *lm_password /* [in] [unique] */,
9243                                          struct samr_Password *lm_verifier /* [in] [unique] */)
9244 {
9245         struct samr_ChangePasswordUser2 r;
9246         NTSTATUS status;
9247
9248         /* In parameters */
9249         r.in.server = server;
9250         r.in.account = account;
9251         r.in.nt_password = nt_password;
9252         r.in.nt_verifier = nt_verifier;
9253         r.in.lm_change = lm_change;
9254         r.in.lm_password = lm_password;
9255         r.in.lm_verifier = lm_verifier;
9256
9257         if (DEBUGLEVEL >= 10) {
9258                 NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser2, &r);
9259         }
9260
9261         status = cli->dispatch(cli,
9262                                 mem_ctx,
9263                                 &ndr_table_samr,
9264                                 NDR_SAMR_CHANGEPASSWORDUSER2,
9265                                 &r);
9266
9267         if (!NT_STATUS_IS_OK(status)) {
9268                 return status;
9269         }
9270
9271         if (DEBUGLEVEL >= 10) {
9272                 NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser2, &r);
9273         }
9274
9275         if (NT_STATUS_IS_ERR(status)) {
9276                 return status;
9277         }
9278
9279         /* Return variables */
9280
9281         /* Return result */
9282         return r.out.result;
9283 }
9284
9285 struct rpccli_samr_GetDomPwInfo_state {
9286         struct samr_GetDomPwInfo orig;
9287         struct samr_GetDomPwInfo tmp;
9288         TALLOC_CTX *out_mem_ctx;
9289         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9290 };
9291
9292 static void rpccli_samr_GetDomPwInfo_done(struct tevent_req *subreq);
9293
9294 struct tevent_req *rpccli_samr_GetDomPwInfo_send(TALLOC_CTX *mem_ctx,
9295                                                  struct tevent_context *ev,
9296                                                  struct rpc_pipe_client *cli,
9297                                                  struct lsa_String *_domain_name /* [in] [unique] */,
9298                                                  struct samr_PwInfo *_info /* [out] [ref] */)
9299 {
9300         struct tevent_req *req;
9301         struct rpccli_samr_GetDomPwInfo_state *state;
9302         struct tevent_req *subreq;
9303
9304         req = tevent_req_create(mem_ctx, &state,
9305                                 struct rpccli_samr_GetDomPwInfo_state);
9306         if (req == NULL) {
9307                 return NULL;
9308         }
9309         state->out_mem_ctx = NULL;
9310         state->dispatch_recv = cli->dispatch_recv;
9311
9312         /* In parameters */
9313         state->orig.in.domain_name = _domain_name;
9314
9315         /* Out parameters */
9316         state->orig.out.info = _info;
9317
9318         /* Result */
9319         ZERO_STRUCT(state->orig.out.result);
9320
9321         if (DEBUGLEVEL >= 10) {
9322                 NDR_PRINT_IN_DEBUG(samr_GetDomPwInfo, &state->orig);
9323         }
9324
9325         state->out_mem_ctx = talloc_named_const(state, 0,
9326                              "rpccli_samr_GetDomPwInfo_out_memory");
9327         if (tevent_req_nomem(state->out_mem_ctx, req)) {
9328                 return tevent_req_post(req, ev);
9329         }
9330
9331         /* make a temporary copy, that we pass to the dispatch function */
9332         state->tmp = state->orig;
9333
9334         subreq = cli->dispatch_send(state, ev, cli,
9335                                     &ndr_table_samr,
9336                                     NDR_SAMR_GETDOMPWINFO,
9337                                     &state->tmp);
9338         if (tevent_req_nomem(subreq, req)) {
9339                 return tevent_req_post(req, ev);
9340         }
9341         tevent_req_set_callback(subreq, rpccli_samr_GetDomPwInfo_done, req);
9342         return req;
9343 }
9344
9345 static void rpccli_samr_GetDomPwInfo_done(struct tevent_req *subreq)
9346 {
9347         struct tevent_req *req = tevent_req_callback_data(
9348                 subreq, struct tevent_req);
9349         struct rpccli_samr_GetDomPwInfo_state *state = tevent_req_data(
9350                 req, struct rpccli_samr_GetDomPwInfo_state);
9351         NTSTATUS status;
9352         TALLOC_CTX *mem_ctx;
9353
9354         if (state->out_mem_ctx) {
9355                 mem_ctx = state->out_mem_ctx;
9356         } else {
9357                 mem_ctx = state;
9358         }
9359
9360         status = state->dispatch_recv(subreq, mem_ctx);
9361         TALLOC_FREE(subreq);
9362         if (!NT_STATUS_IS_OK(status)) {
9363                 tevent_req_nterror(req, status);
9364                 return;
9365         }
9366
9367         /* Copy out parameters */
9368         *state->orig.out.info = *state->tmp.out.info;
9369
9370         /* Copy result */
9371         state->orig.out.result = state->tmp.out.result;
9372
9373         /* Reset temporary structure */
9374         ZERO_STRUCT(state->tmp);
9375
9376         if (DEBUGLEVEL >= 10) {
9377                 NDR_PRINT_OUT_DEBUG(samr_GetDomPwInfo, &state->orig);
9378         }
9379
9380         tevent_req_done(req);
9381 }
9382
9383 NTSTATUS rpccli_samr_GetDomPwInfo_recv(struct tevent_req *req,
9384                                        TALLOC_CTX *mem_ctx,
9385                                        NTSTATUS *result)
9386 {
9387         struct rpccli_samr_GetDomPwInfo_state *state = tevent_req_data(
9388                 req, struct rpccli_samr_GetDomPwInfo_state);
9389         NTSTATUS status;
9390
9391         if (tevent_req_is_nterror(req, &status)) {
9392                 tevent_req_received(req);
9393                 return status;
9394         }
9395
9396         /* Steal possbile out parameters to the callers context */
9397         talloc_steal(mem_ctx, state->out_mem_ctx);
9398
9399         /* Return result */
9400         *result = state->orig.out.result;
9401
9402         tevent_req_received(req);
9403         return NT_STATUS_OK;
9404 }
9405
9406 NTSTATUS rpccli_samr_GetDomPwInfo(struct rpc_pipe_client *cli,
9407                                   TALLOC_CTX *mem_ctx,
9408                                   struct lsa_String *domain_name /* [in] [unique] */,
9409                                   struct samr_PwInfo *info /* [out] [ref] */)
9410 {
9411         struct samr_GetDomPwInfo r;
9412         NTSTATUS status;
9413
9414         /* In parameters */
9415         r.in.domain_name = domain_name;
9416
9417         if (DEBUGLEVEL >= 10) {
9418                 NDR_PRINT_IN_DEBUG(samr_GetDomPwInfo, &r);
9419         }
9420
9421         status = cli->dispatch(cli,
9422                                 mem_ctx,
9423                                 &ndr_table_samr,
9424                                 NDR_SAMR_GETDOMPWINFO,
9425                                 &r);
9426
9427         if (!NT_STATUS_IS_OK(status)) {
9428                 return status;
9429         }
9430
9431         if (DEBUGLEVEL >= 10) {
9432                 NDR_PRINT_OUT_DEBUG(samr_GetDomPwInfo, &r);
9433         }
9434
9435         if (NT_STATUS_IS_ERR(status)) {
9436                 return status;
9437         }
9438
9439         /* Return variables */
9440         *info = *r.out.info;
9441
9442         /* Return result */
9443         return r.out.result;
9444 }
9445
9446 struct rpccli_samr_Connect2_state {
9447         struct samr_Connect2 orig;
9448         struct samr_Connect2 tmp;
9449         TALLOC_CTX *out_mem_ctx;
9450         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9451 };
9452
9453 static void rpccli_samr_Connect2_done(struct tevent_req *subreq);
9454
9455 struct tevent_req *rpccli_samr_Connect2_send(TALLOC_CTX *mem_ctx,
9456                                              struct tevent_context *ev,
9457                                              struct rpc_pipe_client *cli,
9458                                              const char *_system_name /* [in] [unique,charset(UTF16)] */,
9459                                              uint32_t _access_mask /* [in]  */,
9460                                              struct policy_handle *_connect_handle /* [out] [ref] */)
9461 {
9462         struct tevent_req *req;
9463         struct rpccli_samr_Connect2_state *state;
9464         struct tevent_req *subreq;
9465
9466         req = tevent_req_create(mem_ctx, &state,
9467                                 struct rpccli_samr_Connect2_state);
9468         if (req == NULL) {
9469                 return NULL;
9470         }
9471         state->out_mem_ctx = NULL;
9472         state->dispatch_recv = cli->dispatch_recv;
9473
9474         /* In parameters */
9475         state->orig.in.system_name = _system_name;
9476         state->orig.in.access_mask = _access_mask;
9477
9478         /* Out parameters */
9479         state->orig.out.connect_handle = _connect_handle;
9480
9481         /* Result */
9482         ZERO_STRUCT(state->orig.out.result);
9483
9484         if (DEBUGLEVEL >= 10) {
9485                 NDR_PRINT_IN_DEBUG(samr_Connect2, &state->orig);
9486         }
9487
9488         state->out_mem_ctx = talloc_named_const(state, 0,
9489                              "rpccli_samr_Connect2_out_memory");
9490         if (tevent_req_nomem(state->out_mem_ctx, req)) {
9491                 return tevent_req_post(req, ev);
9492         }
9493
9494         /* make a temporary copy, that we pass to the dispatch function */
9495         state->tmp = state->orig;
9496
9497         subreq = cli->dispatch_send(state, ev, cli,
9498                                     &ndr_table_samr,
9499                                     NDR_SAMR_CONNECT2,
9500                                     &state->tmp);
9501         if (tevent_req_nomem(subreq, req)) {
9502                 return tevent_req_post(req, ev);
9503         }
9504         tevent_req_set_callback(subreq, rpccli_samr_Connect2_done, req);
9505         return req;
9506 }
9507
9508 static void rpccli_samr_Connect2_done(struct tevent_req *subreq)
9509 {
9510         struct tevent_req *req = tevent_req_callback_data(
9511                 subreq, struct tevent_req);
9512         struct rpccli_samr_Connect2_state *state = tevent_req_data(
9513                 req, struct rpccli_samr_Connect2_state);
9514         NTSTATUS status;
9515         TALLOC_CTX *mem_ctx;
9516
9517         if (state->out_mem_ctx) {
9518                 mem_ctx = state->out_mem_ctx;
9519         } else {
9520                 mem_ctx = state;
9521         }
9522
9523         status = state->dispatch_recv(subreq, mem_ctx);
9524         TALLOC_FREE(subreq);
9525         if (!NT_STATUS_IS_OK(status)) {
9526                 tevent_req_nterror(req, status);
9527                 return;
9528         }
9529
9530         /* Copy out parameters */
9531         *state->orig.out.connect_handle = *state->tmp.out.connect_handle;
9532
9533         /* Copy result */
9534         state->orig.out.result = state->tmp.out.result;
9535
9536         /* Reset temporary structure */
9537         ZERO_STRUCT(state->tmp);
9538
9539         if (DEBUGLEVEL >= 10) {
9540                 NDR_PRINT_OUT_DEBUG(samr_Connect2, &state->orig);
9541         }
9542
9543         tevent_req_done(req);
9544 }
9545
9546 NTSTATUS rpccli_samr_Connect2_recv(struct tevent_req *req,
9547                                    TALLOC_CTX *mem_ctx,
9548                                    NTSTATUS *result)
9549 {
9550         struct rpccli_samr_Connect2_state *state = tevent_req_data(
9551                 req, struct rpccli_samr_Connect2_state);
9552         NTSTATUS status;
9553
9554         if (tevent_req_is_nterror(req, &status)) {
9555                 tevent_req_received(req);
9556                 return status;
9557         }
9558
9559         /* Steal possbile out parameters to the callers context */
9560         talloc_steal(mem_ctx, state->out_mem_ctx);
9561
9562         /* Return result */
9563         *result = state->orig.out.result;
9564
9565         tevent_req_received(req);
9566         return NT_STATUS_OK;
9567 }
9568
9569 NTSTATUS rpccli_samr_Connect2(struct rpc_pipe_client *cli,
9570                               TALLOC_CTX *mem_ctx,
9571                               const char *system_name /* [in] [unique,charset(UTF16)] */,
9572                               uint32_t access_mask /* [in]  */,
9573                               struct policy_handle *connect_handle /* [out] [ref] */)
9574 {
9575         struct samr_Connect2 r;
9576         NTSTATUS status;
9577
9578         /* In parameters */
9579         r.in.system_name = system_name;
9580         r.in.access_mask = access_mask;
9581
9582         if (DEBUGLEVEL >= 10) {
9583                 NDR_PRINT_IN_DEBUG(samr_Connect2, &r);
9584         }
9585
9586         status = cli->dispatch(cli,
9587                                 mem_ctx,
9588                                 &ndr_table_samr,
9589                                 NDR_SAMR_CONNECT2,
9590                                 &r);
9591
9592         if (!NT_STATUS_IS_OK(status)) {
9593                 return status;
9594         }
9595
9596         if (DEBUGLEVEL >= 10) {
9597                 NDR_PRINT_OUT_DEBUG(samr_Connect2, &r);
9598         }
9599
9600         if (NT_STATUS_IS_ERR(status)) {
9601                 return status;
9602         }
9603
9604         /* Return variables */
9605         *connect_handle = *r.out.connect_handle;
9606
9607         /* Return result */
9608         return r.out.result;
9609 }
9610
9611 struct rpccli_samr_SetUserInfo2_state {
9612         struct samr_SetUserInfo2 orig;
9613         struct samr_SetUserInfo2 tmp;
9614         TALLOC_CTX *out_mem_ctx;
9615         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9616 };
9617
9618 static void rpccli_samr_SetUserInfo2_done(struct tevent_req *subreq);
9619
9620 struct tevent_req *rpccli_samr_SetUserInfo2_send(TALLOC_CTX *mem_ctx,
9621                                                  struct tevent_context *ev,
9622                                                  struct rpc_pipe_client *cli,
9623                                                  struct policy_handle *_user_handle /* [in] [ref] */,
9624                                                  enum samr_UserInfoLevel _level /* [in]  */,
9625                                                  union samr_UserInfo *_info /* [in] [ref,switch_is(level)] */)
9626 {
9627         struct tevent_req *req;
9628         struct rpccli_samr_SetUserInfo2_state *state;
9629         struct tevent_req *subreq;
9630
9631         req = tevent_req_create(mem_ctx, &state,
9632                                 struct rpccli_samr_SetUserInfo2_state);
9633         if (req == NULL) {
9634                 return NULL;
9635         }
9636         state->out_mem_ctx = NULL;
9637         state->dispatch_recv = cli->dispatch_recv;
9638
9639         /* In parameters */
9640         state->orig.in.user_handle = _user_handle;
9641         state->orig.in.level = _level;
9642         state->orig.in.info = _info;
9643
9644         /* Out parameters */
9645
9646         /* Result */
9647         ZERO_STRUCT(state->orig.out.result);
9648
9649         if (DEBUGLEVEL >= 10) {
9650                 NDR_PRINT_IN_DEBUG(samr_SetUserInfo2, &state->orig);
9651         }
9652
9653         /* make a temporary copy, that we pass to the dispatch function */
9654         state->tmp = state->orig;
9655
9656         subreq = cli->dispatch_send(state, ev, cli,
9657                                     &ndr_table_samr,
9658                                     NDR_SAMR_SETUSERINFO2,
9659                                     &state->tmp);
9660         if (tevent_req_nomem(subreq, req)) {
9661                 return tevent_req_post(req, ev);
9662         }
9663         tevent_req_set_callback(subreq, rpccli_samr_SetUserInfo2_done, req);
9664         return req;
9665 }
9666
9667 static void rpccli_samr_SetUserInfo2_done(struct tevent_req *subreq)
9668 {
9669         struct tevent_req *req = tevent_req_callback_data(
9670                 subreq, struct tevent_req);
9671         struct rpccli_samr_SetUserInfo2_state *state = tevent_req_data(
9672                 req, struct rpccli_samr_SetUserInfo2_state);
9673         NTSTATUS status;
9674         TALLOC_CTX *mem_ctx;
9675
9676         if (state->out_mem_ctx) {
9677                 mem_ctx = state->out_mem_ctx;
9678         } else {
9679                 mem_ctx = state;
9680         }
9681
9682         status = state->dispatch_recv(subreq, mem_ctx);
9683         TALLOC_FREE(subreq);
9684         if (!NT_STATUS_IS_OK(status)) {
9685                 tevent_req_nterror(req, status);
9686                 return;
9687         }
9688
9689         /* Copy out parameters */
9690
9691         /* Copy result */
9692         state->orig.out.result = state->tmp.out.result;
9693
9694         /* Reset temporary structure */
9695         ZERO_STRUCT(state->tmp);
9696
9697         if (DEBUGLEVEL >= 10) {
9698                 NDR_PRINT_OUT_DEBUG(samr_SetUserInfo2, &state->orig);
9699         }
9700
9701         tevent_req_done(req);
9702 }
9703
9704 NTSTATUS rpccli_samr_SetUserInfo2_recv(struct tevent_req *req,
9705                                        TALLOC_CTX *mem_ctx,
9706                                        NTSTATUS *result)
9707 {
9708         struct rpccli_samr_SetUserInfo2_state *state = tevent_req_data(
9709                 req, struct rpccli_samr_SetUserInfo2_state);
9710         NTSTATUS status;
9711
9712         if (tevent_req_is_nterror(req, &status)) {
9713                 tevent_req_received(req);
9714                 return status;
9715         }
9716
9717         /* Steal possbile out parameters to the callers context */
9718         talloc_steal(mem_ctx, state->out_mem_ctx);
9719
9720         /* Return result */
9721         *result = state->orig.out.result;
9722
9723         tevent_req_received(req);
9724         return NT_STATUS_OK;
9725 }
9726
9727 NTSTATUS rpccli_samr_SetUserInfo2(struct rpc_pipe_client *cli,
9728                                   TALLOC_CTX *mem_ctx,
9729                                   struct policy_handle *user_handle /* [in] [ref] */,
9730                                   enum samr_UserInfoLevel level /* [in]  */,
9731                                   union samr_UserInfo *info /* [in] [ref,switch_is(level)] */)
9732 {
9733         struct samr_SetUserInfo2 r;
9734         NTSTATUS status;
9735
9736         /* In parameters */
9737         r.in.user_handle = user_handle;
9738         r.in.level = level;
9739         r.in.info = info;
9740
9741         if (DEBUGLEVEL >= 10) {
9742                 NDR_PRINT_IN_DEBUG(samr_SetUserInfo2, &r);
9743         }
9744
9745         status = cli->dispatch(cli,
9746                                 mem_ctx,
9747                                 &ndr_table_samr,
9748                                 NDR_SAMR_SETUSERINFO2,
9749                                 &r);
9750
9751         if (!NT_STATUS_IS_OK(status)) {
9752                 return status;
9753         }
9754
9755         if (DEBUGLEVEL >= 10) {
9756                 NDR_PRINT_OUT_DEBUG(samr_SetUserInfo2, &r);
9757         }
9758
9759         if (NT_STATUS_IS_ERR(status)) {
9760                 return status;
9761         }
9762
9763         /* Return variables */
9764
9765         /* Return result */
9766         return r.out.result;
9767 }
9768
9769 struct rpccli_samr_SetBootKeyInformation_state {
9770         struct samr_SetBootKeyInformation orig;
9771         struct samr_SetBootKeyInformation tmp;
9772         TALLOC_CTX *out_mem_ctx;
9773         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9774 };
9775
9776 static void rpccli_samr_SetBootKeyInformation_done(struct tevent_req *subreq);
9777
9778 struct tevent_req *rpccli_samr_SetBootKeyInformation_send(TALLOC_CTX *mem_ctx,
9779                                                           struct tevent_context *ev,
9780                                                           struct rpc_pipe_client *cli,
9781                                                           struct policy_handle *_connect_handle /* [in] [ref] */,
9782                                                           uint32_t _unknown1 /* [in]  */,
9783                                                           uint32_t _unknown2 /* [in]  */,
9784                                                           uint32_t _unknown3 /* [in]  */)
9785 {
9786         struct tevent_req *req;
9787         struct rpccli_samr_SetBootKeyInformation_state *state;
9788         struct tevent_req *subreq;
9789
9790         req = tevent_req_create(mem_ctx, &state,
9791                                 struct rpccli_samr_SetBootKeyInformation_state);
9792         if (req == NULL) {
9793                 return NULL;
9794         }
9795         state->out_mem_ctx = NULL;
9796         state->dispatch_recv = cli->dispatch_recv;
9797
9798         /* In parameters */
9799         state->orig.in.connect_handle = _connect_handle;
9800         state->orig.in.unknown1 = _unknown1;
9801         state->orig.in.unknown2 = _unknown2;
9802         state->orig.in.unknown3 = _unknown3;
9803
9804         /* Out parameters */
9805
9806         /* Result */
9807         ZERO_STRUCT(state->orig.out.result);
9808
9809         if (DEBUGLEVEL >= 10) {
9810                 NDR_PRINT_IN_DEBUG(samr_SetBootKeyInformation, &state->orig);
9811         }
9812
9813         /* make a temporary copy, that we pass to the dispatch function */
9814         state->tmp = state->orig;
9815
9816         subreq = cli->dispatch_send(state, ev, cli,
9817                                     &ndr_table_samr,
9818                                     NDR_SAMR_SETBOOTKEYINFORMATION,
9819                                     &state->tmp);
9820         if (tevent_req_nomem(subreq, req)) {
9821                 return tevent_req_post(req, ev);
9822         }
9823         tevent_req_set_callback(subreq, rpccli_samr_SetBootKeyInformation_done, req);
9824         return req;
9825 }
9826
9827 static void rpccli_samr_SetBootKeyInformation_done(struct tevent_req *subreq)
9828 {
9829         struct tevent_req *req = tevent_req_callback_data(
9830                 subreq, struct tevent_req);
9831         struct rpccli_samr_SetBootKeyInformation_state *state = tevent_req_data(
9832                 req, struct rpccli_samr_SetBootKeyInformation_state);
9833         NTSTATUS status;
9834         TALLOC_CTX *mem_ctx;
9835
9836         if (state->out_mem_ctx) {
9837                 mem_ctx = state->out_mem_ctx;
9838         } else {
9839                 mem_ctx = state;
9840         }
9841
9842         status = state->dispatch_recv(subreq, mem_ctx);
9843         TALLOC_FREE(subreq);
9844         if (!NT_STATUS_IS_OK(status)) {
9845                 tevent_req_nterror(req, status);
9846                 return;
9847         }
9848
9849         /* Copy out parameters */
9850
9851         /* Copy result */
9852         state->orig.out.result = state->tmp.out.result;
9853
9854         /* Reset temporary structure */
9855         ZERO_STRUCT(state->tmp);
9856
9857         if (DEBUGLEVEL >= 10) {
9858                 NDR_PRINT_OUT_DEBUG(samr_SetBootKeyInformation, &state->orig);
9859         }
9860
9861         tevent_req_done(req);
9862 }
9863
9864 NTSTATUS rpccli_samr_SetBootKeyInformation_recv(struct tevent_req *req,
9865                                                 TALLOC_CTX *mem_ctx,
9866                                                 NTSTATUS *result)
9867 {
9868         struct rpccli_samr_SetBootKeyInformation_state *state = tevent_req_data(
9869                 req, struct rpccli_samr_SetBootKeyInformation_state);
9870         NTSTATUS status;
9871
9872         if (tevent_req_is_nterror(req, &status)) {
9873                 tevent_req_received(req);
9874                 return status;
9875         }
9876
9877         /* Steal possbile out parameters to the callers context */
9878         talloc_steal(mem_ctx, state->out_mem_ctx);
9879
9880         /* Return result */
9881         *result = state->orig.out.result;
9882
9883         tevent_req_received(req);
9884         return NT_STATUS_OK;
9885 }
9886
9887 NTSTATUS rpccli_samr_SetBootKeyInformation(struct rpc_pipe_client *cli,
9888                                            TALLOC_CTX *mem_ctx,
9889                                            struct policy_handle *connect_handle /* [in] [ref] */,
9890                                            uint32_t unknown1 /* [in]  */,
9891                                            uint32_t unknown2 /* [in]  */,
9892                                            uint32_t unknown3 /* [in]  */)
9893 {
9894         struct samr_SetBootKeyInformation r;
9895         NTSTATUS status;
9896
9897         /* In parameters */
9898         r.in.connect_handle = connect_handle;
9899         r.in.unknown1 = unknown1;
9900         r.in.unknown2 = unknown2;
9901         r.in.unknown3 = unknown3;
9902
9903         if (DEBUGLEVEL >= 10) {
9904                 NDR_PRINT_IN_DEBUG(samr_SetBootKeyInformation, &r);
9905         }
9906
9907         status = cli->dispatch(cli,
9908                                 mem_ctx,
9909                                 &ndr_table_samr,
9910                                 NDR_SAMR_SETBOOTKEYINFORMATION,
9911                                 &r);
9912
9913         if (!NT_STATUS_IS_OK(status)) {
9914                 return status;
9915         }
9916
9917         if (DEBUGLEVEL >= 10) {
9918                 NDR_PRINT_OUT_DEBUG(samr_SetBootKeyInformation, &r);
9919         }
9920
9921         if (NT_STATUS_IS_ERR(status)) {
9922                 return status;
9923         }
9924
9925         /* Return variables */
9926
9927         /* Return result */
9928         return r.out.result;
9929 }
9930
9931 struct rpccli_samr_GetBootKeyInformation_state {
9932         struct samr_GetBootKeyInformation orig;
9933         struct samr_GetBootKeyInformation tmp;
9934         TALLOC_CTX *out_mem_ctx;
9935         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9936 };
9937
9938 static void rpccli_samr_GetBootKeyInformation_done(struct tevent_req *subreq);
9939
9940 struct tevent_req *rpccli_samr_GetBootKeyInformation_send(TALLOC_CTX *mem_ctx,
9941                                                           struct tevent_context *ev,
9942                                                           struct rpc_pipe_client *cli,
9943                                                           struct policy_handle *_domain_handle /* [in] [ref] */,
9944                                                           uint32_t *_unknown /* [out] [ref] */)
9945 {
9946         struct tevent_req *req;
9947         struct rpccli_samr_GetBootKeyInformation_state *state;
9948         struct tevent_req *subreq;
9949
9950         req = tevent_req_create(mem_ctx, &state,
9951                                 struct rpccli_samr_GetBootKeyInformation_state);
9952         if (req == NULL) {
9953                 return NULL;
9954         }
9955         state->out_mem_ctx = NULL;
9956         state->dispatch_recv = cli->dispatch_recv;
9957
9958         /* In parameters */
9959         state->orig.in.domain_handle = _domain_handle;
9960
9961         /* Out parameters */
9962         state->orig.out.unknown = _unknown;
9963
9964         /* Result */
9965         ZERO_STRUCT(state->orig.out.result);
9966
9967         if (DEBUGLEVEL >= 10) {
9968                 NDR_PRINT_IN_DEBUG(samr_GetBootKeyInformation, &state->orig);
9969         }
9970
9971         state->out_mem_ctx = talloc_named_const(state, 0,
9972                              "rpccli_samr_GetBootKeyInformation_out_memory");
9973         if (tevent_req_nomem(state->out_mem_ctx, req)) {
9974                 return tevent_req_post(req, ev);
9975         }
9976
9977         /* make a temporary copy, that we pass to the dispatch function */
9978         state->tmp = state->orig;
9979
9980         subreq = cli->dispatch_send(state, ev, cli,
9981                                     &ndr_table_samr,
9982                                     NDR_SAMR_GETBOOTKEYINFORMATION,
9983                                     &state->tmp);
9984         if (tevent_req_nomem(subreq, req)) {
9985                 return tevent_req_post(req, ev);
9986         }
9987         tevent_req_set_callback(subreq, rpccli_samr_GetBootKeyInformation_done, req);
9988         return req;
9989 }
9990
9991 static void rpccli_samr_GetBootKeyInformation_done(struct tevent_req *subreq)
9992 {
9993         struct tevent_req *req = tevent_req_callback_data(
9994                 subreq, struct tevent_req);
9995         struct rpccli_samr_GetBootKeyInformation_state *state = tevent_req_data(
9996                 req, struct rpccli_samr_GetBootKeyInformation_state);
9997         NTSTATUS status;
9998         TALLOC_CTX *mem_ctx;
9999
10000         if (state->out_mem_ctx) {
10001                 mem_ctx = state->out_mem_ctx;
10002         } else {
10003                 mem_ctx = state;
10004         }
10005
10006         status = state->dispatch_recv(subreq, mem_ctx);
10007         TALLOC_FREE(subreq);
10008         if (!NT_STATUS_IS_OK(status)) {
10009                 tevent_req_nterror(req, status);
10010                 return;
10011         }
10012
10013         /* Copy out parameters */
10014         *state->orig.out.unknown = *state->tmp.out.unknown;
10015
10016         /* Copy result */
10017         state->orig.out.result = state->tmp.out.result;
10018
10019         /* Reset temporary structure */
10020         ZERO_STRUCT(state->tmp);
10021
10022         if (DEBUGLEVEL >= 10) {
10023                 NDR_PRINT_OUT_DEBUG(samr_GetBootKeyInformation, &state->orig);
10024         }
10025
10026         tevent_req_done(req);
10027 }
10028
10029 NTSTATUS rpccli_samr_GetBootKeyInformation_recv(struct tevent_req *req,
10030                                                 TALLOC_CTX *mem_ctx,
10031                                                 NTSTATUS *result)
10032 {
10033         struct rpccli_samr_GetBootKeyInformation_state *state = tevent_req_data(
10034                 req, struct rpccli_samr_GetBootKeyInformation_state);
10035         NTSTATUS status;
10036
10037         if (tevent_req_is_nterror(req, &status)) {
10038                 tevent_req_received(req);
10039                 return status;
10040         }
10041
10042         /* Steal possbile out parameters to the callers context */
10043         talloc_steal(mem_ctx, state->out_mem_ctx);
10044
10045         /* Return result */
10046         *result = state->orig.out.result;
10047
10048         tevent_req_received(req);
10049         return NT_STATUS_OK;
10050 }
10051
10052 NTSTATUS rpccli_samr_GetBootKeyInformation(struct rpc_pipe_client *cli,
10053                                            TALLOC_CTX *mem_ctx,
10054                                            struct policy_handle *domain_handle /* [in] [ref] */,
10055                                            uint32_t *unknown /* [out] [ref] */)
10056 {
10057         struct samr_GetBootKeyInformation r;
10058         NTSTATUS status;
10059
10060         /* In parameters */
10061         r.in.domain_handle = domain_handle;
10062
10063         if (DEBUGLEVEL >= 10) {
10064                 NDR_PRINT_IN_DEBUG(samr_GetBootKeyInformation, &r);
10065         }
10066
10067         status = cli->dispatch(cli,
10068                                 mem_ctx,
10069                                 &ndr_table_samr,
10070                                 NDR_SAMR_GETBOOTKEYINFORMATION,
10071                                 &r);
10072
10073         if (!NT_STATUS_IS_OK(status)) {
10074                 return status;
10075         }
10076
10077         if (DEBUGLEVEL >= 10) {
10078                 NDR_PRINT_OUT_DEBUG(samr_GetBootKeyInformation, &r);
10079         }
10080
10081         if (NT_STATUS_IS_ERR(status)) {
10082                 return status;
10083         }
10084
10085         /* Return variables */
10086         *unknown = *r.out.unknown;
10087
10088         /* Return result */
10089         return r.out.result;
10090 }
10091
10092 struct rpccli_samr_Connect3_state {
10093         struct samr_Connect3 orig;
10094         struct samr_Connect3 tmp;
10095         TALLOC_CTX *out_mem_ctx;
10096         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10097 };
10098
10099 static void rpccli_samr_Connect3_done(struct tevent_req *subreq);
10100
10101 struct tevent_req *rpccli_samr_Connect3_send(TALLOC_CTX *mem_ctx,
10102                                              struct tevent_context *ev,
10103                                              struct rpc_pipe_client *cli,
10104                                              const char *_system_name /* [in] [unique,charset(UTF16)] */,
10105                                              uint32_t _unknown /* [in]  */,
10106                                              uint32_t _access_mask /* [in]  */,
10107                                              struct policy_handle *_connect_handle /* [out] [ref] */)
10108 {
10109         struct tevent_req *req;
10110         struct rpccli_samr_Connect3_state *state;
10111         struct tevent_req *subreq;
10112
10113         req = tevent_req_create(mem_ctx, &state,
10114                                 struct rpccli_samr_Connect3_state);
10115         if (req == NULL) {
10116                 return NULL;
10117         }
10118         state->out_mem_ctx = NULL;
10119         state->dispatch_recv = cli->dispatch_recv;
10120
10121         /* In parameters */
10122         state->orig.in.system_name = _system_name;
10123         state->orig.in.unknown = _unknown;
10124         state->orig.in.access_mask = _access_mask;
10125
10126         /* Out parameters */
10127         state->orig.out.connect_handle = _connect_handle;
10128
10129         /* Result */
10130         ZERO_STRUCT(state->orig.out.result);
10131
10132         if (DEBUGLEVEL >= 10) {
10133                 NDR_PRINT_IN_DEBUG(samr_Connect3, &state->orig);
10134         }
10135
10136         state->out_mem_ctx = talloc_named_const(state, 0,
10137                              "rpccli_samr_Connect3_out_memory");
10138         if (tevent_req_nomem(state->out_mem_ctx, req)) {
10139                 return tevent_req_post(req, ev);
10140         }
10141
10142         /* make a temporary copy, that we pass to the dispatch function */
10143         state->tmp = state->orig;
10144
10145         subreq = cli->dispatch_send(state, ev, cli,
10146                                     &ndr_table_samr,
10147                                     NDR_SAMR_CONNECT3,
10148                                     &state->tmp);
10149         if (tevent_req_nomem(subreq, req)) {
10150                 return tevent_req_post(req, ev);
10151         }
10152         tevent_req_set_callback(subreq, rpccli_samr_Connect3_done, req);
10153         return req;
10154 }
10155
10156 static void rpccli_samr_Connect3_done(struct tevent_req *subreq)
10157 {
10158         struct tevent_req *req = tevent_req_callback_data(
10159                 subreq, struct tevent_req);
10160         struct rpccli_samr_Connect3_state *state = tevent_req_data(
10161                 req, struct rpccli_samr_Connect3_state);
10162         NTSTATUS status;
10163         TALLOC_CTX *mem_ctx;
10164
10165         if (state->out_mem_ctx) {
10166                 mem_ctx = state->out_mem_ctx;
10167         } else {
10168                 mem_ctx = state;
10169         }
10170
10171         status = state->dispatch_recv(subreq, mem_ctx);
10172         TALLOC_FREE(subreq);
10173         if (!NT_STATUS_IS_OK(status)) {
10174                 tevent_req_nterror(req, status);
10175                 return;
10176         }
10177
10178         /* Copy out parameters */
10179         *state->orig.out.connect_handle = *state->tmp.out.connect_handle;
10180
10181         /* Copy result */
10182         state->orig.out.result = state->tmp.out.result;
10183
10184         /* Reset temporary structure */
10185         ZERO_STRUCT(state->tmp);
10186
10187         if (DEBUGLEVEL >= 10) {
10188                 NDR_PRINT_OUT_DEBUG(samr_Connect3, &state->orig);
10189         }
10190
10191         tevent_req_done(req);
10192 }
10193
10194 NTSTATUS rpccli_samr_Connect3_recv(struct tevent_req *req,
10195                                    TALLOC_CTX *mem_ctx,
10196                                    NTSTATUS *result)
10197 {
10198         struct rpccli_samr_Connect3_state *state = tevent_req_data(
10199                 req, struct rpccli_samr_Connect3_state);
10200         NTSTATUS status;
10201
10202         if (tevent_req_is_nterror(req, &status)) {
10203                 tevent_req_received(req);
10204                 return status;
10205         }
10206
10207         /* Steal possbile out parameters to the callers context */
10208         talloc_steal(mem_ctx, state->out_mem_ctx);
10209
10210         /* Return result */
10211         *result = state->orig.out.result;
10212
10213         tevent_req_received(req);
10214         return NT_STATUS_OK;
10215 }
10216
10217 NTSTATUS rpccli_samr_Connect3(struct rpc_pipe_client *cli,
10218                               TALLOC_CTX *mem_ctx,
10219                               const char *system_name /* [in] [unique,charset(UTF16)] */,
10220                               uint32_t unknown /* [in]  */,
10221                               uint32_t access_mask /* [in]  */,
10222                               struct policy_handle *connect_handle /* [out] [ref] */)
10223 {
10224         struct samr_Connect3 r;
10225         NTSTATUS status;
10226
10227         /* In parameters */
10228         r.in.system_name = system_name;
10229         r.in.unknown = unknown;
10230         r.in.access_mask = access_mask;
10231
10232         if (DEBUGLEVEL >= 10) {
10233                 NDR_PRINT_IN_DEBUG(samr_Connect3, &r);
10234         }
10235
10236         status = cli->dispatch(cli,
10237                                 mem_ctx,
10238                                 &ndr_table_samr,
10239                                 NDR_SAMR_CONNECT3,
10240                                 &r);
10241
10242         if (!NT_STATUS_IS_OK(status)) {
10243                 return status;
10244         }
10245
10246         if (DEBUGLEVEL >= 10) {
10247                 NDR_PRINT_OUT_DEBUG(samr_Connect3, &r);
10248         }
10249
10250         if (NT_STATUS_IS_ERR(status)) {
10251                 return status;
10252         }
10253
10254         /* Return variables */
10255         *connect_handle = *r.out.connect_handle;
10256
10257         /* Return result */
10258         return r.out.result;
10259 }
10260
10261 struct rpccli_samr_Connect4_state {
10262         struct samr_Connect4 orig;
10263         struct samr_Connect4 tmp;
10264         TALLOC_CTX *out_mem_ctx;
10265         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10266 };
10267
10268 static void rpccli_samr_Connect4_done(struct tevent_req *subreq);
10269
10270 struct tevent_req *rpccli_samr_Connect4_send(TALLOC_CTX *mem_ctx,
10271                                              struct tevent_context *ev,
10272                                              struct rpc_pipe_client *cli,
10273                                              const char *_system_name /* [in] [unique,charset(UTF16)] */,
10274                                              enum samr_ConnectVersion _client_version /* [in]  */,
10275                                              uint32_t _access_mask /* [in]  */,
10276                                              struct policy_handle *_connect_handle /* [out] [ref] */)
10277 {
10278         struct tevent_req *req;
10279         struct rpccli_samr_Connect4_state *state;
10280         struct tevent_req *subreq;
10281
10282         req = tevent_req_create(mem_ctx, &state,
10283                                 struct rpccli_samr_Connect4_state);
10284         if (req == NULL) {
10285                 return NULL;
10286         }
10287         state->out_mem_ctx = NULL;
10288         state->dispatch_recv = cli->dispatch_recv;
10289
10290         /* In parameters */
10291         state->orig.in.system_name = _system_name;
10292         state->orig.in.client_version = _client_version;
10293         state->orig.in.access_mask = _access_mask;
10294
10295         /* Out parameters */
10296         state->orig.out.connect_handle = _connect_handle;
10297
10298         /* Result */
10299         ZERO_STRUCT(state->orig.out.result);
10300
10301         if (DEBUGLEVEL >= 10) {
10302                 NDR_PRINT_IN_DEBUG(samr_Connect4, &state->orig);
10303         }
10304
10305         state->out_mem_ctx = talloc_named_const(state, 0,
10306                              "rpccli_samr_Connect4_out_memory");
10307         if (tevent_req_nomem(state->out_mem_ctx, req)) {
10308                 return tevent_req_post(req, ev);
10309         }
10310
10311         /* make a temporary copy, that we pass to the dispatch function */
10312         state->tmp = state->orig;
10313
10314         subreq = cli->dispatch_send(state, ev, cli,
10315                                     &ndr_table_samr,
10316                                     NDR_SAMR_CONNECT4,
10317                                     &state->tmp);
10318         if (tevent_req_nomem(subreq, req)) {
10319                 return tevent_req_post(req, ev);
10320         }
10321         tevent_req_set_callback(subreq, rpccli_samr_Connect4_done, req);
10322         return req;
10323 }
10324
10325 static void rpccli_samr_Connect4_done(struct tevent_req *subreq)
10326 {
10327         struct tevent_req *req = tevent_req_callback_data(
10328                 subreq, struct tevent_req);
10329         struct rpccli_samr_Connect4_state *state = tevent_req_data(
10330                 req, struct rpccli_samr_Connect4_state);
10331         NTSTATUS status;
10332         TALLOC_CTX *mem_ctx;
10333
10334         if (state->out_mem_ctx) {
10335                 mem_ctx = state->out_mem_ctx;
10336         } else {
10337                 mem_ctx = state;
10338         }
10339
10340         status = state->dispatch_recv(subreq, mem_ctx);
10341         TALLOC_FREE(subreq);
10342         if (!NT_STATUS_IS_OK(status)) {
10343                 tevent_req_nterror(req, status);
10344                 return;
10345         }
10346
10347         /* Copy out parameters */
10348         *state->orig.out.connect_handle = *state->tmp.out.connect_handle;
10349
10350         /* Copy result */
10351         state->orig.out.result = state->tmp.out.result;
10352
10353         /* Reset temporary structure */
10354         ZERO_STRUCT(state->tmp);
10355
10356         if (DEBUGLEVEL >= 10) {
10357                 NDR_PRINT_OUT_DEBUG(samr_Connect4, &state->orig);
10358         }
10359
10360         tevent_req_done(req);
10361 }
10362
10363 NTSTATUS rpccli_samr_Connect4_recv(struct tevent_req *req,
10364                                    TALLOC_CTX *mem_ctx,
10365                                    NTSTATUS *result)
10366 {
10367         struct rpccli_samr_Connect4_state *state = tevent_req_data(
10368                 req, struct rpccli_samr_Connect4_state);
10369         NTSTATUS status;
10370
10371         if (tevent_req_is_nterror(req, &status)) {
10372                 tevent_req_received(req);
10373                 return status;
10374         }
10375
10376         /* Steal possbile out parameters to the callers context */
10377         talloc_steal(mem_ctx, state->out_mem_ctx);
10378
10379         /* Return result */
10380         *result = state->orig.out.result;
10381
10382         tevent_req_received(req);
10383         return NT_STATUS_OK;
10384 }
10385
10386 NTSTATUS rpccli_samr_Connect4(struct rpc_pipe_client *cli,
10387                               TALLOC_CTX *mem_ctx,
10388                               const char *system_name /* [in] [unique,charset(UTF16)] */,
10389                               enum samr_ConnectVersion client_version /* [in]  */,
10390                               uint32_t access_mask /* [in]  */,
10391                               struct policy_handle *connect_handle /* [out] [ref] */)
10392 {
10393         struct samr_Connect4 r;
10394         NTSTATUS status;
10395
10396         /* In parameters */
10397         r.in.system_name = system_name;
10398         r.in.client_version = client_version;
10399         r.in.access_mask = access_mask;
10400
10401         if (DEBUGLEVEL >= 10) {
10402                 NDR_PRINT_IN_DEBUG(samr_Connect4, &r);
10403         }
10404
10405         status = cli->dispatch(cli,
10406                                 mem_ctx,
10407                                 &ndr_table_samr,
10408                                 NDR_SAMR_CONNECT4,
10409                                 &r);
10410
10411         if (!NT_STATUS_IS_OK(status)) {
10412                 return status;
10413         }
10414
10415         if (DEBUGLEVEL >= 10) {
10416                 NDR_PRINT_OUT_DEBUG(samr_Connect4, &r);
10417         }
10418
10419         if (NT_STATUS_IS_ERR(status)) {
10420                 return status;
10421         }
10422
10423         /* Return variables */
10424         *connect_handle = *r.out.connect_handle;
10425
10426         /* Return result */
10427         return r.out.result;
10428 }
10429
10430 struct rpccli_samr_ChangePasswordUser3_state {
10431         struct samr_ChangePasswordUser3 orig;
10432         struct samr_ChangePasswordUser3 tmp;
10433         TALLOC_CTX *out_mem_ctx;
10434         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10435 };
10436
10437 static void rpccli_samr_ChangePasswordUser3_done(struct tevent_req *subreq);
10438
10439 struct tevent_req *rpccli_samr_ChangePasswordUser3_send(TALLOC_CTX *mem_ctx,
10440                                                         struct tevent_context *ev,
10441                                                         struct rpc_pipe_client *cli,
10442                                                         struct lsa_String *_server /* [in] [unique] */,
10443                                                         struct lsa_String *_account /* [in] [ref] */,
10444                                                         struct samr_CryptPassword *_nt_password /* [in] [unique] */,
10445                                                         struct samr_Password *_nt_verifier /* [in] [unique] */,
10446                                                         uint8_t _lm_change /* [in]  */,
10447                                                         struct samr_CryptPassword *_lm_password /* [in] [unique] */,
10448                                                         struct samr_Password *_lm_verifier /* [in] [unique] */,
10449                                                         struct samr_CryptPassword *_password3 /* [in] [unique] */,
10450                                                         struct samr_DomInfo1 **_dominfo /* [out] [ref] */,
10451                                                         struct userPwdChangeFailureInformation **_reject /* [out] [ref] */)
10452 {
10453         struct tevent_req *req;
10454         struct rpccli_samr_ChangePasswordUser3_state *state;
10455         struct tevent_req *subreq;
10456
10457         req = tevent_req_create(mem_ctx, &state,
10458                                 struct rpccli_samr_ChangePasswordUser3_state);
10459         if (req == NULL) {
10460                 return NULL;
10461         }
10462         state->out_mem_ctx = NULL;
10463         state->dispatch_recv = cli->dispatch_recv;
10464
10465         /* In parameters */
10466         state->orig.in.server = _server;
10467         state->orig.in.account = _account;
10468         state->orig.in.nt_password = _nt_password;
10469         state->orig.in.nt_verifier = _nt_verifier;
10470         state->orig.in.lm_change = _lm_change;
10471         state->orig.in.lm_password = _lm_password;
10472         state->orig.in.lm_verifier = _lm_verifier;
10473         state->orig.in.password3 = _password3;
10474
10475         /* Out parameters */
10476         state->orig.out.dominfo = _dominfo;
10477         state->orig.out.reject = _reject;
10478
10479         /* Result */
10480         ZERO_STRUCT(state->orig.out.result);
10481
10482         if (DEBUGLEVEL >= 10) {
10483                 NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser3, &state->orig);
10484         }
10485
10486         state->out_mem_ctx = talloc_named_const(state, 0,
10487                              "rpccli_samr_ChangePasswordUser3_out_memory");
10488         if (tevent_req_nomem(state->out_mem_ctx, req)) {
10489                 return tevent_req_post(req, ev);
10490         }
10491
10492         /* make a temporary copy, that we pass to the dispatch function */
10493         state->tmp = state->orig;
10494
10495         subreq = cli->dispatch_send(state, ev, cli,
10496                                     &ndr_table_samr,
10497                                     NDR_SAMR_CHANGEPASSWORDUSER3,
10498                                     &state->tmp);
10499         if (tevent_req_nomem(subreq, req)) {
10500                 return tevent_req_post(req, ev);
10501         }
10502         tevent_req_set_callback(subreq, rpccli_samr_ChangePasswordUser3_done, req);
10503         return req;
10504 }
10505
10506 static void rpccli_samr_ChangePasswordUser3_done(struct tevent_req *subreq)
10507 {
10508         struct tevent_req *req = tevent_req_callback_data(
10509                 subreq, struct tevent_req);
10510         struct rpccli_samr_ChangePasswordUser3_state *state = tevent_req_data(
10511                 req, struct rpccli_samr_ChangePasswordUser3_state);
10512         NTSTATUS status;
10513         TALLOC_CTX *mem_ctx;
10514
10515         if (state->out_mem_ctx) {
10516                 mem_ctx = state->out_mem_ctx;
10517         } else {
10518                 mem_ctx = state;
10519         }
10520
10521         status = state->dispatch_recv(subreq, mem_ctx);
10522         TALLOC_FREE(subreq);
10523         if (!NT_STATUS_IS_OK(status)) {
10524                 tevent_req_nterror(req, status);
10525                 return;
10526         }
10527
10528         /* Copy out parameters */
10529         *state->orig.out.dominfo = *state->tmp.out.dominfo;
10530         *state->orig.out.reject = *state->tmp.out.reject;
10531
10532         /* Copy result */
10533         state->orig.out.result = state->tmp.out.result;
10534
10535         /* Reset temporary structure */
10536         ZERO_STRUCT(state->tmp);
10537
10538         if (DEBUGLEVEL >= 10) {
10539                 NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser3, &state->orig);
10540         }
10541
10542         tevent_req_done(req);
10543 }
10544
10545 NTSTATUS rpccli_samr_ChangePasswordUser3_recv(struct tevent_req *req,
10546                                               TALLOC_CTX *mem_ctx,
10547                                               NTSTATUS *result)
10548 {
10549         struct rpccli_samr_ChangePasswordUser3_state *state = tevent_req_data(
10550                 req, struct rpccli_samr_ChangePasswordUser3_state);
10551         NTSTATUS status;
10552
10553         if (tevent_req_is_nterror(req, &status)) {
10554                 tevent_req_received(req);
10555                 return status;
10556         }
10557
10558         /* Steal possbile out parameters to the callers context */
10559         talloc_steal(mem_ctx, state->out_mem_ctx);
10560
10561         /* Return result */
10562         *result = state->orig.out.result;
10563
10564         tevent_req_received(req);
10565         return NT_STATUS_OK;
10566 }
10567
10568 NTSTATUS rpccli_samr_ChangePasswordUser3(struct rpc_pipe_client *cli,
10569                                          TALLOC_CTX *mem_ctx,
10570                                          struct lsa_String *server /* [in] [unique] */,
10571                                          struct lsa_String *account /* [in] [ref] */,
10572                                          struct samr_CryptPassword *nt_password /* [in] [unique] */,
10573                                          struct samr_Password *nt_verifier /* [in] [unique] */,
10574                                          uint8_t lm_change /* [in]  */,
10575                                          struct samr_CryptPassword *lm_password /* [in] [unique] */,
10576                                          struct samr_Password *lm_verifier /* [in] [unique] */,
10577                                          struct samr_CryptPassword *password3 /* [in] [unique] */,
10578                                          struct samr_DomInfo1 **dominfo /* [out] [ref] */,
10579                                          struct userPwdChangeFailureInformation **reject /* [out] [ref] */)
10580 {
10581         struct samr_ChangePasswordUser3 r;
10582         NTSTATUS status;
10583
10584         /* In parameters */
10585         r.in.server = server;
10586         r.in.account = account;
10587         r.in.nt_password = nt_password;
10588         r.in.nt_verifier = nt_verifier;
10589         r.in.lm_change = lm_change;
10590         r.in.lm_password = lm_password;
10591         r.in.lm_verifier = lm_verifier;
10592         r.in.password3 = password3;
10593
10594         if (DEBUGLEVEL >= 10) {
10595                 NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser3, &r);
10596         }
10597
10598         status = cli->dispatch(cli,
10599                                 mem_ctx,
10600                                 &ndr_table_samr,
10601                                 NDR_SAMR_CHANGEPASSWORDUSER3,
10602                                 &r);
10603
10604         if (!NT_STATUS_IS_OK(status)) {
10605                 return status;
10606         }
10607
10608         if (DEBUGLEVEL >= 10) {
10609                 NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser3, &r);
10610         }
10611
10612         if (NT_STATUS_IS_ERR(status)) {
10613                 return status;
10614         }
10615
10616         /* Return variables */
10617         *dominfo = *r.out.dominfo;
10618         *reject = *r.out.reject;
10619
10620         /* Return result */
10621         return r.out.result;
10622 }
10623
10624 struct rpccli_samr_Connect5_state {
10625         struct samr_Connect5 orig;
10626         struct samr_Connect5 tmp;
10627         TALLOC_CTX *out_mem_ctx;
10628         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10629 };
10630
10631 static void rpccli_samr_Connect5_done(struct tevent_req *subreq);
10632
10633 struct tevent_req *rpccli_samr_Connect5_send(TALLOC_CTX *mem_ctx,
10634                                              struct tevent_context *ev,
10635                                              struct rpc_pipe_client *cli,
10636                                              const char *_system_name /* [in] [unique,charset(UTF16)] */,
10637                                              uint32_t _access_mask /* [in]  */,
10638                                              uint32_t _level_in /* [in]  */,
10639                                              union samr_ConnectInfo *_info_in /* [in] [ref,switch_is(level_in)] */,
10640                                              uint32_t *_level_out /* [out] [ref] */,
10641                                              union samr_ConnectInfo *_info_out /* [out] [ref,switch_is(*level_out)] */,
10642                                              struct policy_handle *_connect_handle /* [out] [ref] */)
10643 {
10644         struct tevent_req *req;
10645         struct rpccli_samr_Connect5_state *state;
10646         struct tevent_req *subreq;
10647
10648         req = tevent_req_create(mem_ctx, &state,
10649                                 struct rpccli_samr_Connect5_state);
10650         if (req == NULL) {
10651                 return NULL;
10652         }
10653         state->out_mem_ctx = NULL;
10654         state->dispatch_recv = cli->dispatch_recv;
10655
10656         /* In parameters */
10657         state->orig.in.system_name = _system_name;
10658         state->orig.in.access_mask = _access_mask;
10659         state->orig.in.level_in = _level_in;
10660         state->orig.in.info_in = _info_in;
10661
10662         /* Out parameters */
10663         state->orig.out.level_out = _level_out;
10664         state->orig.out.info_out = _info_out;
10665         state->orig.out.connect_handle = _connect_handle;
10666
10667         /* Result */
10668         ZERO_STRUCT(state->orig.out.result);
10669
10670         if (DEBUGLEVEL >= 10) {
10671                 NDR_PRINT_IN_DEBUG(samr_Connect5, &state->orig);
10672         }
10673
10674         state->out_mem_ctx = talloc_named_const(state, 0,
10675                              "rpccli_samr_Connect5_out_memory");
10676         if (tevent_req_nomem(state->out_mem_ctx, req)) {
10677                 return tevent_req_post(req, ev);
10678         }
10679
10680         /* make a temporary copy, that we pass to the dispatch function */
10681         state->tmp = state->orig;
10682
10683         subreq = cli->dispatch_send(state, ev, cli,
10684                                     &ndr_table_samr,
10685                                     NDR_SAMR_CONNECT5,
10686                                     &state->tmp);
10687         if (tevent_req_nomem(subreq, req)) {
10688                 return tevent_req_post(req, ev);
10689         }
10690         tevent_req_set_callback(subreq, rpccli_samr_Connect5_done, req);
10691         return req;
10692 }
10693
10694 static void rpccli_samr_Connect5_done(struct tevent_req *subreq)
10695 {
10696         struct tevent_req *req = tevent_req_callback_data(
10697                 subreq, struct tevent_req);
10698         struct rpccli_samr_Connect5_state *state = tevent_req_data(
10699                 req, struct rpccli_samr_Connect5_state);
10700         NTSTATUS status;
10701         TALLOC_CTX *mem_ctx;
10702
10703         if (state->out_mem_ctx) {
10704                 mem_ctx = state->out_mem_ctx;
10705         } else {
10706                 mem_ctx = state;
10707         }
10708
10709         status = state->dispatch_recv(subreq, mem_ctx);
10710         TALLOC_FREE(subreq);
10711         if (!NT_STATUS_IS_OK(status)) {
10712                 tevent_req_nterror(req, status);
10713                 return;
10714         }
10715
10716         /* Copy out parameters */
10717         *state->orig.out.level_out = *state->tmp.out.level_out;
10718         *state->orig.out.info_out = *state->tmp.out.info_out;
10719         *state->orig.out.connect_handle = *state->tmp.out.connect_handle;
10720
10721         /* Copy result */
10722         state->orig.out.result = state->tmp.out.result;
10723
10724         /* Reset temporary structure */
10725         ZERO_STRUCT(state->tmp);
10726
10727         if (DEBUGLEVEL >= 10) {
10728                 NDR_PRINT_OUT_DEBUG(samr_Connect5, &state->orig);
10729         }
10730
10731         tevent_req_done(req);
10732 }
10733
10734 NTSTATUS rpccli_samr_Connect5_recv(struct tevent_req *req,
10735                                    TALLOC_CTX *mem_ctx,
10736                                    NTSTATUS *result)
10737 {
10738         struct rpccli_samr_Connect5_state *state = tevent_req_data(
10739                 req, struct rpccli_samr_Connect5_state);
10740         NTSTATUS status;
10741
10742         if (tevent_req_is_nterror(req, &status)) {
10743                 tevent_req_received(req);
10744                 return status;
10745         }
10746
10747         /* Steal possbile out parameters to the callers context */
10748         talloc_steal(mem_ctx, state->out_mem_ctx);
10749
10750         /* Return result */
10751         *result = state->orig.out.result;
10752
10753         tevent_req_received(req);
10754         return NT_STATUS_OK;
10755 }
10756
10757 NTSTATUS rpccli_samr_Connect5(struct rpc_pipe_client *cli,
10758                               TALLOC_CTX *mem_ctx,
10759                               const char *system_name /* [in] [unique,charset(UTF16)] */,
10760                               uint32_t access_mask /* [in]  */,
10761                               uint32_t level_in /* [in]  */,
10762                               union samr_ConnectInfo *info_in /* [in] [ref,switch_is(level_in)] */,
10763                               uint32_t *level_out /* [out] [ref] */,
10764                               union samr_ConnectInfo *info_out /* [out] [ref,switch_is(*level_out)] */,
10765                               struct policy_handle *connect_handle /* [out] [ref] */)
10766 {
10767         struct samr_Connect5 r;
10768         NTSTATUS status;
10769
10770         /* In parameters */
10771         r.in.system_name = system_name;
10772         r.in.access_mask = access_mask;
10773         r.in.level_in = level_in;
10774         r.in.info_in = info_in;
10775
10776         if (DEBUGLEVEL >= 10) {
10777                 NDR_PRINT_IN_DEBUG(samr_Connect5, &r);
10778         }
10779
10780         status = cli->dispatch(cli,
10781                                 mem_ctx,
10782                                 &ndr_table_samr,
10783                                 NDR_SAMR_CONNECT5,
10784                                 &r);
10785
10786         if (!NT_STATUS_IS_OK(status)) {
10787                 return status;
10788         }
10789
10790         if (DEBUGLEVEL >= 10) {
10791                 NDR_PRINT_OUT_DEBUG(samr_Connect5, &r);
10792         }
10793
10794         if (NT_STATUS_IS_ERR(status)) {
10795                 return status;
10796         }
10797
10798         /* Return variables */
10799         *level_out = *r.out.level_out;
10800         *info_out = *r.out.info_out;
10801         *connect_handle = *r.out.connect_handle;
10802
10803         /* Return result */
10804         return r.out.result;
10805 }
10806
10807 struct rpccli_samr_RidToSid_state {
10808         struct samr_RidToSid orig;
10809         struct samr_RidToSid tmp;
10810         TALLOC_CTX *out_mem_ctx;
10811         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10812 };
10813
10814 static void rpccli_samr_RidToSid_done(struct tevent_req *subreq);
10815
10816 struct tevent_req *rpccli_samr_RidToSid_send(TALLOC_CTX *mem_ctx,
10817                                              struct tevent_context *ev,
10818                                              struct rpc_pipe_client *cli,
10819                                              struct policy_handle *_domain_handle /* [in] [ref] */,
10820                                              uint32_t _rid /* [in]  */,
10821                                              struct dom_sid2 **_sid /* [out] [ref] */)
10822 {
10823         struct tevent_req *req;
10824         struct rpccli_samr_RidToSid_state *state;
10825         struct tevent_req *subreq;
10826
10827         req = tevent_req_create(mem_ctx, &state,
10828                                 struct rpccli_samr_RidToSid_state);
10829         if (req == NULL) {
10830                 return NULL;
10831         }
10832         state->out_mem_ctx = NULL;
10833         state->dispatch_recv = cli->dispatch_recv;
10834
10835         /* In parameters */
10836         state->orig.in.domain_handle = _domain_handle;
10837         state->orig.in.rid = _rid;
10838
10839         /* Out parameters */
10840         state->orig.out.sid = _sid;
10841
10842         /* Result */
10843         ZERO_STRUCT(state->orig.out.result);
10844
10845         if (DEBUGLEVEL >= 10) {
10846                 NDR_PRINT_IN_DEBUG(samr_RidToSid, &state->orig);
10847         }
10848
10849         state->out_mem_ctx = talloc_named_const(state, 0,
10850                              "rpccli_samr_RidToSid_out_memory");
10851         if (tevent_req_nomem(state->out_mem_ctx, req)) {
10852                 return tevent_req_post(req, ev);
10853         }
10854
10855         /* make a temporary copy, that we pass to the dispatch function */
10856         state->tmp = state->orig;
10857
10858         subreq = cli->dispatch_send(state, ev, cli,
10859                                     &ndr_table_samr,
10860                                     NDR_SAMR_RIDTOSID,
10861                                     &state->tmp);
10862         if (tevent_req_nomem(subreq, req)) {
10863                 return tevent_req_post(req, ev);
10864         }
10865         tevent_req_set_callback(subreq, rpccli_samr_RidToSid_done, req);
10866         return req;
10867 }
10868
10869 static void rpccli_samr_RidToSid_done(struct tevent_req *subreq)
10870 {
10871         struct tevent_req *req = tevent_req_callback_data(
10872                 subreq, struct tevent_req);
10873         struct rpccli_samr_RidToSid_state *state = tevent_req_data(
10874                 req, struct rpccli_samr_RidToSid_state);
10875         NTSTATUS status;
10876         TALLOC_CTX *mem_ctx;
10877
10878         if (state->out_mem_ctx) {
10879                 mem_ctx = state->out_mem_ctx;
10880         } else {
10881                 mem_ctx = state;
10882         }
10883
10884         status = state->dispatch_recv(subreq, mem_ctx);
10885         TALLOC_FREE(subreq);
10886         if (!NT_STATUS_IS_OK(status)) {
10887                 tevent_req_nterror(req, status);
10888                 return;
10889         }
10890
10891         /* Copy out parameters */
10892         *state->orig.out.sid = *state->tmp.out.sid;
10893
10894         /* Copy result */
10895         state->orig.out.result = state->tmp.out.result;
10896
10897         /* Reset temporary structure */
10898         ZERO_STRUCT(state->tmp);
10899
10900         if (DEBUGLEVEL >= 10) {
10901                 NDR_PRINT_OUT_DEBUG(samr_RidToSid, &state->orig);
10902         }
10903
10904         tevent_req_done(req);
10905 }
10906
10907 NTSTATUS rpccli_samr_RidToSid_recv(struct tevent_req *req,
10908                                    TALLOC_CTX *mem_ctx,
10909                                    NTSTATUS *result)
10910 {
10911         struct rpccli_samr_RidToSid_state *state = tevent_req_data(
10912                 req, struct rpccli_samr_RidToSid_state);
10913         NTSTATUS status;
10914
10915         if (tevent_req_is_nterror(req, &status)) {
10916                 tevent_req_received(req);
10917                 return status;
10918         }
10919
10920         /* Steal possbile out parameters to the callers context */
10921         talloc_steal(mem_ctx, state->out_mem_ctx);
10922
10923         /* Return result */
10924         *result = state->orig.out.result;
10925
10926         tevent_req_received(req);
10927         return NT_STATUS_OK;
10928 }
10929
10930 NTSTATUS rpccli_samr_RidToSid(struct rpc_pipe_client *cli,
10931                               TALLOC_CTX *mem_ctx,
10932                               struct policy_handle *domain_handle /* [in] [ref] */,
10933                               uint32_t rid /* [in]  */,
10934                               struct dom_sid2 **sid /* [out] [ref] */)
10935 {
10936         struct samr_RidToSid r;
10937         NTSTATUS status;
10938
10939         /* In parameters */
10940         r.in.domain_handle = domain_handle;
10941         r.in.rid = rid;
10942
10943         if (DEBUGLEVEL >= 10) {
10944                 NDR_PRINT_IN_DEBUG(samr_RidToSid, &r);
10945         }
10946
10947         status = cli->dispatch(cli,
10948                                 mem_ctx,
10949                                 &ndr_table_samr,
10950                                 NDR_SAMR_RIDTOSID,
10951                                 &r);
10952
10953         if (!NT_STATUS_IS_OK(status)) {
10954                 return status;
10955         }
10956
10957         if (DEBUGLEVEL >= 10) {
10958                 NDR_PRINT_OUT_DEBUG(samr_RidToSid, &r);
10959         }
10960
10961         if (NT_STATUS_IS_ERR(status)) {
10962                 return status;
10963         }
10964
10965         /* Return variables */
10966         *sid = *r.out.sid;
10967
10968         /* Return result */
10969         return r.out.result;
10970 }
10971
10972 struct rpccli_samr_SetDsrmPassword_state {
10973         struct samr_SetDsrmPassword orig;
10974         struct samr_SetDsrmPassword tmp;
10975         TALLOC_CTX *out_mem_ctx;
10976         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10977 };
10978
10979 static void rpccli_samr_SetDsrmPassword_done(struct tevent_req *subreq);
10980
10981 struct tevent_req *rpccli_samr_SetDsrmPassword_send(TALLOC_CTX *mem_ctx,
10982                                                     struct tevent_context *ev,
10983                                                     struct rpc_pipe_client *cli,
10984                                                     struct lsa_String *_name /* [in] [unique] */,
10985                                                     uint32_t _unknown /* [in]  */,
10986                                                     struct samr_Password *_hash /* [in] [unique] */)
10987 {
10988         struct tevent_req *req;
10989         struct rpccli_samr_SetDsrmPassword_state *state;
10990         struct tevent_req *subreq;
10991
10992         req = tevent_req_create(mem_ctx, &state,
10993                                 struct rpccli_samr_SetDsrmPassword_state);
10994         if (req == NULL) {
10995                 return NULL;
10996         }
10997         state->out_mem_ctx = NULL;
10998         state->dispatch_recv = cli->dispatch_recv;
10999
11000         /* In parameters */
11001         state->orig.in.name = _name;
11002         state->orig.in.unknown = _unknown;
11003         state->orig.in.hash = _hash;
11004
11005         /* Out parameters */
11006
11007         /* Result */
11008         ZERO_STRUCT(state->orig.out.result);
11009
11010         if (DEBUGLEVEL >= 10) {
11011                 NDR_PRINT_IN_DEBUG(samr_SetDsrmPassword, &state->orig);
11012         }
11013
11014         /* make a temporary copy, that we pass to the dispatch function */
11015         state->tmp = state->orig;
11016
11017         subreq = cli->dispatch_send(state, ev, cli,
11018                                     &ndr_table_samr,
11019                                     NDR_SAMR_SETDSRMPASSWORD,
11020                                     &state->tmp);
11021         if (tevent_req_nomem(subreq, req)) {
11022                 return tevent_req_post(req, ev);
11023         }
11024         tevent_req_set_callback(subreq, rpccli_samr_SetDsrmPassword_done, req);
11025         return req;
11026 }
11027
11028 static void rpccli_samr_SetDsrmPassword_done(struct tevent_req *subreq)
11029 {
11030         struct tevent_req *req = tevent_req_callback_data(
11031                 subreq, struct tevent_req);
11032         struct rpccli_samr_SetDsrmPassword_state *state = tevent_req_data(
11033                 req, struct rpccli_samr_SetDsrmPassword_state);
11034         NTSTATUS status;
11035         TALLOC_CTX *mem_ctx;
11036
11037         if (state->out_mem_ctx) {
11038                 mem_ctx = state->out_mem_ctx;
11039         } else {
11040                 mem_ctx = state;
11041         }
11042
11043         status = state->dispatch_recv(subreq, mem_ctx);
11044         TALLOC_FREE(subreq);
11045         if (!NT_STATUS_IS_OK(status)) {
11046                 tevent_req_nterror(req, status);
11047                 return;
11048         }
11049
11050         /* Copy out parameters */
11051
11052         /* Copy result */
11053         state->orig.out.result = state->tmp.out.result;
11054
11055         /* Reset temporary structure */
11056         ZERO_STRUCT(state->tmp);
11057
11058         if (DEBUGLEVEL >= 10) {
11059                 NDR_PRINT_OUT_DEBUG(samr_SetDsrmPassword, &state->orig);
11060         }
11061
11062         tevent_req_done(req);
11063 }
11064
11065 NTSTATUS rpccli_samr_SetDsrmPassword_recv(struct tevent_req *req,
11066                                           TALLOC_CTX *mem_ctx,
11067                                           NTSTATUS *result)
11068 {
11069         struct rpccli_samr_SetDsrmPassword_state *state = tevent_req_data(
11070                 req, struct rpccli_samr_SetDsrmPassword_state);
11071         NTSTATUS status;
11072
11073         if (tevent_req_is_nterror(req, &status)) {
11074                 tevent_req_received(req);
11075                 return status;
11076         }
11077
11078         /* Steal possbile out parameters to the callers context */
11079         talloc_steal(mem_ctx, state->out_mem_ctx);
11080
11081         /* Return result */
11082         *result = state->orig.out.result;
11083
11084         tevent_req_received(req);
11085         return NT_STATUS_OK;
11086 }
11087
11088 NTSTATUS rpccli_samr_SetDsrmPassword(struct rpc_pipe_client *cli,
11089                                      TALLOC_CTX *mem_ctx,
11090                                      struct lsa_String *name /* [in] [unique] */,
11091                                      uint32_t unknown /* [in]  */,
11092                                      struct samr_Password *hash /* [in] [unique] */)
11093 {
11094         struct samr_SetDsrmPassword r;
11095         NTSTATUS status;
11096
11097         /* In parameters */
11098         r.in.name = name;
11099         r.in.unknown = unknown;
11100         r.in.hash = hash;
11101
11102         if (DEBUGLEVEL >= 10) {
11103                 NDR_PRINT_IN_DEBUG(samr_SetDsrmPassword, &r);
11104         }
11105
11106         status = cli->dispatch(cli,
11107                                 mem_ctx,
11108                                 &ndr_table_samr,
11109                                 NDR_SAMR_SETDSRMPASSWORD,
11110                                 &r);
11111
11112         if (!NT_STATUS_IS_OK(status)) {
11113                 return status;
11114         }
11115
11116         if (DEBUGLEVEL >= 10) {
11117                 NDR_PRINT_OUT_DEBUG(samr_SetDsrmPassword, &r);
11118         }
11119
11120         if (NT_STATUS_IS_ERR(status)) {
11121                 return status;
11122         }
11123
11124         /* Return variables */
11125
11126         /* Return result */
11127         return r.out.result;
11128 }
11129
11130 struct rpccli_samr_ValidatePassword_state {
11131         struct samr_ValidatePassword orig;
11132         struct samr_ValidatePassword tmp;
11133         TALLOC_CTX *out_mem_ctx;
11134         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11135 };
11136
11137 static void rpccli_samr_ValidatePassword_done(struct tevent_req *subreq);
11138
11139 struct tevent_req *rpccli_samr_ValidatePassword_send(TALLOC_CTX *mem_ctx,
11140                                                      struct tevent_context *ev,
11141                                                      struct rpc_pipe_client *cli,
11142                                                      enum samr_ValidatePasswordLevel _level /* [in]  */,
11143                                                      union samr_ValidatePasswordReq *_req /* [in] [ref,switch_is(level)] */,
11144                                                      union samr_ValidatePasswordRep **_rep /* [out] [ref,switch_is(level)] */)
11145 {
11146         struct tevent_req *req;
11147         struct rpccli_samr_ValidatePassword_state *state;
11148         struct tevent_req *subreq;
11149
11150         req = tevent_req_create(mem_ctx, &state,
11151                                 struct rpccli_samr_ValidatePassword_state);
11152         if (req == NULL) {
11153                 return NULL;
11154         }
11155         state->out_mem_ctx = NULL;
11156         state->dispatch_recv = cli->dispatch_recv;
11157
11158         /* In parameters */
11159         state->orig.in.level = _level;
11160         state->orig.in.req = _req;
11161
11162         /* Out parameters */
11163         state->orig.out.rep = _rep;
11164
11165         /* Result */
11166         ZERO_STRUCT(state->orig.out.result);
11167
11168         if (DEBUGLEVEL >= 10) {
11169                 NDR_PRINT_IN_DEBUG(samr_ValidatePassword, &state->orig);
11170         }
11171
11172         state->out_mem_ctx = talloc_named_const(state, 0,
11173                              "rpccli_samr_ValidatePassword_out_memory");
11174         if (tevent_req_nomem(state->out_mem_ctx, req)) {
11175                 return tevent_req_post(req, ev);
11176         }
11177
11178         /* make a temporary copy, that we pass to the dispatch function */
11179         state->tmp = state->orig;
11180
11181         subreq = cli->dispatch_send(state, ev, cli,
11182                                     &ndr_table_samr,
11183                                     NDR_SAMR_VALIDATEPASSWORD,
11184                                     &state->tmp);
11185         if (tevent_req_nomem(subreq, req)) {
11186                 return tevent_req_post(req, ev);
11187         }
11188         tevent_req_set_callback(subreq, rpccli_samr_ValidatePassword_done, req);
11189         return req;
11190 }
11191
11192 static void rpccli_samr_ValidatePassword_done(struct tevent_req *subreq)
11193 {
11194         struct tevent_req *req = tevent_req_callback_data(
11195                 subreq, struct tevent_req);
11196         struct rpccli_samr_ValidatePassword_state *state = tevent_req_data(
11197                 req, struct rpccli_samr_ValidatePassword_state);
11198         NTSTATUS status;
11199         TALLOC_CTX *mem_ctx;
11200
11201         if (state->out_mem_ctx) {
11202                 mem_ctx = state->out_mem_ctx;
11203         } else {
11204                 mem_ctx = state;
11205         }
11206
11207         status = state->dispatch_recv(subreq, mem_ctx);
11208         TALLOC_FREE(subreq);
11209         if (!NT_STATUS_IS_OK(status)) {
11210                 tevent_req_nterror(req, status);
11211                 return;
11212         }
11213
11214         /* Copy out parameters */
11215         *state->orig.out.rep = *state->tmp.out.rep;
11216
11217         /* Copy result */
11218         state->orig.out.result = state->tmp.out.result;
11219
11220         /* Reset temporary structure */
11221         ZERO_STRUCT(state->tmp);
11222
11223         if (DEBUGLEVEL >= 10) {
11224                 NDR_PRINT_OUT_DEBUG(samr_ValidatePassword, &state->orig);
11225         }
11226
11227         tevent_req_done(req);
11228 }
11229
11230 NTSTATUS rpccli_samr_ValidatePassword_recv(struct tevent_req *req,
11231                                            TALLOC_CTX *mem_ctx,
11232                                            NTSTATUS *result)
11233 {
11234         struct rpccli_samr_ValidatePassword_state *state = tevent_req_data(
11235                 req, struct rpccli_samr_ValidatePassword_state);
11236         NTSTATUS status;
11237
11238         if (tevent_req_is_nterror(req, &status)) {
11239                 tevent_req_received(req);
11240                 return status;
11241         }
11242
11243         /* Steal possbile out parameters to the callers context */
11244         talloc_steal(mem_ctx, state->out_mem_ctx);
11245
11246         /* Return result */
11247         *result = state->orig.out.result;
11248
11249         tevent_req_received(req);
11250         return NT_STATUS_OK;
11251 }
11252
11253 NTSTATUS rpccli_samr_ValidatePassword(struct rpc_pipe_client *cli,
11254                                       TALLOC_CTX *mem_ctx,
11255                                       enum samr_ValidatePasswordLevel level /* [in]  */,
11256                                       union samr_ValidatePasswordReq *req /* [in] [ref,switch_is(level)] */,
11257                                       union samr_ValidatePasswordRep **rep /* [out] [ref,switch_is(level)] */)
11258 {
11259         struct samr_ValidatePassword r;
11260         NTSTATUS status;
11261
11262         /* In parameters */
11263         r.in.level = level;
11264         r.in.req = req;
11265
11266         if (DEBUGLEVEL >= 10) {
11267                 NDR_PRINT_IN_DEBUG(samr_ValidatePassword, &r);
11268         }
11269
11270         status = cli->dispatch(cli,
11271                                 mem_ctx,
11272                                 &ndr_table_samr,
11273                                 NDR_SAMR_VALIDATEPASSWORD,
11274                                 &r);
11275
11276         if (!NT_STATUS_IS_OK(status)) {
11277                 return status;
11278         }
11279
11280         if (DEBUGLEVEL >= 10) {
11281                 NDR_PRINT_OUT_DEBUG(samr_ValidatePassword, &r);
11282         }
11283
11284         if (NT_STATUS_IS_ERR(status)) {
11285                 return status;
11286         }
11287
11288         /* Return variables */
11289         *rep = *r.out.rep;
11290
11291         /* Return result */
11292         return r.out.result;
11293 }
11294