s3: Do not reference ndr_table_<pipe> in the cli_ routines directly
[ira/wip.git] / librpc / gen_ndr / cli_lsa.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_lsa.h"
8
9 struct rpccli_lsa_Close_state {
10         struct lsa_Close orig;
11         struct lsa_Close 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_lsa_Close_done(struct tevent_req *subreq);
17
18 struct tevent_req *rpccli_lsa_Close_send(TALLOC_CTX *mem_ctx,
19                                          struct tevent_context *ev,
20                                          struct rpc_pipe_client *cli,
21                                          struct policy_handle *_handle /* [in,out] [ref] */)
22 {
23         struct tevent_req *req;
24         struct rpccli_lsa_Close_state *state;
25         struct tevent_req *subreq;
26
27         req = tevent_req_create(mem_ctx, &state,
28                                 struct rpccli_lsa_Close_state);
29         if (req == NULL) {
30                 return NULL;
31         }
32         state->out_mem_ctx = NULL;
33         state->dispatch_recv = cli->dispatch_recv;
34
35         /* In parameters */
36         state->orig.in.handle = _handle;
37
38         /* Out parameters */
39         state->orig.out.handle = _handle;
40
41         /* Result */
42         ZERO_STRUCT(state->orig.out.result);
43
44         state->out_mem_ctx = talloc_named_const(state, 0,
45                              "rpccli_lsa_Close_out_memory");
46         if (tevent_req_nomem(state->out_mem_ctx, req)) {
47                 return tevent_req_post(req, ev);
48         }
49
50         /* make a temporary copy, that we pass to the dispatch function */
51         state->tmp = state->orig;
52
53         subreq = cli->dispatch_send(state, ev, cli,
54                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
55                                     NDR_LSA_CLOSE,
56                                     &state->tmp);
57         if (tevent_req_nomem(subreq, req)) {
58                 return tevent_req_post(req, ev);
59         }
60         tevent_req_set_callback(subreq, rpccli_lsa_Close_done, req);
61         return req;
62 }
63
64 static void rpccli_lsa_Close_done(struct tevent_req *subreq)
65 {
66         struct tevent_req *req = tevent_req_callback_data(
67                 subreq, struct tevent_req);
68         struct rpccli_lsa_Close_state *state = tevent_req_data(
69                 req, struct rpccli_lsa_Close_state);
70         NTSTATUS status;
71         TALLOC_CTX *mem_ctx;
72
73         if (state->out_mem_ctx) {
74                 mem_ctx = state->out_mem_ctx;
75         } else {
76                 mem_ctx = state;
77         }
78
79         status = state->dispatch_recv(subreq, mem_ctx);
80         TALLOC_FREE(subreq);
81         if (!NT_STATUS_IS_OK(status)) {
82                 tevent_req_nterror(req, status);
83                 return;
84         }
85
86         /* Copy out parameters */
87         *state->orig.out.handle = *state->tmp.out.handle;
88
89         /* Copy result */
90         state->orig.out.result = state->tmp.out.result;
91
92         /* Reset temporary structure */
93         ZERO_STRUCT(state->tmp);
94
95         tevent_req_done(req);
96 }
97
98 NTSTATUS rpccli_lsa_Close_recv(struct tevent_req *req,
99                                TALLOC_CTX *mem_ctx,
100                                NTSTATUS *result)
101 {
102         struct rpccli_lsa_Close_state *state = tevent_req_data(
103                 req, struct rpccli_lsa_Close_state);
104         NTSTATUS status;
105
106         if (tevent_req_is_nterror(req, &status)) {
107                 tevent_req_received(req);
108                 return status;
109         }
110
111         /* Steal possbile out parameters to the callers context */
112         talloc_steal(mem_ctx, state->out_mem_ctx);
113
114         /* Return result */
115         *result = state->orig.out.result;
116
117         tevent_req_received(req);
118         return NT_STATUS_OK;
119 }
120
121 NTSTATUS rpccli_lsa_Close(struct rpc_pipe_client *cli,
122                           TALLOC_CTX *mem_ctx,
123                           struct policy_handle *handle /* [in,out] [ref] */)
124 {
125         struct lsa_Close r;
126         NTSTATUS status;
127
128         /* In parameters */
129         r.in.handle = handle;
130
131         status = cli->dispatch(cli,
132                                 mem_ctx,
133                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
134                                 NDR_LSA_CLOSE,
135                                 &r);
136
137         if (!NT_STATUS_IS_OK(status)) {
138                 return status;
139         }
140
141         if (NT_STATUS_IS_ERR(status)) {
142                 return status;
143         }
144
145         /* Return variables */
146         *handle = *r.out.handle;
147
148         /* Return result */
149         return r.out.result;
150 }
151
152 struct rpccli_lsa_Delete_state {
153         struct lsa_Delete orig;
154         struct lsa_Delete tmp;
155         TALLOC_CTX *out_mem_ctx;
156         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
157 };
158
159 static void rpccli_lsa_Delete_done(struct tevent_req *subreq);
160
161 struct tevent_req *rpccli_lsa_Delete_send(TALLOC_CTX *mem_ctx,
162                                           struct tevent_context *ev,
163                                           struct rpc_pipe_client *cli,
164                                           struct policy_handle *_handle /* [in] [ref] */)
165 {
166         struct tevent_req *req;
167         struct rpccli_lsa_Delete_state *state;
168         struct tevent_req *subreq;
169
170         req = tevent_req_create(mem_ctx, &state,
171                                 struct rpccli_lsa_Delete_state);
172         if (req == NULL) {
173                 return NULL;
174         }
175         state->out_mem_ctx = NULL;
176         state->dispatch_recv = cli->dispatch_recv;
177
178         /* In parameters */
179         state->orig.in.handle = _handle;
180
181         /* Out parameters */
182
183         /* Result */
184         ZERO_STRUCT(state->orig.out.result);
185
186         /* make a temporary copy, that we pass to the dispatch function */
187         state->tmp = state->orig;
188
189         subreq = cli->dispatch_send(state, ev, cli,
190                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
191                                     NDR_LSA_DELETE,
192                                     &state->tmp);
193         if (tevent_req_nomem(subreq, req)) {
194                 return tevent_req_post(req, ev);
195         }
196         tevent_req_set_callback(subreq, rpccli_lsa_Delete_done, req);
197         return req;
198 }
199
200 static void rpccli_lsa_Delete_done(struct tevent_req *subreq)
201 {
202         struct tevent_req *req = tevent_req_callback_data(
203                 subreq, struct tevent_req);
204         struct rpccli_lsa_Delete_state *state = tevent_req_data(
205                 req, struct rpccli_lsa_Delete_state);
206         NTSTATUS status;
207         TALLOC_CTX *mem_ctx;
208
209         if (state->out_mem_ctx) {
210                 mem_ctx = state->out_mem_ctx;
211         } else {
212                 mem_ctx = state;
213         }
214
215         status = state->dispatch_recv(subreq, mem_ctx);
216         TALLOC_FREE(subreq);
217         if (!NT_STATUS_IS_OK(status)) {
218                 tevent_req_nterror(req, status);
219                 return;
220         }
221
222         /* Copy out parameters */
223
224         /* Copy result */
225         state->orig.out.result = state->tmp.out.result;
226
227         /* Reset temporary structure */
228         ZERO_STRUCT(state->tmp);
229
230         tevent_req_done(req);
231 }
232
233 NTSTATUS rpccli_lsa_Delete_recv(struct tevent_req *req,
234                                 TALLOC_CTX *mem_ctx,
235                                 NTSTATUS *result)
236 {
237         struct rpccli_lsa_Delete_state *state = tevent_req_data(
238                 req, struct rpccli_lsa_Delete_state);
239         NTSTATUS status;
240
241         if (tevent_req_is_nterror(req, &status)) {
242                 tevent_req_received(req);
243                 return status;
244         }
245
246         /* Steal possbile out parameters to the callers context */
247         talloc_steal(mem_ctx, state->out_mem_ctx);
248
249         /* Return result */
250         *result = state->orig.out.result;
251
252         tevent_req_received(req);
253         return NT_STATUS_OK;
254 }
255
256 NTSTATUS rpccli_lsa_Delete(struct rpc_pipe_client *cli,
257                            TALLOC_CTX *mem_ctx,
258                            struct policy_handle *handle /* [in] [ref] */)
259 {
260         struct lsa_Delete r;
261         NTSTATUS status;
262
263         /* In parameters */
264         r.in.handle = handle;
265
266         status = cli->dispatch(cli,
267                                 mem_ctx,
268                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
269                                 NDR_LSA_DELETE,
270                                 &r);
271
272         if (!NT_STATUS_IS_OK(status)) {
273                 return status;
274         }
275
276         if (NT_STATUS_IS_ERR(status)) {
277                 return status;
278         }
279
280         /* Return variables */
281
282         /* Return result */
283         return r.out.result;
284 }
285
286 struct rpccli_lsa_EnumPrivs_state {
287         struct lsa_EnumPrivs orig;
288         struct lsa_EnumPrivs tmp;
289         TALLOC_CTX *out_mem_ctx;
290         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
291 };
292
293 static void rpccli_lsa_EnumPrivs_done(struct tevent_req *subreq);
294
295 struct tevent_req *rpccli_lsa_EnumPrivs_send(TALLOC_CTX *mem_ctx,
296                                              struct tevent_context *ev,
297                                              struct rpc_pipe_client *cli,
298                                              struct policy_handle *_handle /* [in] [ref] */,
299                                              uint32_t *_resume_handle /* [in,out] [ref] */,
300                                              struct lsa_PrivArray *_privs /* [out] [ref] */,
301                                              uint32_t _max_count /* [in]  */)
302 {
303         struct tevent_req *req;
304         struct rpccli_lsa_EnumPrivs_state *state;
305         struct tevent_req *subreq;
306
307         req = tevent_req_create(mem_ctx, &state,
308                                 struct rpccli_lsa_EnumPrivs_state);
309         if (req == NULL) {
310                 return NULL;
311         }
312         state->out_mem_ctx = NULL;
313         state->dispatch_recv = cli->dispatch_recv;
314
315         /* In parameters */
316         state->orig.in.handle = _handle;
317         state->orig.in.resume_handle = _resume_handle;
318         state->orig.in.max_count = _max_count;
319
320         /* Out parameters */
321         state->orig.out.resume_handle = _resume_handle;
322         state->orig.out.privs = _privs;
323
324         /* Result */
325         ZERO_STRUCT(state->orig.out.result);
326
327         state->out_mem_ctx = talloc_named_const(state, 0,
328                              "rpccli_lsa_EnumPrivs_out_memory");
329         if (tevent_req_nomem(state->out_mem_ctx, req)) {
330                 return tevent_req_post(req, ev);
331         }
332
333         /* make a temporary copy, that we pass to the dispatch function */
334         state->tmp = state->orig;
335
336         subreq = cli->dispatch_send(state, ev, cli,
337                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
338                                     NDR_LSA_ENUMPRIVS,
339                                     &state->tmp);
340         if (tevent_req_nomem(subreq, req)) {
341                 return tevent_req_post(req, ev);
342         }
343         tevent_req_set_callback(subreq, rpccli_lsa_EnumPrivs_done, req);
344         return req;
345 }
346
347 static void rpccli_lsa_EnumPrivs_done(struct tevent_req *subreq)
348 {
349         struct tevent_req *req = tevent_req_callback_data(
350                 subreq, struct tevent_req);
351         struct rpccli_lsa_EnumPrivs_state *state = tevent_req_data(
352                 req, struct rpccli_lsa_EnumPrivs_state);
353         NTSTATUS status;
354         TALLOC_CTX *mem_ctx;
355
356         if (state->out_mem_ctx) {
357                 mem_ctx = state->out_mem_ctx;
358         } else {
359                 mem_ctx = state;
360         }
361
362         status = state->dispatch_recv(subreq, mem_ctx);
363         TALLOC_FREE(subreq);
364         if (!NT_STATUS_IS_OK(status)) {
365                 tevent_req_nterror(req, status);
366                 return;
367         }
368
369         /* Copy out parameters */
370         *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
371         *state->orig.out.privs = *state->tmp.out.privs;
372
373         /* Copy result */
374         state->orig.out.result = state->tmp.out.result;
375
376         /* Reset temporary structure */
377         ZERO_STRUCT(state->tmp);
378
379         tevent_req_done(req);
380 }
381
382 NTSTATUS rpccli_lsa_EnumPrivs_recv(struct tevent_req *req,
383                                    TALLOC_CTX *mem_ctx,
384                                    NTSTATUS *result)
385 {
386         struct rpccli_lsa_EnumPrivs_state *state = tevent_req_data(
387                 req, struct rpccli_lsa_EnumPrivs_state);
388         NTSTATUS status;
389
390         if (tevent_req_is_nterror(req, &status)) {
391                 tevent_req_received(req);
392                 return status;
393         }
394
395         /* Steal possbile out parameters to the callers context */
396         talloc_steal(mem_ctx, state->out_mem_ctx);
397
398         /* Return result */
399         *result = state->orig.out.result;
400
401         tevent_req_received(req);
402         return NT_STATUS_OK;
403 }
404
405 NTSTATUS rpccli_lsa_EnumPrivs(struct rpc_pipe_client *cli,
406                               TALLOC_CTX *mem_ctx,
407                               struct policy_handle *handle /* [in] [ref] */,
408                               uint32_t *resume_handle /* [in,out] [ref] */,
409                               struct lsa_PrivArray *privs /* [out] [ref] */,
410                               uint32_t max_count /* [in]  */)
411 {
412         struct lsa_EnumPrivs r;
413         NTSTATUS status;
414
415         /* In parameters */
416         r.in.handle = handle;
417         r.in.resume_handle = resume_handle;
418         r.in.max_count = max_count;
419
420         status = cli->dispatch(cli,
421                                 mem_ctx,
422                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
423                                 NDR_LSA_ENUMPRIVS,
424                                 &r);
425
426         if (!NT_STATUS_IS_OK(status)) {
427                 return status;
428         }
429
430         if (NT_STATUS_IS_ERR(status)) {
431                 return status;
432         }
433
434         /* Return variables */
435         *resume_handle = *r.out.resume_handle;
436         *privs = *r.out.privs;
437
438         /* Return result */
439         return r.out.result;
440 }
441
442 struct rpccli_lsa_QuerySecurity_state {
443         struct lsa_QuerySecurity orig;
444         struct lsa_QuerySecurity tmp;
445         TALLOC_CTX *out_mem_ctx;
446         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
447 };
448
449 static void rpccli_lsa_QuerySecurity_done(struct tevent_req *subreq);
450
451 struct tevent_req *rpccli_lsa_QuerySecurity_send(TALLOC_CTX *mem_ctx,
452                                                  struct tevent_context *ev,
453                                                  struct rpc_pipe_client *cli,
454                                                  struct policy_handle *_handle /* [in] [ref] */,
455                                                  uint32_t _sec_info /* [in]  */,
456                                                  struct sec_desc_buf **_sdbuf /* [out] [ref] */)
457 {
458         struct tevent_req *req;
459         struct rpccli_lsa_QuerySecurity_state *state;
460         struct tevent_req *subreq;
461
462         req = tevent_req_create(mem_ctx, &state,
463                                 struct rpccli_lsa_QuerySecurity_state);
464         if (req == NULL) {
465                 return NULL;
466         }
467         state->out_mem_ctx = NULL;
468         state->dispatch_recv = cli->dispatch_recv;
469
470         /* In parameters */
471         state->orig.in.handle = _handle;
472         state->orig.in.sec_info = _sec_info;
473
474         /* Out parameters */
475         state->orig.out.sdbuf = _sdbuf;
476
477         /* Result */
478         ZERO_STRUCT(state->orig.out.result);
479
480         state->out_mem_ctx = talloc_named_const(state, 0,
481                              "rpccli_lsa_QuerySecurity_out_memory");
482         if (tevent_req_nomem(state->out_mem_ctx, req)) {
483                 return tevent_req_post(req, ev);
484         }
485
486         /* make a temporary copy, that we pass to the dispatch function */
487         state->tmp = state->orig;
488
489         subreq = cli->dispatch_send(state, ev, cli,
490                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
491                                     NDR_LSA_QUERYSECURITY,
492                                     &state->tmp);
493         if (tevent_req_nomem(subreq, req)) {
494                 return tevent_req_post(req, ev);
495         }
496         tevent_req_set_callback(subreq, rpccli_lsa_QuerySecurity_done, req);
497         return req;
498 }
499
500 static void rpccli_lsa_QuerySecurity_done(struct tevent_req *subreq)
501 {
502         struct tevent_req *req = tevent_req_callback_data(
503                 subreq, struct tevent_req);
504         struct rpccli_lsa_QuerySecurity_state *state = tevent_req_data(
505                 req, struct rpccli_lsa_QuerySecurity_state);
506         NTSTATUS status;
507         TALLOC_CTX *mem_ctx;
508
509         if (state->out_mem_ctx) {
510                 mem_ctx = state->out_mem_ctx;
511         } else {
512                 mem_ctx = state;
513         }
514
515         status = state->dispatch_recv(subreq, mem_ctx);
516         TALLOC_FREE(subreq);
517         if (!NT_STATUS_IS_OK(status)) {
518                 tevent_req_nterror(req, status);
519                 return;
520         }
521
522         /* Copy out parameters */
523         *state->orig.out.sdbuf = *state->tmp.out.sdbuf;
524
525         /* Copy result */
526         state->orig.out.result = state->tmp.out.result;
527
528         /* Reset temporary structure */
529         ZERO_STRUCT(state->tmp);
530
531         tevent_req_done(req);
532 }
533
534 NTSTATUS rpccli_lsa_QuerySecurity_recv(struct tevent_req *req,
535                                        TALLOC_CTX *mem_ctx,
536                                        NTSTATUS *result)
537 {
538         struct rpccli_lsa_QuerySecurity_state *state = tevent_req_data(
539                 req, struct rpccli_lsa_QuerySecurity_state);
540         NTSTATUS status;
541
542         if (tevent_req_is_nterror(req, &status)) {
543                 tevent_req_received(req);
544                 return status;
545         }
546
547         /* Steal possbile out parameters to the callers context */
548         talloc_steal(mem_ctx, state->out_mem_ctx);
549
550         /* Return result */
551         *result = state->orig.out.result;
552
553         tevent_req_received(req);
554         return NT_STATUS_OK;
555 }
556
557 NTSTATUS rpccli_lsa_QuerySecurity(struct rpc_pipe_client *cli,
558                                   TALLOC_CTX *mem_ctx,
559                                   struct policy_handle *handle /* [in] [ref] */,
560                                   uint32_t sec_info /* [in]  */,
561                                   struct sec_desc_buf **sdbuf /* [out] [ref] */)
562 {
563         struct lsa_QuerySecurity r;
564         NTSTATUS status;
565
566         /* In parameters */
567         r.in.handle = handle;
568         r.in.sec_info = sec_info;
569
570         status = cli->dispatch(cli,
571                                 mem_ctx,
572                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
573                                 NDR_LSA_QUERYSECURITY,
574                                 &r);
575
576         if (!NT_STATUS_IS_OK(status)) {
577                 return status;
578         }
579
580         if (NT_STATUS_IS_ERR(status)) {
581                 return status;
582         }
583
584         /* Return variables */
585         *sdbuf = *r.out.sdbuf;
586
587         /* Return result */
588         return r.out.result;
589 }
590
591 struct rpccli_lsa_SetSecObj_state {
592         struct lsa_SetSecObj orig;
593         struct lsa_SetSecObj tmp;
594         TALLOC_CTX *out_mem_ctx;
595         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
596 };
597
598 static void rpccli_lsa_SetSecObj_done(struct tevent_req *subreq);
599
600 struct tevent_req *rpccli_lsa_SetSecObj_send(TALLOC_CTX *mem_ctx,
601                                              struct tevent_context *ev,
602                                              struct rpc_pipe_client *cli,
603                                              struct policy_handle *_handle /* [in] [ref] */,
604                                              uint32_t _sec_info /* [in]  */,
605                                              struct sec_desc_buf *_sdbuf /* [in] [ref] */)
606 {
607         struct tevent_req *req;
608         struct rpccli_lsa_SetSecObj_state *state;
609         struct tevent_req *subreq;
610
611         req = tevent_req_create(mem_ctx, &state,
612                                 struct rpccli_lsa_SetSecObj_state);
613         if (req == NULL) {
614                 return NULL;
615         }
616         state->out_mem_ctx = NULL;
617         state->dispatch_recv = cli->dispatch_recv;
618
619         /* In parameters */
620         state->orig.in.handle = _handle;
621         state->orig.in.sec_info = _sec_info;
622         state->orig.in.sdbuf = _sdbuf;
623
624         /* Out parameters */
625
626         /* Result */
627         ZERO_STRUCT(state->orig.out.result);
628
629         /* make a temporary copy, that we pass to the dispatch function */
630         state->tmp = state->orig;
631
632         subreq = cli->dispatch_send(state, ev, cli,
633                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
634                                     NDR_LSA_SETSECOBJ,
635                                     &state->tmp);
636         if (tevent_req_nomem(subreq, req)) {
637                 return tevent_req_post(req, ev);
638         }
639         tevent_req_set_callback(subreq, rpccli_lsa_SetSecObj_done, req);
640         return req;
641 }
642
643 static void rpccli_lsa_SetSecObj_done(struct tevent_req *subreq)
644 {
645         struct tevent_req *req = tevent_req_callback_data(
646                 subreq, struct tevent_req);
647         struct rpccli_lsa_SetSecObj_state *state = tevent_req_data(
648                 req, struct rpccli_lsa_SetSecObj_state);
649         NTSTATUS status;
650         TALLOC_CTX *mem_ctx;
651
652         if (state->out_mem_ctx) {
653                 mem_ctx = state->out_mem_ctx;
654         } else {
655                 mem_ctx = state;
656         }
657
658         status = state->dispatch_recv(subreq, mem_ctx);
659         TALLOC_FREE(subreq);
660         if (!NT_STATUS_IS_OK(status)) {
661                 tevent_req_nterror(req, status);
662                 return;
663         }
664
665         /* Copy out parameters */
666
667         /* Copy result */
668         state->orig.out.result = state->tmp.out.result;
669
670         /* Reset temporary structure */
671         ZERO_STRUCT(state->tmp);
672
673         tevent_req_done(req);
674 }
675
676 NTSTATUS rpccli_lsa_SetSecObj_recv(struct tevent_req *req,
677                                    TALLOC_CTX *mem_ctx,
678                                    NTSTATUS *result)
679 {
680         struct rpccli_lsa_SetSecObj_state *state = tevent_req_data(
681                 req, struct rpccli_lsa_SetSecObj_state);
682         NTSTATUS status;
683
684         if (tevent_req_is_nterror(req, &status)) {
685                 tevent_req_received(req);
686                 return status;
687         }
688
689         /* Steal possbile out parameters to the callers context */
690         talloc_steal(mem_ctx, state->out_mem_ctx);
691
692         /* Return result */
693         *result = state->orig.out.result;
694
695         tevent_req_received(req);
696         return NT_STATUS_OK;
697 }
698
699 NTSTATUS rpccli_lsa_SetSecObj(struct rpc_pipe_client *cli,
700                               TALLOC_CTX *mem_ctx,
701                               struct policy_handle *handle /* [in] [ref] */,
702                               uint32_t sec_info /* [in]  */,
703                               struct sec_desc_buf *sdbuf /* [in] [ref] */)
704 {
705         struct lsa_SetSecObj r;
706         NTSTATUS status;
707
708         /* In parameters */
709         r.in.handle = handle;
710         r.in.sec_info = sec_info;
711         r.in.sdbuf = sdbuf;
712
713         status = cli->dispatch(cli,
714                                 mem_ctx,
715                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
716                                 NDR_LSA_SETSECOBJ,
717                                 &r);
718
719         if (!NT_STATUS_IS_OK(status)) {
720                 return status;
721         }
722
723         if (NT_STATUS_IS_ERR(status)) {
724                 return status;
725         }
726
727         /* Return variables */
728
729         /* Return result */
730         return r.out.result;
731 }
732
733 struct rpccli_lsa_ChangePassword_state {
734         struct lsa_ChangePassword orig;
735         struct lsa_ChangePassword tmp;
736         TALLOC_CTX *out_mem_ctx;
737         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
738 };
739
740 static void rpccli_lsa_ChangePassword_done(struct tevent_req *subreq);
741
742 struct tevent_req *rpccli_lsa_ChangePassword_send(TALLOC_CTX *mem_ctx,
743                                                   struct tevent_context *ev,
744                                                   struct rpc_pipe_client *cli)
745 {
746         struct tevent_req *req;
747         struct rpccli_lsa_ChangePassword_state *state;
748         struct tevent_req *subreq;
749
750         req = tevent_req_create(mem_ctx, &state,
751                                 struct rpccli_lsa_ChangePassword_state);
752         if (req == NULL) {
753                 return NULL;
754         }
755         state->out_mem_ctx = NULL;
756         state->dispatch_recv = cli->dispatch_recv;
757
758         /* In parameters */
759
760         /* Out parameters */
761
762         /* Result */
763         ZERO_STRUCT(state->orig.out.result);
764
765         /* make a temporary copy, that we pass to the dispatch function */
766         state->tmp = state->orig;
767
768         subreq = cli->dispatch_send(state, ev, cli,
769                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
770                                     NDR_LSA_CHANGEPASSWORD,
771                                     &state->tmp);
772         if (tevent_req_nomem(subreq, req)) {
773                 return tevent_req_post(req, ev);
774         }
775         tevent_req_set_callback(subreq, rpccli_lsa_ChangePassword_done, req);
776         return req;
777 }
778
779 static void rpccli_lsa_ChangePassword_done(struct tevent_req *subreq)
780 {
781         struct tevent_req *req = tevent_req_callback_data(
782                 subreq, struct tevent_req);
783         struct rpccli_lsa_ChangePassword_state *state = tevent_req_data(
784                 req, struct rpccli_lsa_ChangePassword_state);
785         NTSTATUS status;
786         TALLOC_CTX *mem_ctx;
787
788         if (state->out_mem_ctx) {
789                 mem_ctx = state->out_mem_ctx;
790         } else {
791                 mem_ctx = state;
792         }
793
794         status = state->dispatch_recv(subreq, mem_ctx);
795         TALLOC_FREE(subreq);
796         if (!NT_STATUS_IS_OK(status)) {
797                 tevent_req_nterror(req, status);
798                 return;
799         }
800
801         /* Copy out parameters */
802
803         /* Copy result */
804         state->orig.out.result = state->tmp.out.result;
805
806         /* Reset temporary structure */
807         ZERO_STRUCT(state->tmp);
808
809         tevent_req_done(req);
810 }
811
812 NTSTATUS rpccli_lsa_ChangePassword_recv(struct tevent_req *req,
813                                         TALLOC_CTX *mem_ctx,
814                                         NTSTATUS *result)
815 {
816         struct rpccli_lsa_ChangePassword_state *state = tevent_req_data(
817                 req, struct rpccli_lsa_ChangePassword_state);
818         NTSTATUS status;
819
820         if (tevent_req_is_nterror(req, &status)) {
821                 tevent_req_received(req);
822                 return status;
823         }
824
825         /* Steal possbile out parameters to the callers context */
826         talloc_steal(mem_ctx, state->out_mem_ctx);
827
828         /* Return result */
829         *result = state->orig.out.result;
830
831         tevent_req_received(req);
832         return NT_STATUS_OK;
833 }
834
835 NTSTATUS rpccli_lsa_ChangePassword(struct rpc_pipe_client *cli,
836                                    TALLOC_CTX *mem_ctx)
837 {
838         struct lsa_ChangePassword r;
839         NTSTATUS status;
840
841         /* In parameters */
842
843         status = cli->dispatch(cli,
844                                 mem_ctx,
845                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
846                                 NDR_LSA_CHANGEPASSWORD,
847                                 &r);
848
849         if (!NT_STATUS_IS_OK(status)) {
850                 return status;
851         }
852
853         if (NT_STATUS_IS_ERR(status)) {
854                 return status;
855         }
856
857         /* Return variables */
858
859         /* Return result */
860         return r.out.result;
861 }
862
863 struct rpccli_lsa_OpenPolicy_state {
864         struct lsa_OpenPolicy orig;
865         struct lsa_OpenPolicy tmp;
866         TALLOC_CTX *out_mem_ctx;
867         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
868 };
869
870 static void rpccli_lsa_OpenPolicy_done(struct tevent_req *subreq);
871
872 struct tevent_req *rpccli_lsa_OpenPolicy_send(TALLOC_CTX *mem_ctx,
873                                               struct tevent_context *ev,
874                                               struct rpc_pipe_client *cli,
875                                               uint16_t *_system_name /* [in] [unique] */,
876                                               struct lsa_ObjectAttribute *_attr /* [in] [ref] */,
877                                               uint32_t _access_mask /* [in]  */,
878                                               struct policy_handle *_handle /* [out] [ref] */)
879 {
880         struct tevent_req *req;
881         struct rpccli_lsa_OpenPolicy_state *state;
882         struct tevent_req *subreq;
883
884         req = tevent_req_create(mem_ctx, &state,
885                                 struct rpccli_lsa_OpenPolicy_state);
886         if (req == NULL) {
887                 return NULL;
888         }
889         state->out_mem_ctx = NULL;
890         state->dispatch_recv = cli->dispatch_recv;
891
892         /* In parameters */
893         state->orig.in.system_name = _system_name;
894         state->orig.in.attr = _attr;
895         state->orig.in.access_mask = _access_mask;
896
897         /* Out parameters */
898         state->orig.out.handle = _handle;
899
900         /* Result */
901         ZERO_STRUCT(state->orig.out.result);
902
903         state->out_mem_ctx = talloc_named_const(state, 0,
904                              "rpccli_lsa_OpenPolicy_out_memory");
905         if (tevent_req_nomem(state->out_mem_ctx, req)) {
906                 return tevent_req_post(req, ev);
907         }
908
909         /* make a temporary copy, that we pass to the dispatch function */
910         state->tmp = state->orig;
911
912         subreq = cli->dispatch_send(state, ev, cli,
913                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
914                                     NDR_LSA_OPENPOLICY,
915                                     &state->tmp);
916         if (tevent_req_nomem(subreq, req)) {
917                 return tevent_req_post(req, ev);
918         }
919         tevent_req_set_callback(subreq, rpccli_lsa_OpenPolicy_done, req);
920         return req;
921 }
922
923 static void rpccli_lsa_OpenPolicy_done(struct tevent_req *subreq)
924 {
925         struct tevent_req *req = tevent_req_callback_data(
926                 subreq, struct tevent_req);
927         struct rpccli_lsa_OpenPolicy_state *state = tevent_req_data(
928                 req, struct rpccli_lsa_OpenPolicy_state);
929         NTSTATUS status;
930         TALLOC_CTX *mem_ctx;
931
932         if (state->out_mem_ctx) {
933                 mem_ctx = state->out_mem_ctx;
934         } else {
935                 mem_ctx = state;
936         }
937
938         status = state->dispatch_recv(subreq, mem_ctx);
939         TALLOC_FREE(subreq);
940         if (!NT_STATUS_IS_OK(status)) {
941                 tevent_req_nterror(req, status);
942                 return;
943         }
944
945         /* Copy out parameters */
946         *state->orig.out.handle = *state->tmp.out.handle;
947
948         /* Copy result */
949         state->orig.out.result = state->tmp.out.result;
950
951         /* Reset temporary structure */
952         ZERO_STRUCT(state->tmp);
953
954         tevent_req_done(req);
955 }
956
957 NTSTATUS rpccli_lsa_OpenPolicy_recv(struct tevent_req *req,
958                                     TALLOC_CTX *mem_ctx,
959                                     NTSTATUS *result)
960 {
961         struct rpccli_lsa_OpenPolicy_state *state = tevent_req_data(
962                 req, struct rpccli_lsa_OpenPolicy_state);
963         NTSTATUS status;
964
965         if (tevent_req_is_nterror(req, &status)) {
966                 tevent_req_received(req);
967                 return status;
968         }
969
970         /* Steal possbile out parameters to the callers context */
971         talloc_steal(mem_ctx, state->out_mem_ctx);
972
973         /* Return result */
974         *result = state->orig.out.result;
975
976         tevent_req_received(req);
977         return NT_STATUS_OK;
978 }
979
980 NTSTATUS rpccli_lsa_OpenPolicy(struct rpc_pipe_client *cli,
981                                TALLOC_CTX *mem_ctx,
982                                uint16_t *system_name /* [in] [unique] */,
983                                struct lsa_ObjectAttribute *attr /* [in] [ref] */,
984                                uint32_t access_mask /* [in]  */,
985                                struct policy_handle *handle /* [out] [ref] */)
986 {
987         struct lsa_OpenPolicy r;
988         NTSTATUS status;
989
990         /* In parameters */
991         r.in.system_name = system_name;
992         r.in.attr = attr;
993         r.in.access_mask = access_mask;
994
995         status = cli->dispatch(cli,
996                                 mem_ctx,
997                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
998                                 NDR_LSA_OPENPOLICY,
999                                 &r);
1000
1001         if (!NT_STATUS_IS_OK(status)) {
1002                 return status;
1003         }
1004
1005         if (NT_STATUS_IS_ERR(status)) {
1006                 return status;
1007         }
1008
1009         /* Return variables */
1010         *handle = *r.out.handle;
1011
1012         /* Return result */
1013         return r.out.result;
1014 }
1015
1016 struct rpccli_lsa_QueryInfoPolicy_state {
1017         struct lsa_QueryInfoPolicy orig;
1018         struct lsa_QueryInfoPolicy tmp;
1019         TALLOC_CTX *out_mem_ctx;
1020         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1021 };
1022
1023 static void rpccli_lsa_QueryInfoPolicy_done(struct tevent_req *subreq);
1024
1025 struct tevent_req *rpccli_lsa_QueryInfoPolicy_send(TALLOC_CTX *mem_ctx,
1026                                                    struct tevent_context *ev,
1027                                                    struct rpc_pipe_client *cli,
1028                                                    struct policy_handle *_handle /* [in] [ref] */,
1029                                                    enum lsa_PolicyInfo _level /* [in]  */,
1030                                                    union lsa_PolicyInformation **_info /* [out] [ref,switch_is(level)] */)
1031 {
1032         struct tevent_req *req;
1033         struct rpccli_lsa_QueryInfoPolicy_state *state;
1034         struct tevent_req *subreq;
1035
1036         req = tevent_req_create(mem_ctx, &state,
1037                                 struct rpccli_lsa_QueryInfoPolicy_state);
1038         if (req == NULL) {
1039                 return NULL;
1040         }
1041         state->out_mem_ctx = NULL;
1042         state->dispatch_recv = cli->dispatch_recv;
1043
1044         /* In parameters */
1045         state->orig.in.handle = _handle;
1046         state->orig.in.level = _level;
1047
1048         /* Out parameters */
1049         state->orig.out.info = _info;
1050
1051         /* Result */
1052         ZERO_STRUCT(state->orig.out.result);
1053
1054         state->out_mem_ctx = talloc_named_const(state, 0,
1055                              "rpccli_lsa_QueryInfoPolicy_out_memory");
1056         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1057                 return tevent_req_post(req, ev);
1058         }
1059
1060         /* make a temporary copy, that we pass to the dispatch function */
1061         state->tmp = state->orig;
1062
1063         subreq = cli->dispatch_send(state, ev, cli,
1064                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
1065                                     NDR_LSA_QUERYINFOPOLICY,
1066                                     &state->tmp);
1067         if (tevent_req_nomem(subreq, req)) {
1068                 return tevent_req_post(req, ev);
1069         }
1070         tevent_req_set_callback(subreq, rpccli_lsa_QueryInfoPolicy_done, req);
1071         return req;
1072 }
1073
1074 static void rpccli_lsa_QueryInfoPolicy_done(struct tevent_req *subreq)
1075 {
1076         struct tevent_req *req = tevent_req_callback_data(
1077                 subreq, struct tevent_req);
1078         struct rpccli_lsa_QueryInfoPolicy_state *state = tevent_req_data(
1079                 req, struct rpccli_lsa_QueryInfoPolicy_state);
1080         NTSTATUS status;
1081         TALLOC_CTX *mem_ctx;
1082
1083         if (state->out_mem_ctx) {
1084                 mem_ctx = state->out_mem_ctx;
1085         } else {
1086                 mem_ctx = state;
1087         }
1088
1089         status = state->dispatch_recv(subreq, mem_ctx);
1090         TALLOC_FREE(subreq);
1091         if (!NT_STATUS_IS_OK(status)) {
1092                 tevent_req_nterror(req, status);
1093                 return;
1094         }
1095
1096         /* Copy out parameters */
1097         *state->orig.out.info = *state->tmp.out.info;
1098
1099         /* Copy result */
1100         state->orig.out.result = state->tmp.out.result;
1101
1102         /* Reset temporary structure */
1103         ZERO_STRUCT(state->tmp);
1104
1105         tevent_req_done(req);
1106 }
1107
1108 NTSTATUS rpccli_lsa_QueryInfoPolicy_recv(struct tevent_req *req,
1109                                          TALLOC_CTX *mem_ctx,
1110                                          NTSTATUS *result)
1111 {
1112         struct rpccli_lsa_QueryInfoPolicy_state *state = tevent_req_data(
1113                 req, struct rpccli_lsa_QueryInfoPolicy_state);
1114         NTSTATUS status;
1115
1116         if (tevent_req_is_nterror(req, &status)) {
1117                 tevent_req_received(req);
1118                 return status;
1119         }
1120
1121         /* Steal possbile out parameters to the callers context */
1122         talloc_steal(mem_ctx, state->out_mem_ctx);
1123
1124         /* Return result */
1125         *result = state->orig.out.result;
1126
1127         tevent_req_received(req);
1128         return NT_STATUS_OK;
1129 }
1130
1131 NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli,
1132                                     TALLOC_CTX *mem_ctx,
1133                                     struct policy_handle *handle /* [in] [ref] */,
1134                                     enum lsa_PolicyInfo level /* [in]  */,
1135                                     union lsa_PolicyInformation **info /* [out] [ref,switch_is(level)] */)
1136 {
1137         struct lsa_QueryInfoPolicy r;
1138         NTSTATUS status;
1139
1140         /* In parameters */
1141         r.in.handle = handle;
1142         r.in.level = level;
1143
1144         status = cli->dispatch(cli,
1145                                 mem_ctx,
1146                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
1147                                 NDR_LSA_QUERYINFOPOLICY,
1148                                 &r);
1149
1150         if (!NT_STATUS_IS_OK(status)) {
1151                 return status;
1152         }
1153
1154         if (NT_STATUS_IS_ERR(status)) {
1155                 return status;
1156         }
1157
1158         /* Return variables */
1159         *info = *r.out.info;
1160
1161         /* Return result */
1162         return r.out.result;
1163 }
1164
1165 struct rpccli_lsa_SetInfoPolicy_state {
1166         struct lsa_SetInfoPolicy orig;
1167         struct lsa_SetInfoPolicy tmp;
1168         TALLOC_CTX *out_mem_ctx;
1169         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1170 };
1171
1172 static void rpccli_lsa_SetInfoPolicy_done(struct tevent_req *subreq);
1173
1174 struct tevent_req *rpccli_lsa_SetInfoPolicy_send(TALLOC_CTX *mem_ctx,
1175                                                  struct tevent_context *ev,
1176                                                  struct rpc_pipe_client *cli,
1177                                                  struct policy_handle *_handle /* [in] [ref] */,
1178                                                  enum lsa_PolicyInfo _level /* [in]  */,
1179                                                  union lsa_PolicyInformation *_info /* [in] [ref,switch_is(level)] */)
1180 {
1181         struct tevent_req *req;
1182         struct rpccli_lsa_SetInfoPolicy_state *state;
1183         struct tevent_req *subreq;
1184
1185         req = tevent_req_create(mem_ctx, &state,
1186                                 struct rpccli_lsa_SetInfoPolicy_state);
1187         if (req == NULL) {
1188                 return NULL;
1189         }
1190         state->out_mem_ctx = NULL;
1191         state->dispatch_recv = cli->dispatch_recv;
1192
1193         /* In parameters */
1194         state->orig.in.handle = _handle;
1195         state->orig.in.level = _level;
1196         state->orig.in.info = _info;
1197
1198         /* Out parameters */
1199
1200         /* Result */
1201         ZERO_STRUCT(state->orig.out.result);
1202
1203         /* make a temporary copy, that we pass to the dispatch function */
1204         state->tmp = state->orig;
1205
1206         subreq = cli->dispatch_send(state, ev, cli,
1207                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
1208                                     NDR_LSA_SETINFOPOLICY,
1209                                     &state->tmp);
1210         if (tevent_req_nomem(subreq, req)) {
1211                 return tevent_req_post(req, ev);
1212         }
1213         tevent_req_set_callback(subreq, rpccli_lsa_SetInfoPolicy_done, req);
1214         return req;
1215 }
1216
1217 static void rpccli_lsa_SetInfoPolicy_done(struct tevent_req *subreq)
1218 {
1219         struct tevent_req *req = tevent_req_callback_data(
1220                 subreq, struct tevent_req);
1221         struct rpccli_lsa_SetInfoPolicy_state *state = tevent_req_data(
1222                 req, struct rpccli_lsa_SetInfoPolicy_state);
1223         NTSTATUS status;
1224         TALLOC_CTX *mem_ctx;
1225
1226         if (state->out_mem_ctx) {
1227                 mem_ctx = state->out_mem_ctx;
1228         } else {
1229                 mem_ctx = state;
1230         }
1231
1232         status = state->dispatch_recv(subreq, mem_ctx);
1233         TALLOC_FREE(subreq);
1234         if (!NT_STATUS_IS_OK(status)) {
1235                 tevent_req_nterror(req, status);
1236                 return;
1237         }
1238
1239         /* Copy out parameters */
1240
1241         /* Copy result */
1242         state->orig.out.result = state->tmp.out.result;
1243
1244         /* Reset temporary structure */
1245         ZERO_STRUCT(state->tmp);
1246
1247         tevent_req_done(req);
1248 }
1249
1250 NTSTATUS rpccli_lsa_SetInfoPolicy_recv(struct tevent_req *req,
1251                                        TALLOC_CTX *mem_ctx,
1252                                        NTSTATUS *result)
1253 {
1254         struct rpccli_lsa_SetInfoPolicy_state *state = tevent_req_data(
1255                 req, struct rpccli_lsa_SetInfoPolicy_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_lsa_SetInfoPolicy(struct rpc_pipe_client *cli,
1274                                   TALLOC_CTX *mem_ctx,
1275                                   struct policy_handle *handle /* [in] [ref] */,
1276                                   enum lsa_PolicyInfo level /* [in]  */,
1277                                   union lsa_PolicyInformation *info /* [in] [ref,switch_is(level)] */)
1278 {
1279         struct lsa_SetInfoPolicy r;
1280         NTSTATUS status;
1281
1282         /* In parameters */
1283         r.in.handle = handle;
1284         r.in.level = level;
1285         r.in.info = info;
1286
1287         status = cli->dispatch(cli,
1288                                 mem_ctx,
1289                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
1290                                 NDR_LSA_SETINFOPOLICY,
1291                                 &r);
1292
1293         if (!NT_STATUS_IS_OK(status)) {
1294                 return status;
1295         }
1296
1297         if (NT_STATUS_IS_ERR(status)) {
1298                 return status;
1299         }
1300
1301         /* Return variables */
1302
1303         /* Return result */
1304         return r.out.result;
1305 }
1306
1307 struct rpccli_lsa_ClearAuditLog_state {
1308         struct lsa_ClearAuditLog orig;
1309         struct lsa_ClearAuditLog tmp;
1310         TALLOC_CTX *out_mem_ctx;
1311         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1312 };
1313
1314 static void rpccli_lsa_ClearAuditLog_done(struct tevent_req *subreq);
1315
1316 struct tevent_req *rpccli_lsa_ClearAuditLog_send(TALLOC_CTX *mem_ctx,
1317                                                  struct tevent_context *ev,
1318                                                  struct rpc_pipe_client *cli)
1319 {
1320         struct tevent_req *req;
1321         struct rpccli_lsa_ClearAuditLog_state *state;
1322         struct tevent_req *subreq;
1323
1324         req = tevent_req_create(mem_ctx, &state,
1325                                 struct rpccli_lsa_ClearAuditLog_state);
1326         if (req == NULL) {
1327                 return NULL;
1328         }
1329         state->out_mem_ctx = NULL;
1330         state->dispatch_recv = cli->dispatch_recv;
1331
1332         /* In parameters */
1333
1334         /* Out parameters */
1335
1336         /* Result */
1337         ZERO_STRUCT(state->orig.out.result);
1338
1339         /* make a temporary copy, that we pass to the dispatch function */
1340         state->tmp = state->orig;
1341
1342         subreq = cli->dispatch_send(state, ev, cli,
1343                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
1344                                     NDR_LSA_CLEARAUDITLOG,
1345                                     &state->tmp);
1346         if (tevent_req_nomem(subreq, req)) {
1347                 return tevent_req_post(req, ev);
1348         }
1349         tevent_req_set_callback(subreq, rpccli_lsa_ClearAuditLog_done, req);
1350         return req;
1351 }
1352
1353 static void rpccli_lsa_ClearAuditLog_done(struct tevent_req *subreq)
1354 {
1355         struct tevent_req *req = tevent_req_callback_data(
1356                 subreq, struct tevent_req);
1357         struct rpccli_lsa_ClearAuditLog_state *state = tevent_req_data(
1358                 req, struct rpccli_lsa_ClearAuditLog_state);
1359         NTSTATUS status;
1360         TALLOC_CTX *mem_ctx;
1361
1362         if (state->out_mem_ctx) {
1363                 mem_ctx = state->out_mem_ctx;
1364         } else {
1365                 mem_ctx = state;
1366         }
1367
1368         status = state->dispatch_recv(subreq, mem_ctx);
1369         TALLOC_FREE(subreq);
1370         if (!NT_STATUS_IS_OK(status)) {
1371                 tevent_req_nterror(req, status);
1372                 return;
1373         }
1374
1375         /* Copy out parameters */
1376
1377         /* Copy result */
1378         state->orig.out.result = state->tmp.out.result;
1379
1380         /* Reset temporary structure */
1381         ZERO_STRUCT(state->tmp);
1382
1383         tevent_req_done(req);
1384 }
1385
1386 NTSTATUS rpccli_lsa_ClearAuditLog_recv(struct tevent_req *req,
1387                                        TALLOC_CTX *mem_ctx,
1388                                        NTSTATUS *result)
1389 {
1390         struct rpccli_lsa_ClearAuditLog_state *state = tevent_req_data(
1391                 req, struct rpccli_lsa_ClearAuditLog_state);
1392         NTSTATUS status;
1393
1394         if (tevent_req_is_nterror(req, &status)) {
1395                 tevent_req_received(req);
1396                 return status;
1397         }
1398
1399         /* Steal possbile out parameters to the callers context */
1400         talloc_steal(mem_ctx, state->out_mem_ctx);
1401
1402         /* Return result */
1403         *result = state->orig.out.result;
1404
1405         tevent_req_received(req);
1406         return NT_STATUS_OK;
1407 }
1408
1409 NTSTATUS rpccli_lsa_ClearAuditLog(struct rpc_pipe_client *cli,
1410                                   TALLOC_CTX *mem_ctx)
1411 {
1412         struct lsa_ClearAuditLog r;
1413         NTSTATUS status;
1414
1415         /* In parameters */
1416
1417         status = cli->dispatch(cli,
1418                                 mem_ctx,
1419                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
1420                                 NDR_LSA_CLEARAUDITLOG,
1421                                 &r);
1422
1423         if (!NT_STATUS_IS_OK(status)) {
1424                 return status;
1425         }
1426
1427         if (NT_STATUS_IS_ERR(status)) {
1428                 return status;
1429         }
1430
1431         /* Return variables */
1432
1433         /* Return result */
1434         return r.out.result;
1435 }
1436
1437 struct rpccli_lsa_CreateAccount_state {
1438         struct lsa_CreateAccount orig;
1439         struct lsa_CreateAccount tmp;
1440         TALLOC_CTX *out_mem_ctx;
1441         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1442 };
1443
1444 static void rpccli_lsa_CreateAccount_done(struct tevent_req *subreq);
1445
1446 struct tevent_req *rpccli_lsa_CreateAccount_send(TALLOC_CTX *mem_ctx,
1447                                                  struct tevent_context *ev,
1448                                                  struct rpc_pipe_client *cli,
1449                                                  struct policy_handle *_handle /* [in] [ref] */,
1450                                                  struct dom_sid2 *_sid /* [in] [ref] */,
1451                                                  uint32_t _access_mask /* [in]  */,
1452                                                  struct policy_handle *_acct_handle /* [out] [ref] */)
1453 {
1454         struct tevent_req *req;
1455         struct rpccli_lsa_CreateAccount_state *state;
1456         struct tevent_req *subreq;
1457
1458         req = tevent_req_create(mem_ctx, &state,
1459                                 struct rpccli_lsa_CreateAccount_state);
1460         if (req == NULL) {
1461                 return NULL;
1462         }
1463         state->out_mem_ctx = NULL;
1464         state->dispatch_recv = cli->dispatch_recv;
1465
1466         /* In parameters */
1467         state->orig.in.handle = _handle;
1468         state->orig.in.sid = _sid;
1469         state->orig.in.access_mask = _access_mask;
1470
1471         /* Out parameters */
1472         state->orig.out.acct_handle = _acct_handle;
1473
1474         /* Result */
1475         ZERO_STRUCT(state->orig.out.result);
1476
1477         state->out_mem_ctx = talloc_named_const(state, 0,
1478                              "rpccli_lsa_CreateAccount_out_memory");
1479         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1480                 return tevent_req_post(req, ev);
1481         }
1482
1483         /* make a temporary copy, that we pass to the dispatch function */
1484         state->tmp = state->orig;
1485
1486         subreq = cli->dispatch_send(state, ev, cli,
1487                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
1488                                     NDR_LSA_CREATEACCOUNT,
1489                                     &state->tmp);
1490         if (tevent_req_nomem(subreq, req)) {
1491                 return tevent_req_post(req, ev);
1492         }
1493         tevent_req_set_callback(subreq, rpccli_lsa_CreateAccount_done, req);
1494         return req;
1495 }
1496
1497 static void rpccli_lsa_CreateAccount_done(struct tevent_req *subreq)
1498 {
1499         struct tevent_req *req = tevent_req_callback_data(
1500                 subreq, struct tevent_req);
1501         struct rpccli_lsa_CreateAccount_state *state = tevent_req_data(
1502                 req, struct rpccli_lsa_CreateAccount_state);
1503         NTSTATUS status;
1504         TALLOC_CTX *mem_ctx;
1505
1506         if (state->out_mem_ctx) {
1507                 mem_ctx = state->out_mem_ctx;
1508         } else {
1509                 mem_ctx = state;
1510         }
1511
1512         status = state->dispatch_recv(subreq, mem_ctx);
1513         TALLOC_FREE(subreq);
1514         if (!NT_STATUS_IS_OK(status)) {
1515                 tevent_req_nterror(req, status);
1516                 return;
1517         }
1518
1519         /* Copy out parameters */
1520         *state->orig.out.acct_handle = *state->tmp.out.acct_handle;
1521
1522         /* Copy result */
1523         state->orig.out.result = state->tmp.out.result;
1524
1525         /* Reset temporary structure */
1526         ZERO_STRUCT(state->tmp);
1527
1528         tevent_req_done(req);
1529 }
1530
1531 NTSTATUS rpccli_lsa_CreateAccount_recv(struct tevent_req *req,
1532                                        TALLOC_CTX *mem_ctx,
1533                                        NTSTATUS *result)
1534 {
1535         struct rpccli_lsa_CreateAccount_state *state = tevent_req_data(
1536                 req, struct rpccli_lsa_CreateAccount_state);
1537         NTSTATUS status;
1538
1539         if (tevent_req_is_nterror(req, &status)) {
1540                 tevent_req_received(req);
1541                 return status;
1542         }
1543
1544         /* Steal possbile out parameters to the callers context */
1545         talloc_steal(mem_ctx, state->out_mem_ctx);
1546
1547         /* Return result */
1548         *result = state->orig.out.result;
1549
1550         tevent_req_received(req);
1551         return NT_STATUS_OK;
1552 }
1553
1554 NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli,
1555                                   TALLOC_CTX *mem_ctx,
1556                                   struct policy_handle *handle /* [in] [ref] */,
1557                                   struct dom_sid2 *sid /* [in] [ref] */,
1558                                   uint32_t access_mask /* [in]  */,
1559                                   struct policy_handle *acct_handle /* [out] [ref] */)
1560 {
1561         struct lsa_CreateAccount r;
1562         NTSTATUS status;
1563
1564         /* In parameters */
1565         r.in.handle = handle;
1566         r.in.sid = sid;
1567         r.in.access_mask = access_mask;
1568
1569         status = cli->dispatch(cli,
1570                                 mem_ctx,
1571                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
1572                                 NDR_LSA_CREATEACCOUNT,
1573                                 &r);
1574
1575         if (!NT_STATUS_IS_OK(status)) {
1576                 return status;
1577         }
1578
1579         if (NT_STATUS_IS_ERR(status)) {
1580                 return status;
1581         }
1582
1583         /* Return variables */
1584         *acct_handle = *r.out.acct_handle;
1585
1586         /* Return result */
1587         return r.out.result;
1588 }
1589
1590 struct rpccli_lsa_EnumAccounts_state {
1591         struct lsa_EnumAccounts orig;
1592         struct lsa_EnumAccounts tmp;
1593         TALLOC_CTX *out_mem_ctx;
1594         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1595 };
1596
1597 static void rpccli_lsa_EnumAccounts_done(struct tevent_req *subreq);
1598
1599 struct tevent_req *rpccli_lsa_EnumAccounts_send(TALLOC_CTX *mem_ctx,
1600                                                 struct tevent_context *ev,
1601                                                 struct rpc_pipe_client *cli,
1602                                                 struct policy_handle *_handle /* [in] [ref] */,
1603                                                 uint32_t *_resume_handle /* [in,out] [ref] */,
1604                                                 struct lsa_SidArray *_sids /* [out] [ref] */,
1605                                                 uint32_t _num_entries /* [in] [range(0,8192)] */)
1606 {
1607         struct tevent_req *req;
1608         struct rpccli_lsa_EnumAccounts_state *state;
1609         struct tevent_req *subreq;
1610
1611         req = tevent_req_create(mem_ctx, &state,
1612                                 struct rpccli_lsa_EnumAccounts_state);
1613         if (req == NULL) {
1614                 return NULL;
1615         }
1616         state->out_mem_ctx = NULL;
1617         state->dispatch_recv = cli->dispatch_recv;
1618
1619         /* In parameters */
1620         state->orig.in.handle = _handle;
1621         state->orig.in.resume_handle = _resume_handle;
1622         state->orig.in.num_entries = _num_entries;
1623
1624         /* Out parameters */
1625         state->orig.out.resume_handle = _resume_handle;
1626         state->orig.out.sids = _sids;
1627
1628         /* Result */
1629         ZERO_STRUCT(state->orig.out.result);
1630
1631         state->out_mem_ctx = talloc_named_const(state, 0,
1632                              "rpccli_lsa_EnumAccounts_out_memory");
1633         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1634                 return tevent_req_post(req, ev);
1635         }
1636
1637         /* make a temporary copy, that we pass to the dispatch function */
1638         state->tmp = state->orig;
1639
1640         subreq = cli->dispatch_send(state, ev, cli,
1641                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
1642                                     NDR_LSA_ENUMACCOUNTS,
1643                                     &state->tmp);
1644         if (tevent_req_nomem(subreq, req)) {
1645                 return tevent_req_post(req, ev);
1646         }
1647         tevent_req_set_callback(subreq, rpccli_lsa_EnumAccounts_done, req);
1648         return req;
1649 }
1650
1651 static void rpccli_lsa_EnumAccounts_done(struct tevent_req *subreq)
1652 {
1653         struct tevent_req *req = tevent_req_callback_data(
1654                 subreq, struct tevent_req);
1655         struct rpccli_lsa_EnumAccounts_state *state = tevent_req_data(
1656                 req, struct rpccli_lsa_EnumAccounts_state);
1657         NTSTATUS status;
1658         TALLOC_CTX *mem_ctx;
1659
1660         if (state->out_mem_ctx) {
1661                 mem_ctx = state->out_mem_ctx;
1662         } else {
1663                 mem_ctx = state;
1664         }
1665
1666         status = state->dispatch_recv(subreq, mem_ctx);
1667         TALLOC_FREE(subreq);
1668         if (!NT_STATUS_IS_OK(status)) {
1669                 tevent_req_nterror(req, status);
1670                 return;
1671         }
1672
1673         /* Copy out parameters */
1674         *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
1675         *state->orig.out.sids = *state->tmp.out.sids;
1676
1677         /* Copy result */
1678         state->orig.out.result = state->tmp.out.result;
1679
1680         /* Reset temporary structure */
1681         ZERO_STRUCT(state->tmp);
1682
1683         tevent_req_done(req);
1684 }
1685
1686 NTSTATUS rpccli_lsa_EnumAccounts_recv(struct tevent_req *req,
1687                                       TALLOC_CTX *mem_ctx,
1688                                       NTSTATUS *result)
1689 {
1690         struct rpccli_lsa_EnumAccounts_state *state = tevent_req_data(
1691                 req, struct rpccli_lsa_EnumAccounts_state);
1692         NTSTATUS status;
1693
1694         if (tevent_req_is_nterror(req, &status)) {
1695                 tevent_req_received(req);
1696                 return status;
1697         }
1698
1699         /* Steal possbile out parameters to the callers context */
1700         talloc_steal(mem_ctx, state->out_mem_ctx);
1701
1702         /* Return result */
1703         *result = state->orig.out.result;
1704
1705         tevent_req_received(req);
1706         return NT_STATUS_OK;
1707 }
1708
1709 NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli,
1710                                  TALLOC_CTX *mem_ctx,
1711                                  struct policy_handle *handle /* [in] [ref] */,
1712                                  uint32_t *resume_handle /* [in,out] [ref] */,
1713                                  struct lsa_SidArray *sids /* [out] [ref] */,
1714                                  uint32_t num_entries /* [in] [range(0,8192)] */)
1715 {
1716         struct lsa_EnumAccounts r;
1717         NTSTATUS status;
1718
1719         /* In parameters */
1720         r.in.handle = handle;
1721         r.in.resume_handle = resume_handle;
1722         r.in.num_entries = num_entries;
1723
1724         status = cli->dispatch(cli,
1725                                 mem_ctx,
1726                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
1727                                 NDR_LSA_ENUMACCOUNTS,
1728                                 &r);
1729
1730         if (!NT_STATUS_IS_OK(status)) {
1731                 return status;
1732         }
1733
1734         if (NT_STATUS_IS_ERR(status)) {
1735                 return status;
1736         }
1737
1738         /* Return variables */
1739         *resume_handle = *r.out.resume_handle;
1740         *sids = *r.out.sids;
1741
1742         /* Return result */
1743         return r.out.result;
1744 }
1745
1746 struct rpccli_lsa_CreateTrustedDomain_state {
1747         struct lsa_CreateTrustedDomain orig;
1748         struct lsa_CreateTrustedDomain tmp;
1749         TALLOC_CTX *out_mem_ctx;
1750         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1751 };
1752
1753 static void rpccli_lsa_CreateTrustedDomain_done(struct tevent_req *subreq);
1754
1755 struct tevent_req *rpccli_lsa_CreateTrustedDomain_send(TALLOC_CTX *mem_ctx,
1756                                                        struct tevent_context *ev,
1757                                                        struct rpc_pipe_client *cli,
1758                                                        struct policy_handle *_policy_handle /* [in] [ref] */,
1759                                                        struct lsa_DomainInfo *_info /* [in] [ref] */,
1760                                                        uint32_t _access_mask /* [in]  */,
1761                                                        struct policy_handle *_trustdom_handle /* [out] [ref] */)
1762 {
1763         struct tevent_req *req;
1764         struct rpccli_lsa_CreateTrustedDomain_state *state;
1765         struct tevent_req *subreq;
1766
1767         req = tevent_req_create(mem_ctx, &state,
1768                                 struct rpccli_lsa_CreateTrustedDomain_state);
1769         if (req == NULL) {
1770                 return NULL;
1771         }
1772         state->out_mem_ctx = NULL;
1773         state->dispatch_recv = cli->dispatch_recv;
1774
1775         /* In parameters */
1776         state->orig.in.policy_handle = _policy_handle;
1777         state->orig.in.info = _info;
1778         state->orig.in.access_mask = _access_mask;
1779
1780         /* Out parameters */
1781         state->orig.out.trustdom_handle = _trustdom_handle;
1782
1783         /* Result */
1784         ZERO_STRUCT(state->orig.out.result);
1785
1786         state->out_mem_ctx = talloc_named_const(state, 0,
1787                              "rpccli_lsa_CreateTrustedDomain_out_memory");
1788         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1789                 return tevent_req_post(req, ev);
1790         }
1791
1792         /* make a temporary copy, that we pass to the dispatch function */
1793         state->tmp = state->orig;
1794
1795         subreq = cli->dispatch_send(state, ev, cli,
1796                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
1797                                     NDR_LSA_CREATETRUSTEDDOMAIN,
1798                                     &state->tmp);
1799         if (tevent_req_nomem(subreq, req)) {
1800                 return tevent_req_post(req, ev);
1801         }
1802         tevent_req_set_callback(subreq, rpccli_lsa_CreateTrustedDomain_done, req);
1803         return req;
1804 }
1805
1806 static void rpccli_lsa_CreateTrustedDomain_done(struct tevent_req *subreq)
1807 {
1808         struct tevent_req *req = tevent_req_callback_data(
1809                 subreq, struct tevent_req);
1810         struct rpccli_lsa_CreateTrustedDomain_state *state = tevent_req_data(
1811                 req, struct rpccli_lsa_CreateTrustedDomain_state);
1812         NTSTATUS status;
1813         TALLOC_CTX *mem_ctx;
1814
1815         if (state->out_mem_ctx) {
1816                 mem_ctx = state->out_mem_ctx;
1817         } else {
1818                 mem_ctx = state;
1819         }
1820
1821         status = state->dispatch_recv(subreq, mem_ctx);
1822         TALLOC_FREE(subreq);
1823         if (!NT_STATUS_IS_OK(status)) {
1824                 tevent_req_nterror(req, status);
1825                 return;
1826         }
1827
1828         /* Copy out parameters */
1829         *state->orig.out.trustdom_handle = *state->tmp.out.trustdom_handle;
1830
1831         /* Copy result */
1832         state->orig.out.result = state->tmp.out.result;
1833
1834         /* Reset temporary structure */
1835         ZERO_STRUCT(state->tmp);
1836
1837         tevent_req_done(req);
1838 }
1839
1840 NTSTATUS rpccli_lsa_CreateTrustedDomain_recv(struct tevent_req *req,
1841                                              TALLOC_CTX *mem_ctx,
1842                                              NTSTATUS *result)
1843 {
1844         struct rpccli_lsa_CreateTrustedDomain_state *state = tevent_req_data(
1845                 req, struct rpccli_lsa_CreateTrustedDomain_state);
1846         NTSTATUS status;
1847
1848         if (tevent_req_is_nterror(req, &status)) {
1849                 tevent_req_received(req);
1850                 return status;
1851         }
1852
1853         /* Steal possbile out parameters to the callers context */
1854         talloc_steal(mem_ctx, state->out_mem_ctx);
1855
1856         /* Return result */
1857         *result = state->orig.out.result;
1858
1859         tevent_req_received(req);
1860         return NT_STATUS_OK;
1861 }
1862
1863 NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli,
1864                                         TALLOC_CTX *mem_ctx,
1865                                         struct policy_handle *policy_handle /* [in] [ref] */,
1866                                         struct lsa_DomainInfo *info /* [in] [ref] */,
1867                                         uint32_t access_mask /* [in]  */,
1868                                         struct policy_handle *trustdom_handle /* [out] [ref] */)
1869 {
1870         struct lsa_CreateTrustedDomain r;
1871         NTSTATUS status;
1872
1873         /* In parameters */
1874         r.in.policy_handle = policy_handle;
1875         r.in.info = info;
1876         r.in.access_mask = access_mask;
1877
1878         status = cli->dispatch(cli,
1879                                 mem_ctx,
1880                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
1881                                 NDR_LSA_CREATETRUSTEDDOMAIN,
1882                                 &r);
1883
1884         if (!NT_STATUS_IS_OK(status)) {
1885                 return status;
1886         }
1887
1888         if (NT_STATUS_IS_ERR(status)) {
1889                 return status;
1890         }
1891
1892         /* Return variables */
1893         *trustdom_handle = *r.out.trustdom_handle;
1894
1895         /* Return result */
1896         return r.out.result;
1897 }
1898
1899 struct rpccli_lsa_EnumTrustDom_state {
1900         struct lsa_EnumTrustDom orig;
1901         struct lsa_EnumTrustDom tmp;
1902         TALLOC_CTX *out_mem_ctx;
1903         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1904 };
1905
1906 static void rpccli_lsa_EnumTrustDom_done(struct tevent_req *subreq);
1907
1908 struct tevent_req *rpccli_lsa_EnumTrustDom_send(TALLOC_CTX *mem_ctx,
1909                                                 struct tevent_context *ev,
1910                                                 struct rpc_pipe_client *cli,
1911                                                 struct policy_handle *_handle /* [in] [ref] */,
1912                                                 uint32_t *_resume_handle /* [in,out] [ref] */,
1913                                                 struct lsa_DomainList *_domains /* [out] [ref] */,
1914                                                 uint32_t _max_size /* [in]  */)
1915 {
1916         struct tevent_req *req;
1917         struct rpccli_lsa_EnumTrustDom_state *state;
1918         struct tevent_req *subreq;
1919
1920         req = tevent_req_create(mem_ctx, &state,
1921                                 struct rpccli_lsa_EnumTrustDom_state);
1922         if (req == NULL) {
1923                 return NULL;
1924         }
1925         state->out_mem_ctx = NULL;
1926         state->dispatch_recv = cli->dispatch_recv;
1927
1928         /* In parameters */
1929         state->orig.in.handle = _handle;
1930         state->orig.in.resume_handle = _resume_handle;
1931         state->orig.in.max_size = _max_size;
1932
1933         /* Out parameters */
1934         state->orig.out.resume_handle = _resume_handle;
1935         state->orig.out.domains = _domains;
1936
1937         /* Result */
1938         ZERO_STRUCT(state->orig.out.result);
1939
1940         state->out_mem_ctx = talloc_named_const(state, 0,
1941                              "rpccli_lsa_EnumTrustDom_out_memory");
1942         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1943                 return tevent_req_post(req, ev);
1944         }
1945
1946         /* make a temporary copy, that we pass to the dispatch function */
1947         state->tmp = state->orig;
1948
1949         subreq = cli->dispatch_send(state, ev, cli,
1950                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
1951                                     NDR_LSA_ENUMTRUSTDOM,
1952                                     &state->tmp);
1953         if (tevent_req_nomem(subreq, req)) {
1954                 return tevent_req_post(req, ev);
1955         }
1956         tevent_req_set_callback(subreq, rpccli_lsa_EnumTrustDom_done, req);
1957         return req;
1958 }
1959
1960 static void rpccli_lsa_EnumTrustDom_done(struct tevent_req *subreq)
1961 {
1962         struct tevent_req *req = tevent_req_callback_data(
1963                 subreq, struct tevent_req);
1964         struct rpccli_lsa_EnumTrustDom_state *state = tevent_req_data(
1965                 req, struct rpccli_lsa_EnumTrustDom_state);
1966         NTSTATUS status;
1967         TALLOC_CTX *mem_ctx;
1968
1969         if (state->out_mem_ctx) {
1970                 mem_ctx = state->out_mem_ctx;
1971         } else {
1972                 mem_ctx = state;
1973         }
1974
1975         status = state->dispatch_recv(subreq, mem_ctx);
1976         TALLOC_FREE(subreq);
1977         if (!NT_STATUS_IS_OK(status)) {
1978                 tevent_req_nterror(req, status);
1979                 return;
1980         }
1981
1982         /* Copy out parameters */
1983         *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
1984         *state->orig.out.domains = *state->tmp.out.domains;
1985
1986         /* Copy result */
1987         state->orig.out.result = state->tmp.out.result;
1988
1989         /* Reset temporary structure */
1990         ZERO_STRUCT(state->tmp);
1991
1992         tevent_req_done(req);
1993 }
1994
1995 NTSTATUS rpccli_lsa_EnumTrustDom_recv(struct tevent_req *req,
1996                                       TALLOC_CTX *mem_ctx,
1997                                       NTSTATUS *result)
1998 {
1999         struct rpccli_lsa_EnumTrustDom_state *state = tevent_req_data(
2000                 req, struct rpccli_lsa_EnumTrustDom_state);
2001         NTSTATUS status;
2002
2003         if (tevent_req_is_nterror(req, &status)) {
2004                 tevent_req_received(req);
2005                 return status;
2006         }
2007
2008         /* Steal possbile out parameters to the callers context */
2009         talloc_steal(mem_ctx, state->out_mem_ctx);
2010
2011         /* Return result */
2012         *result = state->orig.out.result;
2013
2014         tevent_req_received(req);
2015         return NT_STATUS_OK;
2016 }
2017
2018 NTSTATUS rpccli_lsa_EnumTrustDom(struct rpc_pipe_client *cli,
2019                                  TALLOC_CTX *mem_ctx,
2020                                  struct policy_handle *handle /* [in] [ref] */,
2021                                  uint32_t *resume_handle /* [in,out] [ref] */,
2022                                  struct lsa_DomainList *domains /* [out] [ref] */,
2023                                  uint32_t max_size /* [in]  */)
2024 {
2025         struct lsa_EnumTrustDom r;
2026         NTSTATUS status;
2027
2028         /* In parameters */
2029         r.in.handle = handle;
2030         r.in.resume_handle = resume_handle;
2031         r.in.max_size = max_size;
2032
2033         status = cli->dispatch(cli,
2034                                 mem_ctx,
2035                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
2036                                 NDR_LSA_ENUMTRUSTDOM,
2037                                 &r);
2038
2039         if (!NT_STATUS_IS_OK(status)) {
2040                 return status;
2041         }
2042
2043         if (NT_STATUS_IS_ERR(status)) {
2044                 return status;
2045         }
2046
2047         /* Return variables */
2048         *resume_handle = *r.out.resume_handle;
2049         *domains = *r.out.domains;
2050
2051         /* Return result */
2052         return r.out.result;
2053 }
2054
2055 struct rpccli_lsa_LookupNames_state {
2056         struct lsa_LookupNames orig;
2057         struct lsa_LookupNames tmp;
2058         TALLOC_CTX *out_mem_ctx;
2059         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2060 };
2061
2062 static void rpccli_lsa_LookupNames_done(struct tevent_req *subreq);
2063
2064 struct tevent_req *rpccli_lsa_LookupNames_send(TALLOC_CTX *mem_ctx,
2065                                                struct tevent_context *ev,
2066                                                struct rpc_pipe_client *cli,
2067                                                struct policy_handle *_handle /* [in] [ref] */,
2068                                                uint32_t _num_names /* [in] [range(0,1000)] */,
2069                                                struct lsa_String *_names /* [in] [size_is(num_names)] */,
2070                                                struct lsa_RefDomainList **_domains /* [out] [ref] */,
2071                                                struct lsa_TransSidArray *_sids /* [in,out] [ref] */,
2072                                                enum lsa_LookupNamesLevel _level /* [in]  */,
2073                                                uint32_t *_count /* [in,out] [ref] */)
2074 {
2075         struct tevent_req *req;
2076         struct rpccli_lsa_LookupNames_state *state;
2077         struct tevent_req *subreq;
2078
2079         req = tevent_req_create(mem_ctx, &state,
2080                                 struct rpccli_lsa_LookupNames_state);
2081         if (req == NULL) {
2082                 return NULL;
2083         }
2084         state->out_mem_ctx = NULL;
2085         state->dispatch_recv = cli->dispatch_recv;
2086
2087         /* In parameters */
2088         state->orig.in.handle = _handle;
2089         state->orig.in.num_names = _num_names;
2090         state->orig.in.names = _names;
2091         state->orig.in.sids = _sids;
2092         state->orig.in.level = _level;
2093         state->orig.in.count = _count;
2094
2095         /* Out parameters */
2096         state->orig.out.domains = _domains;
2097         state->orig.out.sids = _sids;
2098         state->orig.out.count = _count;
2099
2100         /* Result */
2101         ZERO_STRUCT(state->orig.out.result);
2102
2103         state->out_mem_ctx = talloc_named_const(state, 0,
2104                              "rpccli_lsa_LookupNames_out_memory");
2105         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2106                 return tevent_req_post(req, ev);
2107         }
2108
2109         /* make a temporary copy, that we pass to the dispatch function */
2110         state->tmp = state->orig;
2111
2112         subreq = cli->dispatch_send(state, ev, cli,
2113                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
2114                                     NDR_LSA_LOOKUPNAMES,
2115                                     &state->tmp);
2116         if (tevent_req_nomem(subreq, req)) {
2117                 return tevent_req_post(req, ev);
2118         }
2119         tevent_req_set_callback(subreq, rpccli_lsa_LookupNames_done, req);
2120         return req;
2121 }
2122
2123 static void rpccli_lsa_LookupNames_done(struct tevent_req *subreq)
2124 {
2125         struct tevent_req *req = tevent_req_callback_data(
2126                 subreq, struct tevent_req);
2127         struct rpccli_lsa_LookupNames_state *state = tevent_req_data(
2128                 req, struct rpccli_lsa_LookupNames_state);
2129         NTSTATUS status;
2130         TALLOC_CTX *mem_ctx;
2131
2132         if (state->out_mem_ctx) {
2133                 mem_ctx = state->out_mem_ctx;
2134         } else {
2135                 mem_ctx = state;
2136         }
2137
2138         status = state->dispatch_recv(subreq, mem_ctx);
2139         TALLOC_FREE(subreq);
2140         if (!NT_STATUS_IS_OK(status)) {
2141                 tevent_req_nterror(req, status);
2142                 return;
2143         }
2144
2145         /* Copy out parameters */
2146         *state->orig.out.domains = *state->tmp.out.domains;
2147         *state->orig.out.sids = *state->tmp.out.sids;
2148         *state->orig.out.count = *state->tmp.out.count;
2149
2150         /* Copy result */
2151         state->orig.out.result = state->tmp.out.result;
2152
2153         /* Reset temporary structure */
2154         ZERO_STRUCT(state->tmp);
2155
2156         tevent_req_done(req);
2157 }
2158
2159 NTSTATUS rpccli_lsa_LookupNames_recv(struct tevent_req *req,
2160                                      TALLOC_CTX *mem_ctx,
2161                                      NTSTATUS *result)
2162 {
2163         struct rpccli_lsa_LookupNames_state *state = tevent_req_data(
2164                 req, struct rpccli_lsa_LookupNames_state);
2165         NTSTATUS status;
2166
2167         if (tevent_req_is_nterror(req, &status)) {
2168                 tevent_req_received(req);
2169                 return status;
2170         }
2171
2172         /* Steal possbile out parameters to the callers context */
2173         talloc_steal(mem_ctx, state->out_mem_ctx);
2174
2175         /* Return result */
2176         *result = state->orig.out.result;
2177
2178         tevent_req_received(req);
2179         return NT_STATUS_OK;
2180 }
2181
2182 NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli,
2183                                 TALLOC_CTX *mem_ctx,
2184                                 struct policy_handle *handle /* [in] [ref] */,
2185                                 uint32_t num_names /* [in] [range(0,1000)] */,
2186                                 struct lsa_String *names /* [in] [size_is(num_names)] */,
2187                                 struct lsa_RefDomainList **domains /* [out] [ref] */,
2188                                 struct lsa_TransSidArray *sids /* [in,out] [ref] */,
2189                                 enum lsa_LookupNamesLevel level /* [in]  */,
2190                                 uint32_t *count /* [in,out] [ref] */)
2191 {
2192         struct lsa_LookupNames r;
2193         NTSTATUS status;
2194
2195         /* In parameters */
2196         r.in.handle = handle;
2197         r.in.num_names = num_names;
2198         r.in.names = names;
2199         r.in.sids = sids;
2200         r.in.level = level;
2201         r.in.count = count;
2202
2203         status = cli->dispatch(cli,
2204                                 mem_ctx,
2205                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
2206                                 NDR_LSA_LOOKUPNAMES,
2207                                 &r);
2208
2209         if (!NT_STATUS_IS_OK(status)) {
2210                 return status;
2211         }
2212
2213         if (NT_STATUS_IS_ERR(status)) {
2214                 return status;
2215         }
2216
2217         /* Return variables */
2218         *domains = *r.out.domains;
2219         *sids = *r.out.sids;
2220         *count = *r.out.count;
2221
2222         /* Return result */
2223         return r.out.result;
2224 }
2225
2226 struct rpccli_lsa_LookupSids_state {
2227         struct lsa_LookupSids orig;
2228         struct lsa_LookupSids tmp;
2229         TALLOC_CTX *out_mem_ctx;
2230         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2231 };
2232
2233 static void rpccli_lsa_LookupSids_done(struct tevent_req *subreq);
2234
2235 struct tevent_req *rpccli_lsa_LookupSids_send(TALLOC_CTX *mem_ctx,
2236                                               struct tevent_context *ev,
2237                                               struct rpc_pipe_client *cli,
2238                                               struct policy_handle *_handle /* [in] [ref] */,
2239                                               struct lsa_SidArray *_sids /* [in] [ref] */,
2240                                               struct lsa_RefDomainList **_domains /* [out] [ref] */,
2241                                               struct lsa_TransNameArray *_names /* [in,out] [ref] */,
2242                                               enum lsa_LookupNamesLevel _level /* [in]  */,
2243                                               uint32_t *_count /* [in,out] [ref] */)
2244 {
2245         struct tevent_req *req;
2246         struct rpccli_lsa_LookupSids_state *state;
2247         struct tevent_req *subreq;
2248
2249         req = tevent_req_create(mem_ctx, &state,
2250                                 struct rpccli_lsa_LookupSids_state);
2251         if (req == NULL) {
2252                 return NULL;
2253         }
2254         state->out_mem_ctx = NULL;
2255         state->dispatch_recv = cli->dispatch_recv;
2256
2257         /* In parameters */
2258         state->orig.in.handle = _handle;
2259         state->orig.in.sids = _sids;
2260         state->orig.in.names = _names;
2261         state->orig.in.level = _level;
2262         state->orig.in.count = _count;
2263
2264         /* Out parameters */
2265         state->orig.out.domains = _domains;
2266         state->orig.out.names = _names;
2267         state->orig.out.count = _count;
2268
2269         /* Result */
2270         ZERO_STRUCT(state->orig.out.result);
2271
2272         state->out_mem_ctx = talloc_named_const(state, 0,
2273                              "rpccli_lsa_LookupSids_out_memory");
2274         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2275                 return tevent_req_post(req, ev);
2276         }
2277
2278         /* make a temporary copy, that we pass to the dispatch function */
2279         state->tmp = state->orig;
2280
2281         subreq = cli->dispatch_send(state, ev, cli,
2282                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
2283                                     NDR_LSA_LOOKUPSIDS,
2284                                     &state->tmp);
2285         if (tevent_req_nomem(subreq, req)) {
2286                 return tevent_req_post(req, ev);
2287         }
2288         tevent_req_set_callback(subreq, rpccli_lsa_LookupSids_done, req);
2289         return req;
2290 }
2291
2292 static void rpccli_lsa_LookupSids_done(struct tevent_req *subreq)
2293 {
2294         struct tevent_req *req = tevent_req_callback_data(
2295                 subreq, struct tevent_req);
2296         struct rpccli_lsa_LookupSids_state *state = tevent_req_data(
2297                 req, struct rpccli_lsa_LookupSids_state);
2298         NTSTATUS status;
2299         TALLOC_CTX *mem_ctx;
2300
2301         if (state->out_mem_ctx) {
2302                 mem_ctx = state->out_mem_ctx;
2303         } else {
2304                 mem_ctx = state;
2305         }
2306
2307         status = state->dispatch_recv(subreq, mem_ctx);
2308         TALLOC_FREE(subreq);
2309         if (!NT_STATUS_IS_OK(status)) {
2310                 tevent_req_nterror(req, status);
2311                 return;
2312         }
2313
2314         /* Copy out parameters */
2315         *state->orig.out.domains = *state->tmp.out.domains;
2316         *state->orig.out.names = *state->tmp.out.names;
2317         *state->orig.out.count = *state->tmp.out.count;
2318
2319         /* Copy result */
2320         state->orig.out.result = state->tmp.out.result;
2321
2322         /* Reset temporary structure */
2323         ZERO_STRUCT(state->tmp);
2324
2325         tevent_req_done(req);
2326 }
2327
2328 NTSTATUS rpccli_lsa_LookupSids_recv(struct tevent_req *req,
2329                                     TALLOC_CTX *mem_ctx,
2330                                     NTSTATUS *result)
2331 {
2332         struct rpccli_lsa_LookupSids_state *state = tevent_req_data(
2333                 req, struct rpccli_lsa_LookupSids_state);
2334         NTSTATUS status;
2335
2336         if (tevent_req_is_nterror(req, &status)) {
2337                 tevent_req_received(req);
2338                 return status;
2339         }
2340
2341         /* Steal possbile out parameters to the callers context */
2342         talloc_steal(mem_ctx, state->out_mem_ctx);
2343
2344         /* Return result */
2345         *result = state->orig.out.result;
2346
2347         tevent_req_received(req);
2348         return NT_STATUS_OK;
2349 }
2350
2351 NTSTATUS rpccli_lsa_LookupSids(struct rpc_pipe_client *cli,
2352                                TALLOC_CTX *mem_ctx,
2353                                struct policy_handle *handle /* [in] [ref] */,
2354                                struct lsa_SidArray *sids /* [in] [ref] */,
2355                                struct lsa_RefDomainList **domains /* [out] [ref] */,
2356                                struct lsa_TransNameArray *names /* [in,out] [ref] */,
2357                                enum lsa_LookupNamesLevel level /* [in]  */,
2358                                uint32_t *count /* [in,out] [ref] */)
2359 {
2360         struct lsa_LookupSids r;
2361         NTSTATUS status;
2362
2363         /* In parameters */
2364         r.in.handle = handle;
2365         r.in.sids = sids;
2366         r.in.names = names;
2367         r.in.level = level;
2368         r.in.count = count;
2369
2370         status = cli->dispatch(cli,
2371                                 mem_ctx,
2372                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
2373                                 NDR_LSA_LOOKUPSIDS,
2374                                 &r);
2375
2376         if (!NT_STATUS_IS_OK(status)) {
2377                 return status;
2378         }
2379
2380         if (NT_STATUS_IS_ERR(status)) {
2381                 return status;
2382         }
2383
2384         /* Return variables */
2385         *domains = *r.out.domains;
2386         *names = *r.out.names;
2387         *count = *r.out.count;
2388
2389         /* Return result */
2390         return r.out.result;
2391 }
2392
2393 struct rpccli_lsa_CreateSecret_state {
2394         struct lsa_CreateSecret orig;
2395         struct lsa_CreateSecret tmp;
2396         TALLOC_CTX *out_mem_ctx;
2397         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2398 };
2399
2400 static void rpccli_lsa_CreateSecret_done(struct tevent_req *subreq);
2401
2402 struct tevent_req *rpccli_lsa_CreateSecret_send(TALLOC_CTX *mem_ctx,
2403                                                 struct tevent_context *ev,
2404                                                 struct rpc_pipe_client *cli,
2405                                                 struct policy_handle *_handle /* [in] [ref] */,
2406                                                 struct lsa_String _name /* [in]  */,
2407                                                 uint32_t _access_mask /* [in]  */,
2408                                                 struct policy_handle *_sec_handle /* [out] [ref] */)
2409 {
2410         struct tevent_req *req;
2411         struct rpccli_lsa_CreateSecret_state *state;
2412         struct tevent_req *subreq;
2413
2414         req = tevent_req_create(mem_ctx, &state,
2415                                 struct rpccli_lsa_CreateSecret_state);
2416         if (req == NULL) {
2417                 return NULL;
2418         }
2419         state->out_mem_ctx = NULL;
2420         state->dispatch_recv = cli->dispatch_recv;
2421
2422         /* In parameters */
2423         state->orig.in.handle = _handle;
2424         state->orig.in.name = _name;
2425         state->orig.in.access_mask = _access_mask;
2426
2427         /* Out parameters */
2428         state->orig.out.sec_handle = _sec_handle;
2429
2430         /* Result */
2431         ZERO_STRUCT(state->orig.out.result);
2432
2433         state->out_mem_ctx = talloc_named_const(state, 0,
2434                              "rpccli_lsa_CreateSecret_out_memory");
2435         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2436                 return tevent_req_post(req, ev);
2437         }
2438
2439         /* make a temporary copy, that we pass to the dispatch function */
2440         state->tmp = state->orig;
2441
2442         subreq = cli->dispatch_send(state, ev, cli,
2443                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
2444                                     NDR_LSA_CREATESECRET,
2445                                     &state->tmp);
2446         if (tevent_req_nomem(subreq, req)) {
2447                 return tevent_req_post(req, ev);
2448         }
2449         tevent_req_set_callback(subreq, rpccli_lsa_CreateSecret_done, req);
2450         return req;
2451 }
2452
2453 static void rpccli_lsa_CreateSecret_done(struct tevent_req *subreq)
2454 {
2455         struct tevent_req *req = tevent_req_callback_data(
2456                 subreq, struct tevent_req);
2457         struct rpccli_lsa_CreateSecret_state *state = tevent_req_data(
2458                 req, struct rpccli_lsa_CreateSecret_state);
2459         NTSTATUS status;
2460         TALLOC_CTX *mem_ctx;
2461
2462         if (state->out_mem_ctx) {
2463                 mem_ctx = state->out_mem_ctx;
2464         } else {
2465                 mem_ctx = state;
2466         }
2467
2468         status = state->dispatch_recv(subreq, mem_ctx);
2469         TALLOC_FREE(subreq);
2470         if (!NT_STATUS_IS_OK(status)) {
2471                 tevent_req_nterror(req, status);
2472                 return;
2473         }
2474
2475         /* Copy out parameters */
2476         *state->orig.out.sec_handle = *state->tmp.out.sec_handle;
2477
2478         /* Copy result */
2479         state->orig.out.result = state->tmp.out.result;
2480
2481         /* Reset temporary structure */
2482         ZERO_STRUCT(state->tmp);
2483
2484         tevent_req_done(req);
2485 }
2486
2487 NTSTATUS rpccli_lsa_CreateSecret_recv(struct tevent_req *req,
2488                                       TALLOC_CTX *mem_ctx,
2489                                       NTSTATUS *result)
2490 {
2491         struct rpccli_lsa_CreateSecret_state *state = tevent_req_data(
2492                 req, struct rpccli_lsa_CreateSecret_state);
2493         NTSTATUS status;
2494
2495         if (tevent_req_is_nterror(req, &status)) {
2496                 tevent_req_received(req);
2497                 return status;
2498         }
2499
2500         /* Steal possbile out parameters to the callers context */
2501         talloc_steal(mem_ctx, state->out_mem_ctx);
2502
2503         /* Return result */
2504         *result = state->orig.out.result;
2505
2506         tevent_req_received(req);
2507         return NT_STATUS_OK;
2508 }
2509
2510 NTSTATUS rpccli_lsa_CreateSecret(struct rpc_pipe_client *cli,
2511                                  TALLOC_CTX *mem_ctx,
2512                                  struct policy_handle *handle /* [in] [ref] */,
2513                                  struct lsa_String name /* [in]  */,
2514                                  uint32_t access_mask /* [in]  */,
2515                                  struct policy_handle *sec_handle /* [out] [ref] */)
2516 {
2517         struct lsa_CreateSecret r;
2518         NTSTATUS status;
2519
2520         /* In parameters */
2521         r.in.handle = handle;
2522         r.in.name = name;
2523         r.in.access_mask = access_mask;
2524
2525         status = cli->dispatch(cli,
2526                                 mem_ctx,
2527                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
2528                                 NDR_LSA_CREATESECRET,
2529                                 &r);
2530
2531         if (!NT_STATUS_IS_OK(status)) {
2532                 return status;
2533         }
2534
2535         if (NT_STATUS_IS_ERR(status)) {
2536                 return status;
2537         }
2538
2539         /* Return variables */
2540         *sec_handle = *r.out.sec_handle;
2541
2542         /* Return result */
2543         return r.out.result;
2544 }
2545
2546 struct rpccli_lsa_OpenAccount_state {
2547         struct lsa_OpenAccount orig;
2548         struct lsa_OpenAccount tmp;
2549         TALLOC_CTX *out_mem_ctx;
2550         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2551 };
2552
2553 static void rpccli_lsa_OpenAccount_done(struct tevent_req *subreq);
2554
2555 struct tevent_req *rpccli_lsa_OpenAccount_send(TALLOC_CTX *mem_ctx,
2556                                                struct tevent_context *ev,
2557                                                struct rpc_pipe_client *cli,
2558                                                struct policy_handle *_handle /* [in] [ref] */,
2559                                                struct dom_sid2 *_sid /* [in] [ref] */,
2560                                                uint32_t _access_mask /* [in]  */,
2561                                                struct policy_handle *_acct_handle /* [out] [ref] */)
2562 {
2563         struct tevent_req *req;
2564         struct rpccli_lsa_OpenAccount_state *state;
2565         struct tevent_req *subreq;
2566
2567         req = tevent_req_create(mem_ctx, &state,
2568                                 struct rpccli_lsa_OpenAccount_state);
2569         if (req == NULL) {
2570                 return NULL;
2571         }
2572         state->out_mem_ctx = NULL;
2573         state->dispatch_recv = cli->dispatch_recv;
2574
2575         /* In parameters */
2576         state->orig.in.handle = _handle;
2577         state->orig.in.sid = _sid;
2578         state->orig.in.access_mask = _access_mask;
2579
2580         /* Out parameters */
2581         state->orig.out.acct_handle = _acct_handle;
2582
2583         /* Result */
2584         ZERO_STRUCT(state->orig.out.result);
2585
2586         state->out_mem_ctx = talloc_named_const(state, 0,
2587                              "rpccli_lsa_OpenAccount_out_memory");
2588         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2589                 return tevent_req_post(req, ev);
2590         }
2591
2592         /* make a temporary copy, that we pass to the dispatch function */
2593         state->tmp = state->orig;
2594
2595         subreq = cli->dispatch_send(state, ev, cli,
2596                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
2597                                     NDR_LSA_OPENACCOUNT,
2598                                     &state->tmp);
2599         if (tevent_req_nomem(subreq, req)) {
2600                 return tevent_req_post(req, ev);
2601         }
2602         tevent_req_set_callback(subreq, rpccli_lsa_OpenAccount_done, req);
2603         return req;
2604 }
2605
2606 static void rpccli_lsa_OpenAccount_done(struct tevent_req *subreq)
2607 {
2608         struct tevent_req *req = tevent_req_callback_data(
2609                 subreq, struct tevent_req);
2610         struct rpccli_lsa_OpenAccount_state *state = tevent_req_data(
2611                 req, struct rpccli_lsa_OpenAccount_state);
2612         NTSTATUS status;
2613         TALLOC_CTX *mem_ctx;
2614
2615         if (state->out_mem_ctx) {
2616                 mem_ctx = state->out_mem_ctx;
2617         } else {
2618                 mem_ctx = state;
2619         }
2620
2621         status = state->dispatch_recv(subreq, mem_ctx);
2622         TALLOC_FREE(subreq);
2623         if (!NT_STATUS_IS_OK(status)) {
2624                 tevent_req_nterror(req, status);
2625                 return;
2626         }
2627
2628         /* Copy out parameters */
2629         *state->orig.out.acct_handle = *state->tmp.out.acct_handle;
2630
2631         /* Copy result */
2632         state->orig.out.result = state->tmp.out.result;
2633
2634         /* Reset temporary structure */
2635         ZERO_STRUCT(state->tmp);
2636
2637         tevent_req_done(req);
2638 }
2639
2640 NTSTATUS rpccli_lsa_OpenAccount_recv(struct tevent_req *req,
2641                                      TALLOC_CTX *mem_ctx,
2642                                      NTSTATUS *result)
2643 {
2644         struct rpccli_lsa_OpenAccount_state *state = tevent_req_data(
2645                 req, struct rpccli_lsa_OpenAccount_state);
2646         NTSTATUS status;
2647
2648         if (tevent_req_is_nterror(req, &status)) {
2649                 tevent_req_received(req);
2650                 return status;
2651         }
2652
2653         /* Steal possbile out parameters to the callers context */
2654         talloc_steal(mem_ctx, state->out_mem_ctx);
2655
2656         /* Return result */
2657         *result = state->orig.out.result;
2658
2659         tevent_req_received(req);
2660         return NT_STATUS_OK;
2661 }
2662
2663 NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli,
2664                                 TALLOC_CTX *mem_ctx,
2665                                 struct policy_handle *handle /* [in] [ref] */,
2666                                 struct dom_sid2 *sid /* [in] [ref] */,
2667                                 uint32_t access_mask /* [in]  */,
2668                                 struct policy_handle *acct_handle /* [out] [ref] */)
2669 {
2670         struct lsa_OpenAccount r;
2671         NTSTATUS status;
2672
2673         /* In parameters */
2674         r.in.handle = handle;
2675         r.in.sid = sid;
2676         r.in.access_mask = access_mask;
2677
2678         status = cli->dispatch(cli,
2679                                 mem_ctx,
2680                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
2681                                 NDR_LSA_OPENACCOUNT,
2682                                 &r);
2683
2684         if (!NT_STATUS_IS_OK(status)) {
2685                 return status;
2686         }
2687
2688         if (NT_STATUS_IS_ERR(status)) {
2689                 return status;
2690         }
2691
2692         /* Return variables */
2693         *acct_handle = *r.out.acct_handle;
2694
2695         /* Return result */
2696         return r.out.result;
2697 }
2698
2699 struct rpccli_lsa_EnumPrivsAccount_state {
2700         struct lsa_EnumPrivsAccount orig;
2701         struct lsa_EnumPrivsAccount tmp;
2702         TALLOC_CTX *out_mem_ctx;
2703         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2704 };
2705
2706 static void rpccli_lsa_EnumPrivsAccount_done(struct tevent_req *subreq);
2707
2708 struct tevent_req *rpccli_lsa_EnumPrivsAccount_send(TALLOC_CTX *mem_ctx,
2709                                                     struct tevent_context *ev,
2710                                                     struct rpc_pipe_client *cli,
2711                                                     struct policy_handle *_handle /* [in] [ref] */,
2712                                                     struct lsa_PrivilegeSet **_privs /* [out] [ref] */)
2713 {
2714         struct tevent_req *req;
2715         struct rpccli_lsa_EnumPrivsAccount_state *state;
2716         struct tevent_req *subreq;
2717
2718         req = tevent_req_create(mem_ctx, &state,
2719                                 struct rpccli_lsa_EnumPrivsAccount_state);
2720         if (req == NULL) {
2721                 return NULL;
2722         }
2723         state->out_mem_ctx = NULL;
2724         state->dispatch_recv = cli->dispatch_recv;
2725
2726         /* In parameters */
2727         state->orig.in.handle = _handle;
2728
2729         /* Out parameters */
2730         state->orig.out.privs = _privs;
2731
2732         /* Result */
2733         ZERO_STRUCT(state->orig.out.result);
2734
2735         state->out_mem_ctx = talloc_named_const(state, 0,
2736                              "rpccli_lsa_EnumPrivsAccount_out_memory");
2737         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2738                 return tevent_req_post(req, ev);
2739         }
2740
2741         /* make a temporary copy, that we pass to the dispatch function */
2742         state->tmp = state->orig;
2743
2744         subreq = cli->dispatch_send(state, ev, cli,
2745                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
2746                                     NDR_LSA_ENUMPRIVSACCOUNT,
2747                                     &state->tmp);
2748         if (tevent_req_nomem(subreq, req)) {
2749                 return tevent_req_post(req, ev);
2750         }
2751         tevent_req_set_callback(subreq, rpccli_lsa_EnumPrivsAccount_done, req);
2752         return req;
2753 }
2754
2755 static void rpccli_lsa_EnumPrivsAccount_done(struct tevent_req *subreq)
2756 {
2757         struct tevent_req *req = tevent_req_callback_data(
2758                 subreq, struct tevent_req);
2759         struct rpccli_lsa_EnumPrivsAccount_state *state = tevent_req_data(
2760                 req, struct rpccli_lsa_EnumPrivsAccount_state);
2761         NTSTATUS status;
2762         TALLOC_CTX *mem_ctx;
2763
2764         if (state->out_mem_ctx) {
2765                 mem_ctx = state->out_mem_ctx;
2766         } else {
2767                 mem_ctx = state;
2768         }
2769
2770         status = state->dispatch_recv(subreq, mem_ctx);
2771         TALLOC_FREE(subreq);
2772         if (!NT_STATUS_IS_OK(status)) {
2773                 tevent_req_nterror(req, status);
2774                 return;
2775         }
2776
2777         /* Copy out parameters */
2778         *state->orig.out.privs = *state->tmp.out.privs;
2779
2780         /* Copy result */
2781         state->orig.out.result = state->tmp.out.result;
2782
2783         /* Reset temporary structure */
2784         ZERO_STRUCT(state->tmp);
2785
2786         tevent_req_done(req);
2787 }
2788
2789 NTSTATUS rpccli_lsa_EnumPrivsAccount_recv(struct tevent_req *req,
2790                                           TALLOC_CTX *mem_ctx,
2791                                           NTSTATUS *result)
2792 {
2793         struct rpccli_lsa_EnumPrivsAccount_state *state = tevent_req_data(
2794                 req, struct rpccli_lsa_EnumPrivsAccount_state);
2795         NTSTATUS status;
2796
2797         if (tevent_req_is_nterror(req, &status)) {
2798                 tevent_req_received(req);
2799                 return status;
2800         }
2801
2802         /* Steal possbile out parameters to the callers context */
2803         talloc_steal(mem_ctx, state->out_mem_ctx);
2804
2805         /* Return result */
2806         *result = state->orig.out.result;
2807
2808         tevent_req_received(req);
2809         return NT_STATUS_OK;
2810 }
2811
2812 NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli,
2813                                      TALLOC_CTX *mem_ctx,
2814                                      struct policy_handle *handle /* [in] [ref] */,
2815                                      struct lsa_PrivilegeSet **privs /* [out] [ref] */)
2816 {
2817         struct lsa_EnumPrivsAccount r;
2818         NTSTATUS status;
2819
2820         /* In parameters */
2821         r.in.handle = handle;
2822
2823         status = cli->dispatch(cli,
2824                                 mem_ctx,
2825                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
2826                                 NDR_LSA_ENUMPRIVSACCOUNT,
2827                                 &r);
2828
2829         if (!NT_STATUS_IS_OK(status)) {
2830                 return status;
2831         }
2832
2833         if (NT_STATUS_IS_ERR(status)) {
2834                 return status;
2835         }
2836
2837         /* Return variables */
2838         *privs = *r.out.privs;
2839
2840         /* Return result */
2841         return r.out.result;
2842 }
2843
2844 struct rpccli_lsa_AddPrivilegesToAccount_state {
2845         struct lsa_AddPrivilegesToAccount orig;
2846         struct lsa_AddPrivilegesToAccount tmp;
2847         TALLOC_CTX *out_mem_ctx;
2848         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2849 };
2850
2851 static void rpccli_lsa_AddPrivilegesToAccount_done(struct tevent_req *subreq);
2852
2853 struct tevent_req *rpccli_lsa_AddPrivilegesToAccount_send(TALLOC_CTX *mem_ctx,
2854                                                           struct tevent_context *ev,
2855                                                           struct rpc_pipe_client *cli,
2856                                                           struct policy_handle *_handle /* [in] [ref] */,
2857                                                           struct lsa_PrivilegeSet *_privs /* [in] [ref] */)
2858 {
2859         struct tevent_req *req;
2860         struct rpccli_lsa_AddPrivilegesToAccount_state *state;
2861         struct tevent_req *subreq;
2862
2863         req = tevent_req_create(mem_ctx, &state,
2864                                 struct rpccli_lsa_AddPrivilegesToAccount_state);
2865         if (req == NULL) {
2866                 return NULL;
2867         }
2868         state->out_mem_ctx = NULL;
2869         state->dispatch_recv = cli->dispatch_recv;
2870
2871         /* In parameters */
2872         state->orig.in.handle = _handle;
2873         state->orig.in.privs = _privs;
2874
2875         /* Out parameters */
2876
2877         /* Result */
2878         ZERO_STRUCT(state->orig.out.result);
2879
2880         /* make a temporary copy, that we pass to the dispatch function */
2881         state->tmp = state->orig;
2882
2883         subreq = cli->dispatch_send(state, ev, cli,
2884                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
2885                                     NDR_LSA_ADDPRIVILEGESTOACCOUNT,
2886                                     &state->tmp);
2887         if (tevent_req_nomem(subreq, req)) {
2888                 return tevent_req_post(req, ev);
2889         }
2890         tevent_req_set_callback(subreq, rpccli_lsa_AddPrivilegesToAccount_done, req);
2891         return req;
2892 }
2893
2894 static void rpccli_lsa_AddPrivilegesToAccount_done(struct tevent_req *subreq)
2895 {
2896         struct tevent_req *req = tevent_req_callback_data(
2897                 subreq, struct tevent_req);
2898         struct rpccli_lsa_AddPrivilegesToAccount_state *state = tevent_req_data(
2899                 req, struct rpccli_lsa_AddPrivilegesToAccount_state);
2900         NTSTATUS status;
2901         TALLOC_CTX *mem_ctx;
2902
2903         if (state->out_mem_ctx) {
2904                 mem_ctx = state->out_mem_ctx;
2905         } else {
2906                 mem_ctx = state;
2907         }
2908
2909         status = state->dispatch_recv(subreq, mem_ctx);
2910         TALLOC_FREE(subreq);
2911         if (!NT_STATUS_IS_OK(status)) {
2912                 tevent_req_nterror(req, status);
2913                 return;
2914         }
2915
2916         /* Copy out parameters */
2917
2918         /* Copy result */
2919         state->orig.out.result = state->tmp.out.result;
2920
2921         /* Reset temporary structure */
2922         ZERO_STRUCT(state->tmp);
2923
2924         tevent_req_done(req);
2925 }
2926
2927 NTSTATUS rpccli_lsa_AddPrivilegesToAccount_recv(struct tevent_req *req,
2928                                                 TALLOC_CTX *mem_ctx,
2929                                                 NTSTATUS *result)
2930 {
2931         struct rpccli_lsa_AddPrivilegesToAccount_state *state = tevent_req_data(
2932                 req, struct rpccli_lsa_AddPrivilegesToAccount_state);
2933         NTSTATUS status;
2934
2935         if (tevent_req_is_nterror(req, &status)) {
2936                 tevent_req_received(req);
2937                 return status;
2938         }
2939
2940         /* Steal possbile out parameters to the callers context */
2941         talloc_steal(mem_ctx, state->out_mem_ctx);
2942
2943         /* Return result */
2944         *result = state->orig.out.result;
2945
2946         tevent_req_received(req);
2947         return NT_STATUS_OK;
2948 }
2949
2950 NTSTATUS rpccli_lsa_AddPrivilegesToAccount(struct rpc_pipe_client *cli,
2951                                            TALLOC_CTX *mem_ctx,
2952                                            struct policy_handle *handle /* [in] [ref] */,
2953                                            struct lsa_PrivilegeSet *privs /* [in] [ref] */)
2954 {
2955         struct lsa_AddPrivilegesToAccount r;
2956         NTSTATUS status;
2957
2958         /* In parameters */
2959         r.in.handle = handle;
2960         r.in.privs = privs;
2961
2962         status = cli->dispatch(cli,
2963                                 mem_ctx,
2964                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
2965                                 NDR_LSA_ADDPRIVILEGESTOACCOUNT,
2966                                 &r);
2967
2968         if (!NT_STATUS_IS_OK(status)) {
2969                 return status;
2970         }
2971
2972         if (NT_STATUS_IS_ERR(status)) {
2973                 return status;
2974         }
2975
2976         /* Return variables */
2977
2978         /* Return result */
2979         return r.out.result;
2980 }
2981
2982 struct rpccli_lsa_RemovePrivilegesFromAccount_state {
2983         struct lsa_RemovePrivilegesFromAccount orig;
2984         struct lsa_RemovePrivilegesFromAccount tmp;
2985         TALLOC_CTX *out_mem_ctx;
2986         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2987 };
2988
2989 static void rpccli_lsa_RemovePrivilegesFromAccount_done(struct tevent_req *subreq);
2990
2991 struct tevent_req *rpccli_lsa_RemovePrivilegesFromAccount_send(TALLOC_CTX *mem_ctx,
2992                                                                struct tevent_context *ev,
2993                                                                struct rpc_pipe_client *cli,
2994                                                                struct policy_handle *_handle /* [in] [ref] */,
2995                                                                uint8_t _remove_all /* [in]  */,
2996                                                                struct lsa_PrivilegeSet *_privs /* [in] [unique] */)
2997 {
2998         struct tevent_req *req;
2999         struct rpccli_lsa_RemovePrivilegesFromAccount_state *state;
3000         struct tevent_req *subreq;
3001
3002         req = tevent_req_create(mem_ctx, &state,
3003                                 struct rpccli_lsa_RemovePrivilegesFromAccount_state);
3004         if (req == NULL) {
3005                 return NULL;
3006         }
3007         state->out_mem_ctx = NULL;
3008         state->dispatch_recv = cli->dispatch_recv;
3009
3010         /* In parameters */
3011         state->orig.in.handle = _handle;
3012         state->orig.in.remove_all = _remove_all;
3013         state->orig.in.privs = _privs;
3014
3015         /* Out parameters */
3016
3017         /* Result */
3018         ZERO_STRUCT(state->orig.out.result);
3019
3020         /* make a temporary copy, that we pass to the dispatch function */
3021         state->tmp = state->orig;
3022
3023         subreq = cli->dispatch_send(state, ev, cli,
3024                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
3025                                     NDR_LSA_REMOVEPRIVILEGESFROMACCOUNT,
3026                                     &state->tmp);
3027         if (tevent_req_nomem(subreq, req)) {
3028                 return tevent_req_post(req, ev);
3029         }
3030         tevent_req_set_callback(subreq, rpccli_lsa_RemovePrivilegesFromAccount_done, req);
3031         return req;
3032 }
3033
3034 static void rpccli_lsa_RemovePrivilegesFromAccount_done(struct tevent_req *subreq)
3035 {
3036         struct tevent_req *req = tevent_req_callback_data(
3037                 subreq, struct tevent_req);
3038         struct rpccli_lsa_RemovePrivilegesFromAccount_state *state = tevent_req_data(
3039                 req, struct rpccli_lsa_RemovePrivilegesFromAccount_state);
3040         NTSTATUS status;
3041         TALLOC_CTX *mem_ctx;
3042
3043         if (state->out_mem_ctx) {
3044                 mem_ctx = state->out_mem_ctx;
3045         } else {
3046                 mem_ctx = state;
3047         }
3048
3049         status = state->dispatch_recv(subreq, mem_ctx);
3050         TALLOC_FREE(subreq);
3051         if (!NT_STATUS_IS_OK(status)) {
3052                 tevent_req_nterror(req, status);
3053                 return;
3054         }
3055
3056         /* Copy out parameters */
3057
3058         /* Copy result */
3059         state->orig.out.result = state->tmp.out.result;
3060
3061         /* Reset temporary structure */
3062         ZERO_STRUCT(state->tmp);
3063
3064         tevent_req_done(req);
3065 }
3066
3067 NTSTATUS rpccli_lsa_RemovePrivilegesFromAccount_recv(struct tevent_req *req,
3068                                                      TALLOC_CTX *mem_ctx,
3069                                                      NTSTATUS *result)
3070 {
3071         struct rpccli_lsa_RemovePrivilegesFromAccount_state *state = tevent_req_data(
3072                 req, struct rpccli_lsa_RemovePrivilegesFromAccount_state);
3073         NTSTATUS status;
3074
3075         if (tevent_req_is_nterror(req, &status)) {
3076                 tevent_req_received(req);
3077                 return status;
3078         }
3079
3080         /* Steal possbile out parameters to the callers context */
3081         talloc_steal(mem_ctx, state->out_mem_ctx);
3082
3083         /* Return result */
3084         *result = state->orig.out.result;
3085
3086         tevent_req_received(req);
3087         return NT_STATUS_OK;
3088 }
3089
3090 NTSTATUS rpccli_lsa_RemovePrivilegesFromAccount(struct rpc_pipe_client *cli,
3091                                                 TALLOC_CTX *mem_ctx,
3092                                                 struct policy_handle *handle /* [in] [ref] */,
3093                                                 uint8_t remove_all /* [in]  */,
3094                                                 struct lsa_PrivilegeSet *privs /* [in] [unique] */)
3095 {
3096         struct lsa_RemovePrivilegesFromAccount r;
3097         NTSTATUS status;
3098
3099         /* In parameters */
3100         r.in.handle = handle;
3101         r.in.remove_all = remove_all;
3102         r.in.privs = privs;
3103
3104         status = cli->dispatch(cli,
3105                                 mem_ctx,
3106                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
3107                                 NDR_LSA_REMOVEPRIVILEGESFROMACCOUNT,
3108                                 &r);
3109
3110         if (!NT_STATUS_IS_OK(status)) {
3111                 return status;
3112         }
3113
3114         if (NT_STATUS_IS_ERR(status)) {
3115                 return status;
3116         }
3117
3118         /* Return variables */
3119
3120         /* Return result */
3121         return r.out.result;
3122 }
3123
3124 struct rpccli_lsa_GetQuotasForAccount_state {
3125         struct lsa_GetQuotasForAccount orig;
3126         struct lsa_GetQuotasForAccount tmp;
3127         TALLOC_CTX *out_mem_ctx;
3128         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3129 };
3130
3131 static void rpccli_lsa_GetQuotasForAccount_done(struct tevent_req *subreq);
3132
3133 struct tevent_req *rpccli_lsa_GetQuotasForAccount_send(TALLOC_CTX *mem_ctx,
3134                                                        struct tevent_context *ev,
3135                                                        struct rpc_pipe_client *cli)
3136 {
3137         struct tevent_req *req;
3138         struct rpccli_lsa_GetQuotasForAccount_state *state;
3139         struct tevent_req *subreq;
3140
3141         req = tevent_req_create(mem_ctx, &state,
3142                                 struct rpccli_lsa_GetQuotasForAccount_state);
3143         if (req == NULL) {
3144                 return NULL;
3145         }
3146         state->out_mem_ctx = NULL;
3147         state->dispatch_recv = cli->dispatch_recv;
3148
3149         /* In parameters */
3150
3151         /* Out parameters */
3152
3153         /* Result */
3154         ZERO_STRUCT(state->orig.out.result);
3155
3156         /* make a temporary copy, that we pass to the dispatch function */
3157         state->tmp = state->orig;
3158
3159         subreq = cli->dispatch_send(state, ev, cli,
3160                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
3161                                     NDR_LSA_GETQUOTASFORACCOUNT,
3162                                     &state->tmp);
3163         if (tevent_req_nomem(subreq, req)) {
3164                 return tevent_req_post(req, ev);
3165         }
3166         tevent_req_set_callback(subreq, rpccli_lsa_GetQuotasForAccount_done, req);
3167         return req;
3168 }
3169
3170 static void rpccli_lsa_GetQuotasForAccount_done(struct tevent_req *subreq)
3171 {
3172         struct tevent_req *req = tevent_req_callback_data(
3173                 subreq, struct tevent_req);
3174         struct rpccli_lsa_GetQuotasForAccount_state *state = tevent_req_data(
3175                 req, struct rpccli_lsa_GetQuotasForAccount_state);
3176         NTSTATUS status;
3177         TALLOC_CTX *mem_ctx;
3178
3179         if (state->out_mem_ctx) {
3180                 mem_ctx = state->out_mem_ctx;
3181         } else {
3182                 mem_ctx = state;
3183         }
3184
3185         status = state->dispatch_recv(subreq, mem_ctx);
3186         TALLOC_FREE(subreq);
3187         if (!NT_STATUS_IS_OK(status)) {
3188                 tevent_req_nterror(req, status);
3189                 return;
3190         }
3191
3192         /* Copy out parameters */
3193
3194         /* Copy result */
3195         state->orig.out.result = state->tmp.out.result;
3196
3197         /* Reset temporary structure */
3198         ZERO_STRUCT(state->tmp);
3199
3200         tevent_req_done(req);
3201 }
3202
3203 NTSTATUS rpccli_lsa_GetQuotasForAccount_recv(struct tevent_req *req,
3204                                              TALLOC_CTX *mem_ctx,
3205                                              NTSTATUS *result)
3206 {
3207         struct rpccli_lsa_GetQuotasForAccount_state *state = tevent_req_data(
3208                 req, struct rpccli_lsa_GetQuotasForAccount_state);
3209         NTSTATUS status;
3210
3211         if (tevent_req_is_nterror(req, &status)) {
3212                 tevent_req_received(req);
3213                 return status;
3214         }
3215
3216         /* Steal possbile out parameters to the callers context */
3217         talloc_steal(mem_ctx, state->out_mem_ctx);
3218
3219         /* Return result */
3220         *result = state->orig.out.result;
3221
3222         tevent_req_received(req);
3223         return NT_STATUS_OK;
3224 }
3225
3226 NTSTATUS rpccli_lsa_GetQuotasForAccount(struct rpc_pipe_client *cli,
3227                                         TALLOC_CTX *mem_ctx)
3228 {
3229         struct lsa_GetQuotasForAccount r;
3230         NTSTATUS status;
3231
3232         /* In parameters */
3233
3234         status = cli->dispatch(cli,
3235                                 mem_ctx,
3236                                 NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
3237                                 NDR_LSA_GETQUOTASFORACCOUNT,
3238                                 &r);
3239
3240         if (!NT_STATUS_IS_OK(status)) {
3241                 return status;
3242         }
3243
3244         if (NT_STATUS_IS_ERR(status)) {
3245                 return status;
3246         }
3247
3248         /* Return variables */
3249
3250         /* Return result */
3251         return r.out.result;
3252 }
3253
3254 struct rpccli_lsa_SetQuotasForAccount_state {
3255         struct lsa_SetQuotasForAccount orig;
3256         struct lsa_SetQuotasForAccount tmp;
3257         TALLOC_CTX *out_mem_ctx;
3258         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3259 };
3260
3261 static void rpccli_lsa_SetQuotasForAccount_done(struct tevent_req *subreq);
3262
3263 struct tevent_req *rpccli_lsa_SetQuotasForAccount_send(TALLOC_CTX *mem_ctx,
3264                                                        struct tevent_context *ev,
3265                                                        struct rpc_pipe_client *cli)
3266 {
3267         struct tevent_req *req;
3268         struct rpccli_lsa_SetQuotasForAccount_state *state;
3269         struct tevent_req *subreq;
3270
3271         req = tevent_req_create(mem_ctx, &state,
3272                                 struct rpccli_lsa_SetQuotasForAccount_state);
3273         if (req == NULL) {
3274                 return NULL;
3275         }
3276         state->out_mem_ctx = NULL;
3277         state->dispatch_recv = cli->dispatch_recv;
3278
3279         /* In parameters */
3280
3281         /* Out parameters */
3282
3283         /* Result */
3284         ZERO_STRUCT(state->orig.out.result);
3285
3286         /* make a temporary copy, that we pass to the dispatch function */
3287         state->tmp = state->orig;
3288
3289         subreq = cli->dispatch_send(state, ev, cli,
3290                                     NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
3291                                     NDR_LSA_SETQUOTASFORACCOUNT,
3292                                     &state->tmp);
3293         if (tevent_req_nomem(subreq, req)) {
3294                 return tevent_req_post(req, ev);
3295         }
3296         tevent_req_set_callback(subreq, rpccli_lsa_SetQuotasForAccount_done, req);
3297         return req;
3298 }
3299
3300 static void rpccli_lsa_SetQuotasForAccount_done(struct tevent_req *subreq)
3301 {
3302         struct tevent_req *req = tevent_req_callback_data(
3303                 subreq, struct tevent_req);
3304         struct rpccli_lsa_SetQuotasForAccount_state *state = tevent_req_data(
3305                 req, struct rpccli_lsa_SetQuotasForAccount_state);
3306         NTSTATUS status;
3307         TALLOC_CTX *mem_ctx;
3308
3309         if (state->out_mem_ctx) {
3310                 mem_ctx = state->out_mem_ctx;
3311         } else {
3312                 mem_ctx = state;
3313         }
3314
3315         status = state->dispatch_recv(subreq, mem_ctx);
3316         TALLOC_FREE(subreq);
3317         if (!NT_STATUS_IS_OK(status)) {
3318                 tevent_req_nterror(req, status);
3319                 return;
3320         }
3321
3322