netlogon: document some more MSVC flags.
[metze/samba/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         if (DEBUGLEVEL >= 10) {
45                 NDR_PRINT_IN_DEBUG(lsa_Close, &state->orig);
46         }
47
48         state->out_mem_ctx = talloc_named_const(state, 0,
49                              "rpccli_lsa_Close_out_memory");
50         if (tevent_req_nomem(state->out_mem_ctx, req)) {
51                 return tevent_req_post(req, ev);
52         }
53
54         /* make a temporary copy, that we pass to the dispatch function */
55         state->tmp = state->orig;
56
57         subreq = cli->dispatch_send(state, ev, cli,
58                                     &ndr_table_lsarpc,
59                                     NDR_LSA_CLOSE,
60                                     &state->tmp);
61         if (tevent_req_nomem(subreq, req)) {
62                 return tevent_req_post(req, ev);
63         }
64         tevent_req_set_callback(subreq, rpccli_lsa_Close_done, req);
65         return req;
66 }
67
68 static void rpccli_lsa_Close_done(struct tevent_req *subreq)
69 {
70         struct tevent_req *req = tevent_req_callback_data(
71                 subreq, struct tevent_req);
72         struct rpccli_lsa_Close_state *state = tevent_req_data(
73                 req, struct rpccli_lsa_Close_state);
74         NTSTATUS status;
75         TALLOC_CTX *mem_ctx;
76
77         if (state->out_mem_ctx) {
78                 mem_ctx = state->out_mem_ctx;
79         } else {
80                 mem_ctx = state;
81         }
82
83         status = state->dispatch_recv(subreq, mem_ctx);
84         TALLOC_FREE(subreq);
85         if (!NT_STATUS_IS_OK(status)) {
86                 tevent_req_nterror(req, status);
87                 return;
88         }
89
90         /* Copy out parameters */
91         *state->orig.out.handle = *state->tmp.out.handle;
92
93         /* Copy result */
94         state->orig.out.result = state->tmp.out.result;
95
96         /* Reset temporary structure */
97         ZERO_STRUCT(state->tmp);
98
99         if (DEBUGLEVEL >= 10) {
100                 NDR_PRINT_OUT_DEBUG(lsa_Close, &state->orig);
101         }
102
103         tevent_req_done(req);
104 }
105
106 NTSTATUS rpccli_lsa_Close_recv(struct tevent_req *req,
107                                TALLOC_CTX *mem_ctx,
108                                NTSTATUS *result)
109 {
110         struct rpccli_lsa_Close_state *state = tevent_req_data(
111                 req, struct rpccli_lsa_Close_state);
112         NTSTATUS status;
113
114         if (tevent_req_is_nterror(req, &status)) {
115                 tevent_req_received(req);
116                 return status;
117         }
118
119         /* Steal possbile out parameters to the callers context */
120         talloc_steal(mem_ctx, state->out_mem_ctx);
121
122         /* Return result */
123         *result = state->orig.out.result;
124
125         tevent_req_received(req);
126         return NT_STATUS_OK;
127 }
128
129 NTSTATUS rpccli_lsa_Close(struct rpc_pipe_client *cli,
130                           TALLOC_CTX *mem_ctx,
131                           struct policy_handle *handle /* [in,out] [ref] */)
132 {
133         struct lsa_Close r;
134         NTSTATUS status;
135
136         /* In parameters */
137         r.in.handle = handle;
138
139         if (DEBUGLEVEL >= 10) {
140                 NDR_PRINT_IN_DEBUG(lsa_Close, &r);
141         }
142
143         status = cli->dispatch(cli,
144                                 mem_ctx,
145                                 &ndr_table_lsarpc,
146                                 NDR_LSA_CLOSE,
147                                 &r);
148
149         if (!NT_STATUS_IS_OK(status)) {
150                 return status;
151         }
152
153         if (DEBUGLEVEL >= 10) {
154                 NDR_PRINT_OUT_DEBUG(lsa_Close, &r);
155         }
156
157         if (NT_STATUS_IS_ERR(status)) {
158                 return status;
159         }
160
161         /* Return variables */
162         *handle = *r.out.handle;
163
164         /* Return result */
165         return r.out.result;
166 }
167
168 struct rpccli_lsa_Delete_state {
169         struct lsa_Delete orig;
170         struct lsa_Delete tmp;
171         TALLOC_CTX *out_mem_ctx;
172         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
173 };
174
175 static void rpccli_lsa_Delete_done(struct tevent_req *subreq);
176
177 struct tevent_req *rpccli_lsa_Delete_send(TALLOC_CTX *mem_ctx,
178                                           struct tevent_context *ev,
179                                           struct rpc_pipe_client *cli,
180                                           struct policy_handle *_handle /* [in] [ref] */)
181 {
182         struct tevent_req *req;
183         struct rpccli_lsa_Delete_state *state;
184         struct tevent_req *subreq;
185
186         req = tevent_req_create(mem_ctx, &state,
187                                 struct rpccli_lsa_Delete_state);
188         if (req == NULL) {
189                 return NULL;
190         }
191         state->out_mem_ctx = NULL;
192         state->dispatch_recv = cli->dispatch_recv;
193
194         /* In parameters */
195         state->orig.in.handle = _handle;
196
197         /* Out parameters */
198
199         /* Result */
200         ZERO_STRUCT(state->orig.out.result);
201
202         if (DEBUGLEVEL >= 10) {
203                 NDR_PRINT_IN_DEBUG(lsa_Delete, &state->orig);
204         }
205
206         /* make a temporary copy, that we pass to the dispatch function */
207         state->tmp = state->orig;
208
209         subreq = cli->dispatch_send(state, ev, cli,
210                                     &ndr_table_lsarpc,
211                                     NDR_LSA_DELETE,
212                                     &state->tmp);
213         if (tevent_req_nomem(subreq, req)) {
214                 return tevent_req_post(req, ev);
215         }
216         tevent_req_set_callback(subreq, rpccli_lsa_Delete_done, req);
217         return req;
218 }
219
220 static void rpccli_lsa_Delete_done(struct tevent_req *subreq)
221 {
222         struct tevent_req *req = tevent_req_callback_data(
223                 subreq, struct tevent_req);
224         struct rpccli_lsa_Delete_state *state = tevent_req_data(
225                 req, struct rpccli_lsa_Delete_state);
226         NTSTATUS status;
227         TALLOC_CTX *mem_ctx;
228
229         if (state->out_mem_ctx) {
230                 mem_ctx = state->out_mem_ctx;
231         } else {
232                 mem_ctx = state;
233         }
234
235         status = state->dispatch_recv(subreq, mem_ctx);
236         TALLOC_FREE(subreq);
237         if (!NT_STATUS_IS_OK(status)) {
238                 tevent_req_nterror(req, status);
239                 return;
240         }
241
242         /* Copy out parameters */
243
244         /* Copy result */
245         state->orig.out.result = state->tmp.out.result;
246
247         /* Reset temporary structure */
248         ZERO_STRUCT(state->tmp);
249
250         if (DEBUGLEVEL >= 10) {
251                 NDR_PRINT_OUT_DEBUG(lsa_Delete, &state->orig);
252         }
253
254         tevent_req_done(req);
255 }
256
257 NTSTATUS rpccli_lsa_Delete_recv(struct tevent_req *req,
258                                 TALLOC_CTX *mem_ctx,
259                                 NTSTATUS *result)
260 {
261         struct rpccli_lsa_Delete_state *state = tevent_req_data(
262                 req, struct rpccli_lsa_Delete_state);
263         NTSTATUS status;
264
265         if (tevent_req_is_nterror(req, &status)) {
266                 tevent_req_received(req);
267                 return status;
268         }
269
270         /* Steal possbile out parameters to the callers context */
271         talloc_steal(mem_ctx, state->out_mem_ctx);
272
273         /* Return result */
274         *result = state->orig.out.result;
275
276         tevent_req_received(req);
277         return NT_STATUS_OK;
278 }
279
280 NTSTATUS rpccli_lsa_Delete(struct rpc_pipe_client *cli,
281                            TALLOC_CTX *mem_ctx,
282                            struct policy_handle *handle /* [in] [ref] */)
283 {
284         struct lsa_Delete r;
285         NTSTATUS status;
286
287         /* In parameters */
288         r.in.handle = handle;
289
290         if (DEBUGLEVEL >= 10) {
291                 NDR_PRINT_IN_DEBUG(lsa_Delete, &r);
292         }
293
294         status = cli->dispatch(cli,
295                                 mem_ctx,
296                                 &ndr_table_lsarpc,
297                                 NDR_LSA_DELETE,
298                                 &r);
299
300         if (!NT_STATUS_IS_OK(status)) {
301                 return status;
302         }
303
304         if (DEBUGLEVEL >= 10) {
305                 NDR_PRINT_OUT_DEBUG(lsa_Delete, &r);
306         }
307
308         if (NT_STATUS_IS_ERR(status)) {
309                 return status;
310         }
311
312         /* Return variables */
313
314         /* Return result */
315         return r.out.result;
316 }
317
318 struct rpccli_lsa_EnumPrivs_state {
319         struct lsa_EnumPrivs orig;
320         struct lsa_EnumPrivs tmp;
321         TALLOC_CTX *out_mem_ctx;
322         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
323 };
324
325 static void rpccli_lsa_EnumPrivs_done(struct tevent_req *subreq);
326
327 struct tevent_req *rpccli_lsa_EnumPrivs_send(TALLOC_CTX *mem_ctx,
328                                              struct tevent_context *ev,
329                                              struct rpc_pipe_client *cli,
330                                              struct policy_handle *_handle /* [in] [ref] */,
331                                              uint32_t *_resume_handle /* [in,out] [ref] */,
332                                              struct lsa_PrivArray *_privs /* [out] [ref] */,
333                                              uint32_t _max_count /* [in]  */)
334 {
335         struct tevent_req *req;
336         struct rpccli_lsa_EnumPrivs_state *state;
337         struct tevent_req *subreq;
338
339         req = tevent_req_create(mem_ctx, &state,
340                                 struct rpccli_lsa_EnumPrivs_state);
341         if (req == NULL) {
342                 return NULL;
343         }
344         state->out_mem_ctx = NULL;
345         state->dispatch_recv = cli->dispatch_recv;
346
347         /* In parameters */
348         state->orig.in.handle = _handle;
349         state->orig.in.resume_handle = _resume_handle;
350         state->orig.in.max_count = _max_count;
351
352         /* Out parameters */
353         state->orig.out.resume_handle = _resume_handle;
354         state->orig.out.privs = _privs;
355
356         /* Result */
357         ZERO_STRUCT(state->orig.out.result);
358
359         if (DEBUGLEVEL >= 10) {
360                 NDR_PRINT_IN_DEBUG(lsa_EnumPrivs, &state->orig);
361         }
362
363         state->out_mem_ctx = talloc_named_const(state, 0,
364                              "rpccli_lsa_EnumPrivs_out_memory");
365         if (tevent_req_nomem(state->out_mem_ctx, req)) {
366                 return tevent_req_post(req, ev);
367         }
368
369         /* make a temporary copy, that we pass to the dispatch function */
370         state->tmp = state->orig;
371
372         subreq = cli->dispatch_send(state, ev, cli,
373                                     &ndr_table_lsarpc,
374                                     NDR_LSA_ENUMPRIVS,
375                                     &state->tmp);
376         if (tevent_req_nomem(subreq, req)) {
377                 return tevent_req_post(req, ev);
378         }
379         tevent_req_set_callback(subreq, rpccli_lsa_EnumPrivs_done, req);
380         return req;
381 }
382
383 static void rpccli_lsa_EnumPrivs_done(struct tevent_req *subreq)
384 {
385         struct tevent_req *req = tevent_req_callback_data(
386                 subreq, struct tevent_req);
387         struct rpccli_lsa_EnumPrivs_state *state = tevent_req_data(
388                 req, struct rpccli_lsa_EnumPrivs_state);
389         NTSTATUS status;
390         TALLOC_CTX *mem_ctx;
391
392         if (state->out_mem_ctx) {
393                 mem_ctx = state->out_mem_ctx;
394         } else {
395                 mem_ctx = state;
396         }
397
398         status = state->dispatch_recv(subreq, mem_ctx);
399         TALLOC_FREE(subreq);
400         if (!NT_STATUS_IS_OK(status)) {
401                 tevent_req_nterror(req, status);
402                 return;
403         }
404
405         /* Copy out parameters */
406         *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
407         *state->orig.out.privs = *state->tmp.out.privs;
408
409         /* Copy result */
410         state->orig.out.result = state->tmp.out.result;
411
412         /* Reset temporary structure */
413         ZERO_STRUCT(state->tmp);
414
415         if (DEBUGLEVEL >= 10) {
416                 NDR_PRINT_OUT_DEBUG(lsa_EnumPrivs, &state->orig);
417         }
418
419         tevent_req_done(req);
420 }
421
422 NTSTATUS rpccli_lsa_EnumPrivs_recv(struct tevent_req *req,
423                                    TALLOC_CTX *mem_ctx,
424                                    NTSTATUS *result)
425 {
426         struct rpccli_lsa_EnumPrivs_state *state = tevent_req_data(
427                 req, struct rpccli_lsa_EnumPrivs_state);
428         NTSTATUS status;
429
430         if (tevent_req_is_nterror(req, &status)) {
431                 tevent_req_received(req);
432                 return status;
433         }
434
435         /* Steal possbile out parameters to the callers context */
436         talloc_steal(mem_ctx, state->out_mem_ctx);
437
438         /* Return result */
439         *result = state->orig.out.result;
440
441         tevent_req_received(req);
442         return NT_STATUS_OK;
443 }
444
445 NTSTATUS rpccli_lsa_EnumPrivs(struct rpc_pipe_client *cli,
446                               TALLOC_CTX *mem_ctx,
447                               struct policy_handle *handle /* [in] [ref] */,
448                               uint32_t *resume_handle /* [in,out] [ref] */,
449                               struct lsa_PrivArray *privs /* [out] [ref] */,
450                               uint32_t max_count /* [in]  */)
451 {
452         struct lsa_EnumPrivs r;
453         NTSTATUS status;
454
455         /* In parameters */
456         r.in.handle = handle;
457         r.in.resume_handle = resume_handle;
458         r.in.max_count = max_count;
459
460         if (DEBUGLEVEL >= 10) {
461                 NDR_PRINT_IN_DEBUG(lsa_EnumPrivs, &r);
462         }
463
464         status = cli->dispatch(cli,
465                                 mem_ctx,
466                                 &ndr_table_lsarpc,
467                                 NDR_LSA_ENUMPRIVS,
468                                 &r);
469
470         if (!NT_STATUS_IS_OK(status)) {
471                 return status;
472         }
473
474         if (DEBUGLEVEL >= 10) {
475                 NDR_PRINT_OUT_DEBUG(lsa_EnumPrivs, &r);
476         }
477
478         if (NT_STATUS_IS_ERR(status)) {
479                 return status;
480         }
481
482         /* Return variables */
483         *resume_handle = *r.out.resume_handle;
484         *privs = *r.out.privs;
485
486         /* Return result */
487         return r.out.result;
488 }
489
490 struct rpccli_lsa_QuerySecurity_state {
491         struct lsa_QuerySecurity orig;
492         struct lsa_QuerySecurity tmp;
493         TALLOC_CTX *out_mem_ctx;
494         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
495 };
496
497 static void rpccli_lsa_QuerySecurity_done(struct tevent_req *subreq);
498
499 struct tevent_req *rpccli_lsa_QuerySecurity_send(TALLOC_CTX *mem_ctx,
500                                                  struct tevent_context *ev,
501                                                  struct rpc_pipe_client *cli,
502                                                  struct policy_handle *_handle /* [in] [ref] */,
503                                                  uint32_t _sec_info /* [in]  */,
504                                                  struct sec_desc_buf **_sdbuf /* [out] [ref] */)
505 {
506         struct tevent_req *req;
507         struct rpccli_lsa_QuerySecurity_state *state;
508         struct tevent_req *subreq;
509
510         req = tevent_req_create(mem_ctx, &state,
511                                 struct rpccli_lsa_QuerySecurity_state);
512         if (req == NULL) {
513                 return NULL;
514         }
515         state->out_mem_ctx = NULL;
516         state->dispatch_recv = cli->dispatch_recv;
517
518         /* In parameters */
519         state->orig.in.handle = _handle;
520         state->orig.in.sec_info = _sec_info;
521
522         /* Out parameters */
523         state->orig.out.sdbuf = _sdbuf;
524
525         /* Result */
526         ZERO_STRUCT(state->orig.out.result);
527
528         if (DEBUGLEVEL >= 10) {
529                 NDR_PRINT_IN_DEBUG(lsa_QuerySecurity, &state->orig);
530         }
531
532         state->out_mem_ctx = talloc_named_const(state, 0,
533                              "rpccli_lsa_QuerySecurity_out_memory");
534         if (tevent_req_nomem(state->out_mem_ctx, req)) {
535                 return tevent_req_post(req, ev);
536         }
537
538         /* make a temporary copy, that we pass to the dispatch function */
539         state->tmp = state->orig;
540
541         subreq = cli->dispatch_send(state, ev, cli,
542                                     &ndr_table_lsarpc,
543                                     NDR_LSA_QUERYSECURITY,
544                                     &state->tmp);
545         if (tevent_req_nomem(subreq, req)) {
546                 return tevent_req_post(req, ev);
547         }
548         tevent_req_set_callback(subreq, rpccli_lsa_QuerySecurity_done, req);
549         return req;
550 }
551
552 static void rpccli_lsa_QuerySecurity_done(struct tevent_req *subreq)
553 {
554         struct tevent_req *req = tevent_req_callback_data(
555                 subreq, struct tevent_req);
556         struct rpccli_lsa_QuerySecurity_state *state = tevent_req_data(
557                 req, struct rpccli_lsa_QuerySecurity_state);
558         NTSTATUS status;
559         TALLOC_CTX *mem_ctx;
560
561         if (state->out_mem_ctx) {
562                 mem_ctx = state->out_mem_ctx;
563         } else {
564                 mem_ctx = state;
565         }
566
567         status = state->dispatch_recv(subreq, mem_ctx);
568         TALLOC_FREE(subreq);
569         if (!NT_STATUS_IS_OK(status)) {
570                 tevent_req_nterror(req, status);
571                 return;
572         }
573
574         /* Copy out parameters */
575         *state->orig.out.sdbuf = *state->tmp.out.sdbuf;
576
577         /* Copy result */
578         state->orig.out.result = state->tmp.out.result;
579
580         /* Reset temporary structure */
581         ZERO_STRUCT(state->tmp);
582
583         if (DEBUGLEVEL >= 10) {
584                 NDR_PRINT_OUT_DEBUG(lsa_QuerySecurity, &state->orig);
585         }
586
587         tevent_req_done(req);
588 }
589
590 NTSTATUS rpccli_lsa_QuerySecurity_recv(struct tevent_req *req,
591                                        TALLOC_CTX *mem_ctx,
592                                        NTSTATUS *result)
593 {
594         struct rpccli_lsa_QuerySecurity_state *state = tevent_req_data(
595                 req, struct rpccli_lsa_QuerySecurity_state);
596         NTSTATUS status;
597
598         if (tevent_req_is_nterror(req, &status)) {
599                 tevent_req_received(req);
600                 return status;
601         }
602
603         /* Steal possbile out parameters to the callers context */
604         talloc_steal(mem_ctx, state->out_mem_ctx);
605
606         /* Return result */
607         *result = state->orig.out.result;
608
609         tevent_req_received(req);
610         return NT_STATUS_OK;
611 }
612
613 NTSTATUS rpccli_lsa_QuerySecurity(struct rpc_pipe_client *cli,
614                                   TALLOC_CTX *mem_ctx,
615                                   struct policy_handle *handle /* [in] [ref] */,
616                                   uint32_t sec_info /* [in]  */,
617                                   struct sec_desc_buf **sdbuf /* [out] [ref] */)
618 {
619         struct lsa_QuerySecurity r;
620         NTSTATUS status;
621
622         /* In parameters */
623         r.in.handle = handle;
624         r.in.sec_info = sec_info;
625
626         if (DEBUGLEVEL >= 10) {
627                 NDR_PRINT_IN_DEBUG(lsa_QuerySecurity, &r);
628         }
629
630         status = cli->dispatch(cli,
631                                 mem_ctx,
632                                 &ndr_table_lsarpc,
633                                 NDR_LSA_QUERYSECURITY,
634                                 &r);
635
636         if (!NT_STATUS_IS_OK(status)) {
637                 return status;
638         }
639
640         if (DEBUGLEVEL >= 10) {
641                 NDR_PRINT_OUT_DEBUG(lsa_QuerySecurity, &r);
642         }
643
644         if (NT_STATUS_IS_ERR(status)) {
645                 return status;
646         }
647
648         /* Return variables */
649         *sdbuf = *r.out.sdbuf;
650
651         /* Return result */
652         return r.out.result;
653 }
654
655 struct rpccli_lsa_SetSecObj_state {
656         struct lsa_SetSecObj orig;
657         struct lsa_SetSecObj tmp;
658         TALLOC_CTX *out_mem_ctx;
659         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
660 };
661
662 static void rpccli_lsa_SetSecObj_done(struct tevent_req *subreq);
663
664 struct tevent_req *rpccli_lsa_SetSecObj_send(TALLOC_CTX *mem_ctx,
665                                              struct tevent_context *ev,
666                                              struct rpc_pipe_client *cli,
667                                              struct policy_handle *_handle /* [in] [ref] */,
668                                              uint32_t _sec_info /* [in]  */,
669                                              struct sec_desc_buf *_sdbuf /* [in] [ref] */)
670 {
671         struct tevent_req *req;
672         struct rpccli_lsa_SetSecObj_state *state;
673         struct tevent_req *subreq;
674
675         req = tevent_req_create(mem_ctx, &state,
676                                 struct rpccli_lsa_SetSecObj_state);
677         if (req == NULL) {
678                 return NULL;
679         }
680         state->out_mem_ctx = NULL;
681         state->dispatch_recv = cli->dispatch_recv;
682
683         /* In parameters */
684         state->orig.in.handle = _handle;
685         state->orig.in.sec_info = _sec_info;
686         state->orig.in.sdbuf = _sdbuf;
687
688         /* Out parameters */
689
690         /* Result */
691         ZERO_STRUCT(state->orig.out.result);
692
693         if (DEBUGLEVEL >= 10) {
694                 NDR_PRINT_IN_DEBUG(lsa_SetSecObj, &state->orig);
695         }
696
697         /* make a temporary copy, that we pass to the dispatch function */
698         state->tmp = state->orig;
699
700         subreq = cli->dispatch_send(state, ev, cli,
701                                     &ndr_table_lsarpc,
702                                     NDR_LSA_SETSECOBJ,
703                                     &state->tmp);
704         if (tevent_req_nomem(subreq, req)) {
705                 return tevent_req_post(req, ev);
706         }
707         tevent_req_set_callback(subreq, rpccli_lsa_SetSecObj_done, req);
708         return req;
709 }
710
711 static void rpccli_lsa_SetSecObj_done(struct tevent_req *subreq)
712 {
713         struct tevent_req *req = tevent_req_callback_data(
714                 subreq, struct tevent_req);
715         struct rpccli_lsa_SetSecObj_state *state = tevent_req_data(
716                 req, struct rpccli_lsa_SetSecObj_state);
717         NTSTATUS status;
718         TALLOC_CTX *mem_ctx;
719
720         if (state->out_mem_ctx) {
721                 mem_ctx = state->out_mem_ctx;
722         } else {
723                 mem_ctx = state;
724         }
725
726         status = state->dispatch_recv(subreq, mem_ctx);
727         TALLOC_FREE(subreq);
728         if (!NT_STATUS_IS_OK(status)) {
729                 tevent_req_nterror(req, status);
730                 return;
731         }
732
733         /* Copy out parameters */
734
735         /* Copy result */
736         state->orig.out.result = state->tmp.out.result;
737
738         /* Reset temporary structure */
739         ZERO_STRUCT(state->tmp);
740
741         if (DEBUGLEVEL >= 10) {
742                 NDR_PRINT_OUT_DEBUG(lsa_SetSecObj, &state->orig);
743         }
744
745         tevent_req_done(req);
746 }
747
748 NTSTATUS rpccli_lsa_SetSecObj_recv(struct tevent_req *req,
749                                    TALLOC_CTX *mem_ctx,
750                                    NTSTATUS *result)
751 {
752         struct rpccli_lsa_SetSecObj_state *state = tevent_req_data(
753                 req, struct rpccli_lsa_SetSecObj_state);
754         NTSTATUS status;
755
756         if (tevent_req_is_nterror(req, &status)) {
757                 tevent_req_received(req);
758                 return status;
759         }
760
761         /* Steal possbile out parameters to the callers context */
762         talloc_steal(mem_ctx, state->out_mem_ctx);
763
764         /* Return result */
765         *result = state->orig.out.result;
766
767         tevent_req_received(req);
768         return NT_STATUS_OK;
769 }
770
771 NTSTATUS rpccli_lsa_SetSecObj(struct rpc_pipe_client *cli,
772                               TALLOC_CTX *mem_ctx,
773                               struct policy_handle *handle /* [in] [ref] */,
774                               uint32_t sec_info /* [in]  */,
775                               struct sec_desc_buf *sdbuf /* [in] [ref] */)
776 {
777         struct lsa_SetSecObj r;
778         NTSTATUS status;
779
780         /* In parameters */
781         r.in.handle = handle;
782         r.in.sec_info = sec_info;
783         r.in.sdbuf = sdbuf;
784
785         if (DEBUGLEVEL >= 10) {
786                 NDR_PRINT_IN_DEBUG(lsa_SetSecObj, &r);
787         }
788
789         status = cli->dispatch(cli,
790                                 mem_ctx,
791                                 &ndr_table_lsarpc,
792                                 NDR_LSA_SETSECOBJ,
793                                 &r);
794
795         if (!NT_STATUS_IS_OK(status)) {
796                 return status;
797         }
798
799         if (DEBUGLEVEL >= 10) {
800                 NDR_PRINT_OUT_DEBUG(lsa_SetSecObj, &r);
801         }
802
803         if (NT_STATUS_IS_ERR(status)) {
804                 return status;
805         }
806
807         /* Return variables */
808
809         /* Return result */
810         return r.out.result;
811 }
812
813 struct rpccli_lsa_ChangePassword_state {
814         struct lsa_ChangePassword orig;
815         struct lsa_ChangePassword tmp;
816         TALLOC_CTX *out_mem_ctx;
817         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
818 };
819
820 static void rpccli_lsa_ChangePassword_done(struct tevent_req *subreq);
821
822 struct tevent_req *rpccli_lsa_ChangePassword_send(TALLOC_CTX *mem_ctx,
823                                                   struct tevent_context *ev,
824                                                   struct rpc_pipe_client *cli)
825 {
826         struct tevent_req *req;
827         struct rpccli_lsa_ChangePassword_state *state;
828         struct tevent_req *subreq;
829
830         req = tevent_req_create(mem_ctx, &state,
831                                 struct rpccli_lsa_ChangePassword_state);
832         if (req == NULL) {
833                 return NULL;
834         }
835         state->out_mem_ctx = NULL;
836         state->dispatch_recv = cli->dispatch_recv;
837
838         /* In parameters */
839
840         /* Out parameters */
841
842         /* Result */
843         ZERO_STRUCT(state->orig.out.result);
844
845         if (DEBUGLEVEL >= 10) {
846                 NDR_PRINT_IN_DEBUG(lsa_ChangePassword, &state->orig);
847         }
848
849         /* make a temporary copy, that we pass to the dispatch function */
850         state->tmp = state->orig;
851
852         subreq = cli->dispatch_send(state, ev, cli,
853                                     &ndr_table_lsarpc,
854                                     NDR_LSA_CHANGEPASSWORD,
855                                     &state->tmp);
856         if (tevent_req_nomem(subreq, req)) {
857                 return tevent_req_post(req, ev);
858         }
859         tevent_req_set_callback(subreq, rpccli_lsa_ChangePassword_done, req);
860         return req;
861 }
862
863 static void rpccli_lsa_ChangePassword_done(struct tevent_req *subreq)
864 {
865         struct tevent_req *req = tevent_req_callback_data(
866                 subreq, struct tevent_req);
867         struct rpccli_lsa_ChangePassword_state *state = tevent_req_data(
868                 req, struct rpccli_lsa_ChangePassword_state);
869         NTSTATUS status;
870         TALLOC_CTX *mem_ctx;
871
872         if (state->out_mem_ctx) {
873                 mem_ctx = state->out_mem_ctx;
874         } else {
875                 mem_ctx = state;
876         }
877
878         status = state->dispatch_recv(subreq, mem_ctx);
879         TALLOC_FREE(subreq);
880         if (!NT_STATUS_IS_OK(status)) {
881                 tevent_req_nterror(req, status);
882                 return;
883         }
884
885         /* Copy out parameters */
886
887         /* Copy result */
888         state->orig.out.result = state->tmp.out.result;
889
890         /* Reset temporary structure */
891         ZERO_STRUCT(state->tmp);
892
893         if (DEBUGLEVEL >= 10) {
894                 NDR_PRINT_OUT_DEBUG(lsa_ChangePassword, &state->orig);
895         }
896
897         tevent_req_done(req);
898 }
899
900 NTSTATUS rpccli_lsa_ChangePassword_recv(struct tevent_req *req,
901                                         TALLOC_CTX *mem_ctx,
902                                         NTSTATUS *result)
903 {
904         struct rpccli_lsa_ChangePassword_state *state = tevent_req_data(
905                 req, struct rpccli_lsa_ChangePassword_state);
906         NTSTATUS status;
907
908         if (tevent_req_is_nterror(req, &status)) {
909                 tevent_req_received(req);
910                 return status;
911         }
912
913         /* Steal possbile out parameters to the callers context */
914         talloc_steal(mem_ctx, state->out_mem_ctx);
915
916         /* Return result */
917         *result = state->orig.out.result;
918
919         tevent_req_received(req);
920         return NT_STATUS_OK;
921 }
922
923 NTSTATUS rpccli_lsa_ChangePassword(struct rpc_pipe_client *cli,
924                                    TALLOC_CTX *mem_ctx)
925 {
926         struct lsa_ChangePassword r;
927         NTSTATUS status;
928
929         /* In parameters */
930
931         if (DEBUGLEVEL >= 10) {
932                 NDR_PRINT_IN_DEBUG(lsa_ChangePassword, &r);
933         }
934
935         status = cli->dispatch(cli,
936                                 mem_ctx,
937                                 &ndr_table_lsarpc,
938                                 NDR_LSA_CHANGEPASSWORD,
939                                 &r);
940
941         if (!NT_STATUS_IS_OK(status)) {
942                 return status;
943         }
944
945         if (DEBUGLEVEL >= 10) {
946                 NDR_PRINT_OUT_DEBUG(lsa_ChangePassword, &r);
947         }
948
949         if (NT_STATUS_IS_ERR(status)) {
950                 return status;
951         }
952
953         /* Return variables */
954
955         /* Return result */
956         return r.out.result;
957 }
958
959 struct rpccli_lsa_OpenPolicy_state {
960         struct lsa_OpenPolicy orig;
961         struct lsa_OpenPolicy tmp;
962         TALLOC_CTX *out_mem_ctx;
963         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
964 };
965
966 static void rpccli_lsa_OpenPolicy_done(struct tevent_req *subreq);
967
968 struct tevent_req *rpccli_lsa_OpenPolicy_send(TALLOC_CTX *mem_ctx,
969                                               struct tevent_context *ev,
970                                               struct rpc_pipe_client *cli,
971                                               uint16_t *_system_name /* [in] [unique] */,
972                                               struct lsa_ObjectAttribute *_attr /* [in] [ref] */,
973                                               uint32_t _access_mask /* [in]  */,
974                                               struct policy_handle *_handle /* [out] [ref] */)
975 {
976         struct tevent_req *req;
977         struct rpccli_lsa_OpenPolicy_state *state;
978         struct tevent_req *subreq;
979
980         req = tevent_req_create(mem_ctx, &state,
981                                 struct rpccli_lsa_OpenPolicy_state);
982         if (req == NULL) {
983                 return NULL;
984         }
985         state->out_mem_ctx = NULL;
986         state->dispatch_recv = cli->dispatch_recv;
987
988         /* In parameters */
989         state->orig.in.system_name = _system_name;
990         state->orig.in.attr = _attr;
991         state->orig.in.access_mask = _access_mask;
992
993         /* Out parameters */
994         state->orig.out.handle = _handle;
995
996         /* Result */
997         ZERO_STRUCT(state->orig.out.result);
998
999         if (DEBUGLEVEL >= 10) {
1000                 NDR_PRINT_IN_DEBUG(lsa_OpenPolicy, &state->orig);
1001         }
1002
1003         state->out_mem_ctx = talloc_named_const(state, 0,
1004                              "rpccli_lsa_OpenPolicy_out_memory");
1005         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1006                 return tevent_req_post(req, ev);
1007         }
1008
1009         /* make a temporary copy, that we pass to the dispatch function */
1010         state->tmp = state->orig;
1011
1012         subreq = cli->dispatch_send(state, ev, cli,
1013                                     &ndr_table_lsarpc,
1014                                     NDR_LSA_OPENPOLICY,
1015                                     &state->tmp);
1016         if (tevent_req_nomem(subreq, req)) {
1017                 return tevent_req_post(req, ev);
1018         }
1019         tevent_req_set_callback(subreq, rpccli_lsa_OpenPolicy_done, req);
1020         return req;
1021 }
1022
1023 static void rpccli_lsa_OpenPolicy_done(struct tevent_req *subreq)
1024 {
1025         struct tevent_req *req = tevent_req_callback_data(
1026                 subreq, struct tevent_req);
1027         struct rpccli_lsa_OpenPolicy_state *state = tevent_req_data(
1028                 req, struct rpccli_lsa_OpenPolicy_state);
1029         NTSTATUS status;
1030         TALLOC_CTX *mem_ctx;
1031
1032         if (state->out_mem_ctx) {
1033                 mem_ctx = state->out_mem_ctx;
1034         } else {
1035                 mem_ctx = state;
1036         }
1037
1038         status = state->dispatch_recv(subreq, mem_ctx);
1039         TALLOC_FREE(subreq);
1040         if (!NT_STATUS_IS_OK(status)) {
1041                 tevent_req_nterror(req, status);
1042                 return;
1043         }
1044
1045         /* Copy out parameters */
1046         *state->orig.out.handle = *state->tmp.out.handle;
1047
1048         /* Copy result */
1049         state->orig.out.result = state->tmp.out.result;
1050
1051         /* Reset temporary structure */
1052         ZERO_STRUCT(state->tmp);
1053
1054         if (DEBUGLEVEL >= 10) {
1055                 NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy, &state->orig);
1056         }
1057
1058         tevent_req_done(req);
1059 }
1060
1061 NTSTATUS rpccli_lsa_OpenPolicy_recv(struct tevent_req *req,
1062                                     TALLOC_CTX *mem_ctx,
1063                                     NTSTATUS *result)
1064 {
1065         struct rpccli_lsa_OpenPolicy_state *state = tevent_req_data(
1066                 req, struct rpccli_lsa_OpenPolicy_state);
1067         NTSTATUS status;
1068
1069         if (tevent_req_is_nterror(req, &status)) {
1070                 tevent_req_received(req);
1071                 return status;
1072         }
1073
1074         /* Steal possbile out parameters to the callers context */
1075         talloc_steal(mem_ctx, state->out_mem_ctx);
1076
1077         /* Return result */
1078         *result = state->orig.out.result;
1079
1080         tevent_req_received(req);
1081         return NT_STATUS_OK;
1082 }
1083
1084 NTSTATUS rpccli_lsa_OpenPolicy(struct rpc_pipe_client *cli,
1085                                TALLOC_CTX *mem_ctx,
1086                                uint16_t *system_name /* [in] [unique] */,
1087                                struct lsa_ObjectAttribute *attr /* [in] [ref] */,
1088                                uint32_t access_mask /* [in]  */,
1089                                struct policy_handle *handle /* [out] [ref] */)
1090 {
1091         struct lsa_OpenPolicy r;
1092         NTSTATUS status;
1093
1094         /* In parameters */
1095         r.in.system_name = system_name;
1096         r.in.attr = attr;
1097         r.in.access_mask = access_mask;
1098
1099         if (DEBUGLEVEL >= 10) {
1100                 NDR_PRINT_IN_DEBUG(lsa_OpenPolicy, &r);
1101         }
1102
1103         status = cli->dispatch(cli,
1104                                 mem_ctx,
1105                                 &ndr_table_lsarpc,
1106                                 NDR_LSA_OPENPOLICY,
1107                                 &r);
1108
1109         if (!NT_STATUS_IS_OK(status)) {
1110                 return status;
1111         }
1112
1113         if (DEBUGLEVEL >= 10) {
1114                 NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy, &r);
1115         }
1116
1117         if (NT_STATUS_IS_ERR(status)) {
1118                 return status;
1119         }
1120
1121         /* Return variables */
1122         *handle = *r.out.handle;
1123
1124         /* Return result */
1125         return r.out.result;
1126 }
1127
1128 struct rpccli_lsa_QueryInfoPolicy_state {
1129         struct lsa_QueryInfoPolicy orig;
1130         struct lsa_QueryInfoPolicy tmp;
1131         TALLOC_CTX *out_mem_ctx;
1132         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1133 };
1134
1135 static void rpccli_lsa_QueryInfoPolicy_done(struct tevent_req *subreq);
1136
1137 struct tevent_req *rpccli_lsa_QueryInfoPolicy_send(TALLOC_CTX *mem_ctx,
1138                                                    struct tevent_context *ev,
1139                                                    struct rpc_pipe_client *cli,
1140                                                    struct policy_handle *_handle /* [in] [ref] */,
1141                                                    enum lsa_PolicyInfo _level /* [in]  */,
1142                                                    union lsa_PolicyInformation **_info /* [out] [ref,switch_is(level)] */)
1143 {
1144         struct tevent_req *req;
1145         struct rpccli_lsa_QueryInfoPolicy_state *state;
1146         struct tevent_req *subreq;
1147
1148         req = tevent_req_create(mem_ctx, &state,
1149                                 struct rpccli_lsa_QueryInfoPolicy_state);
1150         if (req == NULL) {
1151                 return NULL;
1152         }
1153         state->out_mem_ctx = NULL;
1154         state->dispatch_recv = cli->dispatch_recv;
1155
1156         /* In parameters */
1157         state->orig.in.handle = _handle;
1158         state->orig.in.level = _level;
1159
1160         /* Out parameters */
1161         state->orig.out.info = _info;
1162
1163         /* Result */
1164         ZERO_STRUCT(state->orig.out.result);
1165
1166         if (DEBUGLEVEL >= 10) {
1167                 NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy, &state->orig);
1168         }
1169
1170         state->out_mem_ctx = talloc_named_const(state, 0,
1171                              "rpccli_lsa_QueryInfoPolicy_out_memory");
1172         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1173                 return tevent_req_post(req, ev);
1174         }
1175
1176         /* make a temporary copy, that we pass to the dispatch function */
1177         state->tmp = state->orig;
1178
1179         subreq = cli->dispatch_send(state, ev, cli,
1180                                     &ndr_table_lsarpc,
1181                                     NDR_LSA_QUERYINFOPOLICY,
1182                                     &state->tmp);
1183         if (tevent_req_nomem(subreq, req)) {
1184                 return tevent_req_post(req, ev);
1185         }
1186         tevent_req_set_callback(subreq, rpccli_lsa_QueryInfoPolicy_done, req);
1187         return req;
1188 }
1189
1190 static void rpccli_lsa_QueryInfoPolicy_done(struct tevent_req *subreq)
1191 {
1192         struct tevent_req *req = tevent_req_callback_data(
1193                 subreq, struct tevent_req);
1194         struct rpccli_lsa_QueryInfoPolicy_state *state = tevent_req_data(
1195                 req, struct rpccli_lsa_QueryInfoPolicy_state);
1196         NTSTATUS status;
1197         TALLOC_CTX *mem_ctx;
1198
1199         if (state->out_mem_ctx) {
1200                 mem_ctx = state->out_mem_ctx;
1201         } else {
1202                 mem_ctx = state;
1203         }
1204
1205         status = state->dispatch_recv(subreq, mem_ctx);
1206         TALLOC_FREE(subreq);
1207         if (!NT_STATUS_IS_OK(status)) {
1208                 tevent_req_nterror(req, status);
1209                 return;
1210         }
1211
1212         /* Copy out parameters */
1213         *state->orig.out.info = *state->tmp.out.info;
1214
1215         /* Copy result */
1216         state->orig.out.result = state->tmp.out.result;
1217
1218         /* Reset temporary structure */
1219         ZERO_STRUCT(state->tmp);
1220
1221         if (DEBUGLEVEL >= 10) {
1222                 NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy, &state->orig);
1223         }
1224
1225         tevent_req_done(req);
1226 }
1227
1228 NTSTATUS rpccli_lsa_QueryInfoPolicy_recv(struct tevent_req *req,
1229                                          TALLOC_CTX *mem_ctx,
1230                                          NTSTATUS *result)
1231 {
1232         struct rpccli_lsa_QueryInfoPolicy_state *state = tevent_req_data(
1233                 req, struct rpccli_lsa_QueryInfoPolicy_state);
1234         NTSTATUS status;
1235
1236         if (tevent_req_is_nterror(req, &status)) {
1237                 tevent_req_received(req);
1238                 return status;
1239         }
1240
1241         /* Steal possbile out parameters to the callers context */
1242         talloc_steal(mem_ctx, state->out_mem_ctx);
1243
1244         /* Return result */
1245         *result = state->orig.out.result;
1246
1247         tevent_req_received(req);
1248         return NT_STATUS_OK;
1249 }
1250
1251 NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli,
1252                                     TALLOC_CTX *mem_ctx,
1253                                     struct policy_handle *handle /* [in] [ref] */,
1254                                     enum lsa_PolicyInfo level /* [in]  */,
1255                                     union lsa_PolicyInformation **info /* [out] [ref,switch_is(level)] */)
1256 {
1257         struct lsa_QueryInfoPolicy r;
1258         NTSTATUS status;
1259
1260         /* In parameters */
1261         r.in.handle = handle;
1262         r.in.level = level;
1263
1264         if (DEBUGLEVEL >= 10) {
1265                 NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy, &r);
1266         }
1267
1268         status = cli->dispatch(cli,
1269                                 mem_ctx,
1270                                 &ndr_table_lsarpc,
1271                                 NDR_LSA_QUERYINFOPOLICY,
1272                                 &r);
1273
1274         if (!NT_STATUS_IS_OK(status)) {
1275                 return status;
1276         }
1277
1278         if (DEBUGLEVEL >= 10) {
1279                 NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy, &r);
1280         }
1281
1282         if (NT_STATUS_IS_ERR(status)) {
1283                 return status;
1284         }
1285
1286         /* Return variables */
1287         *info = *r.out.info;
1288
1289         /* Return result */
1290         return r.out.result;
1291 }
1292
1293 struct rpccli_lsa_SetInfoPolicy_state {
1294         struct lsa_SetInfoPolicy orig;
1295         struct lsa_SetInfoPolicy tmp;
1296         TALLOC_CTX *out_mem_ctx;
1297         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1298 };
1299
1300 static void rpccli_lsa_SetInfoPolicy_done(struct tevent_req *subreq);
1301
1302 struct tevent_req *rpccli_lsa_SetInfoPolicy_send(TALLOC_CTX *mem_ctx,
1303                                                  struct tevent_context *ev,
1304                                                  struct rpc_pipe_client *cli,
1305                                                  struct policy_handle *_handle /* [in] [ref] */,
1306                                                  enum lsa_PolicyInfo _level /* [in]  */,
1307                                                  union lsa_PolicyInformation *_info /* [in] [ref,switch_is(level)] */)
1308 {
1309         struct tevent_req *req;
1310         struct rpccli_lsa_SetInfoPolicy_state *state;
1311         struct tevent_req *subreq;
1312
1313         req = tevent_req_create(mem_ctx, &state,
1314                                 struct rpccli_lsa_SetInfoPolicy_state);
1315         if (req == NULL) {
1316                 return NULL;
1317         }
1318         state->out_mem_ctx = NULL;
1319         state->dispatch_recv = cli->dispatch_recv;
1320
1321         /* In parameters */
1322         state->orig.in.handle = _handle;
1323         state->orig.in.level = _level;
1324         state->orig.in.info = _info;
1325
1326         /* Out parameters */
1327
1328         /* Result */
1329         ZERO_STRUCT(state->orig.out.result);
1330
1331         if (DEBUGLEVEL >= 10) {
1332                 NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy, &state->orig);
1333         }
1334
1335         /* make a temporary copy, that we pass to the dispatch function */
1336         state->tmp = state->orig;
1337
1338         subreq = cli->dispatch_send(state, ev, cli,
1339                                     &ndr_table_lsarpc,
1340                                     NDR_LSA_SETINFOPOLICY,
1341                                     &state->tmp);
1342         if (tevent_req_nomem(subreq, req)) {
1343                 return tevent_req_post(req, ev);
1344         }
1345         tevent_req_set_callback(subreq, rpccli_lsa_SetInfoPolicy_done, req);
1346         return req;
1347 }
1348
1349 static void rpccli_lsa_SetInfoPolicy_done(struct tevent_req *subreq)
1350 {
1351         struct tevent_req *req = tevent_req_callback_data(
1352                 subreq, struct tevent_req);
1353         struct rpccli_lsa_SetInfoPolicy_state *state = tevent_req_data(
1354                 req, struct rpccli_lsa_SetInfoPolicy_state);
1355         NTSTATUS status;
1356         TALLOC_CTX *mem_ctx;
1357
1358         if (state->out_mem_ctx) {
1359                 mem_ctx = state->out_mem_ctx;
1360         } else {
1361                 mem_ctx = state;
1362         }
1363
1364         status = state->dispatch_recv(subreq, mem_ctx);
1365         TALLOC_FREE(subreq);
1366         if (!NT_STATUS_IS_OK(status)) {
1367                 tevent_req_nterror(req, status);
1368                 return;
1369         }
1370
1371         /* Copy out parameters */
1372
1373         /* Copy result */
1374         state->orig.out.result = state->tmp.out.result;
1375
1376         /* Reset temporary structure */
1377         ZERO_STRUCT(state->tmp);
1378
1379         if (DEBUGLEVEL >= 10) {
1380                 NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy, &state->orig);
1381         }
1382
1383         tevent_req_done(req);
1384 }
1385
1386 NTSTATUS rpccli_lsa_SetInfoPolicy_recv(struct tevent_req *req,
1387                                        TALLOC_CTX *mem_ctx,
1388                                        NTSTATUS *result)
1389 {
1390         struct rpccli_lsa_SetInfoPolicy_state *state = tevent_req_data(
1391                 req, struct rpccli_lsa_SetInfoPolicy_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_SetInfoPolicy(struct rpc_pipe_client *cli,
1410                                   TALLOC_CTX *mem_ctx,
1411                                   struct policy_handle *handle /* [in] [ref] */,
1412                                   enum lsa_PolicyInfo level /* [in]  */,
1413                                   union lsa_PolicyInformation *info /* [in] [ref,switch_is(level)] */)
1414 {
1415         struct lsa_SetInfoPolicy r;
1416         NTSTATUS status;
1417
1418         /* In parameters */
1419         r.in.handle = handle;
1420         r.in.level = level;
1421         r.in.info = info;
1422
1423         if (DEBUGLEVEL >= 10) {
1424                 NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy, &r);
1425         }
1426
1427         status = cli->dispatch(cli,
1428                                 mem_ctx,
1429                                 &ndr_table_lsarpc,
1430                                 NDR_LSA_SETINFOPOLICY,
1431                                 &r);
1432
1433         if (!NT_STATUS_IS_OK(status)) {
1434                 return status;
1435         }
1436
1437         if (DEBUGLEVEL >= 10) {
1438                 NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy, &r);
1439         }
1440
1441         if (NT_STATUS_IS_ERR(status)) {
1442                 return status;
1443         }
1444
1445         /* Return variables */
1446
1447         /* Return result */
1448         return r.out.result;
1449 }
1450
1451 struct rpccli_lsa_ClearAuditLog_state {
1452         struct lsa_ClearAuditLog orig;
1453         struct lsa_ClearAuditLog tmp;
1454         TALLOC_CTX *out_mem_ctx;
1455         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1456 };
1457
1458 static void rpccli_lsa_ClearAuditLog_done(struct tevent_req *subreq);
1459
1460 struct tevent_req *rpccli_lsa_ClearAuditLog_send(TALLOC_CTX *mem_ctx,
1461                                                  struct tevent_context *ev,
1462                                                  struct rpc_pipe_client *cli)
1463 {
1464         struct tevent_req *req;
1465         struct rpccli_lsa_ClearAuditLog_state *state;
1466         struct tevent_req *subreq;
1467
1468         req = tevent_req_create(mem_ctx, &state,
1469                                 struct rpccli_lsa_ClearAuditLog_state);
1470         if (req == NULL) {
1471                 return NULL;
1472         }
1473         state->out_mem_ctx = NULL;
1474         state->dispatch_recv = cli->dispatch_recv;
1475
1476         /* In parameters */
1477
1478         /* Out parameters */
1479
1480         /* Result */
1481         ZERO_STRUCT(state->orig.out.result);
1482
1483         if (DEBUGLEVEL >= 10) {
1484                 NDR_PRINT_IN_DEBUG(lsa_ClearAuditLog, &state->orig);
1485         }
1486
1487         /* make a temporary copy, that we pass to the dispatch function */
1488         state->tmp = state->orig;
1489
1490         subreq = cli->dispatch_send(state, ev, cli,
1491                                     &ndr_table_lsarpc,
1492                                     NDR_LSA_CLEARAUDITLOG,
1493                                     &state->tmp);
1494         if (tevent_req_nomem(subreq, req)) {
1495                 return tevent_req_post(req, ev);
1496         }
1497         tevent_req_set_callback(subreq, rpccli_lsa_ClearAuditLog_done, req);
1498         return req;
1499 }
1500
1501 static void rpccli_lsa_ClearAuditLog_done(struct tevent_req *subreq)
1502 {
1503         struct tevent_req *req = tevent_req_callback_data(
1504                 subreq, struct tevent_req);
1505         struct rpccli_lsa_ClearAuditLog_state *state = tevent_req_data(
1506                 req, struct rpccli_lsa_ClearAuditLog_state);
1507         NTSTATUS status;
1508         TALLOC_CTX *mem_ctx;
1509
1510         if (state->out_mem_ctx) {
1511                 mem_ctx = state->out_mem_ctx;
1512         } else {
1513                 mem_ctx = state;
1514         }
1515
1516         status = state->dispatch_recv(subreq, mem_ctx);
1517         TALLOC_FREE(subreq);
1518         if (!NT_STATUS_IS_OK(status)) {
1519                 tevent_req_nterror(req, status);
1520                 return;
1521         }
1522
1523         /* Copy out parameters */
1524
1525         /* Copy result */
1526         state->orig.out.result = state->tmp.out.result;
1527
1528         /* Reset temporary structure */
1529         ZERO_STRUCT(state->tmp);
1530
1531         if (DEBUGLEVEL >= 10) {
1532                 NDR_PRINT_OUT_DEBUG(lsa_ClearAuditLog, &state->orig);
1533         }
1534
1535         tevent_req_done(req);
1536 }
1537
1538 NTSTATUS rpccli_lsa_ClearAuditLog_recv(struct tevent_req *req,
1539                                        TALLOC_CTX *mem_ctx,
1540                                        NTSTATUS *result)
1541 {
1542         struct rpccli_lsa_ClearAuditLog_state *state = tevent_req_data(
1543                 req, struct rpccli_lsa_ClearAuditLog_state);
1544         NTSTATUS status;
1545
1546         if (tevent_req_is_nterror(req, &status)) {
1547                 tevent_req_received(req);
1548                 return status;
1549         }
1550
1551         /* Steal possbile out parameters to the callers context */
1552         talloc_steal(mem_ctx, state->out_mem_ctx);
1553
1554         /* Return result */
1555         *result = state->orig.out.result;
1556
1557         tevent_req_received(req);
1558         return NT_STATUS_OK;
1559 }
1560
1561 NTSTATUS rpccli_lsa_ClearAuditLog(struct rpc_pipe_client *cli,
1562                                   TALLOC_CTX *mem_ctx)
1563 {
1564         struct lsa_ClearAuditLog r;
1565         NTSTATUS status;
1566
1567         /* In parameters */
1568
1569         if (DEBUGLEVEL >= 10) {
1570                 NDR_PRINT_IN_DEBUG(lsa_ClearAuditLog, &r);
1571         }
1572
1573         status = cli->dispatch(cli,
1574                                 mem_ctx,
1575                                 &ndr_table_lsarpc,
1576                                 NDR_LSA_CLEARAUDITLOG,
1577                                 &r);
1578
1579         if (!NT_STATUS_IS_OK(status)) {
1580                 return status;
1581         }
1582
1583         if (DEBUGLEVEL >= 10) {
1584                 NDR_PRINT_OUT_DEBUG(lsa_ClearAuditLog, &r);
1585         }
1586
1587         if (NT_STATUS_IS_ERR(status)) {
1588                 return status;
1589         }
1590
1591         /* Return variables */
1592
1593         /* Return result */
1594         return r.out.result;
1595 }
1596
1597 struct rpccli_lsa_CreateAccount_state {
1598         struct lsa_CreateAccount orig;
1599         struct lsa_CreateAccount tmp;
1600         TALLOC_CTX *out_mem_ctx;
1601         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1602 };
1603
1604 static void rpccli_lsa_CreateAccount_done(struct tevent_req *subreq);
1605
1606 struct tevent_req *rpccli_lsa_CreateAccount_send(TALLOC_CTX *mem_ctx,
1607                                                  struct tevent_context *ev,
1608                                                  struct rpc_pipe_client *cli,
1609                                                  struct policy_handle *_handle /* [in] [ref] */,
1610                                                  struct dom_sid2 *_sid /* [in] [ref] */,
1611                                                  uint32_t _access_mask /* [in]  */,
1612                                                  struct policy_handle *_acct_handle /* [out] [ref] */)
1613 {
1614         struct tevent_req *req;
1615         struct rpccli_lsa_CreateAccount_state *state;
1616         struct tevent_req *subreq;
1617
1618         req = tevent_req_create(mem_ctx, &state,
1619                                 struct rpccli_lsa_CreateAccount_state);
1620         if (req == NULL) {
1621                 return NULL;
1622         }
1623         state->out_mem_ctx = NULL;
1624         state->dispatch_recv = cli->dispatch_recv;
1625
1626         /* In parameters */
1627         state->orig.in.handle = _handle;
1628         state->orig.in.sid = _sid;
1629         state->orig.in.access_mask = _access_mask;
1630
1631         /* Out parameters */
1632         state->orig.out.acct_handle = _acct_handle;
1633
1634         /* Result */
1635         ZERO_STRUCT(state->orig.out.result);
1636
1637         if (DEBUGLEVEL >= 10) {
1638                 NDR_PRINT_IN_DEBUG(lsa_CreateAccount, &state->orig);
1639         }
1640
1641         state->out_mem_ctx = talloc_named_const(state, 0,
1642                              "rpccli_lsa_CreateAccount_out_memory");
1643         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1644                 return tevent_req_post(req, ev);
1645         }
1646
1647         /* make a temporary copy, that we pass to the dispatch function */
1648         state->tmp = state->orig;
1649
1650         subreq = cli->dispatch_send(state, ev, cli,
1651                                     &ndr_table_lsarpc,
1652                                     NDR_LSA_CREATEACCOUNT,
1653                                     &state->tmp);
1654         if (tevent_req_nomem(subreq, req)) {
1655                 return tevent_req_post(req, ev);
1656         }
1657         tevent_req_set_callback(subreq, rpccli_lsa_CreateAccount_done, req);
1658         return req;
1659 }
1660
1661 static void rpccli_lsa_CreateAccount_done(struct tevent_req *subreq)
1662 {
1663         struct tevent_req *req = tevent_req_callback_data(
1664                 subreq, struct tevent_req);
1665         struct rpccli_lsa_CreateAccount_state *state = tevent_req_data(
1666                 req, struct rpccli_lsa_CreateAccount_state);
1667         NTSTATUS status;
1668         TALLOC_CTX *mem_ctx;
1669
1670         if (state->out_mem_ctx) {
1671                 mem_ctx = state->out_mem_ctx;
1672         } else {
1673                 mem_ctx = state;
1674         }
1675
1676         status = state->dispatch_recv(subreq, mem_ctx);
1677         TALLOC_FREE(subreq);
1678         if (!NT_STATUS_IS_OK(status)) {
1679                 tevent_req_nterror(req, status);
1680                 return;
1681         }
1682
1683         /* Copy out parameters */
1684         *state->orig.out.acct_handle = *state->tmp.out.acct_handle;
1685
1686         /* Copy result */
1687         state->orig.out.result = state->tmp.out.result;
1688
1689         /* Reset temporary structure */
1690         ZERO_STRUCT(state->tmp);
1691
1692         if (DEBUGLEVEL >= 10) {
1693                 NDR_PRINT_OUT_DEBUG(lsa_CreateAccount, &state->orig);
1694         }
1695
1696         tevent_req_done(req);
1697 }
1698
1699 NTSTATUS rpccli_lsa_CreateAccount_recv(struct tevent_req *req,
1700                                        TALLOC_CTX *mem_ctx,
1701                                        NTSTATUS *result)
1702 {
1703         struct rpccli_lsa_CreateAccount_state *state = tevent_req_data(
1704                 req, struct rpccli_lsa_CreateAccount_state);
1705         NTSTATUS status;
1706
1707         if (tevent_req_is_nterror(req, &status)) {
1708                 tevent_req_received(req);
1709                 return status;
1710         }
1711
1712         /* Steal possbile out parameters to the callers context */
1713         talloc_steal(mem_ctx, state->out_mem_ctx);
1714
1715         /* Return result */
1716         *result = state->orig.out.result;
1717
1718         tevent_req_received(req);
1719         return NT_STATUS_OK;
1720 }
1721
1722 NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli,
1723                                   TALLOC_CTX *mem_ctx,
1724                                   struct policy_handle *handle /* [in] [ref] */,
1725                                   struct dom_sid2 *sid /* [in] [ref] */,
1726                                   uint32_t access_mask /* [in]  */,
1727                                   struct policy_handle *acct_handle /* [out] [ref] */)
1728 {
1729         struct lsa_CreateAccount r;
1730         NTSTATUS status;
1731
1732         /* In parameters */
1733         r.in.handle = handle;
1734         r.in.sid = sid;
1735         r.in.access_mask = access_mask;
1736
1737         if (DEBUGLEVEL >= 10) {
1738                 NDR_PRINT_IN_DEBUG(lsa_CreateAccount, &r);
1739         }
1740
1741         status = cli->dispatch(cli,
1742                                 mem_ctx,
1743                                 &ndr_table_lsarpc,
1744                                 NDR_LSA_CREATEACCOUNT,
1745                                 &r);
1746
1747         if (!NT_STATUS_IS_OK(status)) {
1748                 return status;
1749         }
1750
1751         if (DEBUGLEVEL >= 10) {
1752                 NDR_PRINT_OUT_DEBUG(lsa_CreateAccount, &r);
1753         }
1754
1755         if (NT_STATUS_IS_ERR(status)) {
1756                 return status;
1757         }
1758
1759         /* Return variables */
1760         *acct_handle = *r.out.acct_handle;
1761
1762         /* Return result */
1763         return r.out.result;
1764 }
1765
1766 struct rpccli_lsa_EnumAccounts_state {
1767         struct lsa_EnumAccounts orig;
1768         struct lsa_EnumAccounts tmp;
1769         TALLOC_CTX *out_mem_ctx;
1770         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1771 };
1772
1773 static void rpccli_lsa_EnumAccounts_done(struct tevent_req *subreq);
1774
1775 struct tevent_req *rpccli_lsa_EnumAccounts_send(TALLOC_CTX *mem_ctx,
1776                                                 struct tevent_context *ev,
1777                                                 struct rpc_pipe_client *cli,
1778                                                 struct policy_handle *_handle /* [in] [ref] */,
1779                                                 uint32_t *_resume_handle /* [in,out] [ref] */,
1780                                                 struct lsa_SidArray *_sids /* [out] [ref] */,
1781                                                 uint32_t _num_entries /* [in] [range(0,8192)] */)
1782 {
1783         struct tevent_req *req;
1784         struct rpccli_lsa_EnumAccounts_state *state;
1785         struct tevent_req *subreq;
1786
1787         req = tevent_req_create(mem_ctx, &state,
1788                                 struct rpccli_lsa_EnumAccounts_state);
1789         if (req == NULL) {
1790                 return NULL;
1791         }
1792         state->out_mem_ctx = NULL;
1793         state->dispatch_recv = cli->dispatch_recv;
1794
1795         /* In parameters */
1796         state->orig.in.handle = _handle;
1797         state->orig.in.resume_handle = _resume_handle;
1798         state->orig.in.num_entries = _num_entries;
1799
1800         /* Out parameters */
1801         state->orig.out.resume_handle = _resume_handle;
1802         state->orig.out.sids = _sids;
1803
1804         /* Result */
1805         ZERO_STRUCT(state->orig.out.result);
1806
1807         if (DEBUGLEVEL >= 10) {
1808                 NDR_PRINT_IN_DEBUG(lsa_EnumAccounts, &state->orig);
1809         }
1810
1811         state->out_mem_ctx = talloc_named_const(state, 0,
1812                              "rpccli_lsa_EnumAccounts_out_memory");
1813         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1814                 return tevent_req_post(req, ev);
1815         }
1816
1817         /* make a temporary copy, that we pass to the dispatch function */
1818         state->tmp = state->orig;
1819
1820         subreq = cli->dispatch_send(state, ev, cli,
1821                                     &ndr_table_lsarpc,
1822                                     NDR_LSA_ENUMACCOUNTS,
1823                                     &state->tmp);
1824         if (tevent_req_nomem(subreq, req)) {
1825                 return tevent_req_post(req, ev);
1826         }
1827         tevent_req_set_callback(subreq, rpccli_lsa_EnumAccounts_done, req);
1828         return req;
1829 }
1830
1831 static void rpccli_lsa_EnumAccounts_done(struct tevent_req *subreq)
1832 {
1833         struct tevent_req *req = tevent_req_callback_data(
1834                 subreq, struct tevent_req);
1835         struct rpccli_lsa_EnumAccounts_state *state = tevent_req_data(
1836                 req, struct rpccli_lsa_EnumAccounts_state);
1837         NTSTATUS status;
1838         TALLOC_CTX *mem_ctx;
1839
1840         if (state->out_mem_ctx) {
1841                 mem_ctx = state->out_mem_ctx;
1842         } else {
1843                 mem_ctx = state;
1844         }
1845
1846         status = state->dispatch_recv(subreq, mem_ctx);
1847         TALLOC_FREE(subreq);
1848         if (!NT_STATUS_IS_OK(status)) {
1849                 tevent_req_nterror(req, status);
1850                 return;
1851         }
1852
1853         /* Copy out parameters */
1854         *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
1855         *state->orig.out.sids = *state->tmp.out.sids;
1856
1857         /* Copy result */
1858         state->orig.out.result = state->tmp.out.result;
1859
1860         /* Reset temporary structure */
1861         ZERO_STRUCT(state->tmp);
1862
1863         if (DEBUGLEVEL >= 10) {
1864                 NDR_PRINT_OUT_DEBUG(lsa_EnumAccounts, &state->orig);
1865         }
1866
1867         tevent_req_done(req);
1868 }
1869
1870 NTSTATUS rpccli_lsa_EnumAccounts_recv(struct tevent_req *req,
1871                                       TALLOC_CTX *mem_ctx,
1872                                       NTSTATUS *result)
1873 {
1874         struct rpccli_lsa_EnumAccounts_state *state = tevent_req_data(
1875                 req, struct rpccli_lsa_EnumAccounts_state);
1876         NTSTATUS status;
1877
1878         if (tevent_req_is_nterror(req, &status)) {
1879                 tevent_req_received(req);
1880                 return status;
1881         }
1882
1883         /* Steal possbile out parameters to the callers context */
1884         talloc_steal(mem_ctx, state->out_mem_ctx);
1885
1886         /* Return result */
1887         *result = state->orig.out.result;
1888
1889         tevent_req_received(req);
1890         return NT_STATUS_OK;
1891 }
1892
1893 NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli,
1894                                  TALLOC_CTX *mem_ctx,
1895                                  struct policy_handle *handle /* [in] [ref] */,
1896                                  uint32_t *resume_handle /* [in,out] [ref] */,
1897                                  struct lsa_SidArray *sids /* [out] [ref] */,
1898                                  uint32_t num_entries /* [in] [range(0,8192)] */)
1899 {
1900         struct lsa_EnumAccounts r;
1901         NTSTATUS status;
1902
1903         /* In parameters */
1904         r.in.handle = handle;
1905         r.in.resume_handle = resume_handle;
1906         r.in.num_entries = num_entries;
1907
1908         if (DEBUGLEVEL >= 10) {
1909                 NDR_PRINT_IN_DEBUG(lsa_EnumAccounts, &r);
1910         }
1911
1912         status = cli->dispatch(cli,
1913                                 mem_ctx,
1914                                 &ndr_table_lsarpc,
1915                                 NDR_LSA_ENUMACCOUNTS,
1916                                 &r);
1917
1918         if (!NT_STATUS_IS_OK(status)) {
1919                 return status;
1920         }
1921
1922         if (DEBUGLEVEL >= 10) {
1923                 NDR_PRINT_OUT_DEBUG(lsa_EnumAccounts, &r);
1924         }
1925
1926         if (NT_STATUS_IS_ERR(status)) {
1927                 return status;
1928         }
1929
1930         /* Return variables */
1931         *resume_handle = *r.out.resume_handle;
1932         *sids = *r.out.sids;
1933
1934         /* Return result */
1935         return r.out.result;
1936 }
1937
1938 struct rpccli_lsa_CreateTrustedDomain_state {
1939         struct lsa_CreateTrustedDomain orig;
1940         struct lsa_CreateTrustedDomain tmp;
1941         TALLOC_CTX *out_mem_ctx;
1942         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1943 };
1944
1945 static void rpccli_lsa_CreateTrustedDomain_done(struct tevent_req *subreq);
1946
1947 struct tevent_req *rpccli_lsa_CreateTrustedDomain_send(TALLOC_CTX *mem_ctx,
1948                                                        struct tevent_context *ev,
1949                                                        struct rpc_pipe_client *cli,
1950                                                        struct policy_handle *_policy_handle /* [in] [ref] */,
1951                                                        struct lsa_DomainInfo *_info /* [in] [ref] */,
1952                                                        uint32_t _access_mask /* [in]  */,
1953                                                        struct policy_handle *_trustdom_handle /* [out] [ref] */)
1954 {
1955         struct tevent_req *req;
1956         struct rpccli_lsa_CreateTrustedDomain_state *state;
1957         struct tevent_req *subreq;
1958
1959         req = tevent_req_create(mem_ctx, &state,
1960                                 struct rpccli_lsa_CreateTrustedDomain_state);
1961         if (req == NULL) {
1962                 return NULL;
1963         }
1964         state->out_mem_ctx = NULL;
1965         state->dispatch_recv = cli->dispatch_recv;
1966
1967         /* In parameters */
1968         state->orig.in.policy_handle = _policy_handle;
1969         state->orig.in.info = _info;
1970         state->orig.in.access_mask = _access_mask;
1971
1972         /* Out parameters */
1973         state->orig.out.trustdom_handle = _trustdom_handle;
1974
1975         /* Result */
1976         ZERO_STRUCT(state->orig.out.result);
1977
1978         if (DEBUGLEVEL >= 10) {
1979                 NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomain, &state->orig);
1980         }
1981
1982         state->out_mem_ctx = talloc_named_const(state, 0,
1983                              "rpccli_lsa_CreateTrustedDomain_out_memory");
1984         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1985                 return tevent_req_post(req, ev);
1986         }
1987
1988         /* make a temporary copy, that we pass to the dispatch function */
1989         state->tmp = state->orig;
1990
1991         subreq = cli->dispatch_send(state, ev, cli,
1992                                     &ndr_table_lsarpc,
1993                                     NDR_LSA_CREATETRUSTEDDOMAIN,
1994                                     &state->tmp);
1995         if (tevent_req_nomem(subreq, req)) {
1996                 return tevent_req_post(req, ev);
1997         }
1998         tevent_req_set_callback(subreq, rpccli_lsa_CreateTrustedDomain_done, req);
1999         return req;
2000 }
2001
2002 static void rpccli_lsa_CreateTrustedDomain_done(struct tevent_req *subreq)
2003 {
2004         struct tevent_req *req = tevent_req_callback_data(
2005                 subreq, struct tevent_req);
2006         struct rpccli_lsa_CreateTrustedDomain_state *state = tevent_req_data(
2007                 req, struct rpccli_lsa_CreateTrustedDomain_state);
2008         NTSTATUS status;
2009         TALLOC_CTX *mem_ctx;
2010
2011         if (state->out_mem_ctx) {
2012                 mem_ctx = state->out_mem_ctx;
2013         } else {
2014                 mem_ctx = state;
2015         }
2016
2017         status = state->dispatch_recv(subreq, mem_ctx);
2018         TALLOC_FREE(subreq);
2019         if (!NT_STATUS_IS_OK(status)) {
2020                 tevent_req_nterror(req, status);
2021                 return;
2022         }
2023
2024         /* Copy out parameters */
2025         *state->orig.out.trustdom_handle = *state->tmp.out.trustdom_handle;
2026
2027         /* Copy result */
2028         state->orig.out.result = state->tmp.out.result;
2029
2030         /* Reset temporary structure */
2031         ZERO_STRUCT(state->tmp);
2032
2033         if (DEBUGLEVEL >= 10) {
2034                 NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomain, &state->orig);
2035         }
2036
2037         tevent_req_done(req);
2038 }
2039
2040 NTSTATUS rpccli_lsa_CreateTrustedDomain_recv(struct tevent_req *req,
2041                                              TALLOC_CTX *mem_ctx,
2042                                              NTSTATUS *result)
2043 {
2044         struct rpccli_lsa_CreateTrustedDomain_state *state = tevent_req_data(
2045                 req, struct rpccli_lsa_CreateTrustedDomain_state);
2046         NTSTATUS status;
2047
2048         if (tevent_req_is_nterror(req, &status)) {
2049                 tevent_req_received(req);
2050                 return status;
2051         }
2052
2053         /* Steal possbile out parameters to the callers context */
2054         talloc_steal(mem_ctx, state->out_mem_ctx);
2055
2056         /* Return result */
2057         *result = state->orig.out.result;
2058
2059         tevent_req_received(req);
2060         return NT_STATUS_OK;
2061 }
2062
2063 NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli,
2064                                         TALLOC_CTX *mem_ctx,
2065                                         struct policy_handle *policy_handle /* [in] [ref] */,
2066                                         struct lsa_DomainInfo *info /* [in] [ref] */,
2067                                         uint32_t access_mask /* [in]  */,
2068                                         struct policy_handle *trustdom_handle /* [out] [ref] */)
2069 {
2070         struct lsa_CreateTrustedDomain r;
2071         NTSTATUS status;
2072
2073         /* In parameters */
2074         r.in.policy_handle = policy_handle;
2075         r.in.info = info;
2076         r.in.access_mask = access_mask;
2077
2078         if (DEBUGLEVEL >= 10) {
2079                 NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomain, &r);
2080         }
2081
2082         status = cli->dispatch(cli,
2083                                 mem_ctx,
2084                                 &ndr_table_lsarpc,
2085                                 NDR_LSA_CREATETRUSTEDDOMAIN,
2086                                 &r);
2087
2088         if (!NT_STATUS_IS_OK(status)) {
2089                 return status;
2090         }
2091
2092         if (DEBUGLEVEL >= 10) {
2093                 NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomain, &r);
2094         }
2095
2096         if (NT_STATUS_IS_ERR(status)) {
2097                 return status;
2098         }
2099
2100         /* Return variables */
2101         *trustdom_handle = *r.out.trustdom_handle;
2102
2103         /* Return result */
2104         return r.out.result;
2105 }
2106
2107 struct rpccli_lsa_EnumTrustDom_state {
2108         struct lsa_EnumTrustDom orig;
2109         struct lsa_EnumTrustDom tmp;
2110         TALLOC_CTX *out_mem_ctx;
2111         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2112 };
2113
2114 static void rpccli_lsa_EnumTrustDom_done(struct tevent_req *subreq);
2115
2116 struct tevent_req *rpccli_lsa_EnumTrustDom_send(TALLOC_CTX *mem_ctx,
2117                                                 struct tevent_context *ev,
2118                                                 struct rpc_pipe_client *cli,
2119                                                 struct policy_handle *_handle /* [in] [ref] */,
2120                                                 uint32_t *_resume_handle /* [in,out] [ref] */,
2121                                                 struct lsa_DomainList *_domains /* [out] [ref] */,
2122                                                 uint32_t _max_size /* [in]  */)
2123 {
2124         struct tevent_req *req;
2125         struct rpccli_lsa_EnumTrustDom_state *state;
2126         struct tevent_req *subreq;
2127
2128         req = tevent_req_create(mem_ctx, &state,
2129                                 struct rpccli_lsa_EnumTrustDom_state);
2130         if (req == NULL) {
2131                 return NULL;
2132         }
2133         state->out_mem_ctx = NULL;
2134         state->dispatch_recv = cli->dispatch_recv;
2135
2136         /* In parameters */
2137         state->orig.in.handle = _handle;
2138         state->orig.in.resume_handle = _resume_handle;
2139         state->orig.in.max_size = _max_size;
2140
2141         /* Out parameters */
2142         state->orig.out.resume_handle = _resume_handle;
2143         state->orig.out.domains = _domains;
2144
2145         /* Result */
2146         ZERO_STRUCT(state->orig.out.result);
2147
2148         if (DEBUGLEVEL >= 10) {
2149                 NDR_PRINT_IN_DEBUG(lsa_EnumTrustDom, &state->orig);
2150         }
2151
2152         state->out_mem_ctx = talloc_named_const(state, 0,
2153                              "rpccli_lsa_EnumTrustDom_out_memory");
2154         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2155                 return tevent_req_post(req, ev);
2156         }
2157
2158         /* make a temporary copy, that we pass to the dispatch function */
2159         state->tmp = state->orig;
2160
2161         subreq = cli->dispatch_send(state, ev, cli,
2162                                     &ndr_table_lsarpc,
2163                                     NDR_LSA_ENUMTRUSTDOM,
2164                                     &state->tmp);
2165         if (tevent_req_nomem(subreq, req)) {
2166                 return tevent_req_post(req, ev);
2167         }
2168         tevent_req_set_callback(subreq, rpccli_lsa_EnumTrustDom_done, req);
2169         return req;
2170 }
2171
2172 static void rpccli_lsa_EnumTrustDom_done(struct tevent_req *subreq)
2173 {
2174         struct tevent_req *req = tevent_req_callback_data(
2175                 subreq, struct tevent_req);
2176         struct rpccli_lsa_EnumTrustDom_state *state = tevent_req_data(
2177                 req, struct rpccli_lsa_EnumTrustDom_state);
2178         NTSTATUS status;
2179         TALLOC_CTX *mem_ctx;
2180
2181         if (state->out_mem_ctx) {
2182                 mem_ctx = state->out_mem_ctx;
2183         } else {
2184                 mem_ctx = state;
2185         }
2186
2187         status = state->dispatch_recv(subreq, mem_ctx);
2188         TALLOC_FREE(subreq);
2189         if (!NT_STATUS_IS_OK(status)) {
2190                 tevent_req_nterror(req, status);
2191                 return;
2192         }
2193
2194         /* Copy out parameters */
2195         *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
2196         *state->orig.out.domains = *state->tmp.out.domains;
2197
2198         /* Copy result */
2199         state->orig.out.result = state->tmp.out.result;
2200
2201         /* Reset temporary structure */
2202         ZERO_STRUCT(state->tmp);
2203
2204         if (DEBUGLEVEL >= 10) {
2205                 NDR_PRINT_OUT_DEBUG(lsa_EnumTrustDom, &state->orig);
2206         }
2207
2208         tevent_req_done(req);
2209 }
2210
2211 NTSTATUS rpccli_lsa_EnumTrustDom_recv(struct tevent_req *req,
2212                                       TALLOC_CTX *mem_ctx,
2213                                       NTSTATUS *result)
2214 {
2215         struct rpccli_lsa_EnumTrustDom_state *state = tevent_req_data(
2216                 req, struct rpccli_lsa_EnumTrustDom_state);
2217         NTSTATUS status;
2218
2219         if (tevent_req_is_nterror(req, &status)) {
2220                 tevent_req_received(req);
2221                 return status;
2222         }
2223
2224         /* Steal possbile out parameters to the callers context */
2225         talloc_steal(mem_ctx, state->out_mem_ctx);
2226
2227         /* Return result */
2228         *result = state->orig.out.result;
2229
2230         tevent_req_received(req);
2231         return NT_STATUS_OK;
2232 }
2233
2234 NTSTATUS rpccli_lsa_EnumTrustDom(struct rpc_pipe_client *cli,
2235                                  TALLOC_CTX *mem_ctx,
2236                                  struct policy_handle *handle /* [in] [ref] */,
2237                                  uint32_t *resume_handle /* [in,out] [ref] */,
2238                                  struct lsa_DomainList *domains /* [out] [ref] */,
2239                                  uint32_t max_size /* [in]  */)
2240 {
2241         struct lsa_EnumTrustDom r;
2242         NTSTATUS status;
2243
2244         /* In parameters */
2245         r.in.handle = handle;
2246         r.in.resume_handle = resume_handle;
2247         r.in.max_size = max_size;
2248
2249         if (DEBUGLEVEL >= 10) {
2250                 NDR_PRINT_IN_DEBUG(lsa_EnumTrustDom, &r);
2251         }
2252
2253         status = cli->dispatch(cli,
2254                                 mem_ctx,
2255                                 &ndr_table_lsarpc,
2256                                 NDR_LSA_ENUMTRUSTDOM,
2257                                 &r);
2258
2259         if (!NT_STATUS_IS_OK(status)) {
2260                 return status;
2261         }
2262
2263         if (DEBUGLEVEL >= 10) {
2264                 NDR_PRINT_OUT_DEBUG(lsa_EnumTrustDom, &r);
2265         }
2266
2267         if (NT_STATUS_IS_ERR(status)) {
2268                 return status;
2269         }
2270
2271         /* Return variables */
2272         *resume_handle = *r.out.resume_handle;
2273         *domains = *r.out.domains;
2274
2275         /* Return result */
2276         return r.out.result;
2277 }
2278
2279 struct rpccli_lsa_LookupNames_state {
2280         struct lsa_LookupNames orig;
2281         struct lsa_LookupNames tmp;
2282         TALLOC_CTX *out_mem_ctx;
2283         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2284 };
2285
2286 static void rpccli_lsa_LookupNames_done(struct tevent_req *subreq);
2287
2288 struct tevent_req *rpccli_lsa_LookupNames_send(TALLOC_CTX *mem_ctx,
2289                                                struct tevent_context *ev,
2290                                                struct rpc_pipe_client *cli,
2291                                                struct policy_handle *_handle /* [in] [ref] */,
2292                                                uint32_t _num_names /* [in] [range(0,1000)] */,
2293                                                struct lsa_String *_names /* [in] [size_is(num_names)] */,
2294                                                struct lsa_RefDomainList **_domains /* [out] [ref] */,
2295                                                struct lsa_TransSidArray *_sids /* [in,out] [ref] */,
2296                                                enum lsa_LookupNamesLevel _level /* [in]  */,
2297                                                uint32_t *_count /* [in,out] [ref] */)
2298 {
2299         struct tevent_req *req;
2300         struct rpccli_lsa_LookupNames_state *state;
2301         struct tevent_req *subreq;
2302
2303         req = tevent_req_create(mem_ctx, &state,
2304                                 struct rpccli_lsa_LookupNames_state);
2305         if (req == NULL) {
2306                 return NULL;
2307         }
2308         state->out_mem_ctx = NULL;
2309         state->dispatch_recv = cli->dispatch_recv;
2310
2311         /* In parameters */
2312         state->orig.in.handle = _handle;
2313         state->orig.in.num_names = _num_names;
2314         state->orig.in.names = _names;
2315         state->orig.in.sids = _sids;
2316         state->orig.in.level = _level;
2317         state->orig.in.count = _count;
2318
2319         /* Out parameters */
2320         state->orig.out.domains = _domains;
2321         state->orig.out.sids = _sids;
2322         state->orig.out.count = _count;
2323
2324         /* Result */
2325         ZERO_STRUCT(state->orig.out.result);
2326
2327         if (DEBUGLEVEL >= 10) {
2328                 NDR_PRINT_IN_DEBUG(lsa_LookupNames, &state->orig);
2329         }
2330
2331         state->out_mem_ctx = talloc_named_const(state, 0,
2332                              "rpccli_lsa_LookupNames_out_memory");
2333         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2334                 return tevent_req_post(req, ev);
2335         }
2336
2337         /* make a temporary copy, that we pass to the dispatch function */
2338         state->tmp = state->orig;
2339
2340         subreq = cli->dispatch_send(state, ev, cli,
2341                                     &ndr_table_lsarpc,
2342                                     NDR_LSA_LOOKUPNAMES,
2343                                     &state->tmp);
2344         if (tevent_req_nomem(subreq, req)) {
2345                 return tevent_req_post(req, ev);
2346         }
2347         tevent_req_set_callback(subreq, rpccli_lsa_LookupNames_done, req);
2348         return req;
2349 }
2350
2351 static void rpccli_lsa_LookupNames_done(struct tevent_req *subreq)
2352 {
2353         struct tevent_req *req = tevent_req_callback_data(
2354                 subreq, struct tevent_req);
2355         struct rpccli_lsa_LookupNames_state *state = tevent_req_data(
2356                 req, struct rpccli_lsa_LookupNames_state);
2357         NTSTATUS status;
2358         TALLOC_CTX *mem_ctx;
2359
2360         if (state->out_mem_ctx) {
2361                 mem_ctx = state->out_mem_ctx;
2362         } else {
2363                 mem_ctx = state;
2364         }
2365
2366         status = state->dispatch_recv(subreq, mem_ctx);
2367         TALLOC_FREE(subreq);
2368         if (!NT_STATUS_IS_OK(status)) {
2369                 tevent_req_nterror(req, status);
2370                 return;
2371         }
2372
2373         /* Copy out parameters */
2374         *state->orig.out.domains = *state->tmp.out.domains;
2375         *state->orig.out.sids = *state->tmp.out.sids;
2376         *state->orig.out.count = *state->tmp.out.count;
2377
2378         /* Copy result */
2379         state->orig.out.result = state->tmp.out.result;
2380
2381         /* Reset temporary structure */
2382         ZERO_STRUCT(state->tmp);
2383
2384         if (DEBUGLEVEL >= 10) {
2385                 NDR_PRINT_OUT_DEBUG(lsa_LookupNames, &state->orig);
2386         }
2387
2388         tevent_req_done(req);
2389 }
2390
2391 NTSTATUS rpccli_lsa_LookupNames_recv(struct tevent_req *req,
2392                                      TALLOC_CTX *mem_ctx,
2393                                      NTSTATUS *result)
2394 {
2395         struct rpccli_lsa_LookupNames_state *state = tevent_req_data(
2396                 req, struct rpccli_lsa_LookupNames_state);
2397         NTSTATUS status;
2398
2399         if (tevent_req_is_nterror(req, &status)) {
2400                 tevent_req_received(req);
2401                 return status;
2402         }
2403
2404         /* Steal possbile out parameters to the callers context */
2405         talloc_steal(mem_ctx, state->out_mem_ctx);
2406
2407         /* Return result */
2408         *result = state->orig.out.result;
2409
2410         tevent_req_received(req);
2411         return NT_STATUS_OK;
2412 }
2413
2414 NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli,
2415                                 TALLOC_CTX *mem_ctx,
2416                                 struct policy_handle *handle /* [in] [ref] */,
2417                                 uint32_t num_names /* [in] [range(0,1000)] */,
2418                                 struct lsa_String *names /* [in] [size_is(num_names)] */,
2419                                 struct lsa_RefDomainList **domains /* [out] [ref] */,
2420                                 struct lsa_TransSidArray *sids /* [in,out] [ref] */,
2421                                 enum lsa_LookupNamesLevel level /* [in]  */,
2422                                 uint32_t *count /* [in,out] [ref] */)
2423 {
2424         struct lsa_LookupNames r;
2425         NTSTATUS status;
2426
2427         /* In parameters */
2428         r.in.handle = handle;
2429         r.in.num_names = num_names;
2430         r.in.names = names;
2431         r.in.sids = sids;
2432         r.in.level = level;
2433         r.in.count = count;
2434
2435         if (DEBUGLEVEL >= 10) {
2436                 NDR_PRINT_IN_DEBUG(lsa_LookupNames, &r);
2437         }
2438
2439         status = cli->dispatch(cli,
2440                                 mem_ctx,
2441                                 &ndr_table_lsarpc,
2442                                 NDR_LSA_LOOKUPNAMES,
2443                                 &r);
2444
2445         if (!NT_STATUS_IS_OK(status)) {
2446                 return status;
2447         }
2448
2449         if (DEBUGLEVEL >= 10) {
2450                 NDR_PRINT_OUT_DEBUG(lsa_LookupNames, &r);
2451         }
2452
2453         if (NT_STATUS_IS_ERR(status)) {
2454                 return status;
2455         }
2456
2457         /* Return variables */
2458         *domains = *r.out.domains;
2459         *sids = *r.out.sids;
2460         *count = *r.out.count;
2461
2462         /* Return result */
2463         return r.out.result;
2464 }
2465
2466 struct rpccli_lsa_LookupSids_state {
2467         struct lsa_LookupSids orig;
2468         struct lsa_LookupSids tmp;
2469         TALLOC_CTX *out_mem_ctx;
2470         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2471 };
2472
2473 static void rpccli_lsa_LookupSids_done(struct tevent_req *subreq);
2474
2475 struct tevent_req *rpccli_lsa_LookupSids_send(TALLOC_CTX *mem_ctx,
2476                                               struct tevent_context *ev,
2477                                               struct rpc_pipe_client *cli,
2478                                               struct policy_handle *_handle /* [in] [ref] */,
2479                                               struct lsa_SidArray *_sids /* [in] [ref] */,
2480                                               struct lsa_RefDomainList **_domains /* [out] [ref] */,
2481                                               struct lsa_TransNameArray *_names /* [in,out] [ref] */,
2482                                               uint16_t _level /* [in]  */,
2483                                               uint32_t *_count /* [in,out] [ref] */)
2484 {
2485         struct tevent_req *req;
2486         struct rpccli_lsa_LookupSids_state *state;
2487         struct tevent_req *subreq;
2488
2489         req = tevent_req_create(mem_ctx, &state,
2490                                 struct rpccli_lsa_LookupSids_state);
2491         if (req == NULL) {
2492                 return NULL;
2493         }
2494         state->out_mem_ctx = NULL;
2495         state->dispatch_recv = cli->dispatch_recv;
2496
2497         /* In parameters */
2498         state->orig.in.handle = _handle;
2499         state->orig.in.sids = _sids;
2500         state->orig.in.names = _names;
2501         state->orig.in.level = _level;
2502         state->orig.in.count = _count;
2503
2504         /* Out parameters */
2505         state->orig.out.domains = _domains;
2506         state->orig.out.names = _names;
2507         state->orig.out.count = _count;
2508
2509         /* Result */
2510         ZERO_STRUCT(state->orig.out.result);
2511
2512         if (DEBUGLEVEL >= 10) {
2513                 NDR_PRINT_IN_DEBUG(lsa_LookupSids, &state->orig);
2514         }
2515
2516         state->out_mem_ctx = talloc_named_const(state, 0,
2517                              "rpccli_lsa_LookupSids_out_memory");
2518         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2519                 return tevent_req_post(req, ev);
2520         }
2521
2522         /* make a temporary copy, that we pass to the dispatch function */
2523         state->tmp = state->orig;
2524
2525         subreq = cli->dispatch_send(state, ev, cli,
2526                                     &ndr_table_lsarpc,
2527                                     NDR_LSA_LOOKUPSIDS,
2528                                     &state->tmp);
2529         if (tevent_req_nomem(subreq, req)) {
2530                 return tevent_req_post(req, ev);
2531         }
2532         tevent_req_set_callback(subreq, rpccli_lsa_LookupSids_done, req);
2533         return req;
2534 }
2535
2536 static void rpccli_lsa_LookupSids_done(struct tevent_req *subreq)
2537 {
2538         struct tevent_req *req = tevent_req_callback_data(
2539                 subreq, struct tevent_req);
2540         struct rpccli_lsa_LookupSids_state *state = tevent_req_data(
2541                 req, struct rpccli_lsa_LookupSids_state);
2542         NTSTATUS status;
2543         TALLOC_CTX *mem_ctx;
2544
2545         if (state->out_mem_ctx) {
2546                 mem_ctx = state->out_mem_ctx;
2547         } else {
2548                 mem_ctx = state;
2549         }
2550
2551         status = state->dispatch_recv(subreq, mem_ctx);
2552         TALLOC_FREE(subreq);
2553         if (!NT_STATUS_IS_OK(status)) {
2554                 tevent_req_nterror(req, status);
2555                 return;
2556         }
2557
2558         /* Copy out parameters */
2559         *state->orig.out.domains = *state->tmp.out.domains;
2560         *state->orig.out.names = *state->tmp.out.names;
2561         *state->orig.out.count = *state->tmp.out.count;
2562
2563         /* Copy result */
2564         state->orig.out.result = state->tmp.out.result;
2565
2566         /* Reset temporary structure */
2567         ZERO_STRUCT(state->tmp);
2568
2569         if (DEBUGLEVEL >= 10) {
2570                 NDR_PRINT_OUT_DEBUG(lsa_LookupSids, &state->orig);
2571         }
2572
2573         tevent_req_done(req);
2574 }
2575
2576 NTSTATUS rpccli_lsa_LookupSids_recv(struct tevent_req *req,
2577                                     TALLOC_CTX *mem_ctx,
2578                                     NTSTATUS *result)
2579 {
2580         struct rpccli_lsa_LookupSids_state *state = tevent_req_data(
2581                 req, struct rpccli_lsa_LookupSids_state);
2582         NTSTATUS status;
2583
2584         if (tevent_req_is_nterror(req, &status)) {
2585                 tevent_req_received(req);
2586                 return status;
2587         }
2588
2589         /* Steal possbile out parameters to the callers context */
2590         talloc_steal(mem_ctx, state->out_mem_ctx);
2591
2592         /* Return result */
2593         *result = state->orig.out.result;
2594
2595         tevent_req_received(req);
2596         return NT_STATUS_OK;
2597 }
2598
2599 NTSTATUS rpccli_lsa_LookupSids(struct rpc_pipe_client *cli,
2600                                TALLOC_CTX *mem_ctx,
2601                                struct policy_handle *handle /* [in] [ref] */,
2602                                struct lsa_SidArray *sids /* [in] [ref] */,
2603                                struct lsa_RefDomainList **domains /* [out] [ref] */,
2604                                struct lsa_TransNameArray *names /* [in,out] [ref] */,
2605                                uint16_t level /* [in]  */,
2606                                uint32_t *count /* [in,out] [ref] */)
2607 {
2608         struct lsa_LookupSids r;
2609         NTSTATUS status;
2610
2611         /* In parameters */
2612         r.in.handle = handle;
2613         r.in.sids = sids;
2614         r.in.names = names;
2615         r.in.level = level;
2616         r.in.count = count;
2617
2618         if (DEBUGLEVEL >= 10) {
2619                 NDR_PRINT_IN_DEBUG(lsa_LookupSids, &r);
2620         }
2621
2622         status = cli->dispatch(cli,
2623                                 mem_ctx,
2624                                 &ndr_table_lsarpc,
2625                                 NDR_LSA_LOOKUPSIDS,
2626                                 &r);
2627
2628         if (!NT_STATUS_IS_OK(status)) {
2629                 return status;
2630         }
2631
2632         if (DEBUGLEVEL >= 10) {
2633                 NDR_PRINT_OUT_DEBUG(lsa_LookupSids, &r);
2634         }
2635
2636         if (NT_STATUS_IS_ERR(status)) {
2637                 return status;
2638         }
2639
2640         /* Return variables */
2641         *domains = *r.out.domains;
2642         *names = *r.out.names;
2643         *count = *r.out.count;
2644
2645         /* Return result */
2646         return r.out.result;
2647 }
2648
2649 struct rpccli_lsa_CreateSecret_state {
2650         struct lsa_CreateSecret orig;
2651         struct lsa_CreateSecret tmp;
2652         TALLOC_CTX *out_mem_ctx;
2653         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2654 };
2655
2656 static void rpccli_lsa_CreateSecret_done(struct tevent_req *subreq);
2657
2658 struct tevent_req *rpccli_lsa_CreateSecret_send(TALLOC_CTX *mem_ctx,
2659                                                 struct tevent_context *ev,
2660                                                 struct rpc_pipe_client *cli,
2661                                                 struct policy_handle *_handle /* [in] [ref] */,
2662                                                 struct lsa_String _name /* [in]  */,
2663                                                 uint32_t _access_mask /* [in]  */,
2664                                                 struct policy_handle *_sec_handle /* [out] [ref] */)
2665 {
2666         struct tevent_req *req;
2667         struct rpccli_lsa_CreateSecret_state *state;
2668         struct tevent_req *subreq;
2669
2670         req = tevent_req_create(mem_ctx, &state,
2671                                 struct rpccli_lsa_CreateSecret_state);
2672         if (req == NULL) {
2673                 return NULL;
2674         }
2675         state->out_mem_ctx = NULL;
2676         state->dispatch_recv = cli->dispatch_recv;
2677
2678         /* In parameters */
2679         state->orig.in.handle = _handle;
2680         state->orig.in.name = _name;
2681         state->orig.in.access_mask = _access_mask;
2682
2683         /* Out parameters */
2684         state->orig.out.sec_handle = _sec_handle;
2685
2686         /* Result */
2687         ZERO_STRUCT(state->orig.out.result);
2688
2689         if (DEBUGLEVEL >= 10) {
2690                 NDR_PRINT_IN_DEBUG(lsa_CreateSecret, &state->orig);
2691         }
2692
2693         state->out_mem_ctx = talloc_named_const(state, 0,
2694                              "rpccli_lsa_CreateSecret_out_memory");
2695         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2696                 return tevent_req_post(req, ev);
2697         }
2698
2699         /* make a temporary copy, that we pass to the dispatch function */
2700         state->tmp = state->orig;
2701
2702         subreq = cli->dispatch_send(state, ev, cli,
2703                                     &ndr_table_lsarpc,
2704                                     NDR_LSA_CREATESECRET,
2705                                     &state->tmp);
2706         if (tevent_req_nomem(subreq, req)) {
2707                 return tevent_req_post(req, ev);
2708         }
2709         tevent_req_set_callback(subreq, rpccli_lsa_CreateSecret_done, req);
2710         return req;
2711 }
2712
2713 static void rpccli_lsa_CreateSecret_done(struct tevent_req *subreq)
2714 {
2715         struct tevent_req *req = tevent_req_callback_data(
2716                 subreq, struct tevent_req);
2717         struct rpccli_lsa_CreateSecret_state *state = tevent_req_data(
2718                 req, struct rpccli_lsa_CreateSecret_state);
2719         NTSTATUS status;
2720         TALLOC_CTX *mem_ctx;
2721
2722         if (state->out_mem_ctx) {
2723                 mem_ctx = state->out_mem_ctx;
2724         } else {
2725                 mem_ctx = state;
2726         }
2727
2728         status = state->dispatch_recv(subreq, mem_ctx);
2729         TALLOC_FREE(subreq);
2730         if (!NT_STATUS_IS_OK(status)) {
2731                 tevent_req_nterror(req, status);
2732                 return;
2733         }
2734
2735         /* Copy out parameters */
2736         *state->orig.out.sec_handle = *state->tmp.out.sec_handle;
2737
2738         /* Copy result */
2739         state->orig.out.result = state->tmp.out.result;
2740
2741         /* Reset temporary structure */
2742         ZERO_STRUCT(state->tmp);
2743
2744         if (DEBUGLEVEL >= 10) {
2745                 NDR_PRINT_OUT_DEBUG(lsa_CreateSecret, &state->orig);
2746         }
2747
2748         tevent_req_done(req);
2749 }
2750
2751 NTSTATUS rpccli_lsa_CreateSecret_recv(struct tevent_req *req,
2752                                       TALLOC_CTX *mem_ctx,
2753                                       NTSTATUS *result)
2754 {
2755         struct rpccli_lsa_CreateSecret_state *state = tevent_req_data(
2756                 req, struct rpccli_lsa_CreateSecret_state);
2757         NTSTATUS status;
2758
2759         if (tevent_req_is_nterror(req, &status)) {
2760                 tevent_req_received(req);
2761                 return status;
2762         }
2763
2764         /* Steal possbile out parameters to the callers context */
2765         talloc_steal(mem_ctx, state->out_mem_ctx);
2766
2767         /* Return result */
2768         *result = state->orig.out.result;
2769
2770         tevent_req_received(req);
2771         return NT_STATUS_OK;
2772 }
2773
2774 NTSTATUS rpccli_lsa_CreateSecret(struct rpc_pipe_client *cli,
2775                                  TALLOC_CTX *mem_ctx,
2776                                  struct policy_handle *handle /* [in] [ref] */,
2777                                  struct lsa_String name /* [in]  */,
2778                                  uint32_t access_mask /* [in]  */,
2779                                  struct policy_handle *sec_handle /* [out] [ref] */)
2780 {
2781         struct lsa_CreateSecret r;
2782         NTSTATUS status;
2783
2784         /* In parameters */
2785         r.in.handle = handle;
2786         r.in.name = name;
2787         r.in.access_mask = access_mask;
2788
2789         if (DEBUGLEVEL >= 10) {
2790                 NDR_PRINT_IN_DEBUG(lsa_CreateSecret, &r);
2791         }
2792
2793         status = cli->dispatch(cli,
2794                                 mem_ctx,
2795                                 &ndr_table_lsarpc,
2796                                 NDR_LSA_CREATESECRET,
2797                                 &r);
2798
2799         if (!NT_STATUS_IS_OK(status)) {
2800                 return status;
2801         }
2802
2803         if (DEBUGLEVEL >= 10) {
2804                 NDR_PRINT_OUT_DEBUG(lsa_CreateSecret, &r);
2805         }
2806
2807         if (NT_STATUS_IS_ERR(status)) {
2808                 return status;
2809         }
2810
2811         /* Return variables */
2812         *sec_handle = *r.out.sec_handle;
2813
2814         /* Return result */
2815         return r.out.result;
2816 }
2817
2818 struct rpccli_lsa_OpenAccount_state {
2819         struct lsa_OpenAccount orig;
2820         struct lsa_OpenAccount tmp;
2821         TALLOC_CTX *out_mem_ctx;
2822         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2823 };
2824
2825 static void rpccli_lsa_OpenAccount_done(struct tevent_req *subreq);
2826
2827 struct tevent_req *rpccli_lsa_OpenAccount_send(TALLOC_CTX *mem_ctx,
2828                                                struct tevent_context *ev,
2829                                                struct rpc_pipe_client *cli,
2830                                                struct policy_handle *_handle /* [in] [ref] */,
2831                                                struct dom_sid2 *_sid /* [in] [ref] */,
2832                                                uint32_t _access_mask /* [in]  */,
2833                                                struct policy_handle *_acct_handle /* [out] [ref] */)
2834 {
2835         struct tevent_req *req;
2836         struct rpccli_lsa_OpenAccount_state *state;
2837         struct tevent_req *subreq;
2838
2839         req = tevent_req_create(mem_ctx, &state,
2840                                 struct rpccli_lsa_OpenAccount_state);
2841         if (req == NULL) {
2842                 return NULL;
2843         }
2844         state->out_mem_ctx = NULL;
2845         state->dispatch_recv = cli->dispatch_recv;
2846
2847         /* In parameters */
2848         state->orig.in.handle = _handle;
2849         state->orig.in.sid = _sid;
2850         state->orig.in.access_mask = _access_mask;
2851
2852         /* Out parameters */
2853         state->orig.out.acct_handle = _acct_handle;
2854
2855         /* Result */
2856         ZERO_STRUCT(state->orig.out.result);
2857
2858         if (DEBUGLEVEL >= 10) {
2859                 NDR_PRINT_IN_DEBUG(lsa_OpenAccount, &state->orig);
2860         }
2861
2862         state->out_mem_ctx = talloc_named_const(state, 0,
2863                              "rpccli_lsa_OpenAccount_out_memory");
2864         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2865                 return tevent_req_post(req, ev);
2866         }
2867
2868         /* make a temporary copy, that we pass to the dispatch function */
2869         state->tmp = state->orig;
2870
2871         subreq = cli->dispatch_send(state, ev, cli,
2872                                     &ndr_table_lsarpc,
2873                                     NDR_LSA_OPENACCOUNT,
2874                                     &state->tmp);
2875         if (tevent_req_nomem(subreq, req)) {
2876                 return tevent_req_post(req, ev);
2877         }
2878         tevent_req_set_callback(subreq, rpccli_lsa_OpenAccount_done, req);
2879         return req;
2880 }
2881
2882 static void rpccli_lsa_OpenAccount_done(struct tevent_req *subreq)
2883 {
2884         struct tevent_req *req = tevent_req_callback_data(
2885                 subreq, struct tevent_req);
2886         struct rpccli_lsa_OpenAccount_state *state = tevent_req_data(
2887                 req, struct rpccli_lsa_OpenAccount_state);
2888         NTSTATUS status;
2889         TALLOC_CTX *mem_ctx;
2890
2891         if (state->out_mem_ctx) {
2892                 mem_ctx = state->out_mem_ctx;
2893         } else {
2894                 mem_ctx = state;
2895         }
2896
2897         status = state->dispatch_recv(subreq, mem_ctx);
2898         TALLOC_FREE(subreq);
2899         if (!NT_STATUS_IS_OK(status)) {
2900                 tevent_req_nterror(req, status);
2901                 return;
2902         }
2903
2904         /* Copy out parameters */
2905         *state->orig.out.acct_handle = *state->tmp.out.acct_handle;
2906
2907         /* Copy result */
2908         state->orig.out.result = state->tmp.out.result;
2909
2910         /* Reset temporary structure */
2911         ZERO_STRUCT(state->tmp);
2912
2913         if (DEBUGLEVEL >= 10) {
2914                 NDR_PRINT_OUT_DEBUG(lsa_OpenAccount, &state->orig);
2915         }
2916
2917         tevent_req_done(req);
2918 }
2919
2920 NTSTATUS rpccli_lsa_OpenAccount_recv(struct tevent_req *req,
2921                                      TALLOC_CTX *mem_ctx,
2922                                      NTSTATUS *result)
2923 {
2924         struct rpccli_lsa_OpenAccount_state *state = tevent_req_data(
2925                 req, struct rpccli_lsa_OpenAccount_state);
2926         NTSTATUS status;
2927
2928         if (tevent_req_is_nterror(req, &status)) {
2929                 tevent_req_received(req);
2930                 return status;
2931         }
2932
2933         /* Steal possbile out parameters to the callers context */
2934         talloc_steal(mem_ctx, state->out_mem_ctx);
2935
2936         /* Return result */
2937         *result = state->orig.out.result;
2938
2939         tevent_req_received(req);
2940         return NT_STATUS_OK;
2941 }
2942
2943 NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli,
2944                                 TALLOC_CTX *mem_ctx,
2945                                 struct policy_handle *handle /* [in] [ref] */,
2946                                 struct dom_sid2 *sid /* [in] [ref] */,
2947                                 uint32_t access_mask /* [in]  */,
2948                                 struct policy_handle *acct_handle /* [out] [ref] */)
2949 {
2950         struct lsa_OpenAccount r;
2951         NTSTATUS status;
2952
2953         /* In parameters */
2954         r.in.handle = handle;
2955         r.in.sid = sid;
2956         r.in.access_mask = access_mask;
2957
2958         if (DEBUGLEVEL >= 10) {
2959                 NDR_PRINT_IN_DEBUG(lsa_OpenAccount, &r);
2960         }
2961
2962         status = cli->dispatch(cli,
2963                                 mem_ctx,
2964                                 &ndr_table_lsarpc,
2965                                 NDR_LSA_OPENACCOUNT,
2966                                 &r);
2967
2968         if (!NT_STATUS_IS_OK(status)) {
2969                 return status;
2970         }
2971
2972         if (DEBUGLEVEL >= 10) {
2973                 NDR_PRINT_OUT_DEBUG(lsa_OpenAccount, &r);
2974         }
2975
2976         if (NT_STATUS_IS_ERR(status)) {
2977                 return status;
2978         }
2979
2980         /* Return variables */
2981         *acct_handle = *r.out.acct_handle;
2982
2983         /* Return result */
2984         return r.out.result;
2985 }
2986
2987 struct rpccli_lsa_EnumPrivsAccount_state {
2988         struct lsa_EnumPrivsAccount orig;
2989         struct lsa_EnumPrivsAccount tmp;
2990         TALLOC_CTX *out_mem_ctx;
2991         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2992 };
2993
2994 static void rpccli_lsa_EnumPrivsAccount_done(struct tevent_req *subreq);
2995
2996 struct tevent_req *rpccli_lsa_EnumPrivsAccount_send(TALLOC_CTX *mem_ctx,
2997                                                     struct tevent_context *ev,
2998                                                     struct rpc_pipe_client *cli,
2999                                                     struct policy_handle *_handle /* [in] [ref] */,
3000                                                     struct lsa_PrivilegeSet **_privs /* [out] [ref] */)
3001 {
3002         struct tevent_req *req;
3003         struct rpccli_lsa_EnumPrivsAccount_state *state;
3004         struct tevent_req *subreq;
3005
3006         req = tevent_req_create(mem_ctx, &state,
3007                                 struct rpccli_lsa_EnumPrivsAccount_state);
3008         if (req == NULL) {
3009                 return NULL;
3010         }
3011         state->out_mem_ctx = NULL;
3012         state->dispatch_recv = cli->dispatch_recv;
3013
3014         /* In parameters */
3015         state->orig.in.handle = _handle;
3016
3017         /* Out parameters */
3018         state->orig.out.privs = _privs;
3019
3020         /* Result */
3021         ZERO_STRUCT(state->orig.out.result);
3022
3023         if (DEBUGLEVEL >= 10) {
3024                 NDR_PRINT_IN_DEBUG(lsa_EnumPrivsAccount, &state->orig);
3025         }
3026
3027         state->out_mem_ctx = talloc_named_const(state, 0,
3028                              "rpccli_lsa_EnumPrivsAccount_out_memory");
3029         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3030                 return tevent_req_post(req, ev);
3031         }
3032
3033         /* make a temporary copy, that we pass to the dispatch function */
3034         state->tmp = state->orig;
3035
3036         subreq = cli->dispatch_send(state, ev, cli,
3037                                     &ndr_table_lsarpc,
3038                                     NDR_LSA_ENUMPRIVSACCOUNT,
3039                                     &state->tmp);
3040         if (tevent_req_nomem(subreq, req)) {
3041                 return tevent_req_post(req, ev);
3042         }
3043         tevent_req_set_callback(subreq, rpccli_lsa_EnumPrivsAccount_done, req);
3044         return req;
3045 }
3046
3047 static void rpccli_lsa_EnumPrivsAccount_done(struct tevent_req *subreq)
3048 {
3049         struct tevent_req *req = tevent_req_callback_data(
3050                 subreq, struct tevent_req);
3051         struct rpccli_lsa_EnumPrivsAccount_state *state = tevent_req_data(
3052                 req, struct rpccli_lsa_EnumPrivsAccount_state);
3053         NTSTATUS status;
3054         TALLOC_CTX *mem_ctx;
3055
3056         if (state->out_mem_ctx) {
3057                 mem_ctx = state->out_mem_ctx;
3058         } else {
3059                 mem_ctx = state;
3060         }
3061
3062         status = state->dispatch_recv(subreq, mem_ctx);
3063         TALLOC_FREE(subreq);
3064         if (!NT_STATUS_IS_OK(status)) {
3065                 tevent_req_nterror(req, status);
3066                 return;
3067         }
3068
3069         /* Copy out parameters */
3070         *state->orig.out.privs = *state->tmp.out.privs;
3071
3072         /* Copy result */
3073         state->orig.out.result = state->tmp.out.result;
3074
3075         /* Reset temporary structure */
3076         ZERO_STRUCT(state->tmp);
3077
3078         if (DEBUGLEVEL >= 10) {
3079                 NDR_PRINT_OUT_DEBUG(lsa_EnumPrivsAccount, &state->orig);
3080         }
3081
3082         tevent_req_done(req);
3083 }
3084
3085 NTSTATUS rpccli_lsa_EnumPrivsAccount_recv(struct tevent_req *req,
3086                                           TALLOC_CTX *mem_ctx,
3087                                           NTSTATUS *result)
3088 {
3089         struct rpccli_lsa_EnumPrivsAccount_state *state = tevent_req_data(
3090                 req, struct rpccli_lsa_EnumPrivsAccount_state);
3091         NTSTATUS status;
3092
3093         if (tevent_req_is_nterror(req, &status)) {
3094                 tevent_req_received(req);
3095                 return status;
3096         }
3097
3098         /* Steal possbile out parameters to the callers context */
3099         talloc_steal(mem_ctx, state->out_mem_ctx);
3100
3101         /* Return result */
3102         *result = state->orig.out.result;
3103
3104         tevent_req_received(req);
3105         return NT_STATUS_OK;
3106 }
3107
3108 NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli,
3109                                      TALLOC_CTX *mem_ctx,
3110                                      struct policy_handle *handle /* [in] [ref] */,
3111                                      struct lsa_PrivilegeSet **privs /* [out] [ref] */)
3112 {
3113         struct lsa_EnumPrivsAccount r;
3114         NTSTATUS status;
3115
3116         /* In parameters */
3117         r.in.handle = handle;
3118
3119         if (DEBUGLEVEL >= 10) {
3120                 NDR_PRINT_IN_DEBUG(lsa_EnumPrivsAccount, &r);
3121         }
3122
3123         status = cli->dispatch(cli,
3124                                 mem_ctx,
3125                                 &ndr_table_lsarpc,
3126                                 NDR_LSA_ENUMPRIVSACCOUNT,
3127                                 &r);
3128
3129         if (!NT_STATUS_IS_OK(status)) {
3130                 return status;
3131         }
3132
3133         if (DEBUGLEVEL >= 10) {
3134                 NDR_PRINT_OUT_DEBUG(lsa_EnumPrivsAccount, &r);
3135         }
3136
3137         if (NT_STATUS_IS_ERR(status)) {
3138                 return status;
3139         }
3140
3141         /* Return variables */
3142         *privs = *r.out.privs;
3143
3144         /* Return result */
3145         return r.out.result;
3146 }
3147
3148 struct rpccli_lsa_AddPrivilegesToAccount_state {
3149         struct lsa_AddPrivilegesToAccount orig;
3150         struct lsa_AddPrivilegesToAccount tmp;
3151         TALLOC_CTX *out_mem_ctx;
3152         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3153 };
3154
3155 static void rpccli_lsa_AddPrivilegesToAccount_done(struct tevent_req *subreq);
3156
3157 struct tevent_req *rpccli_lsa_AddPrivilegesToAccount_send(TALLOC_CTX *mem_ctx,
3158                                                           struct tevent_context *ev,
3159                                                           struct rpc_pipe_client *cli,
3160                                                           struct policy_handle *_handle /* [in] [ref] */,
3161                                                           struct lsa_PrivilegeSet *_privs /* [in] [ref] */)
3162 {
3163         struct tevent_req *req;
3164         struct rpccli_lsa_AddPrivilegesToAccount_state *state;
3165         struct tevent_req *subreq;
3166
3167         req = tevent_req_create(mem_ctx, &state,
3168                                 struct rpccli_lsa_AddPrivilegesToAccount_state);
3169         if (req == NULL) {
3170                 return NULL;
3171         }
3172         state->out_mem_ctx = NULL;
3173         state->dispatch_recv = cli->dispatch_recv;
3174
3175         /* In parameters */
3176         state->orig.in.handle = _handle;
3177         state->orig.in.privs = _privs;
3178
3179         /* Out parameters */
3180
3181         /* Result */
3182         ZERO_STRUCT(state->orig.out.result);
3183
3184         if (DEBUGLEVEL >= 10) {
3185                 NDR_PRINT_IN_DEBUG(lsa_AddPrivilegesToAccount, &state->orig);
3186         }
3187
3188         /* make a temporary copy, that we pass to the dispatch function */
3189         state->tmp = state->orig;
3190
3191         subreq = cli->dispatch_send(state, ev, cli,
3192                                     &ndr_table_lsarpc,
3193                                     NDR_LSA_ADDPRIVILEGESTOACCOUNT,
3194                                     &state->tmp);
3195         if (tevent_req_nomem(subreq, req)) {
3196                 return tevent_req_post(req, ev);
3197         }
3198         tevent_req_set_callback(subreq, rpccli_lsa_AddPrivilegesToAccount_done, req);
3199         return req;
3200 }
3201
3202 static void rpccli_lsa_AddPrivilegesToAccount_done(struct tevent_req *subreq)
3203 {
3204         struct tevent_req *req = tevent_req_callback_data(
3205                 subreq, struct tevent_req);
3206         struct rpccli_lsa_AddPrivilegesToAccount_state *state = tevent_req_data(
3207                 req, struct rpccli_lsa_AddPrivilegesToAccount_state);
3208         NTSTATUS status;
3209         TALLOC_CTX *mem_ctx;
3210
3211         if (state->out_mem_ctx) {
3212                 mem_ctx = state->out_mem_ctx;
3213         } else {
3214                 mem_ctx = state;
3215         }
3216
3217         status = state->dispatch_recv(subreq, mem_ctx);
3218         TALLOC_FREE(subreq);
3219         if (!NT_STATUS_IS_OK(status)) {
3220                 tevent_req_nterror(req, status);
3221                 return;
3222         }
3223
3224         /* Copy out parameters */
3225
3226         /* Copy result */
3227         state->orig.out.result = state->tmp.out.result;
3228
3229         /* Reset temporary structure */
3230         ZERO_STRUCT(state->tmp);
3231
3232         if (DEBUGLEVEL >= 10) {
3233                 NDR_PRINT_OUT_DEBUG(lsa_AddPrivilegesToAccount, &state->orig);
3234         }
3235
3236         tevent_req_done(req);
3237 }
3238
3239 NTSTATUS rpccli_lsa_AddPrivilegesToAccount_recv(struct tevent_req *req,
3240                                                 TALLOC_CTX *mem_ctx,
3241                                                 NTSTATUS *result)
3242 {
3243         struct rpccli_lsa_AddPrivilegesToAccount_state *state = tevent_req_data(
3244                 req, struct rpccli_lsa_AddPrivilegesToAccount_state);
3245         NTSTATUS status;
3246
3247         if (tevent_req_is_nterror(req, &status)) {
3248                 tevent_req_received(req);
3249                 return status;
3250         }
3251
3252         /* Steal possbile out parameters to the callers context */
3253         talloc_steal(mem_ctx, state->out_mem_ctx);
3254
3255         /* Return result */
3256         *result = state->orig.out.result;
3257
3258         tevent_req_received(req);
3259         return NT_STATUS_OK;
3260 }
3261
3262 NTSTATUS rpccli_lsa_AddPrivilegesToAccount(struct rpc_pipe_client *cli,
3263                                            TALLOC_CTX *mem_ctx,
3264                                            struct policy_handle *handle /* [in] [ref] */,
3265                                            struct lsa_PrivilegeSet *privs /* [in] [ref] */)
3266 {
3267         struct lsa_AddPrivilegesToAccount r;
3268         NTSTATUS status;
3269
3270         /* In parameters */
3271         r.in.handle = handle;
3272         r.in.privs = privs;
3273
3274         if (DEBUGLEVEL >= 10) {
3275                 NDR_PRINT_IN_DEBUG(lsa_AddPrivilegesToAccount, &r);
3276         }
3277
3278         status = cli->dispatch(cli,
3279                                 mem_ctx,
3280                                 &ndr_table_lsarpc,
3281                                 NDR_LSA_ADDPRIVILEGESTOACCOUNT,
3282                                 &r);
3283
3284         if (!NT_STATUS_IS_OK(status)) {
3285                 return status;
3286         }
3287
3288         if (DEBUGLEVEL >= 10) {
3289                 NDR_PRINT_OUT_DEBUG(lsa_AddPrivilegesToAccount, &r);
3290         }
3291
3292         if (NT_STATUS_IS_ERR(status)) {
3293                 return status;
3294         }
3295
3296         /* Return variables */
3297
3298         /* Return result */
3299         return r.out.result;
3300 }
3301
3302 struct rpccli_lsa_RemovePrivilegesFromAccount_state {
3303         struct lsa_RemovePrivilegesFromAccount orig;
3304         struct lsa_RemovePrivilegesFromAccount tmp;
3305         TALLOC_CTX *out_mem_ctx;
3306         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3307 };
3308
3309 static void rpccli_lsa_RemovePrivilegesFromAccount_done(struct tevent_req *subreq);
3310
3311 struct tevent_req *rpccli_lsa_RemovePrivilegesFromAccount_send(TALLOC_CTX *mem_ctx,
3312                                                                struct tevent_context *ev,
3313                                                                struct rpc_pipe_client *cli,
3314                                                                struct policy_handle *_handle /* [in] [ref] */,
3315                                                                uint8_t _remove_all /* [in]  */,
3316                                                                struct lsa_PrivilegeSet *_privs /* [in] [unique] */)
3317 {
3318         struct tevent_req *req;
3319         struct rpccli_lsa_RemovePrivilegesFromAccount_state *state;
3320         struct tevent_req *subreq;
3321
3322         req = tevent_req_create(mem_ctx, &state,
3323                                 struct rpccli_lsa_RemovePrivilegesFromAccount_state);
3324         if (req == NULL) {
3325                 return NULL;
3326         }
3327         state->out_mem_ctx = NULL;
3328         state->dispatch_recv = cli->dispatch_recv;
3329
3330         /* In parameters */
3331         state->orig.in.handle = _handle;
3332         state->orig.in.remove_all = _remove_all;
3333         state->orig.in.privs = _privs;
3334
3335         /* Out parameters */
3336
3337         /* Result */
3338         ZERO_STRUCT(state->orig.out.result);
3339
3340         if (DEBUGLEVEL >= 10) {
3341                 NDR_PRINT_IN_DEBUG(lsa_RemovePrivilegesFromAccount, &state->orig);
3342         }
3343
3344         /* make a temporary copy, that we pass to the dispatch function */
3345         state->tmp = state->orig;
3346
3347         subreq = cli->dispatch_send(state, ev, cli,
3348                                     &ndr_table_lsarpc,
3349                                     NDR_LSA_REMOVEPRIVILEGESFROMACCOUNT,
3350                                     &state->tmp);
3351         if (tevent_req_nomem(subreq, req)) {
3352                 return tevent_req_post(req, ev);
3353         }
3354         tevent_req_set_callback(subreq, rpccli_lsa_RemovePrivilegesFromAccount_done, req);
3355         return req;
3356 }
3357
3358 static void rpccli_lsa_RemovePrivilegesFromAccount_done(struct tevent_req *subreq)
3359 {
3360         struct tevent_req *req = tevent_req_callback_data(
3361                 subreq, struct tevent_req);
3362         struct rpccli_lsa_RemovePrivilegesFromAccount_state *state = tevent_req_data(
3363                 req, struct rpccli_lsa_RemovePrivilegesFromAccount_state);
3364         NTSTATUS status;
3365         TALLOC_CTX *mem_ctx;
3366
3367         if (state->out_mem_ctx) {
3368                 mem_ctx = state->out_mem_ctx;
3369         } else {
3370                 mem_ctx = state;
3371         }
3372
3373         status = state->dispatch_recv(subreq, mem_ctx);
3374         TALLOC_FREE(subreq);
3375         if (!NT_STATUS_IS_OK(status)) {
3376                 tevent_req_nterror(req, status);
3377                 return;
3378         }
3379
3380         /* Copy out parameters */
3381
3382         /* Copy result */
3383         state->orig.out.result = state->tmp.out.result;
3384
3385         /* Reset temporary structure */
3386         ZERO_STRUCT(state->tmp);
3387
3388         if (DEBUGLEVEL >= 10) {
3389                 NDR_PRINT_OUT_DEBUG(lsa_RemovePrivilegesFromAccount, &state->orig);
3390         }
3391
3392         tevent_req_done(req);
3393 }
3394
3395 NTSTATUS rpccli_lsa_RemovePrivilegesFromAccount_recv(struct tevent_req *req,
3396                                                      TALLOC_CTX *mem_ctx,
3397                                                      NTSTATUS *result)
3398 {
3399         struct rpccli_lsa_RemovePrivilegesFromAccount_state *state = tevent_req_data(
3400                 req, struct rpccli_lsa_RemovePrivilegesFromAccount_state);
3401         NTSTATUS status;
3402
3403         if (tevent_req_is_nterror(req, &status)) {
3404                 tevent_req_received(req);
3405                 return status;
3406         }
3407
3408         /* Steal possbile out parameters to the callers context */
3409         talloc_steal(mem_ctx, state->out_mem_ctx);
3410
3411         /* Return result */
3412         *result = state->orig.out.result;
3413
3414         tevent_req_received(req);
3415         return NT_STATUS_OK;
3416 }
3417
3418 NTSTATUS rpccli_lsa_RemovePrivilegesFromAccount(struct rpc_pipe_client *cli,
3419                                                 TALLOC_CTX *mem_ctx,
3420                                                 struct policy_handle *handle /* [in] [ref] */,
3421                                                 uint8_t remove_all /* [in]  */,
3422                                                 struct lsa_PrivilegeSet *privs /* [in] [unique] */)
3423 {
3424         struct lsa_RemovePrivilegesFromAccount r;
3425         NTSTATUS status;
3426
3427         /* In parameters */
3428         r.in.handle = handle;
3429         r.in.remove_all = remove_all;
3430         r.in.privs = privs;
3431
3432         if (DEBUGLEVEL >= 10) {
3433                 NDR_PRINT_IN_DEBUG(lsa_RemovePrivilegesFromAccount, &r);
3434         }
3435
3436         status = cli->dispatch(cli,
3437                                 mem_ctx,
3438                                 &ndr_table_lsarpc,
3439                                 NDR_LSA_REMOVEPRIVILEGESFROMACCOUNT,
3440                                 &r);
3441
3442         if (!NT_STATUS_IS_OK(status)) {
3443                 return status;
3444         }
3445
3446         if (DEBUGLEVEL >= 10) {
3447                 NDR_PRINT_OUT_DEBUG(lsa_RemovePrivilegesFromAccount, &r);
3448         }
3449
3450         if (NT_STATUS_IS_ERR(status)) {
3451                 return status;
3452         }
3453
3454         /* Return variables */
3455
3456         /* Return result */
3457         return r.out.result;
3458 }
3459
3460 struct rpccli_lsa_GetQuotasForAccount_state {
3461         struct lsa_GetQuotasForAccount orig;
3462         struct lsa_GetQuotasForAccount tmp;
3463         TALLOC_CTX *out_mem_ctx;
3464         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3465 };
3466
3467 static void rpccli_lsa_GetQuotasForAccount_done(struct tevent_req *subreq);
3468
3469 struct tevent_req *rpccli_lsa_GetQuotasForAccount_send(TALLOC_CTX *mem_ctx,
3470                                                        struct tevent_context *ev,
3471                                                        struct rpc_pipe_client *cli)
3472 {
3473         struct tevent_req *req;
3474         struct rpccli_lsa_GetQuotasForAccount_state *state;
3475         struct tevent_req *subreq;
3476
3477         req = tevent_req_create(mem_ctx, &state,
3478                                 struct rpccli_lsa_GetQuotasForAccount_state);
3479         if (req == NULL) {
3480                 return NULL;
3481         }
3482         state->out_mem_ctx = NULL;
3483         state->dispatch_recv = cli->dispatch_recv;
3484
3485         /* In parameters */
3486
3487         /* Out parameters */
3488
3489         /* Result */
3490         ZERO_STRUCT(state->orig.out.result);
3491
3492         if (DEBUGLEVEL >= 10) {
3493                 NDR_PRINT_IN_DEBUG(lsa_GetQuotasForAccount, &state->orig);
3494         }
3495
3496         /* make a temporary copy, that we pass to the dispatch function */
3497         state->tmp = state->orig;
3498
3499         subreq = cli->dispatch_send(state, ev, cli,
3500                                     &ndr_table_lsarpc,
3501                                     NDR_LSA_GETQUOTASFORACCOUNT,
3502                                     &state->tmp);
3503         if (tevent_req_nomem(subreq, req)) {
3504                 return tevent_req_post(req, ev);
3505         }
3506         tevent_req_set_callback(subreq, rpccli_lsa_GetQuotasForAccount_done, req);
3507         return req;
3508 }
3509
3510 static void rpccli_lsa_GetQuotasForAccount_done(struct tevent_req *subreq)
3511 {
3512         struct tevent_req *req = tevent_req_callback_data(
3513                 subreq, struct tevent_req);
3514         struct rpccli_lsa_GetQuotasForAccount_state *state = tevent_req_data(
3515                 req, struct rpccli_lsa_GetQuotasForAccount_state);
3516         NTSTATUS status;
3517         TALLOC_CTX *mem_ctx;
3518
3519         if (state->out_mem_ctx) {
3520                 mem_ctx = state->out_mem_ctx;
3521         } else {
3522                 mem_ctx = state;
3523         }
3524
3525         status = state->dispatch_recv(subreq, mem_ctx);
3526         TALLOC_FREE(subreq);
3527         if (!NT_STATUS_IS_OK(status)) {
3528                 tevent_req_nterror(req, status);
3529                 return;
3530         }
3531
3532         /* Copy out parameters */
3533
3534         /* Copy result */
3535         state->orig.out.result = state->tmp.out.result;
3536
3537         /* Reset temporary structure */
3538         ZERO_STRUCT(state->tmp);
3539
3540         if (DEBUGLEVEL >= 10) {
3541                 NDR_PRINT_OUT_DEBUG(lsa_GetQuotasForAccount, &state->orig);
3542         }
3543
3544         tevent_req_done(req);
3545 }
3546
3547 NTSTATUS rpccli_lsa_GetQuotasForAccount_recv(struct tevent_req *req,
3548                                              TALLOC_CTX *mem_ctx,
3549                                              NTSTATUS *result)
3550 {
3551         struct rpccli_lsa_GetQuotasForAccount_state *state = tevent_req_data(
3552                 req, struct rpccli_lsa_GetQuotasForAccount_state);
3553         NTSTATUS status;
3554
3555         if (tevent_req_is_nterror(req, &status)) {
3556                 tevent_req_received(req);
3557                 return status;
3558         }
3559
3560         /* Steal possbile out parameters to the callers context */
3561         talloc_steal(mem_ctx, state->out_mem_ctx);
3562
3563         /* Return result */
3564         *result = state->orig.out.result;
3565
3566         tevent_req_received(req);
3567         return NT_STATUS_OK;
3568 }
3569
3570 NTSTATUS rpccli_lsa_GetQuotasForAccount(struct rpc_pipe_client *cli,
3571                                         TALLOC_CTX *mem_ctx)
3572 {
3573         struct lsa_GetQuotasForAccount r;
3574         NTSTATUS status;
3575
3576         /* In parameters */
3577
3578         if (DEBUGLEVEL >= 10) {
3579                 NDR_PRINT_IN_DEBUG(lsa_GetQuotasForAccount, &r);
3580         }
3581
3582         status = cli->dispatch(cli,
3583                                 mem_ctx,
3584                                 &ndr_table_lsarpc,
3585                                 NDR_LSA_GETQUOTASFORACCOUNT,
3586                                 &r);
3587
3588         if (!NT_STATUS_IS_OK(status)) {
3589                 return status;
3590         }
3591
3592         if (DEBUGLEVEL >= 10) {
3593                 NDR_PRINT_OUT_DEBUG(lsa_GetQuotasForAccount, &r);
3594         }
3595
3596         if (NT_STATUS_IS_ERR(status)) {
3597                 return status;
3598         }
3599
3600         /* Return variables */
3601
3602         /* Return result */
3603         return r.out.result;
3604 }
3605
3606 struct rpccli_lsa_SetQuotasForAccount_state {
3607         struct lsa_SetQuotasForAccount orig;
3608         struct lsa_SetQuotasForAccount tmp;
3609         TALLOC_CTX *out_mem_ctx;
3610         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3611 };
3612
3613 static void rpccli_lsa_SetQuotasForAccount_done(struct tevent_req *subreq);
3614
3615 struct tevent_req *rpccli_lsa_SetQuotasForAccount_send(TALLOC_CTX *mem_ctx,
3616                                                        struct tevent_context *ev,
3617                                                        struct rpc_pipe_client *cli)
3618 {
3619         struct tevent_req *req;
3620         struct rpccli_lsa_SetQuotasForAccount_state *state;
3621         struct tevent_req *subreq;
3622
3623         req = tevent_req_create(mem_ctx, &state,
3624                                 struct rpccli_lsa_SetQuotasForAccount_state);
3625         if (req == NULL) {
3626                 return NULL;
3627         }
3628         state->out_mem_ctx = NULL;
3629         state->dispatch_recv = cli->dispatch_recv;
3630
3631         /* In parameters */
3632
3633         /* Out parameters */
3634
3635         /* Result */
3636         ZERO_STRUCT(state->orig.out.result);
3637
3638         if (DEBUGLEVEL >= 10) {
3639                 NDR_PRINT_IN_DEBUG(lsa_SetQuotasForAccount, &state->orig);
3640         }
3641
3642         /* make a temporary copy, that we pass to the dispatch function */
3643         state->tmp = state->orig;
3644
3645         subreq = cli->dispatch_send(state, ev, cli,
3646                                     &ndr_table_lsarpc,
3647                                     NDR_LSA_SETQUOTASFORACCOUNT,
3648                                     &state->tmp);
3649         if (tevent_req_nomem(subreq, req)) {
3650                 return tevent_req_post(req, ev);
3651         }
3652         tevent_req_set_callback(subreq, rpccli_lsa_SetQuotasForAccount_done, req);
3653         return req;
3654 }
3655
3656 static void rpccli_lsa_SetQuotasForAccount_done(struct tevent_req *subreq)
3657 {
3658         struct tevent_req *req = tevent_req_callback_data(
3659                 subreq, struct tevent_req);
3660         struct rpccli_lsa_SetQuotasForAccount_state *state = tevent_req_data(
3661                 req, struct rpccli_lsa_SetQuotasForAccount_state);
3662         NTSTATUS status;
3663         TALLOC_CTX *mem_ctx;
3664
3665         if (state->out_mem_ctx) {
3666                 mem_ctx = state->out_mem_ctx;
3667         } else {
3668                 mem_ctx = state;
3669         }
3670
3671         status = state->dispatch_recv(subreq, mem_ctx);
3672         TALLOC_FREE(subreq);
3673         if (!NT_STATUS_IS_OK(status)) {
3674                 tevent_req_nterror(req, status);
3675                 return;
3676         }
3677
3678         /* Copy out parameters */
3679
3680         /* Copy result */
3681         state->orig.out.result = state->tmp.out.result;
3682
3683         /* Reset temporary structure */
3684         ZERO_STRUCT(state->tmp);
3685
3686         if (DEBUGLEVEL >= 10) {
3687                 NDR_PRINT_OUT_DEBUG(lsa_SetQuotasForAccount, &state->orig);
3688         }
3689
3690         tevent_req_done(req);
3691 }
3692
3693 NTSTATUS rpccli_lsa_SetQuotasForAccount_recv(struct tevent_req *req,
3694                                              TALLOC_CTX *mem_ctx,
3695                                              NTSTATUS *result)
3696 {
3697         struct rpccli_lsa_SetQuotasForAccount_state *state = tevent_req_data(
3698                 req, struct rpccli_lsa_SetQuotasForAccount_state);
3699         NTSTATUS status;
3700
3701         if (tevent_req_is_nterror(req, &status)) {
3702                 tevent_req_received(req);
3703                 return status;
3704         }
3705
3706         /* Steal possbile out parameters to the callers context */
3707         talloc_steal(mem_ctx, state->out_mem_ctx);
3708
3709         /* Return result */
3710         *result = state->orig.out.result;
3711
3712         tevent_req_received(req);
3713         return NT_STATUS_OK;
3714 }
3715
3716 NTSTATUS rpccli_lsa_SetQuotasForAccount(struct rpc_pipe_client *cli,
3717                                         TALLOC_CTX *mem_ctx)
3718 {
3719         struct lsa_SetQuotasForAccount r;
3720         NTSTATUS status;
3721
3722         /* In parameters */
3723
3724         if (DEBUGLEVEL >= 10) {
3725                 NDR_PRINT_IN_DEBUG(lsa_SetQuotasForAccount, &r);
3726         }
3727
3728         status = cli->dispatch(cli,
3729                                 mem_ctx,
3730                                 &ndr_table_lsarpc,
3731                                 NDR_LSA_SETQUOTASFORACCOUNT,
3732                                 &r);
3733
3734         if (!NT_STATUS_IS_OK(status)) {
3735                 return status;
3736         }
3737
3738         if (DEBUGLEVEL >= 10) {
3739                 NDR_PRINT_OUT_DEBUG(lsa_SetQuotasForAccount, &r);
3740         }
3741
3742         if (NT_STATUS_IS_ERR(status)) {
3743                 return status;
3744         }
3745
3746         /* Return variables */
3747
3748         /* Return result */
3749         return r.out.result;
3750 }
3751
3752 struct rpccli_lsa_GetSystemAccessAccount_state {
3753         struct lsa_GetSystemAccessAccount orig;
3754         struct lsa_GetSystemAccessAccount tmp;
3755         TALLOC_CTX *out_mem_ctx;
3756         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3757 };
3758
3759 static void rpccli_lsa_GetSystemAccessAccount_done(struct tevent_req *subreq);
3760
3761 struct tevent_req *rpccli_lsa_GetSystemAccessAccount_send(TALLOC_CTX *mem_ctx,
3762                                                           struct tevent_context *ev,
3763                                                           struct rpc_pipe_client *cli,
3764                                                           struct policy_handle *_handle /* [in] [ref] */,
3765                                                           uint32_t *_access_mask /* [out] [ref] */)
3766 {
3767         struct tevent_req *req;
3768         struct rpccli_lsa_GetSystemAccessAccount_state *state;
3769         struct tevent_req *subreq;
3770
3771         req = tevent_req_create(mem_ctx, &state,
3772                                 struct rpccli_lsa_GetSystemAccessAccount_state);
3773         if (req == NULL) {
3774                 return NULL;
3775         }
3776         state->out_mem_ctx = NULL;
3777         state->dispatch_recv = cli->dispatch_recv;
3778
3779         /* In parameters */
3780         state->orig.in.handle = _handle;
3781
3782         /* Out parameters */
3783         state->orig.out.access_mask = _access_mask;
3784
3785         /* Result */
3786         ZERO_STRUCT(state->orig.out.result);
3787
3788         if (DEBUGLEVEL >= 10) {
3789                 NDR_PRINT_IN_DEBUG(lsa_GetSystemAccessAccount, &state->orig);
3790         }
3791
3792         state->out_mem_ctx = talloc_named_const(state, 0,
3793                              "rpccli_lsa_GetSystemAccessAccount_out_memory");
3794         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3795                 return tevent_req_post(req, ev);
3796         }
3797
3798         /* make a temporary copy, that we pass to the dispatch function */
3799         state->tmp = state->orig;
3800
3801         subreq = cli->dispatch_send(state, ev, cli,
3802                                     &ndr_table_lsarpc,
3803                                     NDR_LSA_GETSYSTEMACCESSACCOUNT,
3804                                     &state->tmp);
3805         if (tevent_req_nomem(subreq, req)) {
3806                 return tevent_req_post(req, ev);
3807         }
3808         tevent_req_set_callback(subreq, rpccli_lsa_GetSystemAccessAccount_done, req);
3809         return req;
3810 }
3811
3812 static void rpccli_lsa_GetSystemAccessAccount_done(struct tevent_req *subreq)
3813 {
3814         struct tevent_req *req = tevent_req_callback_data(
3815                 subreq, struct tevent_req);
3816         struct rpccli_lsa_GetSystemAccessAccount_state *state = tevent_req_data(
3817                 req, struct rpccli_lsa_GetSystemAccessAccount_state);
3818         NTSTATUS status;
3819         TALLOC_CTX *mem_ctx;
3820
3821         if (state->out_mem_ctx) {
3822                 mem_ctx = state->out_mem_ctx;
3823         } else {
3824                 mem_ctx = state;
3825         }
3826
3827         status = state->dispatch_recv(subreq, mem_ctx);
3828         TALLOC_FREE(subreq);
3829         if (!NT_STATUS_IS_OK(status)) {
3830                 tevent_req_nterror(req, status);
3831                 return;
3832         }
3833
3834         /* Copy out parameters */
3835         *state->orig.out.access_mask = *state->tmp.out.access_mask;
3836
3837         /* Copy result */
3838         state->orig.out.result = state->tmp.out.result;
3839
3840         /* Reset temporary structure */
3841         ZERO_STRUCT(state->tmp);
3842
3843         if (DEBUGLEVEL >= 10) {
3844                 NDR_PRINT_OUT_DEBUG(lsa_GetSystemAccessAccount, &state->orig);
3845         }
3846
3847         tevent_req_done(req);
3848 }
3849
3850 NTSTATUS rpccli_lsa_GetSystemAccessAccount_recv(struct tevent_req *req,
3851                                                 TALLOC_CTX *mem_ctx,
3852                                                 NTSTATUS *result)
3853 {
3854         struct rpccli_lsa_GetSystemAccessAccount_state *state = tevent_req_data(
3855                 req, struct rpccli_lsa_GetSystemAccessAccount_state);
3856         NTSTATUS status;
3857
3858         if (tevent_req_is_nterror(req, &status)) {
3859                 tevent_req_received(req);
3860                 return status;
3861         }
3862
3863         /* Steal possbile out parameters to the callers context */
3864         talloc_steal(mem_ctx, state->out_mem_ctx);
3865
3866         /* Return result */
3867         *result = state->orig.out.result;
3868
3869         tevent_req_received(req);
3870         return NT_STATUS_OK;
3871 }
3872
3873 NTSTATUS rpccli_lsa_GetSystemAccessAccount(struct rpc_pipe_client *cli,
3874                                            TALLOC_CTX *mem_ctx,
3875                                            struct policy_handle *handle /* [in] [ref] */,
3876                                            uint32_t *access_mask /* [out] [ref] */)
3877 {
3878         struct lsa_GetSystemAccessAccount r;
3879         NTSTATUS status;
3880
3881         /* In parameters */
3882         r.in.handle = handle;
3883
3884         if (DEBUGLEVEL >= 10) {
3885                 NDR_PRINT_IN_DEBUG(lsa_GetSystemAccessAccount, &r);
3886         }
3887
3888         status = cli->dispatch(cli,
3889                                 mem_ctx,
3890                                 &ndr_table_lsarpc,
3891                                 NDR_LSA_GETSYSTEMACCESSACCOUNT,
3892                                 &r);
3893
3894         if (!NT_STATUS_IS_OK(status)) {
3895                 return status;
3896         }
3897
3898         if (DEBUGLEVEL >= 10) {
3899                 NDR_PRINT_OUT_DEBUG(lsa_GetSystemAccessAccount, &r);
3900         }
3901
3902         if (NT_STATUS_IS_ERR(status)) {
3903                 return status;
3904         }
3905
3906         /* Return variables */
3907         *access_mask = *r.out.access_mask;
3908
3909         /* Return result */
3910         return r.out.result;
3911 }
3912
3913 struct rpccli_lsa_SetSystemAccessAccount_state {
3914         struct lsa_SetSystemAccessAccount orig;
3915         struct lsa_SetSystemAccessAccount tmp;
3916         TALLOC_CTX *out_mem_ctx;
3917         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3918 };
3919
3920 static void rpccli_lsa_SetSystemAccessAccount_done(struct tevent_req *subreq);
3921
3922 struct tevent_req *rpccli_lsa_SetSystemAccessAccount_send(TALLOC_CTX *mem_ctx,
3923                                                           struct tevent_context *ev,
3924                                                           struct rpc_pipe_client *cli,
3925                                                           struct policy_handle *_handle /* [in] [ref] */,
3926                                                           uint32_t _access_mask /* [in]  */)
3927 {
3928         struct tevent_req *req;
3929         struct rpccli_lsa_SetSystemAccessAccount_state *state;
3930         struct tevent_req *subreq;
3931
3932         req = tevent_req_create(mem_ctx, &state,
3933                                 struct rpccli_lsa_SetSystemAccessAccount_state);
3934         if (req == NULL) {
3935                 return NULL;
3936         }
3937         state->out_mem_ctx = NULL;
3938         state->dispatch_recv = cli->dispatch_recv;
3939
3940         /* In parameters */
3941         state->orig.in.handle = _handle;
3942         state->orig.in.access_mask = _access_mask;
3943
3944         /* Out parameters */
3945
3946         /* Result */
3947         ZERO_STRUCT(state->orig.out.result);
3948
3949         if (DEBUGLEVEL >= 10) {
3950                 NDR_PRINT_IN_DEBUG(lsa_SetSystemAccessAccount, &state->orig);
3951         }
3952
3953         /* make a temporary copy, that we pass to the dispatch function */
3954         state->tmp = state->orig;
3955
3956         subreq = cli->dispatch_send(state, ev, cli,
3957                                     &ndr_table_lsarpc,
3958                                     NDR_LSA_SETSYSTEMACCESSACCOUNT,
3959                                     &state->tmp);
3960         if (tevent_req_nomem(subreq, req)) {
3961                 return tevent_req_post(req, ev);
3962         }
3963         tevent_req_set_callback(subreq, rpccli_lsa_SetSystemAccessAccount_done, req);
3964         return req;
3965 }
3966
3967 static void rpccli_lsa_SetSystemAccessAccount_done(struct tevent_req *subreq)
3968 {
3969         struct tevent_req *req = tevent_req_callback_data(
3970                 subreq, struct tevent_req);
3971         struct rpccli_lsa_SetSystemAccessAccount_state *state = tevent_req_data(
3972                 req, struct rpccli_lsa_SetSystemAccessAccount_state);
3973         NTSTATUS status;
3974         TALLOC_CTX *mem_ctx;
3975
3976         if (state->out_mem_ctx) {
3977                 mem_ctx = state->out_mem_ctx;
3978         } else {
3979                 mem_ctx = state;
3980         }
3981
3982         status = state->dispatch_recv(subreq, mem_ctx);
3983         TALLOC_FREE(subreq);
3984         if (!NT_STATUS_IS_OK(status)) {
3985                 tevent_req_nterror(req, status);
3986                 return;
3987         }
3988
3989         /* Copy out parameters */
3990
3991         /* Copy result */
3992         state->orig.out.result = state->tmp.out.result;
3993
3994         /* Reset temporary structure */
3995         ZERO_STRUCT(state->tmp);
3996
3997         if (DEBUGLEVEL >= 10) {
3998                 NDR_PRINT_OUT_DEBUG(lsa_SetSystemAccessAccount, &state->orig);
3999         }
4000
4001         tevent_req_done(req);
4002 }
4003
4004 NTSTATUS rpccli_lsa_SetSystemAccessAccount_recv(struct tevent_req *req,
4005                                                 TALLOC_CTX *mem_ctx,
4006                                                 NTSTATUS *result)
4007 {
4008         struct rpccli_lsa_SetSystemAccessAccount_state *state = tevent_req_data(
4009                 req, struct rpccli_lsa_SetSystemAccessAccount_state);
4010         NTSTATUS status;
4011
4012         if (tevent_req_is_nterror(req, &status)) {
4013                 tevent_req_received(req);
4014                 return status;
4015         }
4016
4017         /* Steal possbile out parameters to the callers context */
4018         talloc_steal(mem_ctx, state->out_mem_ctx);
4019
4020         /* Return result */
4021         *result = state->orig.out.result;
4022
4023         tevent_req_received(req);
4024         return NT_STATUS_OK;
4025 }
4026
4027 NTSTATUS rpccli_lsa_SetSystemAccessAccount(struct rpc_pipe_client *cli,
4028                                            TALLOC_CTX *mem_ctx,
4029                                            struct policy_handle *handle /* [in] [ref] */,
4030                                            uint32_t access_mask /* [in]  */)
4031 {
4032         struct lsa_SetSystemAccessAccount r;
4033         NTSTATUS status;
4034
4035         /* In parameters */
4036         r.in.handle = handle;
4037         r.in.access_mask = access_mask;
4038
4039         if (DEBUGLEVEL >= 10) {
4040                 NDR_PRINT_IN_DEBUG(lsa_SetSystemAccessAccount, &r);
4041         }
4042
4043         status = cli->dispatch(cli,
4044                                 mem_ctx,
4045                                 &ndr_table_lsarpc,
4046                                 NDR_LSA_SETSYSTEMACCESSACCOUNT,
4047                                 &r);
4048
4049         if (!NT_STATUS_IS_OK(status)) {
4050                 return status;
4051         }
4052
4053         if (DEBUGLEVEL >= 10) {
4054                 NDR_PRINT_OUT_DEBUG(lsa_SetSystemAccessAccount, &r);
4055         }
4056
4057         if (NT_STATUS_IS_ERR(status)) {
4058                 return status;
4059         }
4060
4061         /* Return variables */
4062
4063         /* Return result */
4064         return r.out.result;
4065 }
4066
4067 struct rpccli_lsa_OpenTrustedDomain_state {
4068         struct lsa_OpenTrustedDomain orig;
4069         struct lsa_OpenTrustedDomain tmp;
4070         TALLOC_CTX *out_mem_ctx;
4071         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4072 };
4073
4074 static void rpccli_lsa_OpenTrustedDomain_done(struct tevent_req *subreq);
4075
4076 struct tevent_req *rpccli_lsa_OpenTrustedDomain_send(TALLOC_CTX *mem_ctx,
4077                                                      struct tevent_context *ev,
4078                                                      struct rpc_pipe_client *cli,
4079                                                      struct policy_handle *_handle /* [in] [ref] */,
4080                                                      struct dom_sid2 *_sid /* [in] [ref] */,
4081                                                      uint32_t _access_mask /* [in]  */,
4082                                                      struct policy_handle *_trustdom_handle /* [out] [ref] */)
4083 {
4084         struct tevent_req *req;
4085         struct rpccli_lsa_OpenTrustedDomain_state *state;
4086         struct tevent_req *subreq;
4087
4088         req = tevent_req_create(mem_ctx, &state,
4089                                 struct rpccli_lsa_OpenTrustedDomain_state);
4090         if (req == NULL) {
4091                 return NULL;
4092         }
4093         state->out_mem_ctx = NULL;
4094         state->dispatch_recv = cli->dispatch_recv;
4095
4096         /* In parameters */
4097         state->orig.in.handle = _handle;
4098         state->orig.in.sid = _sid;
4099         state->orig.in.access_mask = _access_mask;
4100
4101         /* Out parameters */
4102         state->orig.out.trustdom_handle = _trustdom_handle;
4103
4104         /* Result */
4105         ZERO_STRUCT(state->orig.out.result);
4106
4107         if (DEBUGLEVEL >= 10) {
4108                 NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomain, &state->orig);
4109         }
4110
4111         state->out_mem_ctx = talloc_named_const(state, 0,
4112                              "rpccli_lsa_OpenTrustedDomain_out_memory");
4113         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4114                 return tevent_req_post(req, ev);
4115         }
4116
4117         /* make a temporary copy, that we pass to the dispatch function */
4118         state->tmp = state->orig;
4119
4120         subreq = cli->dispatch_send(state, ev, cli,
4121                                     &ndr_table_lsarpc,
4122                                     NDR_LSA_OPENTRUSTEDDOMAIN,
4123                                     &state->tmp);
4124         if (tevent_req_nomem(subreq, req)) {
4125                 return tevent_req_post(req, ev);
4126         }
4127         tevent_req_set_callback(subreq, rpccli_lsa_OpenTrustedDomain_done, req);
4128         return req;
4129 }
4130
4131 static void rpccli_lsa_OpenTrustedDomain_done(struct tevent_req *subreq)
4132 {
4133         struct tevent_req *req = tevent_req_callback_data(
4134                 subreq, struct tevent_req);
4135         struct rpccli_lsa_OpenTrustedDomain_state *state = tevent_req_data(
4136                 req, struct rpccli_lsa_OpenTrustedDomain_state);
4137         NTSTATUS status;
4138         TALLOC_CTX *mem_ctx;
4139
4140         if (state->out_mem_ctx) {
4141                 mem_ctx = state->out_mem_ctx;
4142         } else {
4143                 mem_ctx = state;
4144         }
4145
4146         status = state->dispatch_recv(subreq, mem_ctx);
4147         TALLOC_FREE(subreq);
4148         if (!NT_STATUS_IS_OK(status)) {
4149                 tevent_req_nterror(req, status);
4150                 return;
4151         }
4152
4153         /* Copy out parameters */
4154         *state->orig.out.trustdom_handle = *state->tmp.out.trustdom_handle;
4155
4156         /* Copy result */
4157         state->orig.out.result = state->tmp.out.result;
4158
4159         /* Reset temporary structure */
4160         ZERO_STRUCT(state->tmp);
4161
4162         if (DEBUGLEVEL >= 10) {
4163                 NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomain, &state->orig);
4164         }
4165
4166         tevent_req_done(req);
4167 }
4168
4169 NTSTATUS rpccli_lsa_OpenTrustedDomain_recv(struct tevent_req *req,
4170                                            TALLOC_CTX *mem_ctx,
4171                                            NTSTATUS *result)
4172 {
4173         struct rpccli_lsa_OpenTrustedDomain_state *state = tevent_req_data(
4174                 req, struct rpccli_lsa_OpenTrustedDomain_state);
4175         NTSTATUS status;
4176
4177         if (tevent_req_is_nterror(req, &status)) {
4178                 tevent_req_received(req);
4179                 return status;
4180         }
4181
4182         /* Steal possbile out parameters to the callers context */
4183         talloc_steal(mem_ctx, state->out_mem_ctx);
4184
4185         /* Return result */
4186         *result = state->orig.out.result;
4187
4188         tevent_req_received(req);
4189         return NT_STATUS_OK;
4190 }
4191
4192 NTSTATUS rpccli_lsa_OpenTrustedDomain(struct rpc_pipe_client *cli,
4193                                       TALLOC_CTX *mem_ctx,
4194                                       struct policy_handle *handle /* [in] [ref] */,
4195                                       struct dom_sid2 *sid /* [in] [ref] */,
4196                                       uint32_t access_mask /* [in]  */,
4197                                       struct policy_handle *trustdom_handle /* [out] [ref] */)
4198 {
4199         struct lsa_OpenTrustedDomain r;
4200         NTSTATUS status;
4201
4202         /* In parameters */
4203         r.in.handle = handle;
4204         r.in.sid = sid;
4205         r.in.access_mask = access_mask;
4206
4207         if (DEBUGLEVEL >= 10) {
4208                 NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomain, &r);
4209         }
4210
4211         status = cli->dispatch(cli,
4212                                 mem_ctx,
4213                                 &ndr_table_lsarpc,
4214                                 NDR_LSA_OPENTRUSTEDDOMAIN,
4215                                 &r);
4216
4217         if (!NT_STATUS_IS_OK(status)) {
4218                 return status;
4219         }
4220
4221         if (DEBUGLEVEL >= 10) {
4222                 NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomain, &r);
4223         }
4224
4225         if (NT_STATUS_IS_ERR(status)) {
4226                 return status;
4227         }
4228
4229         /* Return variables */
4230         *trustdom_handle = *r.out.trustdom_handle;
4231
4232         /* Return result */
4233         return r.out.result;
4234 }
4235
4236 struct rpccli_lsa_QueryTrustedDomainInfo_state {
4237         struct lsa_QueryTrustedDomainInfo orig;
4238         struct lsa_QueryTrustedDomainInfo tmp;
4239         TALLOC_CTX *out_mem_ctx;
4240         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4241 };
4242
4243 static void rpccli_lsa_QueryTrustedDomainInfo_done(struct tevent_req *subreq);
4244
4245 struct tevent_req *rpccli_lsa_QueryTrustedDomainInfo_send(TALLOC_CTX *mem_ctx,
4246                                                           struct tevent_context *ev,
4247                                                           struct rpc_pipe_client *cli,
4248                                                           struct policy_handle *_trustdom_handle /* [in] [ref] */,
4249                                                           enum lsa_TrustDomInfoEnum _level /* [in]  */,
4250                                                           union lsa_TrustedDomainInfo **_info /* [out] [ref,switch_is(level)] */)
4251 {
4252         struct tevent_req *req;
4253         struct rpccli_lsa_QueryTrustedDomainInfo_state *state;
4254         struct tevent_req *subreq;
4255
4256         req = tevent_req_create(mem_ctx, &state,
4257                                 struct rpccli_lsa_QueryTrustedDomainInfo_state);
4258         if (req == NULL) {
4259                 return NULL;
4260         }
4261         state->out_mem_ctx = NULL;
4262         state->dispatch_recv = cli->dispatch_recv;
4263
4264         /* In parameters */
4265         state->orig.in.trustdom_handle = _trustdom_handle;
4266         state->orig.in.level = _level;
4267
4268         /* Out parameters */
4269         state->orig.out.info = _info;
4270
4271         /* Result */
4272         ZERO_STRUCT(state->orig.out.result);
4273
4274         if (DEBUGLEVEL >= 10) {
4275                 NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfo, &state->orig);
4276         }
4277
4278         state->out_mem_ctx = talloc_named_const(state, 0,
4279                              "rpccli_lsa_QueryTrustedDomainInfo_out_memory");
4280         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4281                 return tevent_req_post(req, ev);
4282         }
4283
4284         /* make a temporary copy, that we pass to the dispatch function */
4285         state->tmp = state->orig;
4286
4287         subreq = cli->dispatch_send(state, ev, cli,
4288                                     &ndr_table_lsarpc,
4289                                     NDR_LSA_QUERYTRUSTEDDOMAININFO,
4290                                     &state->tmp);
4291         if (tevent_req_nomem(subreq, req)) {
4292                 return tevent_req_post(req, ev);
4293         }
4294         tevent_req_set_callback(subreq, rpccli_lsa_QueryTrustedDomainInfo_done, req);
4295         return req;
4296 }
4297
4298 static void rpccli_lsa_QueryTrustedDomainInfo_done(struct tevent_req *subreq)
4299 {
4300         struct tevent_req *req = tevent_req_callback_data(
4301                 subreq, struct tevent_req);
4302         struct rpccli_lsa_QueryTrustedDomainInfo_state *state = tevent_req_data(
4303                 req, struct rpccli_lsa_QueryTrustedDomainInfo_state);
4304         NTSTATUS status;
4305         TALLOC_CTX *mem_ctx;
4306
4307         if (state->out_mem_ctx) {
4308                 mem_ctx = state->out_mem_ctx;
4309         } else {
4310                 mem_ctx = state;
4311         }
4312
4313         status = state->dispatch_recv(subreq, mem_ctx);
4314         TALLOC_FREE(subreq);
4315         if (!NT_STATUS_IS_OK(status)) {
4316                 tevent_req_nterror(req, status);
4317                 return;
4318         }
4319
4320         /* Copy out parameters */
4321         *state->orig.out.info = *state->tmp.out.info;
4322
4323         /* Copy result */
4324         state->orig.out.result = state->tmp.out.result;
4325
4326         /* Reset temporary structure */
4327         ZERO_STRUCT(state->tmp);
4328
4329         if (DEBUGLEVEL >= 10) {
4330                 NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfo, &state->orig);
4331         }
4332
4333         tevent_req_done(req);
4334 }
4335
4336 NTSTATUS rpccli_lsa_QueryTrustedDomainInfo_recv(struct tevent_req *req,
4337                                                 TALLOC_CTX *mem_ctx,
4338                                                 NTSTATUS *result)
4339 {
4340         struct rpccli_lsa_QueryTrustedDomainInfo_state *state = tevent_req_data(
4341                 req, struct rpccli_lsa_QueryTrustedDomainInfo_state);
4342         NTSTATUS status;
4343
4344         if (tevent_req_is_nterror(req, &status)) {
4345                 tevent_req_received(req);
4346                 return status;
4347         }
4348
4349         /* Steal possbile out parameters to the callers context */
4350         talloc_steal(mem_ctx, state->out_mem_ctx);
4351
4352         /* Return result */
4353         *result = state->orig.out.result;
4354
4355         tevent_req_received(req);
4356         return NT_STATUS_OK;
4357 }
4358
4359 NTSTATUS rpccli_lsa_QueryTrustedDomainInfo(struct rpc_pipe_client *cli,
4360                                            TALLOC_CTX *mem_ctx,
4361                                            struct policy_handle *trustdom_handle /* [in] [ref] */,
4362                                            enum lsa_TrustDomInfoEnum level /* [in]  */,
4363                                            union lsa_TrustedDomainInfo **info /* [out] [ref,switch_is(level)] */)
4364 {
4365         struct lsa_QueryTrustedDomainInfo r;
4366         NTSTATUS status;
4367
4368         /* In parameters */
4369         r.in.trustdom_handle = trustdom_handle;
4370         r.in.level = level;
4371
4372         if (DEBUGLEVEL >= 10) {
4373                 NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfo, &r);
4374         }
4375
4376         status = cli->dispatch(cli,
4377                                 mem_ctx,
4378                                 &ndr_table_lsarpc,
4379                                 NDR_LSA_QUERYTRUSTEDDOMAININFO,
4380                                 &r);
4381
4382         if (!NT_STATUS_IS_OK(status)) {
4383                 return status;
4384         }
4385
4386         if (DEBUGLEVEL >= 10) {
4387                 NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfo, &r);
4388         }
4389
4390         if (NT_STATUS_IS_ERR(status)) {
4391                 return status;
4392         }
4393
4394         /* Return variables */
4395         *info = *r.out.info;
4396
4397         /* Return result */
4398         return r.out.result;
4399 }
4400
4401 struct rpccli_lsa_SetInformationTrustedDomain_state {
4402         struct lsa_SetInformationTrustedDomain orig;
4403         struct lsa_SetInformationTrustedDomain tmp;
4404         TALLOC_CTX *out_mem_ctx;
4405         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4406 };
4407
4408 static void rpccli_lsa_SetInformationTrustedDomain_done(struct tevent_req *subreq);
4409
4410 struct tevent_req *rpccli_lsa_SetInformationTrustedDomain_send(TALLOC_CTX *mem_ctx,
4411                                                                struct tevent_context *ev,
4412                                                                struct rpc_pipe_client *cli,
4413                                                                struct policy_handle *_trustdom_handle /* [in] [ref] */,
4414                                                                enum lsa_TrustDomInfoEnum _level /* [in]  */,
4415                                                                union lsa_TrustedDomainInfo *_info /* [in] [ref,switch_is(level)] */)
4416 {
4417         struct tevent_req *req;
4418         struct rpccli_lsa_SetInformationTrustedDomain_state *state;
4419         struct tevent_req *subreq;
4420
4421         req = tevent_req_create(mem_ctx, &state,
4422                                 struct rpccli_lsa_SetInformationTrustedDomain_state);
4423         if (req == NULL) {
4424                 return NULL;
4425         }
4426         state->out_mem_ctx = NULL;
4427         state->dispatch_recv = cli->dispatch_recv;
4428
4429         /* In parameters */
4430         state->orig.in.trustdom_handle = _trustdom_handle;
4431         state->orig.in.level = _level;
4432         state->orig.in.info = _info;
4433
4434         /* Out parameters */
4435
4436         /* Result */
4437         ZERO_STRUCT(state->orig.out.result);
4438
4439         if (DEBUGLEVEL >= 10) {
4440                 NDR_PRINT_IN_DEBUG(lsa_SetInformationTrustedDomain, &state->orig);
4441         }
4442
4443         /* make a temporary copy, that we pass to the dispatch function */
4444         state->tmp = state->orig;
4445
4446         subreq = cli->dispatch_send(state, ev, cli,
4447                                     &ndr_table_lsarpc,
4448                                     NDR_LSA_SETINFORMATIONTRUSTEDDOMAIN,
4449                                     &state->tmp);
4450         if (tevent_req_nomem(subreq, req)) {
4451                 return tevent_req_post(req, ev);
4452         }
4453         tevent_req_set_callback(subreq, rpccli_lsa_SetInformationTrustedDomain_done, req);
4454         return req;
4455 }
4456
4457 static void rpccli_lsa_SetInformationTrustedDomain_done(struct tevent_req *subreq)
4458 {
4459         struct tevent_req *req = tevent_req_callback_data(
4460                 subreq, struct tevent_req);
4461         struct rpccli_lsa_SetInformationTrustedDomain_state *state = tevent_req_data(
4462                 req, struct rpccli_lsa_SetInformationTrustedDomain_state);
4463         NTSTATUS status;
4464         TALLOC_CTX *mem_ctx;
4465
4466         if (state->out_mem_ctx) {
4467                 mem_ctx = state->out_mem_ctx;
4468         } else {
4469                 mem_ctx = state;
4470         }
4471
4472         status = state->dispatch_recv(subreq, mem_ctx);
4473         TALLOC_FREE(subreq);
4474         if (!NT_STATUS_IS_OK(status)) {
4475                 tevent_req_nterror(req, status);
4476                 return;
4477         }
4478
4479         /* Copy out parameters */
4480
4481         /* Copy result */
4482         state->orig.out.result = state->tmp.out.result;
4483
4484         /* Reset temporary structure */
4485         ZERO_STRUCT(state->tmp);
4486
4487         if (DEBUGLEVEL >= 10) {
4488                 NDR_PRINT_OUT_DEBUG(lsa_SetInformationTrustedDomain, &state->orig);
4489         }
4490
4491         tevent_req_done(req);
4492 }
4493
4494 NTSTATUS rpccli_lsa_SetInformationTrustedDomain_recv(struct tevent_req *req,
4495                                                      TALLOC_CTX *mem_ctx,
4496                                                      NTSTATUS *result)
4497 {
4498         struct rpccli_lsa_SetInformationTrustedDomain_state *state = tevent_req_data(
4499                 req, struct rpccli_lsa_SetInformationTrustedDomain_state);
4500         NTSTATUS status;
4501
4502         if (tevent_req_is_nterror(req, &status)) {
4503                 tevent_req_received(req);
4504                 return status;
4505         }
4506
4507         /* Steal possbile out parameters to the callers context */
4508         talloc_steal(mem_ctx, state->out_mem_ctx);
4509
4510         /* Return result */
4511         *result = state->orig.out.result;
4512
4513         tevent_req_received(req);
4514         return NT_STATUS_OK;
4515 }
4516
4517 NTSTATUS rpccli_lsa_SetInformationTrustedDomain(struct rpc_pipe_client *cli,
4518                                                 TALLOC_CTX *mem_ctx,
4519                                                 struct policy_handle *trustdom_handle /* [in] [ref] */,
4520                                                 enum lsa_TrustDomInfoEnum level /* [in]  */,
4521                                                 union lsa_TrustedDomainInfo *info /* [in] [ref,switch_is(level)] */)
4522 {
4523         struct lsa_SetInformationTrustedDomain r;
4524         NTSTATUS status;
4525
4526         /* In parameters */
4527         r.in.trustdom_handle = trustdom_handle;
4528         r.in.level = level;
4529         r.in.info = info;
4530
4531         if (DEBUGLEVEL >= 10) {
4532                 NDR_PRINT_IN_DEBUG(lsa_SetInformationTrustedDomain, &r);
4533         }
4534
4535         status = cli->dispatch(cli,
4536                                 mem_ctx,
4537                                 &ndr_table_lsarpc,
4538                                 NDR_LSA_SETINFORMATIONTRUSTEDDOMAIN,
4539                                 &r);
4540
4541         if (!NT_STATUS_IS_OK(status)) {
4542                 return status;
4543         }
4544
4545         if (DEBUGLEVEL >= 10) {
4546                 NDR_PRINT_OUT_DEBUG(lsa_SetInformationTrustedDomain, &r);
4547         }
4548
4549         if (NT_STATUS_IS_ERR(status)) {
4550                 return status;
4551         }
4552
4553         /* Return variables */
4554
4555         /* Return result */
4556         return r.out.result;
4557 }
4558
4559 struct rpccli_lsa_OpenSecret_state {
4560         struct lsa_OpenSecret orig;
4561         struct lsa_OpenSecret tmp;
4562         TALLOC_CTX *out_mem_ctx;
4563         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4564 };
4565
4566 static void rpccli_lsa_OpenSecret_done(struct tevent_req *subreq);
4567
4568 struct tevent_req *rpccli_lsa_OpenSecret_send(TALLOC_CTX *mem_ctx,
4569                                               struct tevent_context *ev,
4570                                               struct rpc_pipe_client *cli,
4571                                               struct policy_handle *_handle /* [in] [ref] */,
4572                                               struct lsa_String _name /* [in]  */,
4573                                               uint32_t _access_mask /* [in]  */,
4574                                               struct policy_handle *_sec_handle /* [out] [ref] */)
4575 {
4576         struct tevent_req *req;
4577         struct rpccli_lsa_OpenSecret_state *state;
4578         struct tevent_req *subreq;
4579
4580         req = tevent_req_create(mem_ctx, &state,
4581                                 struct rpccli_lsa_OpenSecret_state);
4582         if (req == NULL) {
4583                 return NULL;
4584         }
4585         state->out_mem_ctx = NULL;
4586         state->dispatch_recv = cli->dispatch_recv;
4587
4588         /* In parameters */
4589         state->orig.in.handle = _handle;
4590         state->orig.in.name = _name;
4591         state->orig.in.access_mask = _access_mask;
4592
4593         /* Out parameters */
4594         state->orig.out.sec_handle = _sec_handle;
4595
4596         /* Result */
4597         ZERO_STRUCT(state->orig.out.result);
4598
4599         if (DEBUGLEVEL >= 10) {
4600                 NDR_PRINT_IN_DEBUG(lsa_OpenSecret, &state->orig);
4601         }
4602
4603         state->out_mem_ctx = talloc_named_const(state, 0,
4604                              "rpccli_lsa_OpenSecret_out_memory");
4605         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4606                 return tevent_req_post(req, ev);
4607         }
4608
4609         /* make a temporary copy, that we pass to the dispatch function */
4610         state->tmp = state->orig;
4611
4612         subreq = cli->dispatch_send(state, ev, cli,
4613                                     &ndr_table_lsarpc,
4614                                     NDR_LSA_OPENSECRET,
4615                                     &state->tmp);
4616         if (tevent_req_nomem(subreq, req)) {
4617                 return tevent_req_post(req, ev);
4618         }
4619         tevent_req_set_callback(subreq, rpccli_lsa_OpenSecret_done, req);
4620         return req;
4621 }
4622
4623 static void rpccli_lsa_OpenSecret_done(struct tevent_req *subreq)
4624 {
4625         struct tevent_req *req = tevent_req_callback_data(
4626                 subreq, struct tevent_req);
4627         struct rpccli_lsa_OpenSecret_state *state = tevent_req_data(
4628                 req, struct rpccli_lsa_OpenSecret_state);
4629         NTSTATUS status;
4630         TALLOC_CTX *mem_ctx;
4631
4632         if (state->out_mem_ctx) {
4633                 mem_ctx = state->out_mem_ctx;
4634         } else {
4635                 mem_ctx = state;
4636         }
4637
4638         status = state->dispatch_recv(subreq, mem_ctx);
4639         TALLOC_FREE(subreq);
4640         if (!NT_STATUS_IS_OK(status)) {
4641                 tevent_req_nterror(req, status);
4642                 return;
4643         }
4644
4645         /* Copy out parameters */
4646         *state->orig.out.sec_handle = *state->tmp.out.sec_handle;
4647
4648         /* Copy result */
4649         state->orig.out.result = state->tmp.out.result;
4650
4651         /* Reset temporary structure */
4652         ZERO_STRUCT(state->tmp);
4653
4654         if (DEBUGLEVEL >= 10) {
4655                 NDR_PRINT_OUT_DEBUG(lsa_OpenSecret, &state->orig);
4656         }
4657
4658         tevent_req_done(req);
4659 }
4660
4661 NTSTATUS rpccli_lsa_OpenSecret_recv(struct tevent_req *req,
4662                                     TALLOC_CTX *mem_ctx,
4663                                     NTSTATUS *result)
4664 {
4665         struct rpccli_lsa_OpenSecret_state *state = tevent_req_data(
4666                 req, struct rpccli_lsa_OpenSecret_state);
4667         NTSTATUS status;
4668
4669         if (tevent_req_is_nterror(req, &status)) {
4670                 tevent_req_received(req);
4671                 return status;
4672         }
4673
4674         /* Steal possbile out parameters to the callers context */
4675         talloc_steal(mem_ctx, state->out_mem_ctx);
4676
4677         /* Return result */
4678         *result = state->orig.out.result;
4679
4680         tevent_req_received(req);
4681         return NT_STATUS_OK;
4682 }
4683
4684 NTSTATUS rpccli_lsa_OpenSecret(struct rpc_pipe_client *cli,
4685                                TALLOC_CTX *mem_ctx,
4686                                struct policy_handle *handle /* [in] [ref] */,
4687                                struct lsa_String name /* [in]  */,
4688                                uint32_t access_mask /* [in]  */,
4689                                struct policy_handle *sec_handle /* [out] [ref] */)
4690 {
4691         struct lsa_OpenSecret r;
4692         NTSTATUS status;
4693
4694         /* In parameters */
4695         r.in.handle = handle;
4696         r.in.name = name;
4697         r.in.access_mask = access_mask;
4698
4699         if (DEBUGLEVEL >= 10) {
4700                 NDR_PRINT_IN_DEBUG(lsa_OpenSecret, &r);
4701         }
4702
4703         status = cli->dispatch(cli,
4704                                 mem_ctx,
4705                                 &ndr_table_lsarpc,
4706                                 NDR_LSA_OPENSECRET,
4707                                 &r);
4708
4709         if (!NT_STATUS_IS_OK(status)) {
4710                 return status;
4711         }
4712
4713         if (DEBUGLEVEL >= 10) {
4714                 NDR_PRINT_OUT_DEBUG(lsa_OpenSecret, &r);
4715         }
4716
4717         if (NT_STATUS_IS_ERR(status)) {
4718                 return status;
4719         }
4720
4721         /* Return variables */
4722         *sec_handle = *r.out.sec_handle;
4723
4724         /* Return result */
4725         return r.out.result;
4726 }
4727
4728 struct rpccli_lsa_SetSecret_state {
4729         struct lsa_SetSecret orig;
4730         struct lsa_SetSecret tmp;
4731         TALLOC_CTX *out_mem_ctx;
4732         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4733 };
4734
4735 static void rpccli_lsa_SetSecret_done(struct tevent_req *subreq);
4736
4737 struct tevent_req *rpccli_lsa_SetSecret_send(TALLOC_CTX *mem_ctx,
4738                                              struct tevent_context *ev,
4739                                              struct rpc_pipe_client *cli,
4740                                              struct policy_handle *_sec_handle /* [in] [ref] */,
4741                                              struct lsa_DATA_BUF *_new_val /* [in] [unique] */,
4742                                              struct lsa_DATA_BUF *_old_val /* [in] [unique] */)
4743 {
4744         struct tevent_req *req;
4745         struct rpccli_lsa_SetSecret_state *state;
4746         struct tevent_req *subreq;
4747
4748         req = tevent_req_create(mem_ctx, &state,
4749                                 struct rpccli_lsa_SetSecret_state);
4750         if (req == NULL) {
4751                 return NULL;
4752         }
4753         state->out_mem_ctx = NULL;
4754         state->dispatch_recv = cli->dispatch_recv;
4755
4756         /* In parameters */
4757         state->orig.in.sec_handle = _sec_handle;
4758         state->orig.in.new_val = _new_val;
4759         state->orig.in.old_val = _old_val;
4760
4761         /* Out parameters */
4762
4763         /* Result */
4764         ZERO_STRUCT(state->orig.out.result);
4765
4766         if (DEBUGLEVEL >= 10) {
4767                 NDR_PRINT_IN_DEBUG(lsa_SetSecret, &state->orig);
4768         }
4769
4770         /* make a temporary copy, that we pass to the dispatch function */
4771         state->tmp = state->orig;
4772
4773         subreq = cli->dispatch_send(state, ev, cli,
4774                                     &ndr_table_lsarpc,
4775                                     NDR_LSA_SETSECRET,
4776                                     &state->tmp);
4777         if (tevent_req_nomem(subreq, req)) {
4778                 return tevent_req_post(req, ev);
4779         }
4780         tevent_req_set_callback(subreq, rpccli_lsa_SetSecret_done, req);
4781         return req;
4782 }
4783
4784 static void rpccli_lsa_SetSecret_done(struct tevent_req *subreq)
4785 {
4786         struct tevent_req *req = tevent_req_callback_data(
4787                 subreq, struct tevent_req);
4788         struct rpccli_lsa_SetSecret_state *state = tevent_req_data(
4789                 req, struct rpccli_lsa_SetSecret_state);
4790         NTSTATUS status;
4791         TALLOC_CTX *mem_ctx;
4792
4793         if (state->out_mem_ctx) {
4794                 mem_ctx = state->out_mem_ctx;
4795         } else {
4796                 mem_ctx = state;
4797         }
4798
4799         status = state->dispatch_recv(subreq, mem_ctx);
4800         TALLOC_FREE(subreq);
4801         if (!NT_STATUS_IS_OK(status)) {
4802                 tevent_req_nterror(req, status);
4803                 return;
4804         }
4805
4806         /* Copy out parameters */
4807
4808         /* Copy result */
4809         state->orig.out.result = state->tmp.out.result;
4810
4811         /* Reset temporary structure */
4812         ZERO_STRUCT(state->tmp);
4813
4814         if (DEBUGLEVEL >= 10) {
4815                 NDR_PRINT_OUT_DEBUG(lsa_SetSecret, &state->orig);
4816         }
4817
4818         tevent_req_done(req);
4819 }
4820
4821 NTSTATUS rpccli_lsa_SetSecret_recv(struct tevent_req *req,
4822                                    TALLOC_CTX *mem_ctx,
4823                                    NTSTATUS *result)
4824 {
4825         struct rpccli_lsa_SetSecret_state *state = tevent_req_data(
4826                 req, struct rpccli_lsa_SetSecret_state);
4827         NTSTATUS status;
4828
4829         if (tevent_req_is_nterror(req, &status)) {
4830                 tevent_req_received(req);
4831                 return status;
4832         }
4833
4834         /* Steal possbile out parameters to the callers context */
4835         talloc_steal(mem_ctx, state->out_mem_ctx);
4836
4837         /* Return result */
4838         *result = state->orig.out.result;
4839
4840         tevent_req_received(req);
4841         return NT_STATUS_OK;
4842 }
4843
4844 NTSTATUS rpccli_lsa_SetSecret(struct rpc_pipe_client *cli,
4845                               TALLOC_CTX *mem_ctx,
4846                               struct policy_handle *sec_handle /* [in] [ref] */,
4847                               struct lsa_DATA_BUF *new_val /* [in] [unique] */,
4848                               struct lsa_DATA_BUF *old_val /* [in] [unique] */)
4849 {
4850         struct lsa_SetSecret r;
4851         NTSTATUS status;
4852
4853         /* In parameters */
4854         r.in.sec_handle = sec_handle;
4855         r.in.new_val = new_val;
4856         r.in.old_val = old_val;
4857
4858         if (DEBUGLEVEL >= 10) {
4859                 NDR_PRINT_IN_DEBUG(lsa_SetSecret, &r);
4860         }
4861
4862         status = cli->dispatch(cli,
4863                                 mem_ctx,
4864                                 &ndr_table_lsarpc,
4865                                 NDR_LSA_SETSECRET,
4866                                 &r);
4867
4868         if (!NT_STATUS_IS_OK(status)) {
4869                 return status;
4870         }
4871
4872         if (DEBUGLEVEL >= 10) {
4873                 NDR_PRINT_OUT_DEBUG(lsa_SetSecret, &r);
4874         }
4875
4876         if (NT_STATUS_IS_ERR(status)) {
4877                 return status;
4878         }
4879
4880         /* Return variables */
4881
4882         /* Return result */
4883         return r.out.result;
4884 }
4885
4886 struct rpccli_lsa_QuerySecret_state {
4887         struct lsa_QuerySecret orig;
4888         struct lsa_QuerySecret tmp;
4889         TALLOC_CTX *out_mem_ctx;
4890         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4891 };
4892
4893 static void rpccli_lsa_QuerySecret_done(struct tevent_req *subreq);
4894
4895 struct tevent_req *rpccli_lsa_QuerySecret_send(TALLOC_CTX *mem_ctx,
4896                                                struct tevent_context *ev,
4897                                                struct rpc_pipe_client *cli,
4898                                                struct policy_handle *_sec_handle /* [in] [ref] */,
4899                                                struct lsa_DATA_BUF_PTR *_new_val /* [in,out] [unique] */,
4900                                                NTTIME *_new_mtime /* [in,out] [unique] */,
4901                                                struct lsa_DATA_BUF_PTR *_old_val /* [in,out] [unique] */,
4902                                                NTTIME *_old_mtime /* [in,out] [unique] */)
4903 {
4904         struct tevent_req *req;
4905         struct rpccli_lsa_QuerySecret_state *state;
4906         struct tevent_req *subreq;
4907
4908         req = tevent_req_create(mem_ctx, &state,
4909                                 struct rpccli_lsa_QuerySecret_state);
4910         if (req == NULL) {
4911                 return NULL;
4912         }
4913         state->out_mem_ctx = NULL;
4914         state->dispatch_recv = cli->dispatch_recv;
4915
4916         /* In parameters */
4917         state->orig.in.sec_handle = _sec_handle;
4918         state->orig.in.new_val = _new_val;
4919         state->orig.in.new_mtime = _new_mtime;
4920         state->orig.in.old_val = _old_val;
4921         state->orig.in.old_mtime = _old_mtime;
4922
4923         /* Out parameters */
4924         state->orig.out.new_val = _new_val;
4925         state->orig.out.new_mtime = _new_mtime;
4926         state->orig.out.old_val = _old_val;
4927         state->orig.out.old_mtime = _old_mtime;
4928
4929         /* Result */
4930         ZERO_STRUCT(state->orig.out.result);
4931
4932         if (DEBUGLEVEL >= 10) {
4933                 NDR_PRINT_IN_DEBUG(lsa_QuerySecret, &state->orig);
4934         }
4935
4936         state->out_mem_ctx = talloc_named_const(state, 0,
4937                              "rpccli_lsa_QuerySecret_out_memory");
4938         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4939                 return tevent_req_post(req, ev);
4940         }
4941
4942         /* make a temporary copy, that we pass to the dispatch function */
4943         state->tmp = state->orig;
4944
4945         subreq = cli->dispatch_send(state, ev, cli,
4946                                     &ndr_table_lsarpc,
4947                                     NDR_LSA_QUERYSECRET,
4948                                     &state->tmp);
4949         if (tevent_req_nomem(subreq, req)) {
4950                 return tevent_req_post(req, ev);
4951         }
4952         tevent_req_set_callback(subreq, rpccli_lsa_QuerySecret_done, req);
4953         return req;
4954 }
4955
4956 static void rpccli_lsa_QuerySecret_done(struct tevent_req *subreq)
4957 {
4958         struct tevent_req *req = tevent_req_callback_data(
4959                 subreq, struct tevent_req);
4960         struct rpccli_lsa_QuerySecret_state *state = tevent_req_data(
4961                 req, struct rpccli_lsa_QuerySecret_state);
4962         NTSTATUS status;
4963         TALLOC_CTX *mem_ctx;
4964
4965         if (state->out_mem_ctx) {
4966                 mem_ctx = state->out_mem_ctx;
4967         } else {
4968                 mem_ctx = state;
4969         }
4970
4971         status = state->dispatch_recv(subreq, mem_ctx);
4972         TALLOC_FREE(subreq);
4973         if (!NT_STATUS_IS_OK(status)) {
4974                 tevent_req_nterror(req, status);
4975                 return;
4976         }
4977
4978         /* Copy out parameters */
4979         if (state->orig.out.new_val && state->tmp.out.new_val) {
4980                 *state->orig.out.new_val = *state->tmp.out.new_val;
4981         }
4982         if (state->orig.out.new_mtime && state->tmp.out.new_mtime) {
4983                 *state->orig.out.new_mtime = *state->tmp.out.new_mtime;
4984         }
4985         if (state->orig.out.old_val && state->tmp.out.old_val) {
4986                 *state->orig.out.old_val = *state->tmp.out.old_val;
4987         }
4988         if (state->orig.out.old_mtime && state->tmp.out.old_mtime) {
4989                 *state->orig.out.old_mtime = *state->tmp.out.old_mtime;
4990         }
4991
4992         /* Copy result */
4993         state->orig.out.result = state->tmp.out.result;
4994
4995         /* Reset temporary structure */
4996         ZERO_STRUCT(state->tmp);
4997
4998         if (DEBUGLEVEL >= 10) {
4999                 NDR_PRINT_OUT_DEBUG(lsa_QuerySecret, &state->orig);
5000         }
5001
5002         tevent_req_done(req);
5003 }
5004
5005 NTSTATUS rpccli_lsa_QuerySecret_recv(struct tevent_req *req,
5006                                      TALLOC_CTX *mem_ctx,
5007                                      NTSTATUS *result)
5008 {
5009         struct rpccli_lsa_QuerySecret_state *state = tevent_req_data(
5010                 req, struct rpccli_lsa_QuerySecret_state);
5011         NTSTATUS status;
5012
5013         if (tevent_req_is_nterror(req, &status)) {
5014                 tevent_req_received(req);
5015                 return status;
5016         }
5017
5018         /* Steal possbile out parameters to the callers context */
5019         talloc_steal(mem_ctx, state->out_mem_ctx);
5020
5021         /* Return result */
5022         *result = state->orig.out.result;
5023
5024         tevent_req_received(req);
5025         return NT_STATUS_OK;
5026 }
5027
5028 NTSTATUS rpccli_lsa_QuerySecret(struct rpc_pipe_client *cli,
5029                                 TALLOC_CTX *mem_ctx,
5030                                 struct policy_handle *sec_handle /* [in] [ref] */,
5031                                 struct lsa_DATA_BUF_PTR *new_val /* [in,out] [unique] */,
5032                                 NTTIME *new_mtime /* [in,out] [unique] */,
5033                                 struct lsa_DATA_BUF_PTR *old_val /* [in,out] [unique] */,
5034                                 NTTIME *old_mtime /* [in,out] [unique] */)
5035 {
5036         struct lsa_QuerySecret r;
5037         NTSTATUS status;
5038
5039         /* In parameters */
5040         r.in.sec_handle = sec_handle;
5041         r.in.new_val = new_val;
5042         r.in.new_mtime = new_mtime;
5043         r.in.old_val = old_val;
5044         r.in.old_mtime = old_mtime;
5045
5046         if (DEBUGLEVEL >= 10) {
5047                 NDR_PRINT_IN_DEBUG(lsa_QuerySecret, &r);
5048         }
5049
5050         status = cli->dispatch(cli,
5051                                 mem_ctx,
5052                                 &ndr_table_lsarpc,
5053                                 NDR_LSA_QUERYSECRET,
5054                                 &r);
5055
5056         if (!NT_STATUS_IS_OK(status)) {
5057                 return status;
5058         }
5059
5060         if (DEBUGLEVEL >= 10) {
5061                 NDR_PRINT_OUT_DEBUG(lsa_QuerySecret, &r);
5062         }
5063
5064         if (NT_STATUS_IS_ERR(status)) {
5065                 return status;
5066         }
5067
5068         /* Return variables */
5069         if (new_val && r.out.new_val) {
5070                 *new_val = *r.out.new_val;
5071         }
5072         if (new_mtime && r.out.new_mtime) {
5073                 *new_mtime = *r.out.new_mtime;
5074         }
5075         if (old_val && r.out.old_val) {
5076                 *old_val = *r.out.old_val;
5077         }
5078         if (old_mtime && r.out.old_mtime) {
5079                 *old_mtime = *r.out.old_mtime;
5080         }
5081
5082         /* Return result */
5083         return r.out.result;
5084 }
5085
5086 struct rpccli_lsa_LookupPrivValue_state {
5087         struct lsa_LookupPrivValue orig;
5088         struct lsa_LookupPrivValue tmp;
5089         TALLOC_CTX *out_mem_ctx;
5090         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5091 };
5092
5093 static void rpccli_lsa_LookupPrivValue_done(struct tevent_req *subreq);
5094
5095 struct tevent_req *rpccli_lsa_LookupPrivValue_send(TALLOC_CTX *mem_ctx,
5096                                                    struct tevent_context *ev,
5097                                                    struct rpc_pipe_client *cli,
5098                                                    struct policy_handle *_handle /* [in] [ref] */,
5099                                                    struct lsa_String *_name /* [in] [ref] */,
5100                                                    struct lsa_LUID *_luid /* [out] [ref] */)
5101 {
5102         struct tevent_req *req;
5103         struct rpccli_lsa_LookupPrivValue_state *state;
5104         struct tevent_req *subreq;
5105
5106         req = tevent_req_create(mem_ctx, &state,
5107                                 struct rpccli_lsa_LookupPrivValue_state);
5108         if (req == NULL) {
5109                 return NULL;
5110         }
5111         state->out_mem_ctx = NULL;
5112         state->dispatch_recv = cli->dispatch_recv;
5113
5114         /* In parameters */
5115         state->orig.in.handle = _handle;
5116         state->orig.in.name = _name;
5117
5118         /* Out parameters */
5119         state->orig.out.luid = _luid;
5120
5121         /* Result */
5122         ZERO_STRUCT(state->orig.out.result);
5123
5124         if (DEBUGLEVEL >= 10) {
5125                 NDR_PRINT_IN_DEBUG(lsa_LookupPrivValue, &state->orig);
5126         }
5127
5128         state->out_mem_ctx = talloc_named_const(state, 0,
5129                              "rpccli_lsa_LookupPrivValue_out_memory");
5130         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5131                 return tevent_req_post(req, ev);
5132         }
5133
5134         /* make a temporary copy, that we pass to the dispatch function */
5135         state->tmp = state->orig;
5136
5137         subreq = cli->dispatch_send(state, ev, cli,
5138                                     &ndr_table_lsarpc,
5139                                     NDR_LSA_LOOKUPPRIVVALUE,
5140                                     &state->tmp);
5141         if (tevent_req_nomem(subreq, req)) {
5142                 return tevent_req_post(req, ev);
5143         }
5144         tevent_req_set_callback(subreq, rpccli_lsa_LookupPrivValue_done, req);
5145         return req;
5146 }
5147
5148 static void rpccli_lsa_LookupPrivValue_done(struct tevent_req *subreq)
5149 {
5150         struct tevent_req *req = tevent_req_callback_data(
5151                 subreq, struct tevent_req);
5152         struct rpccli_lsa_LookupPrivValue_state *state = tevent_req_data(
5153                 req, struct rpccli_lsa_LookupPrivValue_state);
5154         NTSTATUS status;
5155         TALLOC_CTX *mem_ctx;
5156
5157         if (state->out_mem_ctx) {
5158                 mem_ctx = state->out_mem_ctx;
5159         } else {
5160                 mem_ctx = state;
5161         }
5162
5163         status = state->dispatch_recv(subreq, mem_ctx);
5164         TALLOC_FREE(subreq);
5165         if (!NT_STATUS_IS_OK(status)) {
5166                 tevent_req_nterror(req, status);
5167                 return;
5168         }
5169
5170         /* Copy out parameters */
5171         *state->orig.out.luid = *state->tmp.out.luid;
5172
5173         /* Copy result */
5174         state->orig.out.result = state->tmp.out.result;
5175
5176         /* Reset temporary structure */
5177         ZERO_STRUCT(state->tmp);
5178
5179         if (DEBUGLEVEL >= 10) {
5180                 NDR_PRINT_OUT_DEBUG(lsa_LookupPrivValue, &state->orig);
5181         }
5182
5183         tevent_req_done(req);
5184 }
5185
5186 NTSTATUS rpccli_lsa_LookupPrivValue_recv(struct tevent_req *req,
5187                                          TALLOC_CTX *mem_ctx,
5188                                          NTSTATUS *result)
5189 {
5190         struct rpccli_lsa_LookupPrivValue_state *state = tevent_req_data(
5191                 req, struct rpccli_lsa_LookupPrivValue_state);
5192         NTSTATUS status;
5193
5194         if (tevent_req_is_nterror(req, &status)) {
5195                 tevent_req_received(req);
5196                 return status;
5197         }
5198
5199         /* Steal possbile out parameters to the callers context */
5200         talloc_steal(mem_ctx, state->out_mem_ctx);
5201
5202         /* Return result */
5203         *result = state->orig.out.result;
5204
5205         tevent_req_received(req);
5206         return NT_STATUS_OK;
5207 }
5208
5209 NTSTATUS rpccli_lsa_LookupPrivValue(struct rpc_pipe_client *cli,
5210                                     TALLOC_CTX *mem_ctx,
5211                                     struct policy_handle *handle /* [in] [ref] */,
5212                                     struct lsa_String *name /* [in] [ref] */,
5213                                     struct lsa_LUID *luid /* [out] [ref] */)
5214 {
5215         struct lsa_LookupPrivValue r;
5216         NTSTATUS status;
5217
5218         /* In parameters */
5219         r.in.handle = handle;
5220         r.in.name = name;
5221
5222         if (DEBUGLEVEL >= 10) {
5223                 NDR_PRINT_IN_DEBUG(lsa_LookupPrivValue, &r);
5224         }
5225
5226         status = cli->dispatch(cli,
5227                                 mem_ctx,
5228                                 &ndr_table_lsarpc,
5229                                 NDR_LSA_LOOKUPPRIVVALUE,
5230                                 &r);
5231
5232         if (!NT_STATUS_IS_OK(status)) {
5233                 return status;
5234         }
5235
5236         if (DEBUGLEVEL >= 10) {
5237                 NDR_PRINT_OUT_DEBUG(lsa_LookupPrivValue, &r);
5238         }
5239
5240         if (NT_STATUS_IS_ERR(status)) {
5241                 return status;
5242         }
5243
5244         /* Return variables */
5245         *luid = *r.out.luid;
5246
5247         /* Return result */
5248         return r.out.result;
5249 }
5250
5251 struct rpccli_lsa_LookupPrivName_state {
5252         struct lsa_LookupPrivName orig;
5253         struct lsa_LookupPrivName tmp;
5254         TALLOC_CTX *out_mem_ctx;
5255         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5256 };
5257
5258 static void rpccli_lsa_LookupPrivName_done(struct tevent_req *subreq);
5259
5260 struct tevent_req *rpccli_lsa_LookupPrivName_send(TALLOC_CTX *mem_ctx,
5261                                                   struct tevent_context *ev,
5262                                                   struct rpc_pipe_client *cli,
5263                                                   struct policy_handle *_handle /* [in] [ref] */,
5264                                                   struct lsa_LUID *_luid /* [in] [ref] */,
5265                                                   struct lsa_StringLarge **_name /* [out] [ref] */)
5266 {
5267         struct tevent_req *req;
5268         struct rpccli_lsa_LookupPrivName_state *state;
5269         struct tevent_req *subreq;
5270
5271         req = tevent_req_create(mem_ctx, &state,
5272                                 struct rpccli_lsa_LookupPrivName_state);
5273         if (req == NULL) {
5274                 return NULL;
5275         }
5276         state->out_mem_ctx = NULL;
5277         state->dispatch_recv = cli->dispatch_recv;
5278
5279         /* In parameters */
5280         state->orig.in.handle = _handle;
5281         state->orig.in.luid = _luid;
5282
5283         /* Out parameters */
5284         state->orig.out.name = _name;
5285
5286         /* Result */
5287         ZERO_STRUCT(state->orig.out.result);
5288
5289         if (DEBUGLEVEL >= 10) {
5290                 NDR_PRINT_IN_DEBUG(lsa_LookupPrivName, &state->orig);
5291         }
5292
5293         state->out_mem_ctx = talloc_named_const(state, 0,
5294                              "rpccli_lsa_LookupPrivName_out_memory");
5295         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5296                 return tevent_req_post(req, ev);
5297         }
5298
5299         /* make a temporary copy, that we pass to the dispatch function */
5300         state->tmp = state->orig;
5301
5302         subreq = cli->dispatch_send(state, ev, cli,
5303                                     &ndr_table_lsarpc,
5304                                     NDR_LSA_LOOKUPPRIVNAME,
5305                                     &state->tmp);
5306         if (tevent_req_nomem(subreq, req)) {
5307                 return tevent_req_post(req, ev);
5308         }
5309         tevent_req_set_callback(subreq, rpccli_lsa_LookupPrivName_done, req);
5310         return req;
5311 }
5312
5313 static void rpccli_lsa_LookupPrivName_done(struct tevent_req *subreq)
5314 {
5315         struct tevent_req *req = tevent_req_callback_data(
5316                 subreq, struct tevent_req);
5317         struct rpccli_lsa_LookupPrivName_state *state = tevent_req_data(
5318                 req, struct rpccli_lsa_LookupPrivName_state);
5319         NTSTATUS status;
5320         TALLOC_CTX *mem_ctx;
5321
5322         if (state->out_mem_ctx) {
5323                 mem_ctx = state->out_mem_ctx;
5324         } else {
5325                 mem_ctx = state;
5326         }
5327
5328         status = state->dispatch_recv(subreq, mem_ctx);
5329         TALLOC_FREE(subreq);
5330         if (!NT_STATUS_IS_OK(status)) {
5331                 tevent_req_nterror(req, status);
5332                 return;
5333         }
5334
5335         /* Copy out parameters */
5336         *state->orig.out.name = *state->tmp.out.name;
5337
5338         /* Copy result */
5339         state->orig.out.result = state->tmp.out.result;
5340
5341         /* Reset temporary structure */
5342         ZERO_STRUCT(state->tmp);
5343
5344         if (DEBUGLEVEL >= 10) {
5345                 NDR_PRINT_OUT_DEBUG(lsa_LookupPrivName, &state->orig);
5346         }
5347
5348         tevent_req_done(req);
5349 }
5350
5351 NTSTATUS rpccli_lsa_LookupPrivName_recv(struct tevent_req *req,
5352                                         TALLOC_CTX *mem_ctx,
5353                                         NTSTATUS *result)
5354 {
5355         struct rpccli_lsa_LookupPrivName_state *state = tevent_req_data(
5356                 req, struct rpccli_lsa_LookupPrivName_state);
5357         NTSTATUS status;
5358
5359         if (tevent_req_is_nterror(req, &status)) {
5360                 tevent_req_received(req);
5361                 return status;
5362         }
5363
5364         /* Steal possbile out parameters to the callers context */
5365         talloc_steal(mem_ctx, state->out_mem_ctx);
5366
5367         /* Return result */
5368         *result = state->orig.out.result;
5369
5370         tevent_req_received(req);
5371         return NT_STATUS_OK;
5372 }
5373
5374 NTSTATUS rpccli_lsa_LookupPrivName(struct rpc_pipe_client *cli,
5375                                    TALLOC_CTX *mem_ctx,
5376                                    struct policy_handle *handle /* [in] [ref] */,
5377                                    struct lsa_LUID *luid /* [in] [ref] */,
5378                                    struct lsa_StringLarge **name /* [out] [ref] */)
5379 {
5380         struct lsa_LookupPrivName r;
5381         NTSTATUS status;
5382
5383         /* In parameters */
5384         r.in.handle = handle;
5385         r.in.luid = luid;
5386
5387         if (DEBUGLEVEL >= 10) {
5388                 NDR_PRINT_IN_DEBUG(lsa_LookupPrivName, &r);
5389         }
5390
5391         status = cli->dispatch(cli,
5392                                 mem_ctx,
5393                                 &ndr_table_lsarpc,
5394                                 NDR_LSA_LOOKUPPRIVNAME,
5395                                 &r);
5396
5397         if (!NT_STATUS_IS_OK(status)) {
5398                 return status;
5399         }
5400
5401         if (DEBUGLEVEL >= 10) {
5402                 NDR_PRINT_OUT_DEBUG(lsa_LookupPrivName, &r);
5403         }
5404
5405         if (NT_STATUS_IS_ERR(status)) {
5406                 return status;
5407         }
5408
5409         /* Return variables */
5410         *name = *r.out.name;
5411
5412         /* Return result */
5413         return r.out.result;
5414 }
5415
5416 struct rpccli_lsa_LookupPrivDisplayName_state {
5417         struct lsa_LookupPrivDisplayName orig;
5418         struct lsa_LookupPrivDisplayName tmp;
5419         TALLOC_CTX *out_mem_ctx;
5420         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5421 };
5422
5423 static void rpccli_lsa_LookupPrivDisplayName_done(struct tevent_req *subreq);
5424
5425 struct tevent_req *rpccli_lsa_LookupPrivDisplayName_send(TALLOC_CTX *mem_ctx,
5426                                                          struct tevent_context *ev,
5427                                                          struct rpc_pipe_client *cli,
5428                                                          struct policy_handle *_handle /* [in] [ref] */,
5429                                                          struct lsa_String *_name /* [in] [ref] */,
5430                                                          uint16_t _language_id /* [in]  */,
5431                                                          uint16_t _language_id_sys /* [in]  */,
5432                                                          struct lsa_StringLarge **_disp_name /* [out] [ref] */,
5433                                                          uint16_t *_returned_language_id /* [out] [ref] */)
5434 {
5435         struct tevent_req *req;
5436         struct rpccli_lsa_LookupPrivDisplayName_state *state;
5437         struct tevent_req *subreq;
5438
5439         req = tevent_req_create(mem_ctx, &state,
5440                                 struct rpccli_lsa_LookupPrivDisplayName_state);
5441         if (req == NULL) {
5442                 return NULL;
5443         }
5444         state->out_mem_ctx = NULL;
5445         state->dispatch_recv = cli->dispatch_recv;
5446
5447         /* In parameters */
5448         state->orig.in.handle = _handle;
5449         state->orig.in.name = _name;
5450         state->orig.in.language_id = _language_id;
5451         state->orig.in.language_id_sys = _language_id_sys;
5452
5453         /* Out parameters */
5454         state->orig.out.disp_name = _disp_name;
5455         state->orig.out.returned_language_id = _returned_language_id;
5456
5457         /* Result */
5458         ZERO_STRUCT(state->orig.out.result);
5459
5460         if (DEBUGLEVEL >= 10) {
5461                 NDR_PRINT_IN_DEBUG(lsa_LookupPrivDisplayName, &state->orig);
5462         }
5463
5464         state->out_mem_ctx = talloc_named_const(state, 0,
5465                              "rpccli_lsa_LookupPrivDisplayName_out_memory");
5466         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5467                 return tevent_req_post(req, ev);
5468         }
5469
5470         /* make a temporary copy, that we pass to the dispatch function */
5471         state->tmp = state->orig;
5472
5473         subreq = cli->dispatch_send(state, ev, cli,
5474                                     &ndr_table_lsarpc,
5475                                     NDR_LSA_LOOKUPPRIVDISPLAYNAME,
5476                                     &state->tmp);
5477         if (tevent_req_nomem(subreq, req)) {
5478                 return tevent_req_post(req, ev);
5479         }
5480         tevent_req_set_callback(subreq, rpccli_lsa_LookupPrivDisplayName_done, req);
5481         return req;
5482 }
5483
5484 static void rpccli_lsa_LookupPrivDisplayName_done(struct tevent_req *subreq)
5485 {
5486         struct tevent_req *req = tevent_req_callback_data(
5487                 subreq, struct tevent_req);
5488         struct rpccli_lsa_LookupPrivDisplayName_state *state = tevent_req_data(
5489                 req, struct rpccli_lsa_LookupPrivDisplayName_state);
5490         NTSTATUS status;
5491         TALLOC_CTX *mem_ctx;
5492
5493         if (state->out_mem_ctx) {
5494                 mem_ctx = state->out_mem_ctx;
5495         } else {
5496                 mem_ctx = state;
5497         }
5498
5499         status = state->dispatch_recv(subreq, mem_ctx);
5500         TALLOC_FREE(subreq);
5501         if (!NT_STATUS_IS_OK(status)) {
5502                 tevent_req_nterror(req, status);
5503                 return;
5504         }
5505
5506         /* Copy out parameters */
5507         *state->orig.out.disp_name = *state->tmp.out.disp_name;
5508         *state->orig.out.returned_language_id = *state->tmp.out.returned_language_id;
5509
5510         /* Copy result */
5511         state->orig.out.result = state->tmp.out.result;
5512
5513         /* Reset temporary structure */
5514         ZERO_STRUCT(state->tmp);
5515
5516         if (DEBUGLEVEL >= 10) {
5517                 NDR_PRINT_OUT_DEBUG(lsa_LookupPrivDisplayName, &state->orig);
5518         }
5519
5520         tevent_req_done(req);
5521 }
5522
5523 NTSTATUS rpccli_lsa_LookupPrivDisplayName_recv(struct tevent_req *req,
5524                                                TALLOC_CTX *mem_ctx,
5525                                                NTSTATUS *result)
5526 {
5527         struct rpccli_lsa_LookupPrivDisplayName_state *state = tevent_req_data(
5528                 req, struct rpccli_lsa_LookupPrivDisplayName_state);
5529         NTSTATUS status;
5530
5531         if (tevent_req_is_nterror(req, &status)) {
5532                 tevent_req_received(req);
5533                 return status;
5534         }
5535
5536         /* Steal possbile out parameters to the callers context */
5537         talloc_steal(mem_ctx, state->out_mem_ctx);
5538
5539         /* Return result */
5540         *result = state->orig.out.result;
5541
5542         tevent_req_received(req);
5543         return NT_STATUS_OK;
5544 }
5545
5546 NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli,
5547                                           TALLOC_CTX *mem_ctx,
5548                                           struct policy_handle *handle /* [in] [ref] */,
5549                                           struct lsa_String *name /* [in] [ref] */,
5550                                           uint16_t language_id /* [in]  */,
5551                                           uint16_t language_id_sys /* [in]  */,
5552                                           struct lsa_StringLarge **disp_name /* [out] [ref] */,
5553                                           uint16_t *returned_language_id /* [out] [ref] */)
5554 {
5555         struct lsa_LookupPrivDisplayName r;
5556         NTSTATUS status;
5557
5558         /* In parameters */
5559         r.in.handle = handle;
5560         r.in.name = name;
5561         r.in.language_id = language_id;
5562         r.in.language_id_sys = language_id_sys;
5563
5564         if (DEBUGLEVEL >= 10) {
5565                 NDR_PRINT_IN_DEBUG(lsa_LookupPrivDisplayName, &r);
5566         }
5567
5568         status = cli->dispatch(cli,
5569                                 mem_ctx,
5570                                 &ndr_table_lsarpc,
5571                                 NDR_LSA_LOOKUPPRIVDISPLAYNAME,
5572                                 &r);
5573
5574         if (!NT_STATUS_IS_OK(status)) {
5575                 return status;
5576         }
5577
5578         if (DEBUGLEVEL >= 10) {
5579                 NDR_PRINT_OUT_DEBUG(lsa_LookupPrivDisplayName, &r);
5580         }
5581
5582         if (NT_STATUS_IS_ERR(status)) {
5583                 return status;
5584         }
5585
5586         /* Return variables */
5587         *disp_name = *r.out.disp_name;
5588         *returned_language_id = *r.out.returned_language_id;
5589
5590         /* Return result */
5591         return r.out.result;
5592 }
5593
5594 struct rpccli_lsa_DeleteObject_state {
5595         struct lsa_DeleteObject orig;
5596         struct lsa_DeleteObject tmp;
5597         TALLOC_CTX *out_mem_ctx;
5598         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5599 };
5600
5601 static void rpccli_lsa_DeleteObject_done(struct tevent_req *subreq);
5602
5603 struct tevent_req *rpccli_lsa_DeleteObject_send(TALLOC_CTX *mem_ctx,
5604                                                 struct tevent_context *ev,
5605                                                 struct rpc_pipe_client *cli,
5606                                                 struct policy_handle *_handle /* [in,out] [ref] */)
5607 {
5608         struct tevent_req *req;
5609         struct rpccli_lsa_DeleteObject_state *state;
5610         struct tevent_req *subreq;
5611
5612         req = tevent_req_create(mem_ctx, &state,
5613                                 struct rpccli_lsa_DeleteObject_state);
5614         if (req == NULL) {
5615                 return NULL;
5616         }
5617         state->out_mem_ctx = NULL;
5618         state->dispatch_recv = cli->dispatch_recv;
5619
5620         /* In parameters */
5621         state->orig.in.handle = _handle;
5622
5623         /* Out parameters */
5624         state->orig.out.handle = _handle;
5625
5626         /* Result */
5627         ZERO_STRUCT(state->orig.out.result);
5628
5629         if (DEBUGLEVEL >= 10) {
5630                 NDR_PRINT_IN_DEBUG(lsa_DeleteObject, &state->orig);
5631         }
5632
5633         state->out_mem_ctx = talloc_named_const(state, 0,
5634                              "rpccli_lsa_DeleteObject_out_memory");
5635         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5636                 return tevent_req_post(req, ev);
5637         }
5638
5639         /* make a temporary copy, that we pass to the dispatch function */
5640         state->tmp = state->orig;
5641
5642         subreq = cli->dispatch_send(state, ev, cli,
5643                                     &ndr_table_lsarpc,
5644                                     NDR_LSA_DELETEOBJECT,
5645                                     &state->tmp);
5646         if (tevent_req_nomem(subreq, req)) {
5647                 return tevent_req_post(req, ev);
5648         }
5649         tevent_req_set_callback(subreq, rpccli_lsa_DeleteObject_done, req);
5650         return req;
5651 }
5652
5653 static void rpccli_lsa_DeleteObject_done(struct tevent_req *subreq)
5654 {
5655         struct tevent_req *req = tevent_req_callback_data(
5656                 subreq, struct tevent_req);
5657         struct rpccli_lsa_DeleteObject_state *state = tevent_req_data(
5658                 req, struct rpccli_lsa_DeleteObject_state);
5659         NTSTATUS status;
5660         TALLOC_CTX *mem_ctx;
5661
5662         if (state->out_mem_ctx) {
5663                 mem_ctx = state->out_mem_ctx;
5664         } else {
5665                 mem_ctx = state;
5666         }
5667
5668         status = state->dispatch_recv(subreq, mem_ctx);
5669         TALLOC_FREE(subreq);
5670         if (!NT_STATUS_IS_OK(status)) {
5671                 tevent_req_nterror(req, status);
5672                 return;
5673         }
5674
5675         /* Copy out parameters */
5676         *state->orig.out.handle = *state->tmp.out.handle;
5677
5678         /* Copy result */
5679         state->orig.out.result = state->tmp.out.result;
5680
5681         /* Reset temporary structure */
5682         ZERO_STRUCT(state->tmp);
5683
5684         if (DEBUGLEVEL >= 10) {
5685                 NDR_PRINT_OUT_DEBUG(lsa_DeleteObject, &state->orig);
5686         }
5687
5688         tevent_req_done(req);
5689 }
5690
5691 NTSTATUS rpccli_lsa_DeleteObject_recv(struct tevent_req *req,
5692                                       TALLOC_CTX *mem_ctx,
5693                                       NTSTATUS *result)
5694 {
5695         struct rpccli_lsa_DeleteObject_state *state = tevent_req_data(
5696                 req, struct rpccli_lsa_DeleteObject_state);
5697         NTSTATUS status;
5698
5699         if (tevent_req_is_nterror(req, &status)) {
5700                 tevent_req_received(req);
5701                 return status;
5702         }
5703
5704         /* Steal possbile out parameters to the callers context */
5705         talloc_steal(mem_ctx, state->out_mem_ctx);
5706
5707         /* Return result */
5708         *result = state->orig.out.result;
5709
5710         tevent_req_received(req);
5711         return NT_STATUS_OK;
5712 }
5713
5714 NTSTATUS rpccli_lsa_DeleteObject(struct rpc_pipe_client *cli,
5715                                  TALLOC_CTX *mem_ctx,
5716                                  struct policy_handle *handle /* [in,out] [ref] */)
5717 {
5718         struct lsa_DeleteObject r;
5719         NTSTATUS status;
5720
5721         /* In parameters */
5722         r.in.handle = handle;
5723
5724         if (DEBUGLEVEL >= 10) {
5725                 NDR_PRINT_IN_DEBUG(lsa_DeleteObject, &r);
5726         }
5727
5728         status = cli->dispatch(cli,
5729                                 mem_ctx,
5730                                 &ndr_table_lsarpc,
5731                                 NDR_LSA_DELETEOBJECT,
5732                                 &r);
5733
5734         if (!NT_STATUS_IS_OK(status)) {
5735                 return status;
5736         }
5737
5738         if (DEBUGLEVEL >= 10) {
5739                 NDR_PRINT_OUT_DEBUG(lsa_DeleteObject, &r);
5740         }
5741
5742         if (NT_STATUS_IS_ERR(status)) {
5743                 return status;
5744         }
5745
5746         /* Return variables */
5747         *handle = *r.out.handle;
5748
5749         /* Return result */
5750         return r.out.result;
5751 }
5752
5753 struct rpccli_lsa_EnumAccountsWithUserRight_state {
5754         struct lsa_EnumAccountsWithUserRight orig;
5755         struct lsa_EnumAccountsWithUserRight tmp;
5756         TALLOC_CTX *out_mem_ctx;
5757         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5758 };
5759
5760 static void rpccli_lsa_EnumAccountsWithUserRight_done(struct tevent_req *subreq);
5761
5762 struct tevent_req *rpccli_lsa_EnumAccountsWithUserRight_send(TALLOC_CTX *mem_ctx,
5763                                                              struct tevent_context *ev,
5764                                                              struct rpc_pipe_client *cli,
5765                                                              struct policy_handle *_handle /* [in] [ref] */,
5766                                                              struct lsa_String *_name /* [in] [unique] */,
5767                                                              struct lsa_SidArray *_sids /* [out] [ref] */)
5768 {
5769         struct tevent_req *req;
5770         struct rpccli_lsa_EnumAccountsWithUserRight_state *state;
5771         struct tevent_req *subreq;
5772
5773         req = tevent_req_create(mem_ctx, &state,
5774                                 struct rpccli_lsa_EnumAccountsWithUserRight_state);
5775         if (req == NULL) {
5776                 return NULL;
5777         }
5778         state->out_mem_ctx = NULL;
5779         state->dispatch_recv = cli->dispatch_recv;
5780
5781         /* In parameters */
5782         state->orig.in.handle = _handle;
5783         state->orig.in.name = _name;
5784
5785         /* Out parameters */
5786         state->orig.out.sids = _sids;
5787
5788         /* Result */
5789         ZERO_STRUCT(state->orig.out.result);
5790
5791         if (DEBUGLEVEL >= 10) {
5792                 NDR_PRINT_IN_DEBUG(lsa_EnumAccountsWithUserRight, &state->orig);
5793         }
5794
5795         state->out_mem_ctx = talloc_named_const(state, 0,
5796                              "rpccli_lsa_EnumAccountsWithUserRight_out_memory");
5797         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5798                 return tevent_req_post(req, ev);
5799         }
5800
5801         /* make a temporary copy, that we pass to the dispatch function */
5802         state->tmp = state->orig;
5803
5804         subreq = cli->dispatch_send(state, ev, cli,
5805                                     &ndr_table_lsarpc,
5806                                     NDR_LSA_ENUMACCOUNTSWITHUSERRIGHT,
5807                                     &state->tmp);
5808         if (tevent_req_nomem(subreq, req)) {
5809                 return tevent_req_post(req, ev);
5810         }
5811         tevent_req_set_callback(subreq, rpccli_lsa_EnumAccountsWithUserRight_done, req);
5812         return req;
5813 }
5814
5815 static void rpccli_lsa_EnumAccountsWithUserRight_done(struct tevent_req *subreq)
5816 {
5817         struct tevent_req *req = tevent_req_callback_data(
5818                 subreq, struct tevent_req);
5819         struct rpccli_lsa_EnumAccountsWithUserRight_state *state = tevent_req_data(
5820                 req, struct rpccli_lsa_EnumAccountsWithUserRight_state);
5821         NTSTATUS status;
5822         TALLOC_CTX *mem_ctx;
5823
5824         if (state->out_mem_ctx) {
5825                 mem_ctx = state->out_mem_ctx;
5826         } else {
5827                 mem_ctx = state;
5828         }
5829
5830         status = state->dispatch_recv(subreq, mem_ctx);
5831         TALLOC_FREE(subreq);
5832         if (!NT_STATUS_IS_OK(status)) {
5833                 tevent_req_nterror(req, status);
5834                 return;
5835         }
5836
5837         /* Copy out parameters */
5838         *state->orig.out.sids = *state->tmp.out.sids;
5839
5840         /* Copy result */
5841         state->orig.out.result = state->tmp.out.result;
5842
5843         /* Reset temporary structure */
5844         ZERO_STRUCT(state->tmp);
5845
5846         if (DEBUGLEVEL >= 10) {
5847                 NDR_PRINT_OUT_DEBUG(lsa_EnumAccountsWithUserRight, &state->orig);
5848         }
5849
5850         tevent_req_done(req);
5851 }
5852
5853 NTSTATUS rpccli_lsa_EnumAccountsWithUserRight_recv(struct tevent_req *req,
5854                                                    TALLOC_CTX *mem_ctx,
5855                                                    NTSTATUS *result)
5856 {
5857         struct rpccli_lsa_EnumAccountsWithUserRight_state *state = tevent_req_data(
5858                 req, struct rpccli_lsa_EnumAccountsWithUserRight_state);
5859         NTSTATUS status;
5860
5861         if (tevent_req_is_nterror(req, &status)) {
5862                 tevent_req_received(req);
5863                 return status;
5864         }
5865
5866         /* Steal possbile out parameters to the callers context */
5867         talloc_steal(mem_ctx, state->out_mem_ctx);
5868
5869         /* Return result */
5870         *result = state->orig.out.result;
5871
5872         tevent_req_received(req);
5873         return NT_STATUS_OK;
5874 }
5875
5876 NTSTATUS rpccli_lsa_EnumAccountsWithUserRight(struct rpc_pipe_client *cli,
5877                                               TALLOC_CTX *mem_ctx,
5878                                               struct policy_handle *handle /* [in] [ref] */,
5879                                               struct lsa_String *name /* [in] [unique] */,
5880                                               struct lsa_SidArray *sids /* [out] [ref] */)
5881 {
5882         struct lsa_EnumAccountsWithUserRight r;
5883         NTSTATUS status;
5884
5885         /* In parameters */
5886         r.in.handle = handle;
5887         r.in.name = name;
5888
5889         if (DEBUGLEVEL >= 10) {
5890                 NDR_PRINT_IN_DEBUG(lsa_EnumAccountsWithUserRight, &r);
5891         }
5892
5893         status = cli->dispatch(cli,
5894                                 mem_ctx,
5895                                 &ndr_table_lsarpc,
5896                                 NDR_LSA_ENUMACCOUNTSWITHUSERRIGHT,
5897                                 &r);
5898
5899         if (!NT_STATUS_IS_OK(status)) {
5900                 return status;
5901         }
5902
5903         if (DEBUGLEVEL >= 10) {
5904                 NDR_PRINT_OUT_DEBUG(lsa_EnumAccountsWithUserRight, &r);
5905         }
5906
5907         if (NT_STATUS_IS_ERR(status)) {
5908                 return status;
5909         }
5910
5911         /* Return variables */
5912         *sids = *r.out.sids;
5913
5914         /* Return result */
5915         return r.out.result;
5916 }
5917
5918 struct rpccli_lsa_EnumAccountRights_state {
5919         struct lsa_EnumAccountRights orig;
5920         struct lsa_EnumAccountRights tmp;
5921         TALLOC_CTX *out_mem_ctx;
5922         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5923 };
5924
5925 static void rpccli_lsa_EnumAccountRights_done(struct tevent_req *subreq);
5926
5927 struct tevent_req *rpccli_lsa_EnumAccountRights_send(TALLOC_CTX *mem_ctx,
5928                                                      struct tevent_context *ev,
5929                                                      struct rpc_pipe_client *cli,
5930                                                      struct policy_handle *_handle /* [in] [ref] */,
5931                                                      struct dom_sid2 *_sid /* [in] [ref] */,
5932                                                      struct lsa_RightSet *_rights /* [out] [ref] */)
5933 {
5934         struct tevent_req *req;
5935         struct rpccli_lsa_EnumAccountRights_state *state;
5936         struct tevent_req *subreq;
5937
5938         req = tevent_req_create(mem_ctx, &state,
5939                                 struct rpccli_lsa_EnumAccountRights_state);
5940         if (req == NULL) {
5941                 return NULL;
5942         }
5943         state->out_mem_ctx = NULL;
5944         state->dispatch_recv = cli->dispatch_recv;
5945
5946         /* In parameters */
5947         state->orig.in.handle = _handle;
5948         state->orig.in.sid = _sid;
5949
5950         /* Out parameters */
5951         state->orig.out.rights = _rights;
5952
5953         /* Result */
5954         ZERO_STRUCT(state->orig.out.result);
5955
5956         if (DEBUGLEVEL >= 10) {
5957                 NDR_PRINT_IN_DEBUG(lsa_EnumAccountRights, &state->orig);
5958         }
5959
5960         state->out_mem_ctx = talloc_named_const(state, 0,
5961                              "rpccli_lsa_EnumAccountRights_out_memory");
5962         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5963                 return tevent_req_post(req, ev);
5964         }
5965
5966         /* make a temporary copy, that we pass to the dispatch function */
5967         state->tmp = state->orig;
5968
5969         subreq = cli->dispatch_send(state, ev, cli,
5970                                     &ndr_table_lsarpc,
5971                                     NDR_LSA_ENUMACCOUNTRIGHTS,
5972                                     &state->tmp);
5973         if (tevent_req_nomem(subreq, req)) {
5974                 return tevent_req_post(req, ev);
5975         }
5976         tevent_req_set_callback(subreq, rpccli_lsa_EnumAccountRights_done, req);
5977         return req;
5978 }
5979
5980 static void rpccli_lsa_EnumAccountRights_done(struct tevent_req *subreq)
5981 {
5982         struct tevent_req *req = tevent_req_callback_data(
5983                 subreq, struct tevent_req);
5984         struct rpccli_lsa_EnumAccountRights_state *state = tevent_req_data(
5985                 req, struct rpccli_lsa_EnumAccountRights_state);
5986         NTSTATUS status;
5987         TALLOC_CTX *mem_ctx;
5988
5989         if (state->out_mem_ctx) {
5990                 mem_ctx = state->out_mem_ctx;
5991         } else {
5992                 mem_ctx = state;
5993         }
5994
5995         status = state->dispatch_recv(subreq, mem_ctx);
5996         TALLOC_FREE(subreq);
5997         if (!NT_STATUS_IS_OK(status)) {
5998                 tevent_req_nterror(req, status);
5999                 return;
6000         }
6001
6002         /* Copy out parameters */
6003         *state->orig.out.rights = *state->tmp.out.rights;
6004
6005         /* Copy result */
6006         state->orig.out.result = state->tmp.out.result;
6007
6008         /* Reset temporary structure */
6009         ZERO_STRUCT(state->tmp);
6010
6011         if (DEBUGLEVEL >= 10) {
6012                 NDR_PRINT_OUT_DEBUG(lsa_EnumAccountRights, &state->orig);
6013         }
6014
6015         tevent_req_done(req);
6016 }
6017
6018 NTSTATUS rpccli_lsa_EnumAccountRights_recv(struct tevent_req *req,
6019                                            TALLOC_CTX *mem_ctx,
6020                                            NTSTATUS *result)
6021 {
6022         struct rpccli_lsa_EnumAccountRights_state *state = tevent_req_data(
6023                 req, struct rpccli_lsa_EnumAccountRights_state);
6024         NTSTATUS status;
6025
6026         if (tevent_req_is_nterror(req, &status)) {
6027                 tevent_req_received(req);
6028                 return status;
6029         }
6030
6031         /* Steal possbile out parameters to the callers context */
6032         talloc_steal(mem_ctx, state->out_mem_ctx);
6033
6034         /* Return result */
6035         *result = state->orig.out.result;
6036
6037         tevent_req_received(req);
6038         return NT_STATUS_OK;
6039 }
6040
6041 NTSTATUS rpccli_lsa_EnumAccountRights(struct rpc_pipe_client *cli,
6042                                       TALLOC_CTX *mem_ctx,
6043                                       struct policy_handle *handle /* [in] [ref] */,
6044                                       struct dom_sid2 *sid /* [in] [ref] */,
6045                                       struct lsa_RightSet *rights /* [out] [ref] */)
6046 {
6047         struct lsa_EnumAccountRights r;
6048         NTSTATUS status;
6049
6050         /* In parameters */
6051         r.in.handle = handle;
6052         r.in.sid = sid;
6053
6054         if (DEBUGLEVEL >= 10) {
6055                 NDR_PRINT_IN_DEBUG(lsa_EnumAccountRights, &r);
6056         }
6057
6058         status = cli->dispatch(cli,
6059                                 mem_ctx,
6060                                 &ndr_table_lsarpc,
6061                                 NDR_LSA_ENUMACCOUNTRIGHTS,
6062                                 &r);
6063
6064         if (!NT_STATUS_IS_OK(status)) {
6065                 return status;
6066         }
6067
6068         if (DEBUGLEVEL >= 10) {
6069                 NDR_PRINT_OUT_DEBUG(lsa_EnumAccountRights, &r);
6070         }
6071
6072         if (NT_STATUS_IS_ERR(status)) {
6073                 return status;
6074         }
6075
6076         /* Return variables */
6077         *rights = *r.out.rights;
6078
6079         /* Return result */
6080         return r.out.result;
6081 }
6082
6083 struct rpccli_lsa_AddAccountRights_state {
6084         struct lsa_AddAccountRights orig;
6085         struct lsa_AddAccountRights tmp;
6086         TALLOC_CTX *out_mem_ctx;
6087         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6088 };
6089
6090 static void rpccli_lsa_AddAccountRights_done(struct tevent_req *subreq);
6091
6092 struct tevent_req *rpccli_lsa_AddAccountRights_send(TALLOC_CTX *mem_ctx,
6093                                                     struct tevent_context *ev,
6094                                                     struct rpc_pipe_client *cli,
6095                                                     struct policy_handle *_handle /* [in] [ref] */,
6096                                                     struct dom_sid2 *_sid /* [in] [ref] */,
6097                                                     struct lsa_RightSet *_rights /* [in] [ref] */)
6098 {
6099         struct tevent_req *req;
6100         struct rpccli_lsa_AddAccountRights_state *state;
6101         struct tevent_req *subreq;
6102
6103         req = tevent_req_create(mem_ctx, &state,
6104                                 struct rpccli_lsa_AddAccountRights_state);
6105         if (req == NULL) {
6106                 return NULL;
6107         }
6108         state->out_mem_ctx = NULL;
6109         state->dispatch_recv = cli->dispatch_recv;
6110
6111         /* In parameters */
6112         state->orig.in.handle = _handle;
6113         state->orig.in.sid = _sid;
6114         state->orig.in.rights = _rights;
6115
6116         /* Out parameters */
6117
6118         /* Result */
6119         ZERO_STRUCT(state->orig.out.result);
6120
6121         if (DEBUGLEVEL >= 10) {
6122                 NDR_PRINT_IN_DEBUG(lsa_AddAccountRights, &state->orig);
6123         }
6124
6125         /* make a temporary copy, that we pass to the dispatch function */
6126         state->tmp = state->orig;
6127
6128         subreq = cli->dispatch_send(state, ev, cli,
6129                                     &ndr_table_lsarpc,
6130                                     NDR_LSA_ADDACCOUNTRIGHTS,
6131                                     &state->tmp);
6132         if (tevent_req_nomem(subreq, req)) {
6133                 return tevent_req_post(req, ev);
6134         }
6135         tevent_req_set_callback(subreq, rpccli_lsa_AddAccountRights_done, req);
6136         return req;
6137 }
6138
6139 static void rpccli_lsa_AddAccountRights_done(struct tevent_req *subreq)
6140 {
6141         struct tevent_req *req = tevent_req_callback_data(
6142                 subreq, struct tevent_req);
6143         struct rpccli_lsa_AddAccountRights_state *state = tevent_req_data(
6144                 req, struct rpccli_lsa_AddAccountRights_state);
6145         NTSTATUS status;
6146         TALLOC_CTX *mem_ctx;
6147
6148         if (state->out_mem_ctx) {
6149                 mem_ctx = state->out_mem_ctx;
6150         } else {
6151                 mem_ctx = state;
6152         }
6153
6154         status = state->dispatch_recv(subreq, mem_ctx);
6155         TALLOC_FREE(subreq);
6156         if (!NT_STATUS_IS_OK(status)) {
6157                 tevent_req_nterror(req, status);
6158                 return;
6159         }
6160
6161         /* Copy out parameters */
6162
6163         /* Copy result */
6164         state->orig.out.result = state->tmp.out.result;
6165
6166         /* Reset temporary structure */
6167         ZERO_STRUCT(state->tmp);
6168
6169         if (DEBUGLEVEL >= 10) {
6170                 NDR_PRINT_OUT_DEBUG(lsa_AddAccountRights, &state->orig);
6171         }
6172
6173         tevent_req_done(req);
6174 }
6175
6176 NTSTATUS rpccli_lsa_AddAccountRights_recv(struct tevent_req *req,
6177                                           TALLOC_CTX *mem_ctx,
6178                                           NTSTATUS *result)
6179 {
6180         struct rpccli_lsa_AddAccountRights_state *state = tevent_req_data(
6181                 req, struct rpccli_lsa_AddAccountRights_state);
6182         NTSTATUS status;
6183
6184         if (tevent_req_is_nterror(req, &status)) {
6185                 tevent_req_received(req);
6186                 return status;
6187         }
6188
6189         /* Steal possbile out parameters to the callers context */
6190         talloc_steal(mem_ctx, state->out_mem_ctx);
6191
6192         /* Return result */
6193         *result = state->orig.out.result;
6194
6195         tevent_req_received(req);
6196         return NT_STATUS_OK;
6197 }
6198
6199 NTSTATUS rpccli_lsa_AddAccountRights(struct rpc_pipe_client *cli,
6200                                      TALLOC_CTX *mem_ctx,
6201                                      struct policy_handle *handle /* [in] [ref] */,
6202                                      struct dom_sid2 *sid /* [in] [ref] */,
6203                                      struct lsa_RightSet *rights /* [in] [ref] */)
6204 {
6205         struct lsa_AddAccountRights r;
6206         NTSTATUS status;
6207
6208         /* In parameters */
6209         r.in.handle = handle;
6210         r.in.sid = sid;
6211         r.in.rights = rights;
6212
6213         if (DEBUGLEVEL >= 10) {
6214                 NDR_PRINT_IN_DEBUG(lsa_AddAccountRights, &r);
6215         }
6216
6217         status = cli->dispatch(cli,
6218                                 mem_ctx,
6219                                 &ndr_table_lsarpc,
6220                                 NDR_LSA_ADDACCOUNTRIGHTS,
6221                                 &r);
6222
6223         if (!NT_STATUS_IS_OK(status)) {
6224                 return status;
6225         }
6226
6227         if (DEBUGLEVEL >= 10) {
6228                 NDR_PRINT_OUT_DEBUG(lsa_AddAccountRights, &r);
6229         }
6230
6231         if (NT_STATUS_IS_ERR(status)) {
6232                 return status;
6233         }
6234
6235         /* Return variables */
6236
6237         /* Return result */
6238         return r.out.result;
6239 }
6240
6241 struct rpccli_lsa_RemoveAccountRights_state {
6242         struct lsa_RemoveAccountRights orig;
6243         struct lsa_RemoveAccountRights tmp;
6244         TALLOC_CTX *out_mem_ctx;
6245         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6246 };
6247
6248 static void rpccli_lsa_RemoveAccountRights_done(struct tevent_req *subreq);
6249
6250 struct tevent_req *rpccli_lsa_RemoveAccountRights_send(TALLOC_CTX *mem_ctx,
6251                                                        struct tevent_context *ev,
6252                                                        struct rpc_pipe_client *cli,
6253                                                        struct policy_handle *_handle /* [in] [ref] */,
6254                                                        struct dom_sid2 *_sid /* [in] [ref] */,
6255                                                        uint8_t _remove_all /* [in]  */,
6256                                                        struct lsa_RightSet *_rights /* [in] [ref] */)
6257 {
6258         struct tevent_req *req;
6259         struct rpccli_lsa_RemoveAccountRights_state *state;
6260         struct tevent_req *subreq;
6261
6262         req = tevent_req_create(mem_ctx, &state,
6263                                 struct rpccli_lsa_RemoveAccountRights_state);
6264         if (req == NULL) {
6265                 return NULL;
6266         }
6267         state->out_mem_ctx = NULL;
6268         state->dispatch_recv = cli->dispatch_recv;
6269
6270         /* In parameters */
6271         state->orig.in.handle = _handle;
6272         state->orig.in.sid = _sid;
6273         state->orig.in.remove_all = _remove_all;
6274         state->orig.in.rights = _rights;
6275
6276         /* Out parameters */
6277
6278         /* Result */
6279         ZERO_STRUCT(state->orig.out.result);
6280
6281         if (DEBUGLEVEL >= 10) {
6282                 NDR_PRINT_IN_DEBUG(lsa_RemoveAccountRights, &state->orig);
6283         }
6284
6285         /* make a temporary copy, that we pass to the dispatch function */
6286         state->tmp = state->orig;
6287
6288         subreq = cli->dispatch_send(state, ev, cli,
6289                                     &ndr_table_lsarpc,
6290                                     NDR_LSA_REMOVEACCOUNTRIGHTS,
6291                                     &state->tmp);
6292         if (tevent_req_nomem(subreq, req)) {
6293                 return tevent_req_post(req, ev);
6294         }
6295         tevent_req_set_callback(subreq, rpccli_lsa_RemoveAccountRights_done, req);
6296         return req;
6297 }
6298
6299 static void rpccli_lsa_RemoveAccountRights_done(struct tevent_req *subreq)
6300 {
6301         struct tevent_req *req = tevent_req_callback_data(
6302                 subreq, struct tevent_req);
6303         struct rpccli_lsa_RemoveAccountRights_state *state = tevent_req_data(
6304                 req, struct rpccli_lsa_RemoveAccountRights_state);
6305         NTSTATUS status;
6306         TALLOC_CTX *mem_ctx;
6307
6308         if (state->out_mem_ctx) {
6309                 mem_ctx = state->out_mem_ctx;
6310         } else {
6311                 mem_ctx = state;
6312         }
6313
6314         status = state->dispatch_recv(subreq, mem_ctx);
6315         TALLOC_FREE(subreq);
6316         if (!NT_STATUS_IS_OK(status)) {
6317                 tevent_req_nterror(req, status);
6318                 return;
6319         }
6320
6321         /* Copy out parameters */
6322
6323         /* Copy result */
6324         state->orig.out.result = state->tmp.out.result;
6325
6326         /* Reset temporary structure */
6327         ZERO_STRUCT(state->tmp);
6328
6329         if (DEBUGLEVEL >= 10) {
6330                 NDR_PRINT_OUT_DEBUG(lsa_RemoveAccountRights, &state->orig);
6331         }
6332
6333         tevent_req_done(req);
6334 }
6335
6336 NTSTATUS rpccli_lsa_RemoveAccountRights_recv(struct tevent_req *req,
6337                                              TALLOC_CTX *mem_ctx,
6338                                              NTSTATUS *result)
6339 {
6340         struct rpccli_lsa_RemoveAccountRights_state *state = tevent_req_data(
6341                 req, struct rpccli_lsa_RemoveAccountRights_state);
6342         NTSTATUS status;
6343
6344         if (tevent_req_is_nterror(req, &status)) {
6345                 tevent_req_received(req);
6346                 return status;
6347         }
6348
6349         /* Steal possbile out parameters to the callers context */
6350         talloc_steal(mem_ctx, state->out_mem_ctx);
6351
6352         /* Return result */
6353         *result = state->orig.out.result;
6354
6355         tevent_req_received(req);
6356         return NT_STATUS_OK;
6357 }
6358
6359 NTSTATUS rpccli_lsa_RemoveAccountRights(struct rpc_pipe_client *cli,
6360                                         TALLOC_CTX *mem_ctx,
6361                                         struct policy_handle *handle /* [in] [ref] */,
6362                                         struct dom_sid2 *sid /* [in] [ref] */,
6363                                         uint8_t remove_all /* [in]  */,
6364                                         struct lsa_RightSet *rights /* [in] [ref] */)
6365 {
6366         struct lsa_RemoveAccountRights r;
6367         NTSTATUS status;
6368
6369         /* In parameters */
6370         r.in.handle = handle;
6371         r.in.sid = sid;
6372         r.in.remove_all = remove_all;
6373         r.in.rights = rights;
6374
6375         if (DEBUGLEVEL >= 10) {
6376                 NDR_PRINT_IN_DEBUG(lsa_RemoveAccountRights, &r);
6377         }
6378
6379         status = cli->dispatch(cli,
6380                                 mem_ctx,
6381                                 &ndr_table_lsarpc,
6382                                 NDR_LSA_REMOVEACCOUNTRIGHTS,
6383                                 &r);
6384
6385         if (!NT_STATUS_IS_OK(status)) {
6386                 return status;
6387         }
6388
6389         if (DEBUGLEVEL >= 10) {
6390                 NDR_PRINT_OUT_DEBUG(lsa_RemoveAccountRights, &r);
6391         }
6392
6393         if (NT_STATUS_IS_ERR(status)) {
6394                 return status;
6395         }
6396
6397         /* Return variables */
6398
6399         /* Return result */
6400         return r.out.result;
6401 }
6402
6403 struct rpccli_lsa_QueryTrustedDomainInfoBySid_state {
6404         struct lsa_QueryTrustedDomainInfoBySid orig;
6405         struct lsa_QueryTrustedDomainInfoBySid tmp;
6406         TALLOC_CTX *out_mem_ctx;
6407         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6408 };
6409
6410 static void rpccli_lsa_QueryTrustedDomainInfoBySid_done(struct tevent_req *subreq);
6411
6412 struct tevent_req *rpccli_lsa_QueryTrustedDomainInfoBySid_send(TALLOC_CTX *mem_ctx,
6413                                                                struct tevent_context *ev,
6414                                                                struct rpc_pipe_client *cli,
6415                                                                struct policy_handle *_handle /* [in] [ref] */,
6416                                                                struct dom_sid2 *_dom_sid /* [in] [ref] */,
6417                                                                enum lsa_TrustDomInfoEnum _level /* [in]  */,
6418                                                                union lsa_TrustedDomainInfo **_info /* [out] [ref,switch_is(level)] */)
6419 {
6420         struct tevent_req *req;
6421         struct rpccli_lsa_QueryTrustedDomainInfoBySid_state *state;
6422         struct tevent_req *subreq;
6423
6424         req = tevent_req_create(mem_ctx, &state,
6425                                 struct rpccli_lsa_QueryTrustedDomainInfoBySid_state);
6426         if (req == NULL) {
6427                 return NULL;
6428         }
6429         state->out_mem_ctx = NULL;
6430         state->dispatch_recv = cli->dispatch_recv;
6431
6432         /* In parameters */
6433         state->orig.in.handle = _handle;
6434         state->orig.in.dom_sid = _dom_sid;
6435         state->orig.in.level = _level;
6436
6437         /* Out parameters */
6438         state->orig.out.info = _info;
6439
6440         /* Result */
6441         ZERO_STRUCT(state->orig.out.result);
6442
6443         if (DEBUGLEVEL >= 10) {
6444                 NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoBySid, &state->orig);
6445         }
6446
6447         state->out_mem_ctx = talloc_named_const(state, 0,
6448                              "rpccli_lsa_QueryTrustedDomainInfoBySid_out_memory");
6449         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6450                 return tevent_req_post(req, ev);
6451         }
6452
6453         /* make a temporary copy, that we pass to the dispatch function */
6454         state->tmp = state->orig;
6455
6456         subreq = cli->dispatch_send(state, ev, cli,
6457                                     &ndr_table_lsarpc,
6458                                     NDR_LSA_QUERYTRUSTEDDOMAININFOBYSID,
6459                                     &state->tmp);
6460         if (tevent_req_nomem(subreq, req)) {
6461                 return tevent_req_post(req, ev);
6462         }
6463         tevent_req_set_callback(subreq, rpccli_lsa_QueryTrustedDomainInfoBySid_done, req);
6464         return req;
6465 }
6466
6467 static void rpccli_lsa_QueryTrustedDomainInfoBySid_done(struct tevent_req *subreq)
6468 {
6469         struct tevent_req *req = tevent_req_callback_data(
6470                 subreq, struct tevent_req);
6471         struct rpccli_lsa_QueryTrustedDomainInfoBySid_state *state = tevent_req_data(
6472                 req, struct rpccli_lsa_QueryTrustedDomainInfoBySid_state);
6473         NTSTATUS status;
6474         TALLOC_CTX *mem_ctx;
6475
6476         if (state->out_mem_ctx) {
6477                 mem_ctx = state->out_mem_ctx;
6478         } else {
6479                 mem_ctx = state;
6480         }
6481
6482         status = state->dispatch_recv(subreq, mem_ctx);
6483         TALLOC_FREE(subreq);
6484         if (!NT_STATUS_IS_OK(status)) {
6485                 tevent_req_nterror(req, status);
6486                 return;
6487         }
6488
6489         /* Copy out parameters */
6490         *state->orig.out.info = *state->tmp.out.info;
6491
6492         /* Copy result */
6493         state->orig.out.result = state->tmp.out.result;
6494
6495         /* Reset temporary structure */
6496         ZERO_STRUCT(state->tmp);
6497
6498         if (DEBUGLEVEL >= 10) {
6499                 NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoBySid, &state->orig);
6500         }
6501
6502         tevent_req_done(req);
6503 }
6504
6505 NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid_recv(struct tevent_req *req,
6506                                                      TALLOC_CTX *mem_ctx,
6507                                                      NTSTATUS *result)
6508 {
6509         struct rpccli_lsa_QueryTrustedDomainInfoBySid_state *state = tevent_req_data(
6510                 req, struct rpccli_lsa_QueryTrustedDomainInfoBySid_state);
6511         NTSTATUS status;
6512
6513         if (tevent_req_is_nterror(req, &status)) {
6514                 tevent_req_received(req);
6515                 return status;
6516         }
6517
6518         /* Steal possbile out parameters to the callers context */
6519         talloc_steal(mem_ctx, state->out_mem_ctx);
6520
6521         /* Return result */
6522         *result = state->orig.out.result;
6523
6524         tevent_req_received(req);
6525         return NT_STATUS_OK;
6526 }
6527
6528 NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid(struct rpc_pipe_client *cli,
6529                                                 TALLOC_CTX *mem_ctx,
6530                                                 struct policy_handle *handle /* [in] [ref] */,
6531                                                 struct dom_sid2 *dom_sid /* [in] [ref] */,
6532                                                 enum lsa_TrustDomInfoEnum level /* [in]  */,
6533                                                 union lsa_TrustedDomainInfo **info /* [out] [ref,switch_is(level)] */)
6534 {
6535         struct lsa_QueryTrustedDomainInfoBySid r;
6536         NTSTATUS status;
6537
6538         /* In parameters */
6539         r.in.handle = handle;
6540         r.in.dom_sid = dom_sid;
6541         r.in.level = level;
6542
6543         if (DEBUGLEVEL >= 10) {
6544                 NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoBySid, &r);
6545         }
6546
6547         status = cli->dispatch(cli,
6548                                 mem_ctx,
6549                                 &ndr_table_lsarpc,
6550                                 NDR_LSA_QUERYTRUSTEDDOMAININFOBYSID,
6551                                 &r);
6552
6553         if (!NT_STATUS_IS_OK(status)) {
6554                 return status;
6555         }
6556
6557         if (DEBUGLEVEL >= 10) {
6558                 NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoBySid, &r);
6559         }
6560
6561         if (NT_STATUS_IS_ERR(status)) {
6562                 return status;
6563         }
6564
6565         /* Return variables */
6566         *info = *r.out.info;
6567
6568         /* Return result */
6569         return r.out.result;
6570 }
6571
6572 struct rpccli_lsa_SetTrustedDomainInfo_state {
6573         struct lsa_SetTrustedDomainInfo orig;
6574         struct lsa_SetTrustedDomainInfo tmp;
6575         TALLOC_CTX *out_mem_ctx;
6576         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6577 };
6578
6579 static void rpccli_lsa_SetTrustedDomainInfo_done(struct tevent_req *subreq);
6580
6581 struct tevent_req *rpccli_lsa_SetTrustedDomainInfo_send(TALLOC_CTX *mem_ctx,
6582                                                         struct tevent_context *ev,
6583                                                         struct rpc_pipe_client *cli,
6584                                                         struct policy_handle *_handle /* [in] [ref] */,
6585                                                         struct dom_sid2 *_dom_sid /* [in] [ref] */,
6586                                                         enum lsa_TrustDomInfoEnum _level /* [in]  */,
6587                                                         union lsa_TrustedDomainInfo *_info /* [in] [ref,switch_is(level)] */)
6588 {
6589         struct tevent_req *req;
6590         struct rpccli_lsa_SetTrustedDomainInfo_state *state;
6591         struct tevent_req *subreq;
6592
6593         req = tevent_req_create(mem_ctx, &state,
6594                                 struct rpccli_lsa_SetTrustedDomainInfo_state);
6595         if (req == NULL) {
6596                 return NULL;
6597         }
6598         state->out_mem_ctx = NULL;
6599         state->dispatch_recv = cli->dispatch_recv;
6600
6601         /* In parameters */
6602         state->orig.in.handle = _handle;
6603         state->orig.in.dom_sid = _dom_sid;
6604         state->orig.in.level = _level;
6605         state->orig.in.info = _info;
6606
6607         /* Out parameters */
6608
6609         /* Result */
6610         ZERO_STRUCT(state->orig.out.result);
6611
6612         if (DEBUGLEVEL >= 10) {
6613                 NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfo, &state->orig);
6614         }
6615
6616         /* make a temporary copy, that we pass to the dispatch function */
6617         state->tmp = state->orig;
6618
6619         subreq = cli->dispatch_send(state, ev, cli,
6620                                     &ndr_table_lsarpc,
6621                                     NDR_LSA_SETTRUSTEDDOMAININFO,
6622                                     &state->tmp);
6623         if (tevent_req_nomem(subreq, req)) {
6624                 return tevent_req_post(req, ev);
6625         }
6626         tevent_req_set_callback(subreq, rpccli_lsa_SetTrustedDomainInfo_done, req);
6627         return req;
6628 }
6629
6630 static void rpccli_lsa_SetTrustedDomainInfo_done(struct tevent_req *subreq)
6631 {
6632         struct tevent_req *req = tevent_req_callback_data(
6633                 subreq, struct tevent_req);
6634         struct rpccli_lsa_SetTrustedDomainInfo_state *state = tevent_req_data(
6635                 req, struct rpccli_lsa_SetTrustedDomainInfo_state);
6636         NTSTATUS status;
6637         TALLOC_CTX *mem_ctx;
6638
6639         if (state->out_mem_ctx) {
6640                 mem_ctx = state->out_mem_ctx;
6641         } else {
6642                 mem_ctx = state;
6643         }
6644
6645         status = state->dispatch_recv(subreq, mem_ctx);
6646         TALLOC_FREE(subreq);
6647         if (!NT_STATUS_IS_OK(status)) {
6648                 tevent_req_nterror(req, status);
6649                 return;
6650         }
6651
6652         /* Copy out parameters */
6653
6654         /* Copy result */
6655         state->orig.out.result = state->tmp.out.result;
6656
6657         /* Reset temporary structure */
6658         ZERO_STRUCT(state->tmp);
6659
6660         if (DEBUGLEVEL >= 10) {
6661                 NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfo, &state->orig);
6662         }
6663
6664         tevent_req_done(req);
6665 }
6666
6667 NTSTATUS rpccli_lsa_SetTrustedDomainInfo_recv(struct tevent_req *req,
6668                                               TALLOC_CTX *mem_ctx,
6669                                               NTSTATUS *result)
6670 {
6671         struct rpccli_lsa_SetTrustedDomainInfo_state *state = tevent_req_data(
6672                 req, struct rpccli_lsa_SetTrustedDomainInfo_state);
6673         NTSTATUS status;
6674
6675         if (tevent_req_is_nterror(req, &status)) {
6676                 tevent_req_received(req);
6677                 return status;
6678         }
6679
6680         /* Steal possbile out parameters to the callers context */
6681         talloc_steal(mem_ctx, state->out_mem_ctx);
6682
6683         /* Return result */
6684         *result = state->orig.out.result;
6685
6686         tevent_req_received(req);
6687         return NT_STATUS_OK;
6688 }
6689
6690 NTSTATUS rpccli_lsa_SetTrustedDomainInfo(struct rpc_pipe_client *cli,
6691                                          TALLOC_CTX *mem_ctx,
6692                                          struct policy_handle *handle /* [in] [ref] */,
6693                                          struct dom_sid2 *dom_sid /* [in] [ref] */,
6694                                          enum lsa_TrustDomInfoEnum level /* [in]  */,
6695                                          union lsa_TrustedDomainInfo *info /* [in] [ref,switch_is(level)] */)
6696 {
6697         struct lsa_SetTrustedDomainInfo r;
6698         NTSTATUS status;
6699
6700         /* In parameters */
6701         r.in.handle = handle;
6702         r.in.dom_sid = dom_sid;
6703         r.in.level = level;
6704         r.in.info = info;
6705
6706         if (DEBUGLEVEL >= 10) {
6707                 NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfo, &r);
6708         }
6709
6710         status = cli->dispatch(cli,
6711                                 mem_ctx,
6712                                 &ndr_table_lsarpc,
6713                                 NDR_LSA_SETTRUSTEDDOMAININFO,
6714                                 &r);
6715
6716         if (!NT_STATUS_IS_OK(status)) {
6717                 return status;
6718         }
6719
6720         if (DEBUGLEVEL >= 10) {
6721                 NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfo, &r);
6722         }
6723
6724         if (NT_STATUS_IS_ERR(status)) {
6725                 return status;
6726         }
6727
6728         /* Return variables */
6729
6730         /* Return result */
6731         return r.out.result;
6732 }
6733
6734 struct rpccli_lsa_DeleteTrustedDomain_state {
6735         struct lsa_DeleteTrustedDomain orig;
6736         struct lsa_DeleteTrustedDomain tmp;
6737         TALLOC_CTX *out_mem_ctx;
6738         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6739 };
6740
6741 static void rpccli_lsa_DeleteTrustedDomain_done(struct tevent_req *subreq);
6742
6743 struct tevent_req *rpccli_lsa_DeleteTrustedDomain_send(TALLOC_CTX *mem_ctx,
6744                                                        struct tevent_context *ev,
6745                                                        struct rpc_pipe_client *cli,
6746                                                        struct policy_handle *_handle /* [in] [ref] */,
6747                                                        struct dom_sid2 *_dom_sid /* [in] [ref] */)
6748 {
6749         struct tevent_req *req;
6750         struct rpccli_lsa_DeleteTrustedDomain_state *state;
6751         struct tevent_req *subreq;
6752
6753         req = tevent_req_create(mem_ctx, &state,
6754                                 struct rpccli_lsa_DeleteTrustedDomain_state);
6755         if (req == NULL) {
6756                 return NULL;
6757         }
6758         state->out_mem_ctx = NULL;
6759         state->dispatch_recv = cli->dispatch_recv;
6760
6761         /* In parameters */
6762         state->orig.in.handle = _handle;
6763         state->orig.in.dom_sid = _dom_sid;
6764
6765         /* Out parameters */
6766
6767         /* Result */
6768         ZERO_STRUCT(state->orig.out.result);
6769
6770         if (DEBUGLEVEL >= 10) {
6771                 NDR_PRINT_IN_DEBUG(lsa_DeleteTrustedDomain, &state->orig);
6772         }
6773
6774         /* make a temporary copy, that we pass to the dispatch function */
6775         state->tmp = state->orig;
6776
6777         subreq = cli->dispatch_send(state, ev, cli,
6778                                     &ndr_table_lsarpc,
6779                                     NDR_LSA_DELETETRUSTEDDOMAIN,
6780                                     &state->tmp);
6781         if (tevent_req_nomem(subreq, req)) {
6782                 return tevent_req_post(req, ev);
6783         }
6784         tevent_req_set_callback(subreq, rpccli_lsa_DeleteTrustedDomain_done, req);
6785         return req;
6786 }
6787
6788 static void rpccli_lsa_DeleteTrustedDomain_done(struct tevent_req *subreq)
6789 {
6790         struct tevent_req *req = tevent_req_callback_data(
6791                 subreq, struct tevent_req);
6792         struct rpccli_lsa_DeleteTrustedDomain_state *state = tevent_req_data(
6793                 req, struct rpccli_lsa_DeleteTrustedDomain_state);
6794         NTSTATUS status;
6795         TALLOC_CTX *mem_ctx;
6796
6797         if (state->out_mem_ctx) {
6798                 mem_ctx = state->out_mem_ctx;
6799         } else {
6800                 mem_ctx = state;
6801         }
6802
6803         status = state->dispatch_recv(subreq, mem_ctx);
6804         TALLOC_FREE(subreq);
6805         if (!NT_STATUS_IS_OK(status)) {
6806                 tevent_req_nterror(req, status);
6807                 return;
6808         }
6809
6810         /* Copy out parameters */
6811
6812         /* Copy result */
6813         state->orig.out.result = state->tmp.out.result;
6814
6815         /* Reset temporary structure */
6816         ZERO_STRUCT(state->tmp);
6817
6818         if (DEBUGLEVEL >= 10) {
6819                 NDR_PRINT_OUT_DEBUG(lsa_DeleteTrustedDomain, &state->orig);
6820         }
6821
6822         tevent_req_done(req);
6823 }
6824
6825 NTSTATUS rpccli_lsa_DeleteTrustedDomain_recv(struct tevent_req *req,
6826                                              TALLOC_CTX *mem_ctx,
6827                                              NTSTATUS *result)
6828 {
6829         struct rpccli_lsa_DeleteTrustedDomain_state *state = tevent_req_data(
6830                 req, struct rpccli_lsa_DeleteTrustedDomain_state);
6831         NTSTATUS status;
6832
6833         if (tevent_req_is_nterror(req, &status)) {
6834                 tevent_req_received(req);
6835                 return status;
6836         }
6837
6838         /* Steal possbile out parameters to the callers context */
6839         talloc_steal(mem_ctx, state->out_mem_ctx);
6840
6841         /* Return result */
6842         *result = state->orig.out.result;
6843
6844         tevent_req_received(req);
6845         return NT_STATUS_OK;
6846 }
6847
6848 NTSTATUS rpccli_lsa_DeleteTrustedDomain(struct rpc_pipe_client *cli,
6849                                         TALLOC_CTX *mem_ctx,
6850                                         struct policy_handle *handle /* [in] [ref] */,
6851                                         struct dom_sid2 *dom_sid /* [in] [ref] */)
6852 {
6853         struct lsa_DeleteTrustedDomain r;
6854         NTSTATUS status;
6855
6856         /* In parameters */
6857         r.in.handle = handle;
6858         r.in.dom_sid = dom_sid;
6859
6860         if (DEBUGLEVEL >= 10) {
6861                 NDR_PRINT_IN_DEBUG(lsa_DeleteTrustedDomain, &r);
6862         }
6863
6864         status = cli->dispatch(cli,
6865                                 mem_ctx,
6866                                 &ndr_table_lsarpc,
6867                                 NDR_LSA_DELETETRUSTEDDOMAIN,
6868                                 &r);
6869
6870         if (!NT_STATUS_IS_OK(status)) {
6871                 return status;
6872         }
6873
6874         if (DEBUGLEVEL >= 10) {
6875                 NDR_PRINT_OUT_DEBUG(lsa_DeleteTrustedDomain, &r);
6876         }
6877
6878         if (NT_STATUS_IS_ERR(status)) {
6879                 return status;
6880         }
6881
6882         /* Return variables */
6883
6884         /* Return result */
6885         return r.out.result;
6886 }
6887
6888 struct rpccli_lsa_StorePrivateData_state {
6889         struct lsa_StorePrivateData orig;
6890         struct lsa_StorePrivateData tmp;
6891         TALLOC_CTX *out_mem_ctx;
6892         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6893 };
6894
6895 static void rpccli_lsa_StorePrivateData_done(struct tevent_req *subreq);
6896
6897 struct tevent_req *rpccli_lsa_StorePrivateData_send(TALLOC_CTX *mem_ctx,
6898                                                     struct tevent_context *ev,
6899                                                     struct rpc_pipe_client *cli,
6900                                                     struct policy_handle *_handle /* [in] [ref] */,
6901                                                     struct lsa_String *_name /* [in] [ref] */,
6902                                                     struct lsa_DATA_BUF *_val /* [in] [unique] */)
6903 {
6904         struct tevent_req *req;
6905         struct rpccli_lsa_StorePrivateData_state *state;
6906         struct tevent_req *subreq;
6907
6908         req = tevent_req_create(mem_ctx, &state,
6909                                 struct rpccli_lsa_StorePrivateData_state);
6910         if (req == NULL) {
6911                 return NULL;
6912         }
6913         state->out_mem_ctx = NULL;
6914         state->dispatch_recv = cli->dispatch_recv;
6915
6916         /* In parameters */
6917         state->orig.in.handle = _handle;
6918         state->orig.in.name = _name;
6919         state->orig.in.val = _val;
6920
6921         /* Out parameters */
6922
6923         /* Result */
6924         ZERO_STRUCT(state->orig.out.result);
6925
6926         if (DEBUGLEVEL >= 10) {
6927                 NDR_PRINT_IN_DEBUG(lsa_StorePrivateData, &state->orig);
6928         }
6929
6930         /* make a temporary copy, that we pass to the dispatch function */
6931         state->tmp = state->orig;
6932
6933         subreq = cli->dispatch_send(state, ev, cli,
6934                                     &ndr_table_lsarpc,
6935                                     NDR_LSA_STOREPRIVATEDATA,
6936                                     &state->tmp);
6937         if (tevent_req_nomem(subreq, req)) {
6938                 return tevent_req_post(req, ev);
6939         }
6940         tevent_req_set_callback(subreq, rpccli_lsa_StorePrivateData_done, req);
6941         return req;
6942 }
6943
6944 static void rpccli_lsa_StorePrivateData_done(struct tevent_req *subreq)
6945 {
6946         struct tevent_req *req = tevent_req_callback_data(
6947                 subreq, struct tevent_req);
6948         struct rpccli_lsa_StorePrivateData_state *state = tevent_req_data(
6949                 req, struct rpccli_lsa_StorePrivateData_state);
6950         NTSTATUS status;
6951         TALLOC_CTX *mem_ctx;
6952
6953         if (state->out_mem_ctx) {
6954                 mem_ctx = state->out_mem_ctx;
6955         } else {
6956                 mem_ctx = state;
6957         }
6958
6959         status = state->dispatch_recv(subreq, mem_ctx);
6960         TALLOC_FREE(subreq);
6961         if (!NT_STATUS_IS_OK(status)) {
6962                 tevent_req_nterror(req, status);
6963                 return;
6964         }
6965
6966         /* Copy out parameters */
6967
6968         /* Copy result */
6969         state->orig.out.result = state->tmp.out.result;
6970
6971         /* Reset temporary structure */
6972         ZERO_STRUCT(state->tmp);
6973
6974         if (DEBUGLEVEL >= 10) {
6975                 NDR_PRINT_OUT_DEBUG(lsa_StorePrivateData, &state->orig);
6976         }
6977
6978         tevent_req_done(req);
6979 }
6980
6981 NTSTATUS rpccli_lsa_StorePrivateData_recv(struct tevent_req *req,
6982                                           TALLOC_CTX *mem_ctx,
6983                                           NTSTATUS *result)
6984 {
6985         struct rpccli_lsa_StorePrivateData_state *state = tevent_req_data(
6986                 req, struct rpccli_lsa_StorePrivateData_state);
6987         NTSTATUS status;
6988
6989         if (tevent_req_is_nterror(req, &status)) {
6990                 tevent_req_received(req);
6991                 return status;
6992         }
6993
6994         /* Steal possbile out parameters to the callers context */
6995         talloc_steal(mem_ctx, state->out_mem_ctx);
6996
6997         /* Return result */
6998         *result = state->orig.out.result;
6999
7000         tevent_req_received(req);
7001         return NT_STATUS_OK;
7002 }
7003
7004 NTSTATUS rpccli_lsa_StorePrivateData(struct rpc_pipe_client *cli,
7005                                      TALLOC_CTX *mem_ctx,
7006                                      struct policy_handle *handle /* [in] [ref] */,
7007                                      struct lsa_String *name /* [in] [ref] */,
7008                                      struct lsa_DATA_BUF *val /* [in] [unique] */)
7009 {
7010         struct lsa_StorePrivateData r;
7011         NTSTATUS status;
7012
7013         /* In parameters */
7014         r.in.handle = handle;
7015         r.in.name = name;
7016         r.in.val = val;
7017
7018         if (DEBUGLEVEL >= 10) {
7019                 NDR_PRINT_IN_DEBUG(lsa_StorePrivateData, &r);
7020         }
7021
7022         status = cli->dispatch(cli,
7023                                 mem_ctx,
7024                                 &ndr_table_lsarpc,
7025                                 NDR_LSA_STOREPRIVATEDATA,
7026                                 &r);
7027
7028         if (!NT_STATUS_IS_OK(status)) {
7029                 return status;
7030         }
7031
7032         if (DEBUGLEVEL >= 10) {
7033                 NDR_PRINT_OUT_DEBUG(lsa_StorePrivateData, &r);
7034         }
7035
7036         if (NT_STATUS_IS_ERR(status)) {
7037                 return status;
7038         }
7039
7040         /* Return variables */
7041
7042         /* Return result */
7043         return r.out.result;
7044 }
7045
7046 struct rpccli_lsa_RetrievePrivateData_state {
7047         struct lsa_RetrievePrivateData orig;
7048         struct lsa_RetrievePrivateData tmp;
7049         TALLOC_CTX *out_mem_ctx;
7050         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7051 };
7052
7053 static void rpccli_lsa_RetrievePrivateData_done(struct tevent_req *subreq);
7054
7055 struct tevent_req *rpccli_lsa_RetrievePrivateData_send(TALLOC_CTX *mem_ctx,
7056                                                        struct tevent_context *ev,
7057                                                        struct rpc_pipe_client *cli,
7058                                                        struct policy_handle *_handle /* [in] [ref] */,
7059                                                        struct lsa_String *_name /* [in] [ref] */,
7060                                                        struct lsa_DATA_BUF **_val /* [in,out] [ref] */)
7061 {
7062         struct tevent_req *req;
7063         struct rpccli_lsa_RetrievePrivateData_state *state;
7064         struct tevent_req *subreq;
7065
7066         req = tevent_req_create(mem_ctx, &state,
7067                                 struct rpccli_lsa_RetrievePrivateData_state);
7068         if (req == NULL) {
7069                 return NULL;
7070         }
7071         state->out_mem_ctx = NULL;
7072         state->dispatch_recv = cli->dispatch_recv;
7073
7074         /* In parameters */
7075         state->orig.in.handle = _handle;
7076         state->orig.in.name = _name;
7077         state->orig.in.val = _val;
7078
7079         /* Out parameters */
7080         state->orig.out.val = _val;
7081
7082         /* Result */
7083         ZERO_STRUCT(state->orig.out.result);
7084
7085         if (DEBUGLEVEL >= 10) {
7086                 NDR_PRINT_IN_DEBUG(lsa_RetrievePrivateData, &state->orig);
7087         }
7088
7089         state->out_mem_ctx = talloc_named_const(state, 0,
7090                              "rpccli_lsa_RetrievePrivateData_out_memory");
7091         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7092                 return tevent_req_post(req, ev);
7093         }
7094
7095         /* make a temporary copy, that we pass to the dispatch function */
7096         state->tmp = state->orig;
7097
7098         subreq = cli->dispatch_send(state, ev, cli,
7099                                     &ndr_table_lsarpc,
7100                                     NDR_LSA_RETRIEVEPRIVATEDATA,
7101                                     &state->tmp);
7102         if (tevent_req_nomem(subreq, req)) {
7103                 return tevent_req_post(req, ev);
7104         }
7105         tevent_req_set_callback(subreq, rpccli_lsa_RetrievePrivateData_done, req);
7106         return req;
7107 }
7108
7109 static void rpccli_lsa_RetrievePrivateData_done(struct tevent_req *subreq)
7110 {
7111         struct tevent_req *req = tevent_req_callback_data(
7112                 subreq, struct tevent_req);
7113         struct rpccli_lsa_RetrievePrivateData_state *state = tevent_req_data(
7114                 req, struct rpccli_lsa_RetrievePrivateData_state);
7115         NTSTATUS status;
7116         TALLOC_CTX *mem_ctx;
7117
7118         if (state->out_mem_ctx) {
7119                 mem_ctx = state->out_mem_ctx;
7120         } else {
7121                 mem_ctx = state;
7122         }
7123
7124         status = state->dispatch_recv(subreq, mem_ctx);
7125         TALLOC_FREE(subreq);
7126         if (!NT_STATUS_IS_OK(status)) {
7127                 tevent_req_nterror(req, status);
7128                 return;
7129         }
7130
7131         /* Copy out parameters */
7132         *state->orig.out.val = *state->tmp.out.val;
7133
7134         /* Copy result */
7135         state->orig.out.result = state->tmp.out.result;
7136
7137         /* Reset temporary structure */
7138         ZERO_STRUCT(state->tmp);
7139
7140         if (DEBUGLEVEL >= 10) {
7141                 NDR_PRINT_OUT_DEBUG(lsa_RetrievePrivateData, &state->orig);
7142         }
7143
7144         tevent_req_done(req);
7145 }
7146
7147 NTSTATUS rpccli_lsa_RetrievePrivateData_recv(struct tevent_req *req,
7148                                              TALLOC_CTX *mem_ctx,
7149                                              NTSTATUS *result)
7150 {
7151         struct rpccli_lsa_RetrievePrivateData_state *state = tevent_req_data(
7152                 req, struct rpccli_lsa_RetrievePrivateData_state);
7153         NTSTATUS status;
7154
7155         if (tevent_req_is_nterror(req, &status)) {
7156                 tevent_req_received(req);
7157                 return status;
7158         }
7159
7160         /* Steal possbile out parameters to the callers context */
7161         talloc_steal(mem_ctx, state->out_mem_ctx);
7162
7163         /* Return result */
7164         *result = state->orig.out.result;
7165
7166         tevent_req_received(req);
7167         return NT_STATUS_OK;
7168 }
7169
7170 NTSTATUS rpccli_lsa_RetrievePrivateData(struct rpc_pipe_client *cli,
7171                                         TALLOC_CTX *mem_ctx,
7172                                         struct policy_handle *handle /* [in] [ref] */,
7173                                         struct lsa_String *name /* [in] [ref] */,
7174                                         struct lsa_DATA_BUF **val /* [in,out] [ref] */)
7175 {
7176         struct lsa_RetrievePrivateData r;
7177         NTSTATUS status;
7178
7179         /* In parameters */
7180         r.in.handle = handle;
7181         r.in.name = name;
7182         r.in.val = val;
7183
7184         if (DEBUGLEVEL >= 10) {
7185                 NDR_PRINT_IN_DEBUG(lsa_RetrievePrivateData, &r);
7186         }
7187
7188         status = cli->dispatch(cli,
7189                                 mem_ctx,
7190                                 &ndr_table_lsarpc,
7191                                 NDR_LSA_RETRIEVEPRIVATEDATA,
7192                                 &r);
7193
7194         if (!NT_STATUS_IS_OK(status)) {
7195                 return status;
7196         }
7197
7198         if (DEBUGLEVEL >= 10) {
7199                 NDR_PRINT_OUT_DEBUG(lsa_RetrievePrivateData, &r);
7200         }
7201
7202         if (NT_STATUS_IS_ERR(status)) {
7203                 return status;
7204         }
7205
7206         /* Return variables */
7207         *val = *r.out.val;
7208
7209         /* Return result */
7210         return r.out.result;
7211 }
7212
7213 struct rpccli_lsa_OpenPolicy2_state {
7214         struct lsa_OpenPolicy2 orig;
7215         struct lsa_OpenPolicy2 tmp;
7216         TALLOC_CTX *out_mem_ctx;
7217         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7218 };
7219
7220 static void rpccli_lsa_OpenPolicy2_done(struct tevent_req *subreq);
7221
7222 struct tevent_req *rpccli_lsa_OpenPolicy2_send(TALLOC_CTX *mem_ctx,
7223                                                struct tevent_context *ev,
7224                                                struct rpc_pipe_client *cli,
7225                                                const char *_system_name /* [in] [unique,charset(UTF16)] */,
7226                                                struct lsa_ObjectAttribute *_attr /* [in] [ref] */,
7227                                                uint32_t _access_mask /* [in]  */,
7228                                                struct policy_handle *_handle /* [out] [ref] */)
7229 {
7230         struct tevent_req *req;
7231         struct rpccli_lsa_OpenPolicy2_state *state;
7232         struct tevent_req *subreq;
7233
7234         req = tevent_req_create(mem_ctx, &state,
7235                                 struct rpccli_lsa_OpenPolicy2_state);
7236         if (req == NULL) {
7237                 return NULL;
7238         }
7239         state->out_mem_ctx = NULL;
7240         state->dispatch_recv = cli->dispatch_recv;
7241
7242         /* In parameters */
7243         state->orig.in.system_name = _system_name;
7244         state->orig.in.attr = _attr;
7245         state->orig.in.access_mask = _access_mask;
7246
7247         /* Out parameters */
7248         state->orig.out.handle = _handle;
7249
7250         /* Result */
7251         ZERO_STRUCT(state->orig.out.result);
7252
7253         if (DEBUGLEVEL >= 10) {
7254                 NDR_PRINT_IN_DEBUG(lsa_OpenPolicy2, &state->orig);
7255         }
7256
7257         state->out_mem_ctx = talloc_named_const(state, 0,
7258                              "rpccli_lsa_OpenPolicy2_out_memory");
7259         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7260                 return tevent_req_post(req, ev);
7261         }
7262
7263         /* make a temporary copy, that we pass to the dispatch function */
7264         state->tmp = state->orig;
7265
7266         subreq = cli->dispatch_send(state, ev, cli,
7267                                     &ndr_table_lsarpc,
7268                                     NDR_LSA_OPENPOLICY2,
7269                                     &state->tmp);
7270         if (tevent_req_nomem(subreq, req)) {
7271                 return tevent_req_post(req, ev);
7272         }
7273         tevent_req_set_callback(subreq, rpccli_lsa_OpenPolicy2_done, req);
7274         return req;
7275 }
7276
7277 static void rpccli_lsa_OpenPolicy2_done(struct tevent_req *subreq)
7278 {
7279         struct tevent_req *req = tevent_req_callback_data(
7280                 subreq, struct tevent_req);
7281         struct rpccli_lsa_OpenPolicy2_state *state = tevent_req_data(
7282                 req, struct rpccli_lsa_OpenPolicy2_state);
7283         NTSTATUS status;
7284         TALLOC_CTX *mem_ctx;
7285
7286         if (state->out_mem_ctx) {
7287                 mem_ctx = state->out_mem_ctx;
7288         } else {
7289                 mem_ctx = state;
7290         }
7291
7292         status = state->dispatch_recv(subreq, mem_ctx);
7293         TALLOC_FREE(subreq);
7294         if (!NT_STATUS_IS_OK(status)) {
7295                 tevent_req_nterror(req, status);
7296                 return;
7297         }
7298
7299         /* Copy out parameters */
7300         *state->orig.out.handle = *state->tmp.out.handle;
7301
7302         /* Copy result */
7303         state->orig.out.result = state->tmp.out.result;
7304
7305         /* Reset temporary structure */
7306         ZERO_STRUCT(state->tmp);
7307
7308         if (DEBUGLEVEL >= 10) {
7309                 NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy2, &state->orig);
7310         }
7311
7312         tevent_req_done(req);
7313 }
7314
7315 NTSTATUS rpccli_lsa_OpenPolicy2_recv(struct tevent_req *req,
7316                                      TALLOC_CTX *mem_ctx,
7317                                      NTSTATUS *result)
7318 {
7319         struct rpccli_lsa_OpenPolicy2_state *state = tevent_req_data(
7320                 req, struct rpccli_lsa_OpenPolicy2_state);
7321         NTSTATUS status;
7322
7323         if (tevent_req_is_nterror(req, &status)) {
7324                 tevent_req_received(req);
7325                 return status;
7326         }
7327
7328         /* Steal possbile out parameters to the callers context */
7329         talloc_steal(mem_ctx, state->out_mem_ctx);
7330
7331         /* Return result */
7332         *result = state->orig.out.result;
7333
7334         tevent_req_received(req);
7335         return NT_STATUS_OK;
7336 }
7337
7338 NTSTATUS rpccli_lsa_OpenPolicy2(struct rpc_pipe_client *cli,
7339                                 TALLOC_CTX *mem_ctx,
7340                                 const char *system_name /* [in] [unique,charset(UTF16)] */,
7341                                 struct lsa_ObjectAttribute *attr /* [in] [ref] */,
7342                                 uint32_t access_mask /* [in]  */,
7343                                 struct policy_handle *handle /* [out] [ref] */)
7344 {
7345         struct lsa_OpenPolicy2 r;
7346         NTSTATUS status;
7347
7348         /* In parameters */
7349         r.in.system_name = system_name;
7350         r.in.attr = attr;
7351         r.in.access_mask = access_mask;
7352
7353         if (DEBUGLEVEL >= 10) {
7354                 NDR_PRINT_IN_DEBUG(lsa_OpenPolicy2, &r);
7355         }
7356
7357         status = cli->dispatch(cli,
7358                                 mem_ctx,
7359                                 &ndr_table_lsarpc,
7360                                 NDR_LSA_OPENPOLICY2,
7361                                 &r);
7362
7363         if (!NT_STATUS_IS_OK(status)) {
7364                 return status;
7365         }
7366
7367         if (DEBUGLEVEL >= 10) {
7368                 NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy2, &r);
7369         }
7370
7371         if (NT_STATUS_IS_ERR(status)) {
7372                 return status;
7373         }
7374
7375         /* Return variables */
7376         *handle = *r.out.handle;
7377
7378         /* Return result */
7379         return r.out.result;
7380 }
7381
7382 struct rpccli_lsa_GetUserName_state {
7383         struct lsa_GetUserName orig;
7384         struct lsa_GetUserName tmp;
7385         TALLOC_CTX *out_mem_ctx;
7386         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7387 };
7388
7389 static void rpccli_lsa_GetUserName_done(struct tevent_req *subreq);
7390
7391 struct tevent_req *rpccli_lsa_GetUserName_send(TALLOC_CTX *mem_ctx,
7392                                                struct tevent_context *ev,
7393                                                struct rpc_pipe_client *cli,
7394                                                const char *_system_name /* [in] [unique,charset(UTF16)] */,
7395                                                struct lsa_String **_account_name /* [in,out] [ref] */,
7396                                                struct lsa_String **_authority_name /* [in,out] [unique] */)
7397 {
7398         struct tevent_req *req;
7399         struct rpccli_lsa_GetUserName_state *state;
7400         struct tevent_req *subreq;
7401
7402         req = tevent_req_create(mem_ctx, &state,
7403                                 struct rpccli_lsa_GetUserName_state);
7404         if (req == NULL) {
7405                 return NULL;
7406         }
7407         state->out_mem_ctx = NULL;
7408         state->dispatch_recv = cli->dispatch_recv;
7409
7410         /* In parameters */
7411         state->orig.in.system_name = _system_name;
7412         state->orig.in.account_name = _account_name;
7413         state->orig.in.authority_name = _authority_name;
7414
7415         /* Out parameters */
7416         state->orig.out.account_name = _account_name;
7417         state->orig.out.authority_name = _authority_name;
7418
7419         /* Result */
7420         ZERO_STRUCT(state->orig.out.result);
7421
7422         if (DEBUGLEVEL >= 10) {
7423                 NDR_PRINT_IN_DEBUG(lsa_GetUserName, &state->orig);
7424         }
7425
7426         state->out_mem_ctx = talloc_named_const(state, 0,
7427                              "rpccli_lsa_GetUserName_out_memory");
7428         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7429                 return tevent_req_post(req, ev);
7430         }
7431
7432         /* make a temporary copy, that we pass to the dispatch function */
7433         state->tmp = state->orig;
7434
7435         subreq = cli->dispatch_send(state, ev, cli,
7436                                     &ndr_table_lsarpc,
7437                                     NDR_LSA_GETUSERNAME,
7438                                     &state->tmp);
7439         if (tevent_req_nomem(subreq, req)) {
7440                 return tevent_req_post(req, ev);
7441         }
7442         tevent_req_set_callback(subreq, rpccli_lsa_GetUserName_done, req);
7443         return req;
7444 }
7445
7446 static void rpccli_lsa_GetUserName_done(struct tevent_req *subreq)
7447 {
7448         struct tevent_req *req = tevent_req_callback_data(
7449                 subreq, struct tevent_req);
7450         struct rpccli_lsa_GetUserName_state *state = tevent_req_data(
7451                 req, struct rpccli_lsa_GetUserName_state);
7452         NTSTATUS status;
7453         TALLOC_CTX *mem_ctx;
7454
7455         if (state->out_mem_ctx) {
7456                 mem_ctx = state->out_mem_ctx;
7457         } else {
7458                 mem_ctx = state;
7459         }
7460
7461         status = state->dispatch_recv(subreq, mem_ctx);
7462         TALLOC_FREE(subreq);
7463         if (!NT_STATUS_IS_OK(status)) {
7464                 tevent_req_nterror(req, status);
7465                 return;
7466         }
7467
7468         /* Copy out parameters */
7469         *state->orig.out.account_name = *state->tmp.out.account_name;
7470         if (state->orig.out.authority_name && state->tmp.out.authority_name) {
7471                 *state->orig.out.authority_name = *state->tmp.out.authority_name;
7472         }
7473
7474         /* Copy result */
7475         state->orig.out.result = state->tmp.out.result;
7476
7477         /* Reset temporary structure */
7478         ZERO_STRUCT(state->tmp);
7479
7480         if (DEBUGLEVEL >= 10) {
7481                 NDR_PRINT_OUT_DEBUG(lsa_GetUserName, &state->orig);
7482         }
7483
7484         tevent_req_done(req);
7485 }
7486
7487 NTSTATUS rpccli_lsa_GetUserName_recv(struct tevent_req *req,
7488                                      TALLOC_CTX *mem_ctx,
7489                                      NTSTATUS *result)
7490 {
7491         struct rpccli_lsa_GetUserName_state *state = tevent_req_data(
7492                 req, struct rpccli_lsa_GetUserName_state);
7493         NTSTATUS status;
7494
7495         if (tevent_req_is_nterror(req, &status)) {
7496                 tevent_req_received(req);
7497                 return status;
7498         }
7499
7500         /* Steal possbile out parameters to the callers context */
7501         talloc_steal(mem_ctx, state->out_mem_ctx);
7502
7503         /* Return result */
7504         *result = state->orig.out.result;
7505
7506         tevent_req_received(req);
7507         return NT_STATUS_OK;
7508 }
7509
7510 NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli,
7511                                 TALLOC_CTX *mem_ctx,
7512                                 const char *system_name /* [in] [unique,charset(UTF16)] */,
7513                                 struct lsa_String **account_name /* [in,out] [ref] */,
7514                                 struct lsa_String **authority_name /* [in,out] [unique] */)
7515 {
7516         struct lsa_GetUserName r;
7517         NTSTATUS status;
7518
7519         /* In parameters */
7520         r.in.system_name = system_name;
7521         r.in.account_name = account_name;
7522         r.in.authority_name = authority_name;
7523
7524         if (DEBUGLEVEL >= 10) {
7525                 NDR_PRINT_IN_DEBUG(lsa_GetUserName, &r);
7526         }
7527
7528         status = cli->dispatch(cli,
7529                                 mem_ctx,
7530                                 &ndr_table_lsarpc,
7531                                 NDR_LSA_GETUSERNAME,
7532                                 &r);
7533
7534         if (!NT_STATUS_IS_OK(status)) {
7535                 return status;
7536         }
7537
7538         if (DEBUGLEVEL >= 10) {
7539                 NDR_PRINT_OUT_DEBUG(lsa_GetUserName, &r);
7540         }
7541
7542         if (NT_STATUS_IS_ERR(status)) {
7543                 return status;
7544         }
7545
7546         /* Return variables */
7547         *account_name = *r.out.account_name;
7548         if (authority_name && r.out.authority_name) {
7549                 *authority_name = *r.out.authority_name;
7550         }
7551
7552         /* Return result */
7553         return r.out.result;
7554 }
7555
7556 struct rpccli_lsa_QueryInfoPolicy2_state {
7557         struct lsa_QueryInfoPolicy2 orig;
7558         struct lsa_QueryInfoPolicy2 tmp;
7559         TALLOC_CTX *out_mem_ctx;
7560         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7561 };
7562
7563 static void rpccli_lsa_QueryInfoPolicy2_done(struct tevent_req *subreq);
7564
7565 struct tevent_req *rpccli_lsa_QueryInfoPolicy2_send(TALLOC_CTX *mem_ctx,
7566                                                     struct tevent_context *ev,
7567                                                     struct rpc_pipe_client *cli,
7568                                                     struct policy_handle *_handle /* [in] [ref] */,
7569                                                     enum lsa_PolicyInfo _level /* [in]  */,
7570                                                     union lsa_PolicyInformation **_info /* [out] [ref,switch_is(level)] */)
7571 {
7572         struct tevent_req *req;
7573         struct rpccli_lsa_QueryInfoPolicy2_state *state;
7574         struct tevent_req *subreq;
7575
7576         req = tevent_req_create(mem_ctx, &state,
7577                                 struct rpccli_lsa_QueryInfoPolicy2_state);
7578         if (req == NULL) {
7579                 return NULL;
7580         }
7581         state->out_mem_ctx = NULL;
7582         state->dispatch_recv = cli->dispatch_recv;
7583
7584         /* In parameters */
7585         state->orig.in.handle = _handle;
7586         state->orig.in.level = _level;
7587
7588         /* Out parameters */
7589         state->orig.out.info = _info;
7590
7591         /* Result */
7592         ZERO_STRUCT(state->orig.out.result);
7593
7594         if (DEBUGLEVEL >= 10) {
7595                 NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy2, &state->orig);
7596         }
7597
7598         state->out_mem_ctx = talloc_named_const(state, 0,
7599                              "rpccli_lsa_QueryInfoPolicy2_out_memory");
7600         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7601                 return tevent_req_post(req, ev);
7602         }
7603
7604         /* make a temporary copy, that we pass to the dispatch function */
7605         state->tmp = state->orig;
7606
7607         subreq = cli->dispatch_send(state, ev, cli,
7608                                     &ndr_table_lsarpc,
7609                                     NDR_LSA_QUERYINFOPOLICY2,
7610                                     &state->tmp);
7611         if (tevent_req_nomem(subreq, req)) {
7612                 return tevent_req_post(req, ev);
7613         }
7614         tevent_req_set_callback(subreq, rpccli_lsa_QueryInfoPolicy2_done, req);
7615         return req;
7616 }
7617
7618 static void rpccli_lsa_QueryInfoPolicy2_done(struct tevent_req *subreq)
7619 {
7620         struct tevent_req *req = tevent_req_callback_data(
7621                 subreq, struct tevent_req);
7622         struct rpccli_lsa_QueryInfoPolicy2_state *state = tevent_req_data(
7623                 req, struct rpccli_lsa_QueryInfoPolicy2_state);
7624         NTSTATUS status;
7625         TALLOC_CTX *mem_ctx;
7626
7627         if (state->out_mem_ctx) {
7628                 mem_ctx = state->out_mem_ctx;
7629         } else {
7630                 mem_ctx = state;
7631         }
7632
7633         status = state->dispatch_recv(subreq, mem_ctx);
7634         TALLOC_FREE(subreq);
7635         if (!NT_STATUS_IS_OK(status)) {
7636                 tevent_req_nterror(req, status);
7637                 return;
7638         }
7639
7640         /* Copy out parameters */
7641         *state->orig.out.info = *state->tmp.out.info;
7642
7643         /* Copy result */
7644         state->orig.out.result = state->tmp.out.result;
7645
7646         /* Reset temporary structure */
7647         ZERO_STRUCT(state->tmp);
7648
7649         if (DEBUGLEVEL >= 10) {
7650                 NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy2, &state->orig);
7651         }
7652
7653         tevent_req_done(req);
7654 }
7655
7656 NTSTATUS rpccli_lsa_QueryInfoPolicy2_recv(struct tevent_req *req,
7657                                           TALLOC_CTX *mem_ctx,
7658                                           NTSTATUS *result)
7659 {
7660         struct rpccli_lsa_QueryInfoPolicy2_state *state = tevent_req_data(
7661                 req, struct rpccli_lsa_QueryInfoPolicy2_state);
7662         NTSTATUS status;
7663
7664         if (tevent_req_is_nterror(req, &status)) {
7665                 tevent_req_received(req);
7666                 return status;
7667         }
7668
7669         /* Steal possbile out parameters to the callers context */
7670         talloc_steal(mem_ctx, state->out_mem_ctx);
7671
7672         /* Return result */
7673         *result = state->orig.out.result;
7674
7675         tevent_req_received(req);
7676         return NT_STATUS_OK;
7677 }
7678
7679 NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli,
7680                                      TALLOC_CTX *mem_ctx,
7681                                      struct policy_handle *handle /* [in] [ref] */,
7682                                      enum lsa_PolicyInfo level /* [in]  */,
7683                                      union lsa_PolicyInformation **info /* [out] [ref,switch_is(level)] */)
7684 {
7685         struct lsa_QueryInfoPolicy2 r;
7686         NTSTATUS status;
7687
7688         /* In parameters */
7689         r.in.handle = handle;
7690         r.in.level = level;
7691
7692         if (DEBUGLEVEL >= 10) {
7693                 NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy2, &r);
7694         }
7695
7696         status = cli->dispatch(cli,
7697                                 mem_ctx,
7698                                 &ndr_table_lsarpc,
7699                                 NDR_LSA_QUERYINFOPOLICY2,
7700                                 &r);
7701
7702         if (!NT_STATUS_IS_OK(status)) {
7703                 return status;
7704         }
7705
7706         if (DEBUGLEVEL >= 10) {
7707                 NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy2, &r);
7708         }
7709
7710         if (NT_STATUS_IS_ERR(status)) {
7711                 return status;
7712         }
7713
7714         /* Return variables */
7715         *info = *r.out.info;
7716
7717         /* Return result */
7718         return r.out.result;
7719 }
7720
7721 struct rpccli_lsa_SetInfoPolicy2_state {
7722         struct lsa_SetInfoPolicy2 orig;
7723         struct lsa_SetInfoPolicy2 tmp;
7724         TALLOC_CTX *out_mem_ctx;
7725         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7726 };
7727
7728 static void rpccli_lsa_SetInfoPolicy2_done(struct tevent_req *subreq);
7729
7730 struct tevent_req *rpccli_lsa_SetInfoPolicy2_send(TALLOC_CTX *mem_ctx,
7731                                                   struct tevent_context *ev,
7732                                                   struct rpc_pipe_client *cli,
7733                                                   struct policy_handle *_handle /* [in] [ref] */,
7734                                                   enum lsa_PolicyInfo _level /* [in]  */,
7735                                                   union lsa_PolicyInformation *_info /* [in] [ref,switch_is(level)] */)
7736 {
7737         struct tevent_req *req;
7738         struct rpccli_lsa_SetInfoPolicy2_state *state;
7739         struct tevent_req *subreq;
7740
7741         req = tevent_req_create(mem_ctx, &state,
7742                                 struct rpccli_lsa_SetInfoPolicy2_state);
7743         if (req == NULL) {
7744                 return NULL;
7745         }
7746         state->out_mem_ctx = NULL;
7747         state->dispatch_recv = cli->dispatch_recv;
7748
7749         /* In parameters */
7750         state->orig.in.handle = _handle;
7751         state->orig.in.level = _level;
7752         state->orig.in.info = _info;
7753
7754         /* Out parameters */
7755
7756         /* Result */
7757         ZERO_STRUCT(state->orig.out.result);
7758
7759         if (DEBUGLEVEL >= 10) {
7760                 NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy2, &state->orig);
7761         }
7762
7763         /* make a temporary copy, that we pass to the dispatch function */
7764         state->tmp = state->orig;
7765
7766         subreq = cli->dispatch_send(state, ev, cli,
7767                                     &ndr_table_lsarpc,
7768                                     NDR_LSA_SETINFOPOLICY2,
7769                                     &state->tmp);
7770         if (tevent_req_nomem(subreq, req)) {
7771                 return tevent_req_post(req, ev);
7772         }
7773         tevent_req_set_callback(subreq, rpccli_lsa_SetInfoPolicy2_done, req);
7774         return req;
7775 }
7776
7777 static void rpccli_lsa_SetInfoPolicy2_done(struct tevent_req *subreq)
7778 {
7779         struct tevent_req *req = tevent_req_callback_data(
7780                 subreq, struct tevent_req);
7781         struct rpccli_lsa_SetInfoPolicy2_state *state = tevent_req_data(
7782                 req, struct rpccli_lsa_SetInfoPolicy2_state);
7783         NTSTATUS status;
7784         TALLOC_CTX *mem_ctx;
7785
7786         if (state->out_mem_ctx) {
7787                 mem_ctx = state->out_mem_ctx;
7788         } else {
7789                 mem_ctx = state;
7790         }
7791
7792         status = state->dispatch_recv(subreq, mem_ctx);
7793         TALLOC_FREE(subreq);
7794         if (!NT_STATUS_IS_OK(status)) {
7795                 tevent_req_nterror(req, status);
7796                 return;
7797         }
7798
7799         /* Copy out parameters */
7800
7801         /* Copy result */
7802         state->orig.out.result = state->tmp.out.result;
7803
7804         /* Reset temporary structure */
7805         ZERO_STRUCT(state->tmp);
7806
7807         if (DEBUGLEVEL >= 10) {
7808                 NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy2, &state->orig);
7809         }
7810
7811         tevent_req_done(req);
7812 }
7813
7814 NTSTATUS rpccli_lsa_SetInfoPolicy2_recv(struct tevent_req *req,
7815                                         TALLOC_CTX *mem_ctx,
7816                                         NTSTATUS *result)
7817 {
7818         struct rpccli_lsa_SetInfoPolicy2_state *state = tevent_req_data(
7819                 req, struct rpccli_lsa_SetInfoPolicy2_state);
7820         NTSTATUS status;
7821
7822         if (tevent_req_is_nterror(req, &status)) {
7823                 tevent_req_received(req);
7824                 return status;
7825         }
7826
7827         /* Steal possbile out parameters to the callers context */
7828         talloc_steal(mem_ctx, state->out_mem_ctx);
7829
7830         /* Return result */
7831         *result = state->orig.out.result;
7832
7833         tevent_req_received(req);
7834         return NT_STATUS_OK;
7835 }
7836
7837 NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli,
7838                                    TALLOC_CTX *mem_ctx,
7839                                    struct policy_handle *handle /* [in] [ref] */,
7840                                    enum lsa_PolicyInfo level /* [in]  */,
7841                                    union lsa_PolicyInformation *info /* [in] [ref,switch_is(level)] */)
7842 {
7843         struct lsa_SetInfoPolicy2 r;
7844         NTSTATUS status;
7845
7846         /* In parameters */
7847         r.in.handle = handle;
7848         r.in.level = level;
7849         r.in.info = info;
7850
7851         if (DEBUGLEVEL >= 10) {
7852                 NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy2, &r);
7853         }
7854
7855         status = cli->dispatch(cli,
7856                                 mem_ctx,
7857                                 &ndr_table_lsarpc,
7858                                 NDR_LSA_SETINFOPOLICY2,
7859                                 &r);
7860
7861         if (!NT_STATUS_IS_OK(status)) {
7862                 return status;
7863         }
7864
7865         if (DEBUGLEVEL >= 10) {
7866                 NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy2, &r);
7867         }
7868
7869         if (NT_STATUS_IS_ERR(status)) {
7870                 return status;
7871         }
7872
7873         /* Return variables */
7874
7875         /* Return result */
7876         return r.out.result;
7877 }
7878
7879 struct rpccli_lsa_QueryTrustedDomainInfoByName_state {
7880         struct lsa_QueryTrustedDomainInfoByName orig;
7881         struct lsa_QueryTrustedDomainInfoByName tmp;
7882         TALLOC_CTX *out_mem_ctx;
7883         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7884 };
7885
7886 static void rpccli_lsa_QueryTrustedDomainInfoByName_done(struct tevent_req *subreq);
7887
7888 struct tevent_req *rpccli_lsa_QueryTrustedDomainInfoByName_send(TALLOC_CTX *mem_ctx,
7889                                                                 struct tevent_context *ev,
7890                                                                 struct rpc_pipe_client *cli,
7891                                                                 struct policy_handle *_handle /* [in] [ref] */,
7892                                                                 struct lsa_String *_trusted_domain /* [in] [ref] */,
7893                                                                 enum lsa_TrustDomInfoEnum _level /* [in]  */,
7894                                                                 union lsa_TrustedDomainInfo **_info /* [out] [ref,switch_is(level)] */)
7895 {
7896         struct tevent_req *req;
7897         struct rpccli_lsa_QueryTrustedDomainInfoByName_state *state;
7898         struct tevent_req *subreq;
7899
7900         req = tevent_req_create(mem_ctx, &state,
7901                                 struct rpccli_lsa_QueryTrustedDomainInfoByName_state);
7902         if (req == NULL) {
7903                 return NULL;
7904         }
7905         state->out_mem_ctx = NULL;
7906         state->dispatch_recv = cli->dispatch_recv;
7907
7908         /* In parameters */
7909         state->orig.in.handle = _handle;
7910         state->orig.in.trusted_domain = _trusted_domain;
7911         state->orig.in.level = _level;
7912
7913         /* Out parameters */
7914         state->orig.out.info = _info;
7915
7916         /* Result */
7917         ZERO_STRUCT(state->orig.out.result);
7918
7919         if (DEBUGLEVEL >= 10) {
7920                 NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoByName, &state->orig);
7921         }
7922
7923         state->out_mem_ctx = talloc_named_const(state, 0,
7924                              "rpccli_lsa_QueryTrustedDomainInfoByName_out_memory");
7925         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7926                 return tevent_req_post(req, ev);
7927         }
7928
7929         /* make a temporary copy, that we pass to the dispatch function */
7930         state->tmp = state->orig;
7931
7932         subreq = cli->dispatch_send(state, ev, cli,
7933                                     &ndr_table_lsarpc,
7934                                     NDR_LSA_QUERYTRUSTEDDOMAININFOBYNAME,
7935                                     &state->tmp);
7936         if (tevent_req_nomem(subreq, req)) {
7937                 return tevent_req_post(req, ev);
7938         }
7939         tevent_req_set_callback(subreq, rpccli_lsa_QueryTrustedDomainInfoByName_done, req);
7940         return req;
7941 }
7942
7943 static void rpccli_lsa_QueryTrustedDomainInfoByName_done(struct tevent_req *subreq)
7944 {
7945         struct tevent_req *req = tevent_req_callback_data(
7946                 subreq, struct tevent_req);
7947         struct rpccli_lsa_QueryTrustedDomainInfoByName_state *state = tevent_req_data(
7948                 req, struct rpccli_lsa_QueryTrustedDomainInfoByName_state);
7949         NTSTATUS status;
7950         TALLOC_CTX *mem_ctx;
7951
7952         if (state->out_mem_ctx) {
7953                 mem_ctx = state->out_mem_ctx;
7954         } else {
7955                 mem_ctx = state;
7956         }
7957
7958         status = state->dispatch_recv(subreq, mem_ctx);
7959         TALLOC_FREE(subreq);
7960         if (!NT_STATUS_IS_OK(status)) {
7961                 tevent_req_nterror(req, status);
7962                 return;
7963         }
7964
7965         /* Copy out parameters */
7966         *state->orig.out.info = *state->tmp.out.info;
7967
7968         /* Copy result */
7969         state->orig.out.result = state->tmp.out.result;
7970
7971         /* Reset temporary structure */
7972         ZERO_STRUCT(state->tmp);
7973
7974         if (DEBUGLEVEL >= 10) {
7975                 NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoByName, &state->orig);
7976         }
7977
7978         tevent_req_done(req);
7979 }
7980
7981 NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName_recv(struct tevent_req *req,
7982                                                       TALLOC_CTX *mem_ctx,
7983                                                       NTSTATUS *result)
7984 {
7985         struct rpccli_lsa_QueryTrustedDomainInfoByName_state *state = tevent_req_data(
7986                 req, struct rpccli_lsa_QueryTrustedDomainInfoByName_state);
7987         NTSTATUS status;
7988
7989         if (tevent_req_is_nterror(req, &status)) {
7990                 tevent_req_received(req);
7991                 return status;
7992         }
7993
7994         /* Steal possbile out parameters to the callers context */
7995         talloc_steal(mem_ctx, state->out_mem_ctx);
7996
7997         /* Return result */
7998         *result = state->orig.out.result;
7999
8000         tevent_req_received(req);
8001         return NT_STATUS_OK;
8002 }
8003
8004 NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli,
8005                                                  TALLOC_CTX *mem_ctx,
8006                                                  struct policy_handle *handle /* [in] [ref] */,
8007                                                  struct lsa_String *trusted_domain /* [in] [ref] */,
8008                                                  enum lsa_TrustDomInfoEnum level /* [in]  */,
8009                                                  union lsa_TrustedDomainInfo **info /* [out] [ref,switch_is(level)] */)
8010 {
8011         struct lsa_QueryTrustedDomainInfoByName r;
8012         NTSTATUS status;
8013
8014         /* In parameters */
8015         r.in.handle = handle;
8016         r.in.trusted_domain = trusted_domain;
8017         r.in.level = level;
8018
8019         if (DEBUGLEVEL >= 10) {
8020                 NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoByName, &r);
8021         }
8022
8023         status = cli->dispatch(cli,
8024                                 mem_ctx,
8025                                 &ndr_table_lsarpc,
8026                                 NDR_LSA_QUERYTRUSTEDDOMAININFOBYNAME,
8027                                 &r);
8028
8029         if (!NT_STATUS_IS_OK(status)) {
8030                 return status;
8031         }
8032
8033         if (DEBUGLEVEL >= 10) {
8034                 NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoByName, &r);
8035         }
8036
8037         if (NT_STATUS_IS_ERR(status)) {
8038                 return status;
8039         }
8040
8041         /* Return variables */
8042         *info = *r.out.info;
8043
8044         /* Return result */
8045         return r.out.result;
8046 }
8047
8048 struct rpccli_lsa_SetTrustedDomainInfoByName_state {
8049         struct lsa_SetTrustedDomainInfoByName orig;
8050         struct lsa_SetTrustedDomainInfoByName tmp;
8051         TALLOC_CTX *out_mem_ctx;
8052         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8053 };
8054
8055 static void rpccli_lsa_SetTrustedDomainInfoByName_done(struct tevent_req *subreq);
8056
8057 struct tevent_req *rpccli_lsa_SetTrustedDomainInfoByName_send(TALLOC_CTX *mem_ctx,
8058                                                               struct tevent_context *ev,
8059                                                               struct rpc_pipe_client *cli,
8060                                                               struct policy_handle *_handle /* [in] [ref] */,
8061                                                               struct lsa_String _trusted_domain /* [in]  */,
8062                                                               enum lsa_TrustDomInfoEnum _level /* [in]  */,
8063                                                               union lsa_TrustedDomainInfo *_info /* [in] [unique,switch_is(level)] */)
8064 {
8065         struct tevent_req *req;
8066         struct rpccli_lsa_SetTrustedDomainInfoByName_state *state;
8067         struct tevent_req *subreq;
8068
8069         req = tevent_req_create(mem_ctx, &state,
8070                                 struct rpccli_lsa_SetTrustedDomainInfoByName_state);
8071         if (req == NULL) {
8072                 return NULL;
8073         }
8074         state->out_mem_ctx = NULL;
8075         state->dispatch_recv = cli->dispatch_recv;
8076
8077         /* In parameters */
8078         state->orig.in.handle = _handle;
8079         state->orig.in.trusted_domain = _trusted_domain;
8080         state->orig.in.level = _level;
8081         state->orig.in.info = _info;
8082
8083         /* Out parameters */
8084
8085         /* Result */
8086         ZERO_STRUCT(state->orig.out.result);
8087
8088         if (DEBUGLEVEL >= 10) {
8089                 NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfoByName, &state->orig);
8090         }
8091
8092         /* make a temporary copy, that we pass to the dispatch function */
8093         state->tmp = state->orig;
8094
8095         subreq = cli->dispatch_send(state, ev, cli,
8096                                     &ndr_table_lsarpc,
8097                                     NDR_LSA_SETTRUSTEDDOMAININFOBYNAME,
8098                                     &state->tmp);
8099         if (tevent_req_nomem(subreq, req)) {
8100                 return tevent_req_post(req, ev);
8101         }
8102         tevent_req_set_callback(subreq, rpccli_lsa_SetTrustedDomainInfoByName_done, req);
8103         return req;
8104 }
8105
8106 static void rpccli_lsa_SetTrustedDomainInfoByName_done(struct tevent_req *subreq)
8107 {
8108         struct tevent_req *req = tevent_req_callback_data(
8109                 subreq, struct tevent_req);
8110         struct rpccli_lsa_SetTrustedDomainInfoByName_state *state = tevent_req_data(
8111                 req, struct rpccli_lsa_SetTrustedDomainInfoByName_state);
8112         NTSTATUS status;
8113         TALLOC_CTX *mem_ctx;
8114
8115         if (state->out_mem_ctx) {
8116                 mem_ctx = state->out_mem_ctx;
8117         } else {
8118                 mem_ctx = state;
8119         }
8120
8121         status = state->dispatch_recv(subreq, mem_ctx);
8122         TALLOC_FREE(subreq);
8123         if (!NT_STATUS_IS_OK(status)) {
8124                 tevent_req_nterror(req, status);
8125                 return;
8126         }
8127
8128         /* Copy out parameters */
8129
8130         /* Copy result */
8131         state->orig.out.result = state->tmp.out.result;
8132
8133         /* Reset temporary structure */
8134         ZERO_STRUCT(state->tmp);
8135
8136         if (DEBUGLEVEL >= 10) {
8137                 NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfoByName, &state->orig);
8138         }
8139
8140         tevent_req_done(req);
8141 }
8142
8143 NTSTATUS rpccli_lsa_SetTrustedDomainInfoByName_recv(struct tevent_req *req,
8144                                                     TALLOC_CTX *mem_ctx,
8145                                                     NTSTATUS *result)
8146 {
8147         struct rpccli_lsa_SetTrustedDomainInfoByName_state *state = tevent_req_data(
8148                 req, struct rpccli_lsa_SetTrustedDomainInfoByName_state);
8149         NTSTATUS status;
8150
8151         if (tevent_req_is_nterror(req, &status)) {
8152                 tevent_req_received(req);
8153                 return status;
8154         }
8155
8156         /* Steal possbile out parameters to the callers context */
8157         talloc_steal(mem_ctx, state->out_mem_ctx);
8158
8159         /* Return result */
8160         *result = state->orig.out.result;
8161
8162         tevent_req_received(req);
8163         return NT_STATUS_OK;
8164 }
8165
8166 NTSTATUS rpccli_lsa_SetTrustedDomainInfoByName(struct rpc_pipe_client *cli,
8167                                                TALLOC_CTX *mem_ctx,
8168                                                struct policy_handle *handle /* [in] [ref] */,
8169                                                struct lsa_String trusted_domain /* [in]  */,
8170                                                enum lsa_TrustDomInfoEnum level /* [in]  */,
8171                                                union lsa_TrustedDomainInfo *info /* [in] [unique,switch_is(level)] */)
8172 {
8173         struct lsa_SetTrustedDomainInfoByName r;
8174         NTSTATUS status;
8175
8176         /* In parameters */
8177         r.in.handle = handle;
8178         r.in.trusted_domain = trusted_domain;
8179         r.in.level = level;
8180         r.in.info = info;
8181
8182         if (DEBUGLEVEL >= 10) {
8183                 NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfoByName, &r);
8184         }
8185
8186         status = cli->dispatch(cli,
8187                                 mem_ctx,
8188                                 &ndr_table_lsarpc,
8189                                 NDR_LSA_SETTRUSTEDDOMAININFOBYNAME,
8190                                 &r);
8191
8192         if (!NT_STATUS_IS_OK(status)) {
8193                 return status;
8194         }
8195
8196         if (DEBUGLEVEL >= 10) {
8197                 NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfoByName, &r);
8198         }
8199
8200         if (NT_STATUS_IS_ERR(status)) {
8201                 return status;
8202         }
8203
8204         /* Return variables */
8205
8206         /* Return result */
8207         return r.out.result;
8208 }
8209
8210 struct rpccli_lsa_EnumTrustedDomainsEx_state {
8211         struct lsa_EnumTrustedDomainsEx orig;
8212         struct lsa_EnumTrustedDomainsEx tmp;
8213         TALLOC_CTX *out_mem_ctx;
8214         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8215 };
8216
8217 static void rpccli_lsa_EnumTrustedDomainsEx_done(struct tevent_req *subreq);
8218
8219 struct tevent_req *rpccli_lsa_EnumTrustedDomainsEx_send(TALLOC_CTX *mem_ctx,
8220                                                         struct tevent_context *ev,
8221                                                         struct rpc_pipe_client *cli,
8222                                                         struct policy_handle *_handle /* [in] [ref] */,
8223                                                         uint32_t *_resume_handle /* [in,out] [ref] */,
8224                                                         struct lsa_DomainListEx *_domains /* [out] [ref] */,
8225                                                         uint32_t _max_size /* [in]  */)
8226 {
8227         struct tevent_req *req;
8228         struct rpccli_lsa_EnumTrustedDomainsEx_state *state;
8229         struct tevent_req *subreq;
8230
8231         req = tevent_req_create(mem_ctx, &state,
8232                                 struct rpccli_lsa_EnumTrustedDomainsEx_state);
8233         if (req == NULL) {
8234                 return NULL;
8235         }
8236         state->out_mem_ctx = NULL;
8237         state->dispatch_recv = cli->dispatch_recv;
8238
8239         /* In parameters */
8240         state->orig.in.handle = _handle;
8241         state->orig.in.resume_handle = _resume_handle;
8242         state->orig.in.max_size = _max_size;
8243
8244         /* Out parameters */
8245         state->orig.out.resume_handle = _resume_handle;
8246         state->orig.out.domains = _domains;
8247
8248         /* Result */
8249         ZERO_STRUCT(state->orig.out.result);
8250
8251         if (DEBUGLEVEL >= 10) {
8252                 NDR_PRINT_IN_DEBUG(lsa_EnumTrustedDomainsEx, &state->orig);
8253         }
8254
8255         state->out_mem_ctx = talloc_named_const(state, 0,
8256                              "rpccli_lsa_EnumTrustedDomainsEx_out_memory");
8257         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8258                 return tevent_req_post(req, ev);
8259         }
8260
8261         /* make a temporary copy, that we pass to the dispatch function */
8262         state->tmp = state->orig;
8263
8264         subreq = cli->dispatch_send(state, ev, cli,
8265                                     &ndr_table_lsarpc,
8266                                     NDR_LSA_ENUMTRUSTEDDOMAINSEX,
8267                                     &state->tmp);
8268         if (tevent_req_nomem(subreq, req)) {
8269                 return tevent_req_post(req, ev);
8270         }
8271         tevent_req_set_callback(subreq, rpccli_lsa_EnumTrustedDomainsEx_done, req);
8272         return req;
8273 }
8274
8275 static void rpccli_lsa_EnumTrustedDomainsEx_done(struct tevent_req *subreq)
8276 {
8277         struct tevent_req *req = tevent_req_callback_data(
8278                 subreq, struct tevent_req);
8279         struct rpccli_lsa_EnumTrustedDomainsEx_state *state = tevent_req_data(
8280                 req, struct rpccli_lsa_EnumTrustedDomainsEx_state);
8281         NTSTATUS status;
8282         TALLOC_CTX *mem_ctx;
8283
8284         if (state->out_mem_ctx) {
8285                 mem_ctx = state->out_mem_ctx;
8286         } else {
8287                 mem_ctx = state;
8288         }
8289
8290         status = state->dispatch_recv(subreq, mem_ctx);
8291         TALLOC_FREE(subreq);
8292         if (!NT_STATUS_IS_OK(status)) {
8293                 tevent_req_nterror(req, status);
8294                 return;
8295         }
8296
8297         /* Copy out parameters */
8298         *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
8299         *state->orig.out.domains = *state->tmp.out.domains;
8300
8301         /* Copy result */
8302         state->orig.out.result = state->tmp.out.result;
8303
8304         /* Reset temporary structure */
8305         ZERO_STRUCT(state->tmp);
8306
8307         if (DEBUGLEVEL >= 10) {
8308                 NDR_PRINT_OUT_DEBUG(lsa_EnumTrustedDomainsEx, &state->orig);
8309         }
8310
8311         tevent_req_done(req);
8312 }
8313
8314 NTSTATUS rpccli_lsa_EnumTrustedDomainsEx_recv(struct tevent_req *req,
8315                                               TALLOC_CTX *mem_ctx,
8316                                               NTSTATUS *result)
8317 {
8318         struct rpccli_lsa_EnumTrustedDomainsEx_state *state = tevent_req_data(
8319                 req, struct rpccli_lsa_EnumTrustedDomainsEx_state);
8320         NTSTATUS status;
8321
8322         if (tevent_req_is_nterror(req, &status)) {
8323                 tevent_req_received(req);
8324                 return status;
8325         }
8326
8327         /* Steal possbile out parameters to the callers context */
8328         talloc_steal(mem_ctx, state->out_mem_ctx);
8329
8330         /* Return result */
8331         *result = state->orig.out.result;
8332
8333         tevent_req_received(req);
8334         return NT_STATUS_OK;
8335 }
8336
8337 NTSTATUS rpccli_lsa_EnumTrustedDomainsEx(struct rpc_pipe_client *cli,
8338                                          TALLOC_CTX *mem_ctx,
8339                                          struct policy_handle *handle /* [in] [ref] */,
8340                                          uint32_t *resume_handle /* [in,out] [ref] */,
8341                                          struct lsa_DomainListEx *domains /* [out] [ref] */,
8342                                          uint32_t max_size /* [in]  */)
8343 {
8344         struct lsa_EnumTrustedDomainsEx r;
8345         NTSTATUS status;
8346
8347         /* In parameters */
8348         r.in.handle = handle;
8349         r.in.resume_handle = resume_handle;
8350         r.in.max_size = max_size;
8351
8352         if (DEBUGLEVEL >= 10) {
8353                 NDR_PRINT_IN_DEBUG(lsa_EnumTrustedDomainsEx, &r);
8354         }
8355
8356         status = cli->dispatch(cli,
8357                                 mem_ctx,
8358                                 &ndr_table_lsarpc,
8359                                 NDR_LSA_ENUMTRUSTEDDOMAINSEX,
8360                                 &r);
8361
8362         if (!NT_STATUS_IS_OK(status)) {
8363                 return status;
8364         }
8365
8366         if (DEBUGLEVEL >= 10) {
8367                 NDR_PRINT_OUT_DEBUG(lsa_EnumTrustedDomainsEx, &r);
8368         }
8369
8370         if (NT_STATUS_IS_ERR(status)) {
8371                 return status;
8372         }
8373
8374         /* Return variables */
8375         *resume_handle = *r.out.resume_handle;
8376         *domains = *r.out.domains;
8377
8378         /* Return result */
8379         return r.out.result;
8380 }
8381
8382 struct rpccli_lsa_CreateTrustedDomainEx_state {
8383         struct lsa_CreateTrustedDomainEx orig;
8384         struct lsa_CreateTrustedDomainEx tmp;
8385         TALLOC_CTX *out_mem_ctx;
8386         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8387 };
8388
8389 static void rpccli_lsa_CreateTrustedDomainEx_done(struct tevent_req *subreq);
8390
8391 struct tevent_req *rpccli_lsa_CreateTrustedDomainEx_send(TALLOC_CTX *mem_ctx,
8392                                                          struct tevent_context *ev,
8393                                                          struct rpc_pipe_client *cli,
8394                                                          struct policy_handle *_policy_handle /* [in] [ref] */,
8395                                                          struct lsa_TrustDomainInfoInfoEx *_info /* [in] [ref] */,
8396                                                          struct lsa_TrustDomainInfoAuthInfoInternal *_auth_info /* [in] [ref] */,
8397                                                          uint32_t _access_mask /* [in]  */,
8398                                                          struct policy_handle *_trustdom_handle /* [out] [ref] */)
8399 {
8400         struct tevent_req *req;
8401         struct rpccli_lsa_CreateTrustedDomainEx_state *state;
8402         struct tevent_req *subreq;
8403
8404         req = tevent_req_create(mem_ctx, &state,
8405                                 struct rpccli_lsa_CreateTrustedDomainEx_state);
8406         if (req == NULL) {
8407                 return NULL;
8408         }
8409         state->out_mem_ctx = NULL;
8410         state->dispatch_recv = cli->dispatch_recv;
8411
8412         /* In parameters */
8413         state->orig.in.policy_handle = _policy_handle;
8414         state->orig.in.info = _info;
8415         state->orig.in.auth_info = _auth_info;
8416         state->orig.in.access_mask = _access_mask;
8417
8418         /* Out parameters */
8419         state->orig.out.trustdom_handle = _trustdom_handle;
8420
8421         /* Result */
8422         ZERO_STRUCT(state->orig.out.result);
8423
8424         if (DEBUGLEVEL >= 10) {
8425                 NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx, &state->orig);
8426         }
8427
8428         state->out_mem_ctx = talloc_named_const(state, 0,
8429                              "rpccli_lsa_CreateTrustedDomainEx_out_memory");
8430         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8431                 return tevent_req_post(req, ev);
8432         }
8433
8434         /* make a temporary copy, that we pass to the dispatch function */
8435         state->tmp = state->orig;
8436
8437         subreq = cli->dispatch_send(state, ev, cli,
8438                                     &ndr_table_lsarpc,
8439                                     NDR_LSA_CREATETRUSTEDDOMAINEX,
8440                                     &state->tmp);
8441         if (tevent_req_nomem(subreq, req)) {
8442                 return tevent_req_post(req, ev);
8443         }
8444         tevent_req_set_callback(subreq, rpccli_lsa_CreateTrustedDomainEx_done, req);
8445         return req;
8446 }
8447
8448 static void rpccli_lsa_CreateTrustedDomainEx_done(struct tevent_req *subreq)
8449 {
8450         struct tevent_req *req = tevent_req_callback_data(
8451                 subreq, struct tevent_req);
8452         struct rpccli_lsa_CreateTrustedDomainEx_state *state = tevent_req_data(
8453                 req, struct rpccli_lsa_CreateTrustedDomainEx_state);
8454         NTSTATUS status;
8455         TALLOC_CTX *mem_ctx;
8456
8457         if (state->out_mem_ctx) {
8458                 mem_ctx = state->out_mem_ctx;
8459         } else {
8460                 mem_ctx = state;
8461         }
8462
8463         status = state->dispatch_recv(subreq, mem_ctx);
8464         TALLOC_FREE(subreq);
8465         if (!NT_STATUS_IS_OK(status)) {
8466                 tevent_req_nterror(req, status);
8467                 return;
8468         }
8469
8470         /* Copy out parameters */
8471         *state->orig.out.trustdom_handle = *state->tmp.out.trustdom_handle;
8472
8473         /* Copy result */
8474         state->orig.out.result = state->tmp.out.result;
8475
8476         /* Reset temporary structure */
8477         ZERO_STRUCT(state->tmp);
8478
8479         if (DEBUGLEVEL >= 10) {
8480                 NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx, &state->orig);
8481         }
8482
8483         tevent_req_done(req);
8484 }
8485
8486 NTSTATUS rpccli_lsa_CreateTrustedDomainEx_recv(struct tevent_req *req,
8487                                                TALLOC_CTX *mem_ctx,
8488                                                NTSTATUS *result)
8489 {
8490         struct rpccli_lsa_CreateTrustedDomainEx_state *state = tevent_req_data(
8491                 req, struct rpccli_lsa_CreateTrustedDomainEx_state);
8492         NTSTATUS status;
8493
8494         if (tevent_req_is_nterror(req, &status)) {
8495                 tevent_req_received(req);
8496                 return status;
8497         }
8498
8499         /* Steal possbile out parameters to the callers context */
8500         talloc_steal(mem_ctx, state->out_mem_ctx);
8501
8502         /* Return result */
8503         *result = state->orig.out.result;
8504
8505         tevent_req_received(req);
8506         return NT_STATUS_OK;
8507 }
8508
8509 NTSTATUS rpccli_lsa_CreateTrustedDomainEx(struct rpc_pipe_client *cli,
8510                                           TALLOC_CTX *mem_ctx,
8511                                           struct policy_handle *policy_handle /* [in] [ref] */,
8512                                           struct lsa_TrustDomainInfoInfoEx *info /* [in] [ref] */,
8513                                           struct lsa_TrustDomainInfoAuthInfoInternal *auth_info /* [in] [ref] */,
8514                                           uint32_t access_mask /* [in]  */,
8515                                           struct policy_handle *trustdom_handle /* [out] [ref] */)
8516 {
8517         struct lsa_CreateTrustedDomainEx r;
8518         NTSTATUS status;
8519
8520         /* In parameters */
8521         r.in.policy_handle = policy_handle;
8522         r.in.info = info;
8523         r.in.auth_info = auth_info;
8524         r.in.access_mask = access_mask;
8525
8526         if (DEBUGLEVEL >= 10) {
8527                 NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx, &r);
8528         }
8529
8530         status = cli->dispatch(cli,
8531                                 mem_ctx,
8532                                 &ndr_table_lsarpc,
8533                                 NDR_LSA_CREATETRUSTEDDOMAINEX,
8534                                 &r);
8535
8536         if (!NT_STATUS_IS_OK(status)) {
8537                 return status;
8538         }
8539
8540         if (DEBUGLEVEL >= 10) {
8541                 NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx, &r);
8542         }
8543
8544         if (NT_STATUS_IS_ERR(status)) {
8545                 return status;
8546         }
8547
8548         /* Return variables */
8549         *trustdom_handle = *r.out.trustdom_handle;
8550
8551         /* Return result */
8552         return r.out.result;
8553 }
8554
8555 struct rpccli_lsa_CloseTrustedDomainEx_state {
8556         struct lsa_CloseTrustedDomainEx orig;
8557         struct lsa_CloseTrustedDomainEx tmp;
8558         TALLOC_CTX *out_mem_ctx;
8559         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8560 };
8561
8562 static void rpccli_lsa_CloseTrustedDomainEx_done(struct tevent_req *subreq);
8563
8564 struct tevent_req *rpccli_lsa_CloseTrustedDomainEx_send(TALLOC_CTX *mem_ctx,
8565                                                         struct tevent_context *ev,
8566                                                         struct rpc_pipe_client *cli,
8567                                                         struct policy_handle *_handle /* [in,out] [ref] */)
8568 {
8569         struct tevent_req *req;
8570         struct rpccli_lsa_CloseTrustedDomainEx_state *state;
8571         struct tevent_req *subreq;
8572
8573         req = tevent_req_create(mem_ctx, &state,
8574                                 struct rpccli_lsa_CloseTrustedDomainEx_state);
8575         if (req == NULL) {
8576                 return NULL;
8577         }
8578         state->out_mem_ctx = NULL;
8579         state->dispatch_recv = cli->dispatch_recv;
8580
8581         /* In parameters */
8582         state->orig.in.handle = _handle;
8583
8584         /* Out parameters */
8585         state->orig.out.handle = _handle;
8586
8587         /* Result */
8588         ZERO_STRUCT(state->orig.out.result);
8589
8590         if (DEBUGLEVEL >= 10) {
8591                 NDR_PRINT_IN_DEBUG(lsa_CloseTrustedDomainEx, &state->orig);
8592         }
8593
8594         state->out_mem_ctx = talloc_named_const(state, 0,
8595                              "rpccli_lsa_CloseTrustedDomainEx_out_memory");
8596         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8597                 return tevent_req_post(req, ev);
8598         }
8599
8600         /* make a temporary copy, that we pass to the dispatch function */
8601         state->tmp = state->orig;
8602
8603         subreq = cli->dispatch_send(state, ev, cli,
8604                                     &ndr_table_lsarpc,
8605                                     NDR_LSA_CLOSETRUSTEDDOMAINEX,
8606                                     &state->tmp);
8607         if (tevent_req_nomem(subreq, req)) {
8608                 return tevent_req_post(req, ev);
8609         }
8610         tevent_req_set_callback(subreq, rpccli_lsa_CloseTrustedDomainEx_done, req);
8611         return req;
8612 }
8613
8614 static void rpccli_lsa_CloseTrustedDomainEx_done(struct tevent_req *subreq)
8615 {
8616         struct tevent_req *req = tevent_req_callback_data(
8617                 subreq, struct tevent_req);
8618         struct rpccli_lsa_CloseTrustedDomainEx_state *state = tevent_req_data(
8619                 req, struct rpccli_lsa_CloseTrustedDomainEx_state);
8620         NTSTATUS status;
8621         TALLOC_CTX *mem_ctx;
8622
8623         if (state->out_mem_ctx) {
8624                 mem_ctx = state->out_mem_ctx;
8625         } else {
8626                 mem_ctx = state;
8627         }
8628
8629         status = state->dispatch_recv(subreq, mem_ctx);
8630         TALLOC_FREE(subreq);
8631         if (!NT_STATUS_IS_OK(status)) {
8632                 tevent_req_nterror(req, status);
8633                 return;
8634         }
8635
8636         /* Copy out parameters */
8637         *state->orig.out.handle = *state->tmp.out.handle;
8638
8639         /* Copy result */
8640         state->orig.out.result = state->tmp.out.result;
8641
8642         /* Reset temporary structure */
8643         ZERO_STRUCT(state->tmp);
8644
8645         if (DEBUGLEVEL >= 10) {
8646                 NDR_PRINT_OUT_DEBUG(lsa_CloseTrustedDomainEx, &state->orig);
8647         }
8648
8649         tevent_req_done(req);
8650 }
8651
8652 NTSTATUS rpccli_lsa_CloseTrustedDomainEx_recv(struct tevent_req *req,
8653                                               TALLOC_CTX *mem_ctx,
8654                                               NTSTATUS *result)
8655 {
8656         struct rpccli_lsa_CloseTrustedDomainEx_state *state = tevent_req_data(
8657                 req, struct rpccli_lsa_CloseTrustedDomainEx_state);
8658         NTSTATUS status;
8659
8660         if (tevent_req_is_nterror(req, &status)) {
8661                 tevent_req_received(req);
8662                 return status;
8663         }
8664
8665         /* Steal possbile out parameters to the callers context */
8666         talloc_steal(mem_ctx, state->out_mem_ctx);
8667
8668         /* Return result */
8669         *result = state->orig.out.result;
8670
8671         tevent_req_received(req);
8672         return NT_STATUS_OK;
8673 }
8674
8675 NTSTATUS rpccli_lsa_CloseTrustedDomainEx(struct rpc_pipe_client *cli,
8676                                          TALLOC_CTX *mem_ctx,
8677                                          struct policy_handle *handle /* [in,out] [ref] */)
8678 {
8679         struct lsa_CloseTrustedDomainEx r;
8680         NTSTATUS status;
8681
8682         /* In parameters */
8683         r.in.handle = handle;
8684
8685         if (DEBUGLEVEL >= 10) {
8686                 NDR_PRINT_IN_DEBUG(lsa_CloseTrustedDomainEx, &r);
8687         }
8688
8689         status = cli->dispatch(cli,
8690                                 mem_ctx,
8691                                 &ndr_table_lsarpc,
8692                                 NDR_LSA_CLOSETRUSTEDDOMAINEX,
8693                                 &r);
8694
8695         if (!NT_STATUS_IS_OK(status)) {
8696                 return status;
8697         }
8698
8699         if (DEBUGLEVEL >= 10) {
8700                 NDR_PRINT_OUT_DEBUG(lsa_CloseTrustedDomainEx, &r);
8701         }
8702
8703         if (NT_STATUS_IS_ERR(status)) {
8704                 return status;
8705         }
8706
8707         /* Return variables */
8708         *handle = *r.out.handle;
8709
8710         /* Return result */
8711         return r.out.result;
8712 }
8713
8714 struct rpccli_lsa_QueryDomainInformationPolicy_state {
8715         struct lsa_QueryDomainInformationPolicy orig;
8716         struct lsa_QueryDomainInformationPolicy tmp;
8717         TALLOC_CTX *out_mem_ctx;
8718         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8719 };
8720
8721 static void rpccli_lsa_QueryDomainInformationPolicy_done(struct tevent_req *subreq);
8722
8723 struct tevent_req *rpccli_lsa_QueryDomainInformationPolicy_send(TALLOC_CTX *mem_ctx,
8724                                                                 struct tevent_context *ev,
8725                                                                 struct rpc_pipe_client *cli,
8726                                                                 struct policy_handle *_handle /* [in] [ref] */,
8727                                                                 uint16_t _level /* [in]  */,
8728                                                                 union lsa_DomainInformationPolicy **_info /* [out] [ref,switch_is(level)] */)
8729 {
8730         struct tevent_req *req;
8731         struct rpccli_lsa_QueryDomainInformationPolicy_state *state;
8732         struct tevent_req *subreq;
8733
8734         req = tevent_req_create(mem_ctx, &state,
8735                                 struct rpccli_lsa_QueryDomainInformationPolicy_state);
8736         if (req == NULL) {
8737                 return NULL;
8738         }
8739         state->out_mem_ctx = NULL;
8740         state->dispatch_recv = cli->dispatch_recv;
8741
8742         /* In parameters */
8743         state->orig.in.handle = _handle;
8744         state->orig.in.level = _level;
8745
8746         /* Out parameters */
8747         state->orig.out.info = _info;
8748
8749         /* Result */
8750         ZERO_STRUCT(state->orig.out.result);
8751
8752         if (DEBUGLEVEL >= 10) {
8753                 NDR_PRINT_IN_DEBUG(lsa_QueryDomainInformationPolicy, &state->orig);
8754         }
8755
8756         state->out_mem_ctx = talloc_named_const(state, 0,
8757                              "rpccli_lsa_QueryDomainInformationPolicy_out_memory");
8758         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8759                 return tevent_req_post(req, ev);
8760         }
8761
8762         /* make a temporary copy, that we pass to the dispatch function */
8763         state->tmp = state->orig;
8764
8765         subreq = cli->dispatch_send(state, ev, cli,
8766                                     &ndr_table_lsarpc,
8767                                     NDR_LSA_QUERYDOMAININFORMATIONPOLICY,
8768                                     &state->tmp);
8769         if (tevent_req_nomem(subreq, req)) {
8770                 return tevent_req_post(req, ev);
8771         }
8772         tevent_req_set_callback(subreq, rpccli_lsa_QueryDomainInformationPolicy_done, req);
8773         return req;
8774 }
8775
8776 static void rpccli_lsa_QueryDomainInformationPolicy_done(struct tevent_req *subreq)
8777 {
8778         struct tevent_req *req = tevent_req_callback_data(
8779                 subreq, struct tevent_req);
8780         struct rpccli_lsa_QueryDomainInformationPolicy_state *state = tevent_req_data(
8781                 req, struct rpccli_lsa_QueryDomainInformationPolicy_state);
8782         NTSTATUS status;
8783         TALLOC_CTX *mem_ctx;
8784
8785         if (state->out_mem_ctx) {
8786                 mem_ctx = state->out_mem_ctx;
8787         } else {
8788                 mem_ctx = state;
8789         }
8790
8791         status = state->dispatch_recv(subreq, mem_ctx);
8792         TALLOC_FREE(subreq);
8793         if (!NT_STATUS_IS_OK(status)) {
8794                 tevent_req_nterror(req, status);
8795                 return;
8796         }
8797
8798         /* Copy out parameters */
8799         *state->orig.out.info = *state->tmp.out.info;
8800
8801         /* Copy result */
8802         state->orig.out.result = state->tmp.out.result;
8803
8804         /* Reset temporary structure */
8805         ZERO_STRUCT(state->tmp);
8806
8807         if (DEBUGLEVEL >= 10) {
8808                 NDR_PRINT_OUT_DEBUG(lsa_QueryDomainInformationPolicy, &state->orig);
8809         }
8810
8811         tevent_req_done(req);
8812 }
8813
8814 NTSTATUS rpccli_lsa_QueryDomainInformationPolicy_recv(struct tevent_req *req,
8815                                                       TALLOC_CTX *mem_ctx,
8816                                                       NTSTATUS *result)
8817 {
8818         struct rpccli_lsa_QueryDomainInformationPolicy_state *state = tevent_req_data(
8819                 req, struct rpccli_lsa_QueryDomainInformationPolicy_state);
8820         NTSTATUS status;
8821
8822         if (tevent_req_is_nterror(req, &status)) {
8823                 tevent_req_received(req);
8824                 return status;
8825         }
8826
8827         /* Steal possbile out parameters to the callers context */
8828         talloc_steal(mem_ctx, state->out_mem_ctx);
8829
8830         /* Return result */
8831         *result = state->orig.out.result;
8832
8833         tevent_req_received(req);
8834         return NT_STATUS_OK;
8835 }
8836
8837 NTSTATUS rpccli_lsa_QueryDomainInformationPolicy(struct rpc_pipe_client *cli,
8838                                                  TALLOC_CTX *mem_ctx,
8839                                                  struct policy_handle *handle /* [in] [ref] */,
8840                                                  uint16_t level /* [in]  */,
8841                                                  union lsa_DomainInformationPolicy **info /* [out] [ref,switch_is(level)] */)
8842 {
8843         struct lsa_QueryDomainInformationPolicy r;
8844         NTSTATUS status;
8845
8846         /* In parameters */
8847         r.in.handle = handle;
8848         r.in.level = level;
8849
8850         if (DEBUGLEVEL >= 10) {
8851                 NDR_PRINT_IN_DEBUG(lsa_QueryDomainInformationPolicy, &r);
8852         }
8853
8854         status = cli->dispatch(cli,
8855                                 mem_ctx,
8856                                 &ndr_table_lsarpc,
8857                                 NDR_LSA_QUERYDOMAININFORMATIONPOLICY,
8858                                 &r);
8859
8860         if (!NT_STATUS_IS_OK(status)) {
8861                 return status;
8862         }
8863
8864         if (DEBUGLEVEL >= 10) {
8865                 NDR_PRINT_OUT_DEBUG(lsa_QueryDomainInformationPolicy, &r);
8866         }
8867
8868         if (NT_STATUS_IS_ERR(status)) {
8869                 return status;
8870         }
8871
8872         /* Return variables */
8873         *info = *r.out.info;
8874
8875         /* Return result */
8876         return r.out.result;
8877 }
8878
8879 struct rpccli_lsa_SetDomainInformationPolicy_state {
8880         struct lsa_SetDomainInformationPolicy orig;
8881         struct lsa_SetDomainInformationPolicy tmp;
8882         TALLOC_CTX *out_mem_ctx;
8883         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8884 };
8885
8886 static void rpccli_lsa_SetDomainInformationPolicy_done(struct tevent_req *subreq);
8887
8888 struct tevent_req *rpccli_lsa_SetDomainInformationPolicy_send(TALLOC_CTX *mem_ctx,
8889                                                               struct tevent_context *ev,
8890                                                               struct rpc_pipe_client *cli,
8891                                                               struct policy_handle *_handle /* [in] [ref] */,
8892                                                               uint16_t _level /* [in]  */,
8893                                                               union lsa_DomainInformationPolicy *_info /* [in] [unique,switch_is(level)] */)
8894 {
8895         struct tevent_req *req;
8896         struct rpccli_lsa_SetDomainInformationPolicy_state *state;
8897         struct tevent_req *subreq;
8898
8899         req = tevent_req_create(mem_ctx, &state,
8900                                 struct rpccli_lsa_SetDomainInformationPolicy_state);
8901         if (req == NULL) {
8902                 return NULL;
8903         }
8904         state->out_mem_ctx = NULL;
8905         state->dispatch_recv = cli->dispatch_recv;
8906
8907         /* In parameters */
8908         state->orig.in.handle = _handle;
8909         state->orig.in.level = _level;
8910         state->orig.in.info = _info;
8911
8912         /* Out parameters */
8913
8914         /* Result */
8915         ZERO_STRUCT(state->orig.out.result);
8916
8917         if (DEBUGLEVEL >= 10) {
8918                 NDR_PRINT_IN_DEBUG(lsa_SetDomainInformationPolicy, &state->orig);
8919         }
8920
8921         /* make a temporary copy, that we pass to the dispatch function */
8922         state->tmp = state->orig;
8923
8924         subreq = cli->dispatch_send(state, ev, cli,
8925                                     &ndr_table_lsarpc,
8926                                     NDR_LSA_SETDOMAININFORMATIONPOLICY,
8927                                     &state->tmp);
8928         if (tevent_req_nomem(subreq, req)) {
8929                 return tevent_req_post(req, ev);
8930         }
8931         tevent_req_set_callback(subreq, rpccli_lsa_SetDomainInformationPolicy_done, req);
8932         return req;
8933 }
8934
8935 static void rpccli_lsa_SetDomainInformationPolicy_done(struct tevent_req *subreq)
8936 {
8937         struct tevent_req *req = tevent_req_callback_data(
8938                 subreq, struct tevent_req);
8939         struct rpccli_lsa_SetDomainInformationPolicy_state *state = tevent_req_data(
8940                 req, struct rpccli_lsa_SetDomainInformationPolicy_state);
8941         NTSTATUS status;
8942         TALLOC_CTX *mem_ctx;
8943
8944         if (state->out_mem_ctx) {
8945                 mem_ctx = state->out_mem_ctx;
8946         } else {
8947                 mem_ctx = state;
8948         }
8949
8950         status = state->dispatch_recv(subreq, mem_ctx);
8951         TALLOC_FREE(subreq);
8952         if (!NT_STATUS_IS_OK(status)) {
8953                 tevent_req_nterror(req, status);
8954                 return;
8955         }
8956
8957         /* Copy out parameters */
8958
8959         /* Copy result */
8960         state->orig.out.result = state->tmp.out.result;
8961
8962         /* Reset temporary structure */
8963         ZERO_STRUCT(state->tmp);
8964
8965         if (DEBUGLEVEL >= 10) {
8966                 NDR_PRINT_OUT_DEBUG(lsa_SetDomainInformationPolicy, &state->orig);
8967         }
8968
8969         tevent_req_done(req);
8970 }
8971
8972 NTSTATUS rpccli_lsa_SetDomainInformationPolicy_recv(struct tevent_req *req,
8973                                                     TALLOC_CTX *mem_ctx,
8974                                                     NTSTATUS *result)
8975 {
8976         struct rpccli_lsa_SetDomainInformationPolicy_state *state = tevent_req_data(
8977                 req, struct rpccli_lsa_SetDomainInformationPolicy_state);
8978         NTSTATUS status;
8979
8980         if (tevent_req_is_nterror(req, &status)) {
8981                 tevent_req_received(req);
8982                 return status;
8983         }
8984
8985         /* Steal possbile out parameters to the callers context */
8986         talloc_steal(mem_ctx, state->out_mem_ctx);
8987
8988         /* Return result */
8989         *result = state->orig.out.result;
8990
8991         tevent_req_received(req);
8992         return NT_STATUS_OK;
8993 }
8994
8995 NTSTATUS rpccli_lsa_SetDomainInformationPolicy(struct rpc_pipe_client *cli,
8996                                                TALLOC_CTX *mem_ctx,
8997                                                struct policy_handle *handle /* [in] [ref] */,
8998                                                uint16_t level /* [in]  */,
8999                                                union lsa_DomainInformationPolicy *info /* [in] [unique,switch_is(level)] */)
9000 {
9001         struct lsa_SetDomainInformationPolicy r;
9002         NTSTATUS status;
9003
9004         /* In parameters */
9005         r.in.handle = handle;
9006         r.in.level = level;
9007         r.in.info = info;
9008
9009         if (DEBUGLEVEL >= 10) {
9010                 NDR_PRINT_IN_DEBUG(lsa_SetDomainInformationPolicy, &r);
9011         }
9012
9013         status = cli->dispatch(cli,
9014                                 mem_ctx,
9015                                 &ndr_table_lsarpc,
9016                                 NDR_LSA_SETDOMAININFORMATIONPOLICY,
9017                                 &r);
9018
9019         if (!NT_STATUS_IS_OK(status)) {
9020                 return status;
9021         }
9022
9023         if (DEBUGLEVEL >= 10) {
9024                 NDR_PRINT_OUT_DEBUG(lsa_SetDomainInformationPolicy, &r);
9025         }
9026
9027         if (NT_STATUS_IS_ERR(status)) {
9028                 return status;
9029         }
9030
9031         /* Return variables */
9032
9033         /* Return result */
9034         return r.out.result;
9035 }
9036
9037 struct rpccli_lsa_OpenTrustedDomainByName_state {
9038         struct lsa_OpenTrustedDomainByName orig;
9039         struct lsa_OpenTrustedDomainByName tmp;
9040         TALLOC_CTX *out_mem_ctx;
9041         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9042 };
9043
9044 static void rpccli_lsa_OpenTrustedDomainByName_done(struct tevent_req *subreq);
9045
9046 struct tevent_req *rpccli_lsa_OpenTrustedDomainByName_send(TALLOC_CTX *mem_ctx,
9047                                                            struct tevent_context *ev,
9048                                                            struct rpc_pipe_client *cli,
9049                                                            struct policy_handle *_handle /* [in] [ref] */,
9050                                                            struct lsa_String _name /* [in]  */,
9051                                                            uint32_t _access_mask /* [in]  */,
9052                                                            struct policy_handle *_trustdom_handle /* [out] [ref] */)
9053 {
9054         struct tevent_req *req;
9055         struct rpccli_lsa_OpenTrustedDomainByName_state *state;
9056         struct tevent_req *subreq;
9057
9058         req = tevent_req_create(mem_ctx, &state,
9059                                 struct rpccli_lsa_OpenTrustedDomainByName_state);
9060         if (req == NULL) {
9061                 return NULL;
9062         }
9063         state->out_mem_ctx = NULL;
9064         state->dispatch_recv = cli->dispatch_recv;
9065
9066         /* In parameters */
9067         state->orig.in.handle = _handle;
9068         state->orig.in.name = _name;
9069         state->orig.in.access_mask = _access_mask;
9070
9071         /* Out parameters */
9072         state->orig.out.trustdom_handle = _trustdom_handle;
9073
9074         /* Result */
9075         ZERO_STRUCT(state->orig.out.result);
9076
9077         if (DEBUGLEVEL >= 10) {
9078                 NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomainByName, &state->orig);
9079         }
9080
9081         state->out_mem_ctx = talloc_named_const(state, 0,
9082                              "rpccli_lsa_OpenTrustedDomainByName_out_memory");
9083         if (tevent_req_nomem(state->out_mem_ctx, req)) {
9084                 return tevent_req_post(req, ev);
9085         }
9086
9087         /* make a temporary copy, that we pass to the dispatch function */
9088         state->tmp = state->orig;
9089
9090         subreq = cli->dispatch_send(state, ev, cli,
9091                                     &ndr_table_lsarpc,
9092                                     NDR_LSA_OPENTRUSTEDDOMAINBYNAME,
9093                                     &state->tmp);
9094         if (tevent_req_nomem(subreq, req)) {
9095                 return tevent_req_post(req, ev);
9096         }
9097         tevent_req_set_callback(subreq, rpccli_lsa_OpenTrustedDomainByName_done, req);
9098         return req;
9099 }
9100
9101 static void rpccli_lsa_OpenTrustedDomainByName_done(struct tevent_req *subreq)
9102 {
9103         struct tevent_req *req = tevent_req_callback_data(
9104                 subreq, struct tevent_req);
9105         struct rpccli_lsa_OpenTrustedDomainByName_state *state = tevent_req_data(
9106                 req, struct rpccli_lsa_OpenTrustedDomainByName_state);
9107         NTSTATUS status;
9108         TALLOC_CTX *mem_ctx;
9109
9110         if (state->out_mem_ctx) {
9111                 mem_ctx = state->out_mem_ctx;
9112         } else {
9113                 mem_ctx = state;
9114         }
9115
9116         status = state->dispatch_recv(subreq, mem_ctx);
9117         TALLOC_FREE(subreq);
9118         if (!NT_STATUS_IS_OK(status)) {
9119                 tevent_req_nterror(req, status);
9120                 return;
9121         }
9122
9123         /* Copy out parameters */
9124         *state->orig.out.trustdom_handle = *state->tmp.out.trustdom_handle;
9125
9126         /* Copy result */
9127         state->orig.out.result = state->tmp.out.result;
9128
9129         /* Reset temporary structure */
9130         ZERO_STRUCT(state->tmp);
9131
9132         if (DEBUGLEVEL >= 10) {
9133                 NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomainByName, &state->orig);
9134         }
9135
9136         tevent_req_done(req);
9137 }
9138
9139 NTSTATUS rpccli_lsa_OpenTrustedDomainByName_recv(struct tevent_req *req,
9140                                                  TALLOC_CTX *mem_ctx,
9141                                                  NTSTATUS *result)
9142 {
9143         struct rpccli_lsa_OpenTrustedDomainByName_state *state = tevent_req_data(
9144                 req, struct rpccli_lsa_OpenTrustedDomainByName_state);
9145         NTSTATUS status;
9146
9147         if (tevent_req_is_nterror(req, &status)) {
9148                 tevent_req_received(req);
9149                 return status;
9150         }
9151
9152         /* Steal possbile out parameters to the callers context */
9153         talloc_steal(mem_ctx, state->out_mem_ctx);
9154
9155         /* Return result */
9156         *result = state->orig.out.result;
9157
9158         tevent_req_received(req);
9159         return NT_STATUS_OK;
9160 }
9161
9162 NTSTATUS rpccli_lsa_OpenTrustedDomainByName(struct rpc_pipe_client *cli,
9163                                             TALLOC_CTX *mem_ctx,
9164                                             struct policy_handle *handle /* [in] [ref] */,
9165                                             struct lsa_String name /* [in]  */,
9166                                             uint32_t access_mask /* [in]  */,
9167                                             struct policy_handle *trustdom_handle /* [out] [ref] */)
9168 {
9169         struct lsa_OpenTrustedDomainByName r;
9170         NTSTATUS status;
9171
9172         /* In parameters */
9173         r.in.handle = handle;
9174         r.in.name = name;
9175         r.in.access_mask = access_mask;
9176
9177         if (DEBUGLEVEL >= 10) {
9178                 NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomainByName, &r);
9179         }
9180
9181         status = cli->dispatch(cli,
9182                                 mem_ctx,
9183                                 &ndr_table_lsarpc,
9184                                 NDR_LSA_OPENTRUSTEDDOMAINBYNAME,
9185                                 &r);
9186
9187         if (!NT_STATUS_IS_OK(status)) {
9188                 return status;
9189         }
9190
9191         if (DEBUGLEVEL >= 10) {
9192                 NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomainByName, &r);
9193         }
9194
9195         if (NT_STATUS_IS_ERR(status)) {
9196                 return status;
9197         }
9198
9199         /* Return variables */
9200         *trustdom_handle = *r.out.trustdom_handle;
9201
9202         /* Return result */
9203         return r.out.result;
9204 }
9205
9206 struct rpccli_lsa_TestCall_state {
9207         struct lsa_TestCall orig;
9208         struct lsa_TestCall tmp;
9209         TALLOC_CTX *out_mem_ctx;
9210         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9211 };
9212
9213 static void rpccli_lsa_TestCall_done(struct tevent_req *subreq);
9214
9215 struct tevent_req *rpccli_lsa_TestCall_send(TALLOC_CTX *mem_ctx,
9216                                             struct tevent_context *ev,
9217                                             struct rpc_pipe_client *cli)
9218 {
9219         struct tevent_req *req;
9220         struct rpccli_lsa_TestCall_state *state;
9221         struct tevent_req *subreq;
9222
9223         req = tevent_req_create(mem_ctx, &state,
9224                                 struct rpccli_lsa_TestCall_state);
9225         if (req == NULL) {
9226                 return NULL;
9227         }
9228         state->out_mem_ctx = NULL;
9229         state->dispatch_recv = cli->dispatch_recv;
9230
9231         /* In parameters */
9232
9233         /* Out parameters */
9234
9235         /* Result */
9236         ZERO_STRUCT(state->orig.out.result);
9237
9238         if (DEBUGLEVEL >= 10) {
9239                 NDR_PRINT_IN_DEBUG(lsa_TestCall, &state->orig);
9240         }
9241
9242         /* make a temporary copy, that we pass to the dispatch function */
9243         state->tmp = state->orig;
9244
9245         subreq = cli->dispatch_send(state, ev, cli,
9246                                     &ndr_table_lsarpc,
9247                                     NDR_LSA_TESTCALL,
9248                                     &state->tmp);
9249         if (tevent_req_nomem(subreq, req)) {
9250                 return tevent_req_post(req, ev);
9251         }
9252         tevent_req_set_callback(subreq, rpccli_lsa_TestCall_done, req);
9253         return req;
9254 }
9255
9256 static void rpccli_lsa_TestCall_done(struct tevent_req *subreq)
9257 {
9258         struct tevent_req *req = tevent_req_callback_data(
9259                 subreq, struct tevent_req);
9260         struct rpccli_lsa_TestCall_state *state = tevent_req_data(
9261                 req, struct rpccli_lsa_TestCall_state);
9262         NTSTATUS status;
9263         TALLOC_CTX *mem_ctx;
9264
9265         if (state->out_mem_ctx) {
9266                 mem_ctx = state->out_mem_ctx;
9267         } else {
9268                 mem_ctx = state;
9269         }
9270
9271         status = state->dispatch_recv(subreq, mem_ctx);
9272         TALLOC_FREE(subreq);
9273         if (!NT_STATUS_IS_OK(status)) {
9274                 tevent_req_nterror(req, status);
9275                 return;
9276         }
9277
9278         /* Copy out parameters */
9279
9280         /* Copy result */
9281         state->orig.out.result = state->tmp.out.result;
9282
9283         /* Reset temporary structure */
9284         ZERO_STRUCT(state->tmp);
9285
9286         if (DEBUGLEVEL >= 10) {
9287                 NDR_PRINT_OUT_DEBUG(lsa_TestCall, &state->orig);
9288         }
9289
9290         tevent_req_done(req);
9291 }
9292
9293 NTSTATUS rpccli_lsa_TestCall_recv(struct tevent_req *req,
9294                                   TALLOC_CTX *mem_ctx,
9295                                   NTSTATUS *result)
9296 {
9297         struct rpccli_lsa_TestCall_state *state = tevent_req_data(
9298                 req, struct rpccli_lsa_TestCall_state);
9299         NTSTATUS status;
9300
9301         if (tevent_req_is_nterror(req, &status)) {
9302                 tevent_req_received(req);
9303                 return status;
9304         }
9305
9306         /* Steal possbile out parameters to the callers context */
9307         talloc_steal(mem_ctx, state->out_mem_ctx);
9308
9309         /* Return result */
9310         *result = state->orig.out.result;
9311
9312         tevent_req_received(req);
9313         return NT_STATUS_OK;
9314 }
9315
9316 NTSTATUS rpccli_lsa_TestCall(struct rpc_pipe_client *cli,
9317                              TALLOC_CTX *mem_ctx)
9318 {
9319         struct lsa_TestCall r;
9320         NTSTATUS status;
9321
9322         /* In parameters */
9323
9324         if (DEBUGLEVEL >= 10) {
9325                 NDR_PRINT_IN_DEBUG(lsa_TestCall, &r);
9326         }
9327
9328         status = cli->dispatch(cli,
9329                                 mem_ctx,
9330                                 &ndr_table_lsarpc,
9331                                 NDR_LSA_TESTCALL,
9332                                 &r);
9333
9334         if (!NT_STATUS_IS_OK(status)) {
9335                 return status;
9336         }
9337
9338         if (DEBUGLEVEL >= 10) {
9339                 NDR_PRINT_OUT_DEBUG(lsa_TestCall, &r);
9340         }
9341
9342         if (NT_STATUS_IS_ERR(status)) {
9343                 return status;
9344         }
9345
9346         /* Return variables */
9347
9348         /* Return result */
9349         return r.out.result;
9350 }
9351
9352 struct rpccli_lsa_LookupSids2_state {
9353         struct lsa_LookupSids2 orig;
9354         struct lsa_LookupSids2 tmp;
9355         TALLOC_CTX *out_mem_ctx;
9356         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9357 };
9358
9359 static void rpccli_lsa_LookupSids2_done(struct tevent_req *subreq);
9360
9361 struct tevent_req *rpccli_lsa_LookupSids2_send(TALLOC_CTX *mem_ctx,
9362                                                struct tevent_context *ev,
9363                                                struct rpc_pipe_client *cli,
9364                                                struct policy_handle *_handle /* [in] [ref] */,
9365                                                struct lsa_SidArray *_sids /* [in] [ref] */,
9366                                                struct lsa_RefDomainList **_domains /* [out] [ref] */,
9367                                                struct lsa_TransNameArray2 *_names /* [in,out] [ref] */,
9368                                                uint16_t _level /* [in]  */,
9369                                                uint32_t *_count /* [in,out] [ref] */,
9370                                                uint32_t _unknown1 /* [in]  */,
9371                                                uint32_t _unknown2 /* [in]  */)
9372 {
9373         struct tevent_req *req;
9374         struct rpccli_lsa_LookupSids2_state *state;
9375         struct tevent_req *subreq;
9376
9377         req = tevent_req_create(mem_ctx, &state,
9378                                 struct rpccli_lsa_LookupSids2_state);
9379         if (req == NULL) {
9380                 return NULL;
9381         }
9382         state->out_mem_ctx = NULL;
9383         state->dispatch_recv = cli->dispatch_recv;
9384
9385         /* In parameters */
9386         state->orig.in.handle = _handle;
9387         state->orig.in.sids = _sids;
9388         state->orig.in.names = _names;
9389         state->orig.in.level = _level;
9390         state->orig.in.count = _count;
9391         state->orig.in.unknown1 = _unknown1;
9392         state->orig.in.unknown2 = _unknown2;
9393
9394         /* Out parameters */
9395         state->orig.out.domains = _domains;
9396         state->orig.out.names = _names;
9397         state->orig.out.count = _count;
9398
9399         /* Result */
9400         ZERO_STRUCT(state->orig.out.result);
9401
9402         if (DEBUGLEVEL >= 10) {
9403                 NDR_PRINT_IN_DEBUG(lsa_LookupSids2, &state->orig);
9404         }
9405
9406         state->out_mem_ctx = talloc_named_const(state, 0,
9407                              "rpccli_lsa_LookupSids2_out_memory");
9408         if (tevent_req_nomem(state->out_mem_ctx, req)) {
9409                 return tevent_req_post(req, ev);
9410         }
9411
9412         /* make a temporary copy, that we pass to the dispatch function */
9413         state->tmp = state->orig;
9414
9415         subreq = cli->dispatch_send(state, ev, cli,
9416                                     &ndr_table_lsarpc,
9417                                     NDR_LSA_LOOKUPSIDS2,
9418                                     &state->tmp);
9419         if (tevent_req_nomem(subreq, req)) {
9420                 return tevent_req_post(req, ev);
9421         }
9422         tevent_req_set_callback(subreq, rpccli_lsa_LookupSids2_done, req);
9423         return req;
9424 }
9425
9426 static void rpccli_lsa_LookupSids2_done(struct tevent_req *subreq)
9427 {
9428         struct tevent_req *req = tevent_req_callback_data(
9429                 subreq, struct tevent_req);
9430         struct rpccli_lsa_LookupSids2_state *state = tevent_req_data(
9431                 req, struct rpccli_lsa_LookupSids2_state);
9432         NTSTATUS status;
9433         TALLOC_CTX *mem_ctx;
9434
9435         if (state->out_mem_ctx) {
9436                 mem_ctx = state->out_mem_ctx;
9437         } else {
9438                 mem_ctx = state;
9439         }
9440
9441         status = state->dispatch_recv(subreq, mem_ctx);
9442         TALLOC_FREE(subreq);
9443         if (!NT_STATUS_IS_OK(status)) {
9444                 tevent_req_nterror(req, status);
9445                 return;
9446         }
9447
9448         /* Copy out parameters */
9449         *state->orig.out.domains = *state->tmp.out.domains;
9450         *state->orig.out.names = *state->tmp.out.names;
9451         *state->orig.out.count = *state->tmp.out.count;
9452
9453         /* Copy result */
9454         state->orig.out.result = state->tmp.out.result;
9455
9456         /* Reset temporary structure */
9457         ZERO_STRUCT(state->tmp);
9458
9459         if (DEBUGLEVEL >= 10) {
9460                 NDR_PRINT_OUT_DEBUG(lsa_LookupSids2, &state->orig);
9461         }
9462
9463         tevent_req_done(req);
9464 }
9465
9466 NTSTATUS rpccli_lsa_LookupSids2_recv(struct tevent_req *req,
9467                                      TALLOC_CTX *mem_ctx,
9468                                      NTSTATUS *result)
9469 {
9470         struct rpccli_lsa_LookupSids2_state *state = tevent_req_data(
9471                 req, struct rpccli_lsa_LookupSids2_state);
9472         NTSTATUS status;
9473
9474         if (tevent_req_is_nterror(req, &status)) {
9475                 tevent_req_received(req);
9476                 return status;
9477         }
9478
9479         /* Steal possbile out parameters to the callers context */
9480         talloc_steal(mem_ctx, state->out_mem_ctx);
9481
9482         /* Return result */
9483         *result = state->orig.out.result;
9484
9485         tevent_req_received(req);
9486         return NT_STATUS_OK;
9487 }
9488
9489 NTSTATUS rpccli_lsa_LookupSids2(struct rpc_pipe_client *cli,
9490                                 TALLOC_CTX *mem_ctx,
9491                                 struct policy_handle *handle /* [in] [ref] */,
9492                                 struct lsa_SidArray *sids /* [in] [ref] */,
9493                                 struct lsa_RefDomainList **domains /* [out] [ref] */,
9494                                 struct lsa_TransNameArray2 *names /* [in,out] [ref] */,
9495                                 uint16_t level /* [in]  */,
9496                                 uint32_t *count /* [in,out] [ref] */,
9497                                 uint32_t unknown1 /* [in]  */,
9498                                 uint32_t unknown2 /* [in]  */)
9499 {
9500         struct lsa_LookupSids2 r;
9501         NTSTATUS status;
9502
9503         /* In parameters */
9504         r.in.handle = handle;
9505         r.in.sids = sids;
9506         r.in.names = names;
9507         r.in.level = level;
9508         r.in.count = count;
9509         r.in.unknown1 = unknown1;
9510         r.in.unknown2 = unknown2;
9511
9512         if (DEBUGLEVEL >= 10) {
9513                 NDR_PRINT_IN_DEBUG(lsa_LookupSids2, &r);
9514         }
9515
9516         status = cli->dispatch(cli,
9517                                 mem_ctx,
9518                                 &ndr_table_lsarpc,
9519                                 NDR_LSA_LOOKUPSIDS2,
9520                                 &r);
9521
9522         if (!NT_STATUS_IS_OK(status)) {
9523                 return status;
9524         }
9525
9526         if (DEBUGLEVEL >= 10) {
9527                 NDR_PRINT_OUT_DEBUG(lsa_LookupSids2, &r);
9528         }
9529
9530         if (NT_STATUS_IS_ERR(status)) {
9531                 return status;
9532         }
9533
9534         /* Return variables */
9535         *domains = *r.out.domains;
9536         *names = *r.out.names;
9537         *count = *r.out.count;
9538
9539         /* Return result */
9540         return r.out.result;
9541 }
9542
9543 struct rpccli_lsa_LookupNames2_state {
9544         struct lsa_LookupNames2 orig;
9545         struct lsa_LookupNames2 tmp;
9546         TALLOC_CTX *out_mem_ctx;
9547         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9548 };
9549
9550 static void rpccli_lsa_LookupNames2_done(struct tevent_req *subreq);
9551
9552 struct tevent_req *rpccli_lsa_LookupNames2_send(TALLOC_CTX *mem_ctx,
9553                                                 struct tevent_context *ev,
9554                                                 struct rpc_pipe_client *cli,
9555                                                 struct policy_handle *_handle /* [in] [ref] */,
9556                                                 uint32_t _num_names /* [in] [range(0,1000)] */,
9557                                                 struct lsa_String *_names /* [in] [size_is(num_names)] */,
9558                                                 struct lsa_RefDomainList **_domains /* [out] [ref] */,
9559                                                 struct lsa_TransSidArray2 *_sids /* [in,out] [ref] */,
9560                                                 enum lsa_LookupNamesLevel _level /* [in]  */,
9561                                                 uint32_t *_count /* [in,out] [ref] */,
9562                                                 uint32_t _lookup_options /* [in]  */,
9563                                                 uint32_t _client_revision /* [in]  */)
9564 {
9565         struct tevent_req *req;
9566         struct rpccli_lsa_LookupNames2_state *state;
9567         struct tevent_req *subreq;
9568
9569         req = tevent_req_create(mem_ctx, &state,
9570                                 struct rpccli_lsa_LookupNames2_state);
9571         if (req == NULL) {
9572                 return NULL;
9573         }
9574         state->out_mem_ctx = NULL;
9575         state->dispatch_recv = cli->dispatch_recv;
9576
9577         /* In parameters */
9578         state->orig.in.handle = _handle;
9579         state->orig.in.num_names = _num_names;
9580         state->orig.in.names = _names;
9581         state->orig.in.sids = _sids;
9582         state->orig.in.level = _level;
9583         state->orig.in.count = _count;
9584         state->orig.in.lookup_options = _lookup_options;
9585         state->orig.in.client_revision = _client_revision;
9586
9587         /* Out parameters */
9588         state->orig.out.domains = _domains;
9589         state->orig.out.sids = _sids;
9590         state->orig.out.count = _count;
9591
9592         /* Result */
9593         ZERO_STRUCT(state->orig.out.result);
9594
9595         if (DEBUGLEVEL >= 10) {
9596                 NDR_PRINT_IN_DEBUG(lsa_LookupNames2, &state->orig);
9597         }
9598
9599         state->out_mem_ctx = talloc_named_const(state, 0,
9600                              "rpccli_lsa_LookupNames2_out_memory");
9601         if (tevent_req_nomem(state->out_mem_ctx, req)) {
9602                 return tevent_req_post(req, ev);
9603         }
9604
9605         /* make a temporary copy, that we pass to the dispatch function */
9606         state->tmp = state->orig;
9607
9608         subreq = cli->dispatch_send(state, ev, cli,
9609                                     &ndr_table_lsarpc,
9610                                     NDR_LSA_LOOKUPNAMES2,
9611                                     &state->tmp);
9612         if (tevent_req_nomem(subreq, req)) {
9613                 return tevent_req_post(req, ev);
9614         }
9615         tevent_req_set_callback(subreq, rpccli_lsa_LookupNames2_done, req);
9616         return req;
9617 }
9618
9619 static void rpccli_lsa_LookupNames2_done(struct tevent_req *subreq)
9620 {
9621         struct tevent_req *req = tevent_req_callback_data(
9622                 subreq, struct tevent_req);
9623         struct rpccli_lsa_LookupNames2_state *state = tevent_req_data(
9624                 req, struct rpccli_lsa_LookupNames2_state);
9625         NTSTATUS status;
9626         TALLOC_CTX *mem_ctx;
9627
9628         if (state->out_mem_ctx) {
9629                 mem_ctx = state->out_mem_ctx;
9630         } else {
9631                 mem_ctx = state;
9632         }
9633
9634         status = state->dispatch_recv(subreq, mem_ctx);
9635         TALLOC_FREE(subreq);
9636         if (!NT_STATUS_IS_OK(status)) {
9637                 tevent_req_nterror(req, status);
9638                 return;
9639         }
9640
9641         /* Copy out parameters */
9642         *state->orig.out.domains = *state->tmp.out.domains;
9643         *state->orig.out.sids = *state->tmp.out.sids;
9644         *state->orig.out.count = *state->tmp.out.count;
9645
9646         /* Copy result */
9647         state->orig.out.result = state->tmp.out.result;
9648
9649         /* Reset temporary structure */
9650         ZERO_STRUCT(state->tmp);
9651
9652         if (DEBUGLEVEL >= 10) {
9653                 NDR_PRINT_OUT_DEBUG(lsa_LookupNames2, &state->orig);
9654         }
9655
9656         tevent_req_done(req);
9657 }
9658
9659 NTSTATUS rpccli_lsa_LookupNames2_recv(struct tevent_req *req,
9660                                       TALLOC_CTX *mem_ctx,
9661                                       NTSTATUS *result)
9662 {
9663         struct rpccli_lsa_LookupNames2_state *state = tevent_req_data(
9664                 req, struct rpccli_lsa_LookupNames2_state);
9665         NTSTATUS status;
9666
9667         if (tevent_req_is_nterror(req, &status)) {
9668                 tevent_req_received(req);
9669                 return status;
9670         }
9671
9672         /* Steal possbile out parameters to the callers context */
9673         talloc_steal(mem_ctx, state->out_mem_ctx);
9674
9675         /* Return result */
9676         *result = state->orig.out.result;
9677
9678         tevent_req_received(req);
9679         return NT_STATUS_OK;
9680 }
9681
9682 NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli,
9683                                  TALLOC_CTX *mem_ctx,
9684                                  struct policy_handle *handle /* [in] [ref] */,
9685                                  uint32_t num_names /* [in] [range(0,1000)] */,
9686                                  struct lsa_String *names /* [in] [size_is(num_names)] */,
9687                                  struct lsa_RefDomainList **domains /* [out] [ref] */,
9688                                  struct lsa_TransSidArray2 *sids /* [in,out] [ref] */,
9689                                  enum lsa_LookupNamesLevel level /* [in]  */,
9690                                  uint32_t *count /* [in,out] [ref] */,
9691                                  uint32_t lookup_options /* [in]  */,
9692                                  uint32_t client_revision /* [in]  */)
9693 {
9694         struct lsa_LookupNames2 r;
9695         NTSTATUS status;
9696
9697         /* In parameters */
9698         r.in.handle = handle;
9699         r.in.num_names = num_names;
9700         r.in.names = names;
9701         r.in.sids = sids;
9702         r.in.level = level;
9703         r.in.count = count;
9704         r.in.lookup_options = lookup_options;
9705         r.in.client_revision = client_revision;
9706
9707         if (DEBUGLEVEL >= 10) {
9708                 NDR_PRINT_IN_DEBUG(lsa_LookupNames2, &r);
9709         }
9710
9711         status = cli->dispatch(cli,
9712                                 mem_ctx,
9713                                 &ndr_table_lsarpc,
9714                                 NDR_LSA_LOOKUPNAMES2,
9715                                 &r);
9716
9717         if (!NT_STATUS_IS_OK(status)) {
9718                 return status;
9719         }
9720
9721         if (DEBUGLEVEL >= 10) {
9722                 NDR_PRINT_OUT_DEBUG(lsa_LookupNames2, &r);
9723         }
9724
9725         if (NT_STATUS_IS_ERR(status)) {
9726                 return status;
9727         }
9728
9729         /* Return variables */
9730         *domains = *r.out.domains;
9731         *sids = *r.out.sids;
9732         *count = *r.out.count;
9733
9734         /* Return result */
9735         return r.out.result;
9736 }
9737
9738 struct rpccli_lsa_CreateTrustedDomainEx2_state {
9739         struct lsa_CreateTrustedDomainEx2 orig;
9740         struct lsa_CreateTrustedDomainEx2 tmp;
9741         TALLOC_CTX *out_mem_ctx;
9742         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9743 };
9744
9745 static void rpccli_lsa_CreateTrustedDomainEx2_done(struct tevent_req *subreq);
9746
9747 struct tevent_req *rpccli_lsa_CreateTrustedDomainEx2_send(TALLOC_CTX *mem_ctx,
9748                                                           struct tevent_context *ev,
9749                                                           struct rpc_pipe_client *cli,
9750                                                           struct policy_handle *_policy_handle /* [in] [ref] */,
9751                                                           struct lsa_TrustDomainInfoInfoEx *_info /* [in] [ref] */,
9752                                                           struct lsa_TrustDomainInfoAuthInfoInternal *_auth_info /* [in] [ref] */,
9753                                                           uint32_t _access_mask /* [in]  */,
9754                                                           struct policy_handle *_trustdom_handle /* [out] [ref] */)
9755 {
9756         struct tevent_req *req;
9757         struct rpccli_lsa_CreateTrustedDomainEx2_state *state;
9758         struct tevent_req *subreq;
9759
9760         req = tevent_req_create(mem_ctx, &state,
9761                                 struct rpccli_lsa_CreateTrustedDomainEx2_state);
9762         if (req == NULL) {
9763                 return NULL;
9764         }
9765         state->out_mem_ctx = NULL;
9766         state->dispatch_recv = cli->dispatch_recv;
9767
9768         /* In parameters */
9769         state->orig.in.policy_handle = _policy_handle;
9770         state->orig.in.info = _info;
9771         state->orig.in.auth_info = _auth_info;
9772         state->orig.in.access_mask = _access_mask;
9773
9774         /* Out parameters */
9775         state->orig.out.trustdom_handle = _trustdom_handle;
9776
9777         /* Result */
9778         ZERO_STRUCT(state->orig.out.result);
9779
9780         if (DEBUGLEVEL >= 10) {
9781                 NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx2, &state->orig);
9782         }
9783
9784         state->out_mem_ctx = talloc_named_const(state, 0,
9785                              "rpccli_lsa_CreateTrustedDomainEx2_out_memory");
9786         if (tevent_req_nomem(state->out_mem_ctx, req)) {
9787                 return tevent_req_post(req, ev);
9788         }
9789
9790         /* make a temporary copy, that we pass to the dispatch function */
9791         state->tmp = state->orig;
9792
9793         subreq = cli->dispatch_send(state, ev, cli,
9794                                     &ndr_table_lsarpc,
9795                                     NDR_LSA_CREATETRUSTEDDOMAINEX2,
9796                                     &state->tmp);
9797         if (tevent_req_nomem(subreq, req)) {
9798                 return tevent_req_post(req, ev);
9799         }
9800         tevent_req_set_callback(subreq, rpccli_lsa_CreateTrustedDomainEx2_done, req);
9801         return req;
9802 }
9803
9804 static void rpccli_lsa_CreateTrustedDomainEx2_done(struct tevent_req *subreq)
9805 {
9806         struct tevent_req *req = tevent_req_callback_data(
9807                 subreq, struct tevent_req);
9808         struct rpccli_lsa_CreateTrustedDomainEx2_state *state = tevent_req_data(
9809                 req, struct rpccli_lsa_CreateTrustedDomainEx2_state);
9810         NTSTATUS status;
9811         TALLOC_CTX *mem_ctx;
9812
9813         if (state->out_mem_ctx) {
9814                 mem_ctx = state->out_mem_ctx;
9815         } else {
9816                 mem_ctx = state;
9817         }
9818
9819         status = state->dispatch_recv(subreq, mem_ctx);
9820         TALLOC_FREE(subreq);
9821         if (!NT_STATUS_IS_OK(status)) {
9822                 tevent_req_nterror(req, status);
9823                 return;
9824         }
9825
9826         /* Copy out parameters */
9827         *state->orig.out.trustdom_handle = *state->tmp.out.trustdom_handle;
9828
9829         /* Copy result */
9830         state->orig.out.result = state->tmp.out.result;
9831
9832         /* Reset temporary structure */
9833         ZERO_STRUCT(state->tmp);
9834
9835         if (DEBUGLEVEL >= 10) {
9836                 NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx2, &state->orig);
9837         }
9838
9839         tevent_req_done(req);
9840 }
9841
9842 NTSTATUS rpccli_lsa_CreateTrustedDomainEx2_recv(struct tevent_req *req,
9843                                                 TALLOC_CTX *mem_ctx,
9844                                                 NTSTATUS *result)
9845 {
9846         struct rpccli_lsa_CreateTrustedDomainEx2_state *state = tevent_req_data(
9847                 req, struct rpccli_lsa_CreateTrustedDomainEx2_state);
9848         NTSTATUS status;
9849
9850         if (tevent_req_is_nterror(req, &status)) {
9851                 tevent_req_received(req);
9852                 return status;
9853         }
9854
9855         /* Steal possbile out parameters to the callers context */
9856         talloc_steal(mem_ctx, state->out_mem_ctx);
9857
9858         /* Return result */
9859         *result = state->orig.out.result;
9860
9861         tevent_req_received(req);
9862         return NT_STATUS_OK;
9863 }
9864
9865 NTSTATUS rpccli_lsa_CreateTrustedDomainEx2(struct rpc_pipe_client *cli,
9866                                            TALLOC_CTX *mem_ctx,
9867                                            struct policy_handle *policy_handle /* [in] [ref] */,
9868                                            struct lsa_TrustDomainInfoInfoEx *info /* [in] [ref] */,
9869                                            struct lsa_TrustDomainInfoAuthInfoInternal *auth_info /* [in] [ref] */,
9870                                            uint32_t access_mask /* [in]  */,
9871                                            struct policy_handle *trustdom_handle /* [out] [ref] */)
9872 {
9873         struct lsa_CreateTrustedDomainEx2 r;
9874         NTSTATUS status;
9875
9876         /* In parameters */
9877         r.in.policy_handle = policy_handle;
9878         r.in.info = info;
9879         r.in.auth_info = auth_info;
9880         r.in.access_mask = access_mask;
9881
9882         if (DEBUGLEVEL >= 10) {
9883                 NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx2, &r);
9884         }
9885
9886         status = cli->dispatch(cli,
9887                                 mem_ctx,
9888                                 &ndr_table_lsarpc,
9889                                 NDR_LSA_CREATETRUSTEDDOMAINEX2,
9890                                 &r);
9891
9892         if (!NT_STATUS_IS_OK(status)) {
9893                 return status;
9894         }
9895
9896         if (DEBUGLEVEL >= 10) {
9897                 NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx2, &r);
9898         }
9899
9900         if (NT_STATUS_IS_ERR(status)) {
9901                 return status;
9902         }
9903
9904         /* Return variables */
9905         *trustdom_handle = *r.out.trustdom_handle;
9906
9907         /* Return result */
9908         return r.out.result;
9909 }
9910
9911 struct rpccli_lsa_CREDRWRITE_state {
9912         struct lsa_CREDRWRITE orig;
9913         struct lsa_CREDRWRITE tmp;
9914         TALLOC_CTX *out_mem_ctx;
9915         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9916 };
9917
9918 static void rpccli_lsa_CREDRWRITE_done(struct tevent_req *subreq);
9919
9920 struct tevent_req *rpccli_lsa_CREDRWRITE_send(TALLOC_CTX *mem_ctx,
9921                                               struct tevent_context *ev,
9922                                               struct rpc_pipe_client *cli)
9923 {
9924         struct tevent_req *req;
9925         struct rpccli_lsa_CREDRWRITE_state *state;
9926         struct tevent_req *subreq;
9927
9928         req = tevent_req_create(mem_ctx, &state,
9929                                 struct rpccli_lsa_CREDRWRITE_state);
9930         if (req == NULL) {
9931                 return NULL;
9932         }
9933         state->out_mem_ctx = NULL;
9934         state->dispatch_recv = cli->dispatch_recv;
9935
9936         /* In parameters */
9937
9938         /* Out parameters */
9939
9940         /* Result */
9941         ZERO_STRUCT(state->orig.out.result);
9942
9943         if (DEBUGLEVEL >= 10) {
9944                 NDR_PRINT_IN_DEBUG(lsa_CREDRWRITE, &state->orig);
9945         }
9946
9947         /* make a temporary copy, that we pass to the dispatch function */
9948         state->tmp = state->orig;
9949
9950         subreq = cli->dispatch_send(state, ev, cli,
9951                                     &ndr_table_lsarpc,
9952                                     NDR_LSA_CREDRWRITE,
9953                                     &state->tmp);
9954         if (tevent_req_nomem(subreq, req)) {
9955                 return tevent_req_post(req, ev);
9956         }
9957         tevent_req_set_callback(subreq, rpccli_lsa_CREDRWRITE_done, req);
9958         return req;
9959 }
9960
9961 static void rpccli_lsa_CREDRWRITE_done(struct tevent_req *subreq)
9962 {
9963         struct tevent_req *req = tevent_req_callback_data(
9964                 subreq, struct tevent_req);
9965         struct rpccli_lsa_CREDRWRITE_state *state = tevent_req_data(
9966                 req, struct rpccli_lsa_CREDRWRITE_state);
9967         NTSTATUS status;
9968         TALLOC_CTX *mem_ctx;
9969
9970         if (state->out_mem_ctx) {
9971                 mem_ctx = state->out_mem_ctx;
9972         } else {
9973                 mem_ctx = state;
9974         }
9975
9976         status = state->dispatch_recv(subreq, mem_ctx);
9977         TALLOC_FREE(subreq);
9978         if (!NT_STATUS_IS_OK(status)) {
9979                 tevent_req_nterror(req, status);
9980                 return;
9981         }
9982
9983         /* Copy out parameters */
9984
9985         /* Copy result */
9986         state->orig.out.result = state->tmp.out.result;
9987
9988         /* Reset temporary structure */
9989         ZERO_STRUCT(state->tmp);
9990
9991         if (DEBUGLEVEL >= 10) {
9992                 NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITE, &state->orig);
9993         }
9994
9995         tevent_req_done(req);
9996 }
9997
9998 NTSTATUS rpccli_lsa_CREDRWRITE_recv(struct tevent_req *req,
9999                                     TALLOC_CTX *mem_ctx,
10000                                     NTSTATUS *result)
10001 {
10002         struct rpccli_lsa_CREDRWRITE_state *state = tevent_req_data(
10003                 req, struct rpccli_lsa_CREDRWRITE_state);
10004         NTSTATUS status;
10005
10006         if (tevent_req_is_nterror(req, &status)) {
10007                 tevent_req_received(req);
10008                 return status;
10009         }
10010
10011         /* Steal possbile out parameters to the callers context */
10012         talloc_steal(mem_ctx, state->out_mem_ctx);
10013
10014         /* Return result */
10015         *result = state->orig.out.result;
10016
10017         tevent_req_received(req);
10018         return NT_STATUS_OK;
10019 }
10020
10021 NTSTATUS rpccli_lsa_CREDRWRITE(struct rpc_pipe_client *cli,
10022                                TALLOC_CTX *mem_ctx)
10023 {
10024         struct lsa_CREDRWRITE r;
10025         NTSTATUS status;
10026
10027         /* In parameters */
10028
10029         if (DEBUGLEVEL >= 10) {
10030                 NDR_PRINT_IN_DEBUG(lsa_CREDRWRITE, &r);
10031         }
10032
10033         status = cli->dispatch(cli,
10034                                 mem_ctx,
10035                                 &ndr_table_lsarpc,
10036                                 NDR_LSA_CREDRWRITE,
10037                                 &r);
10038
10039         if (!NT_STATUS_IS_OK(status)) {
10040                 return status;
10041         }
10042
10043         if (DEBUGLEVEL >= 10) {
10044                 NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITE, &r);
10045         }
10046
10047         if (NT_STATUS_IS_ERR(status)) {
10048                 return status;
10049         }
10050
10051         /* Return variables */
10052
10053         /* Return result */
10054         return r.out.result;
10055 }
10056
10057 struct rpccli_lsa_CREDRREAD_state {
10058         struct lsa_CREDRREAD orig;
10059         struct lsa_CREDRREAD tmp;
10060         TALLOC_CTX *out_mem_ctx;
10061         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10062 };
10063
10064 static void rpccli_lsa_CREDRREAD_done(struct tevent_req *subreq);
10065
10066 struct tevent_req *rpccli_lsa_CREDRREAD_send(TALLOC_CTX *mem_ctx,
10067                                              struct tevent_context *ev,
10068                                              struct rpc_pipe_client *cli)
10069 {
10070         struct tevent_req *req;
10071         struct rpccli_lsa_CREDRREAD_state *state;
10072         struct tevent_req *subreq;
10073
10074         req = tevent_req_create(mem_ctx, &state,
10075                                 struct rpccli_lsa_CREDRREAD_state);
10076         if (req == NULL) {
10077                 return NULL;
10078         }
10079         state->out_mem_ctx = NULL;
10080         state->dispatch_recv = cli->dispatch_recv;
10081
10082         /* In parameters */
10083
10084         /* Out parameters */
10085
10086         /* Result */
10087         ZERO_STRUCT(state->orig.out.result);
10088
10089         if (DEBUGLEVEL >= 10) {
10090                 NDR_PRINT_IN_DEBUG(lsa_CREDRREAD, &state->orig);
10091         }
10092
10093         /* make a temporary copy, that we pass to the dispatch function */
10094         state->tmp = state->orig;
10095
10096         subreq = cli->dispatch_send(state, ev, cli,
10097                                     &ndr_table_lsarpc,
10098                                     NDR_LSA_CREDRREAD,
10099                                     &state->tmp);
10100         if (tevent_req_nomem(subreq, req)) {
10101                 return tevent_req_post(req, ev);
10102         }
10103         tevent_req_set_callback(subreq, rpccli_lsa_CREDRREAD_done, req);
10104         return req;
10105 }
10106
10107 static void rpccli_lsa_CREDRREAD_done(struct tevent_req *subreq)
10108 {
10109         struct tevent_req *req = tevent_req_callback_data(
10110                 subreq, struct tevent_req);
10111         struct rpccli_lsa_CREDRREAD_state *state = tevent_req_data(
10112                 req, struct rpccli_lsa_CREDRREAD_state);
10113         NTSTATUS status;
10114         TALLOC_CTX *mem_ctx;
10115
10116         if (state->out_mem_ctx) {
10117                 mem_ctx = state->out_mem_ctx;
10118         } else {
10119                 mem_ctx = state;
10120         }
10121
10122         status = state->dispatch_recv(subreq, mem_ctx);
10123         TALLOC_FREE(subreq);
10124         if (!NT_STATUS_IS_OK(status)) {
10125                 tevent_req_nterror(req, status);
10126                 return;
10127         }
10128
10129         /* Copy out parameters */
10130
10131         /* Copy result */
10132         state->orig.out.result = state->tmp.out.result;
10133
10134         /* Reset temporary structure */
10135         ZERO_STRUCT(state->tmp);
10136
10137         if (DEBUGLEVEL >= 10) {
10138                 NDR_PRINT_OUT_DEBUG(lsa_CREDRREAD, &state->orig);
10139         }
10140
10141         tevent_req_done(req);
10142 }
10143
10144 NTSTATUS rpccli_lsa_CREDRREAD_recv(struct tevent_req *req,
10145                                    TALLOC_CTX *mem_ctx,
10146                                    NTSTATUS *result)
10147 {
10148         struct rpccli_lsa_CREDRREAD_state *state = tevent_req_data(
10149                 req, struct rpccli_lsa_CREDRREAD_state);
10150         NTSTATUS status;
10151
10152         if (tevent_req_is_nterror(req, &status)) {
10153                 tevent_req_received(req);
10154                 return status;
10155         }
10156
10157         /* Steal possbile out parameters to the callers context */
10158         talloc_steal(mem_ctx, state->out_mem_ctx);
10159
10160         /* Return result */
10161         *result = state->orig.out.result;
10162
10163         tevent_req_received(req);
10164         return NT_STATUS_OK;
10165 }
10166
10167 NTSTATUS rpccli_lsa_CREDRREAD(struct rpc_pipe_client *cli,
10168                               TALLOC_CTX *mem_ctx)
10169 {
10170         struct lsa_CREDRREAD r;
10171         NTSTATUS status;
10172
10173         /* In parameters */
10174
10175         if (DEBUGLEVEL >= 10) {
10176                 NDR_PRINT_IN_DEBUG(lsa_CREDRREAD, &r);
10177         }
10178
10179         status = cli->dispatch(cli,
10180                                 mem_ctx,
10181                                 &ndr_table_lsarpc,
10182                                 NDR_LSA_CREDRREAD,
10183                                 &r);
10184
10185         if (!NT_STATUS_IS_OK(status)) {
10186                 return status;
10187         }
10188
10189         if (DEBUGLEVEL >= 10) {
10190                 NDR_PRINT_OUT_DEBUG(lsa_CREDRREAD, &r);
10191         }
10192
10193         if (NT_STATUS_IS_ERR(status)) {
10194                 return status;
10195         }
10196
10197         /* Return variables */
10198
10199         /* Return result */
10200         return r.out.result;
10201 }
10202
10203 struct rpccli_lsa_CREDRENUMERATE_state {
10204         struct lsa_CREDRENUMERATE orig;
10205         struct lsa_CREDRENUMERATE tmp;
10206         TALLOC_CTX *out_mem_ctx;
10207         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10208 };
10209
10210 static void rpccli_lsa_CREDRENUMERATE_done(struct tevent_req *subreq);
10211
10212 struct tevent_req *rpccli_lsa_CREDRENUMERATE_send(TALLOC_CTX *mem_ctx,
10213                                                   struct tevent_context *ev,
10214                                                   struct rpc_pipe_client *cli)
10215 {
10216         struct tevent_req *req;
10217         struct rpccli_lsa_CREDRENUMERATE_state *state;
10218         struct tevent_req *subreq;
10219
10220         req = tevent_req_create(mem_ctx, &state,
10221                                 struct rpccli_lsa_CREDRENUMERATE_state);
10222         if (req == NULL) {
10223                 return NULL;
10224         }
10225         state->out_mem_ctx = NULL;
10226         state->dispatch_recv = cli->dispatch_recv;
10227
10228         /* In parameters */
10229
10230         /* Out parameters */
10231
10232         /* Result */
10233         ZERO_STRUCT(state->orig.out.result);
10234
10235         if (DEBUGLEVEL >= 10) {
10236                 NDR_PRINT_IN_DEBUG(lsa_CREDRENUMERATE, &state->orig);
10237         }
10238
10239         /* make a temporary copy, that we pass to the dispatch function */
10240         state->tmp = state->orig;
10241
10242         subreq = cli->dispatch_send(state, ev, cli,
10243                                     &ndr_table_lsarpc,
10244                                     NDR_LSA_CREDRENUMERATE,
10245                                     &state->tmp);
10246         if (tevent_req_nomem(subreq, req)) {
10247                 return tevent_req_post(req, ev);
10248         }
10249         tevent_req_set_callback(subreq, rpccli_lsa_CREDRENUMERATE_done, req);
10250         return req;
10251 }
10252
10253 static void rpccli_lsa_CREDRENUMERATE_done(struct tevent_req *subreq)
10254 {
10255         struct tevent_req *req = tevent_req_callback_data(
10256                 subreq, struct tevent_req);
10257         struct rpccli_lsa_CREDRENUMERATE_state *state = tevent_req_data(
10258                 req, struct rpccli_lsa_CREDRENUMERATE_state);
10259         NTSTATUS status;
10260         TALLOC_CTX *mem_ctx;
10261
10262         if (state->out_mem_ctx) {
10263                 mem_ctx = state->out_mem_ctx;
10264         } else {
10265                 mem_ctx = state;
10266         }
10267
10268         status = state->dispatch_recv(subreq, mem_ctx);
10269         TALLOC_FREE(subreq);
10270         if (!NT_STATUS_IS_OK(status)) {
10271                 tevent_req_nterror(req, status);
10272                 return;
10273         }
10274
10275         /* Copy out parameters */
10276
10277         /* Copy result */
10278         state->orig.out.result = state->tmp.out.result;
10279
10280         /* Reset temporary structure */
10281         ZERO_STRUCT(state->tmp);
10282
10283         if (DEBUGLEVEL >= 10) {
10284                 NDR_PRINT_OUT_DEBUG(lsa_CREDRENUMERATE, &state->orig);
10285         }
10286
10287         tevent_req_done(req);
10288 }
10289
10290 NTSTATUS rpccli_lsa_CREDRENUMERATE_recv(struct tevent_req *req,
10291                                         TALLOC_CTX *mem_ctx,
10292                                         NTSTATUS *result)
10293 {
10294         struct rpccli_lsa_CREDRENUMERATE_state *state = tevent_req_data(
10295                 req, struct rpccli_lsa_CREDRENUMERATE_state);
10296         NTSTATUS status;
10297
10298         if (tevent_req_is_nterror(req, &status)) {
10299                 tevent_req_received(req);
10300                 return status;
10301         }
10302
10303         /* Steal possbile out parameters to the callers context */
10304         talloc_steal(mem_ctx, state->out_mem_ctx);
10305
10306         /* Return result */
10307         *result = state->orig.out.result;
10308
10309         tevent_req_received(req);
10310         return NT_STATUS_OK;
10311 }
10312
10313 NTSTATUS rpccli_lsa_CREDRENUMERATE(struct rpc_pipe_client *cli,
10314                                    TALLOC_CTX *mem_ctx)
10315 {
10316         struct lsa_CREDRENUMERATE r;
10317         NTSTATUS status;
10318
10319         /* In parameters */
10320
10321         if (DEBUGLEVEL >= 10) {
10322                 NDR_PRINT_IN_DEBUG(lsa_CREDRENUMERATE, &r);
10323         }
10324
10325         status = cli->dispatch(cli,
10326                                 mem_ctx,
10327                                 &ndr_table_lsarpc,
10328                                 NDR_LSA_CREDRENUMERATE,
10329                                 &r);
10330
10331         if (!NT_STATUS_IS_OK(status)) {
10332                 return status;
10333         }
10334
10335         if (DEBUGLEVEL >= 10) {
10336                 NDR_PRINT_OUT_DEBUG(lsa_CREDRENUMERATE, &r);
10337         }
10338
10339         if (NT_STATUS_IS_ERR(status)) {
10340                 return status;
10341         }
10342
10343         /* Return variables */
10344
10345         /* Return result */
10346         return r.out.result;
10347 }
10348
10349 struct rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS_state {
10350         struct lsa_CREDRWRITEDOMAINCREDENTIALS orig;
10351         struct lsa_CREDRWRITEDOMAINCREDENTIALS tmp;
10352         TALLOC_CTX *out_mem_ctx;
10353         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10354 };
10355
10356 static void rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS_done(struct tevent_req *subreq);
10357
10358 struct tevent_req *rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS_send(TALLOC_CTX *mem_ctx,
10359                                                                struct tevent_context *ev,
10360                                                                struct rpc_pipe_client *cli)
10361 {
10362         struct tevent_req *req;
10363         struct rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS_state *state;
10364         struct tevent_req *subreq;
10365
10366         req = tevent_req_create(mem_ctx, &state,
10367                                 struct rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS_state);
10368         if (req == NULL) {
10369                 return NULL;
10370         }
10371         state->out_mem_ctx = NULL;
10372         state->dispatch_recv = cli->dispatch_recv;
10373
10374         /* In parameters */
10375
10376         /* Out parameters */
10377
10378         /* Result */
10379         ZERO_STRUCT(state->orig.out.result);
10380
10381         if (DEBUGLEVEL >= 10) {
10382                 NDR_PRINT_IN_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, &state->orig);
10383         }
10384
10385         /* make a temporary copy, that we pass to the dispatch function */
10386         state->tmp = state->orig;
10387
10388         subreq = cli->dispatch_send(state, ev, cli,
10389                                     &ndr_table_lsarpc,
10390                                     NDR_LSA_CREDRWRITEDOMAINCREDENTIALS,
10391                                     &state->tmp);
10392         if (tevent_req_nomem(subreq, req)) {
10393                 return tevent_req_post(req, ev);
10394         }
10395         tevent_req_set_callback(subreq, rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS_done, req);
10396         return req;
10397 }
10398
10399 static void rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS_done(struct tevent_req *subreq)
10400 {
10401         struct tevent_req *req = tevent_req_callback_data(
10402                 subreq, struct tevent_req);
10403         struct rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS_state *state = tevent_req_data(
10404                 req, struct rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS_state);
10405         NTSTATUS status;
10406         TALLOC_CTX *mem_ctx;
10407
10408         if (state->out_mem_ctx) {
10409                 mem_ctx = state->out_mem_ctx;
10410         } else {
10411                 mem_ctx = state;
10412         }
10413
10414         status = state->dispatch_recv(subreq, mem_ctx);
10415         TALLOC_FREE(subreq);
10416         if (!NT_STATUS_IS_OK(status)) {
10417                 tevent_req_nterror(req, status);
10418                 return;
10419         }
10420
10421         /* Copy out parameters */
10422
10423         /* Copy result */
10424         state->orig.out.result = state->tmp.out.result;
10425
10426         /* Reset temporary structure */
10427         ZERO_STRUCT(state->tmp);
10428
10429         if (DEBUGLEVEL >= 10) {
10430                 NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, &state->orig);
10431         }
10432
10433         tevent_req_done(req);
10434 }
10435
10436 NTSTATUS rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS_recv(struct tevent_req *req,
10437                                                      TALLOC_CTX *mem_ctx,
10438                                                      NTSTATUS *result)
10439 {
10440         struct rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS_state *state = tevent_req_data(
10441                 req, struct rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS_state);
10442         NTSTATUS status;
10443
10444         if (tevent_req_is_nterror(req, &status)) {
10445                 tevent_req_received(req);
10446                 return status;
10447         }
10448
10449         /* Steal possbile out parameters to the callers context */
10450         talloc_steal(mem_ctx, state->out_mem_ctx);
10451
10452         /* Return result */
10453         *result = state->orig.out.result;
10454
10455         tevent_req_received(req);
10456         return NT_STATUS_OK;
10457 }
10458
10459 NTSTATUS rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS(struct rpc_pipe_client *cli,
10460                                                 TALLOC_CTX *mem_ctx)
10461 {
10462         struct lsa_CREDRWRITEDOMAINCREDENTIALS r;
10463         NTSTATUS status;
10464
10465         /* In parameters */
10466
10467         if (DEBUGLEVEL >= 10) {
10468                 NDR_PRINT_IN_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, &r);
10469         }
10470
10471         status = cli->dispatch(cli,
10472                                 mem_ctx,
10473                                 &ndr_table_lsarpc,
10474                                 NDR_LSA_CREDRWRITEDOMAINCREDENTIALS,
10475                                 &r);
10476
10477         if (!NT_STATUS_IS_OK(status)) {
10478                 return status;
10479         }
10480
10481         if (DEBUGLEVEL >= 10) {
10482                 NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, &r);
10483         }
10484
10485         if (NT_STATUS_IS_ERR(status)) {
10486                 return status;
10487         }
10488
10489         /* Return variables */
10490
10491         /* Return result */
10492         return r.out.result;
10493 }
10494
10495 struct rpccli_lsa_CREDRREADDOMAINCREDENTIALS_state {
10496         struct lsa_CREDRREADDOMAINCREDENTIALS orig;
10497         struct lsa_CREDRREADDOMAINCREDENTIALS tmp;
10498         TALLOC_CTX *out_mem_ctx;
10499         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10500 };
10501
10502 static void rpccli_lsa_CREDRREADDOMAINCREDENTIALS_done(struct tevent_req *subreq);
10503
10504 struct tevent_req *rpccli_lsa_CREDRREADDOMAINCREDENTIALS_send(TALLOC_CTX *mem_ctx,
10505                                                               struct tevent_context *ev,
10506                                                               struct rpc_pipe_client *cli)
10507 {
10508         struct tevent_req *req;
10509         struct rpccli_lsa_CREDRREADDOMAINCREDENTIALS_state *state;
10510         struct tevent_req *subreq;
10511
10512         req = tevent_req_create(mem_ctx, &state,
10513                                 struct rpccli_lsa_CREDRREADDOMAINCREDENTIALS_state);
10514         if (req == NULL) {
10515                 return NULL;
10516         }
10517         state->out_mem_ctx = NULL;
10518         state->dispatch_recv = cli->dispatch_recv;
10519
10520         /* In parameters */
10521
10522         /* Out parameters */
10523
10524         /* Result */
10525         ZERO_STRUCT(state->orig.out.result);
10526
10527         if (DEBUGLEVEL >= 10) {
10528                 NDR_PRINT_IN_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, &state->orig);
10529         }
10530
10531         /* make a temporary copy, that we pass to the dispatch function */
10532         state->tmp = state->orig;
10533
10534         subreq = cli->dispatch_send(state, ev, cli,
10535                                     &ndr_table_lsarpc,
10536                                     NDR_LSA_CREDRREADDOMAINCREDENTIALS,
10537                                     &state->tmp);
10538         if (tevent_req_nomem(subreq, req)) {
10539                 return tevent_req_post(req, ev);
10540         }
10541         tevent_req_set_callback(subreq, rpccli_lsa_CREDRREADDOMAINCREDENTIALS_done, req);
10542         return req;
10543 }
10544
10545 static void rpccli_lsa_CREDRREADDOMAINCREDENTIALS_done(struct tevent_req *subreq)
10546 {
10547         struct tevent_req *req = tevent_req_callback_data(
10548                 subreq, struct tevent_req);
10549         struct rpccli_lsa_CREDRREADDOMAINCREDENTIALS_state *state = tevent_req_data(
10550                 req, struct rpccli_lsa_CREDRREADDOMAINCREDENTIALS_state);
10551         NTSTATUS status;
10552         TALLOC_CTX *mem_ctx;
10553
10554         if (state->out_mem_ctx) {
10555                 mem_ctx = state->out_mem_ctx;
10556         } else {
10557                 mem_ctx = state;
10558         }
10559
10560         status = state->dispatch_recv(subreq, mem_ctx);
10561         TALLOC_FREE(subreq);
10562         if (!NT_STATUS_IS_OK(status)) {
10563                 tevent_req_nterror(req, status);
10564                 return;
10565         }
10566
10567         /* Copy out parameters */
10568
10569         /* Copy result */
10570         state->orig.out.result = state->tmp.out.result;
10571
10572         /* Reset temporary structure */
10573         ZERO_STRUCT(state->tmp);
10574
10575         if (DEBUGLEVEL >= 10) {
10576                 NDR_PRINT_OUT_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, &state->orig);
10577         }
10578
10579         tevent_req_done(req);
10580 }
10581
10582 NTSTATUS rpccli_lsa_CREDRREADDOMAINCREDENTIALS_recv(struct tevent_req *req,
10583                                                     TALLOC_CTX *mem_ctx,
10584                                                     NTSTATUS *result)
10585 {
10586         struct rpccli_lsa_CREDRREADDOMAINCREDENTIALS_state *state = tevent_req_data(
10587                 req, struct rpccli_lsa_CREDRREADDOMAINCREDENTIALS_state);
10588         NTSTATUS status;
10589
10590         if (tevent_req_is_nterror(req, &status)) {
10591                 tevent_req_received(req);
10592                 return status;
10593         }
10594
10595         /* Steal possbile out parameters to the callers context */
10596         talloc_steal(mem_ctx, state->out_mem_ctx);
10597
10598         /* Return result */
10599         *result = state->orig.out.result;
10600
10601         tevent_req_received(req);
10602         return NT_STATUS_OK;
10603 }
10604
10605 NTSTATUS rpccli_lsa_CREDRREADDOMAINCREDENTIALS(struct rpc_pipe_client *cli,
10606                                                TALLOC_CTX *mem_ctx)
10607 {
10608         struct lsa_CREDRREADDOMAINCREDENTIALS r;
10609         NTSTATUS status;
10610
10611         /* In parameters */
10612
10613         if (DEBUGLEVEL >= 10) {
10614                 NDR_PRINT_IN_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, &r);
10615         }
10616
10617         status = cli->dispatch(cli,
10618                                 mem_ctx,
10619                                 &ndr_table_lsarpc,
10620                                 NDR_LSA_CREDRREADDOMAINCREDENTIALS,
10621                                 &r);
10622
10623         if (!NT_STATUS_IS_OK(status)) {
10624                 return status;
10625         }
10626
10627         if (DEBUGLEVEL >= 10) {
10628                 NDR_PRINT_OUT_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, &r);
10629         }
10630
10631         if (NT_STATUS_IS_ERR(status)) {
10632                 return status;
10633         }
10634
10635         /* Return variables */
10636
10637         /* Return result */
10638         return r.out.result;
10639 }
10640
10641 struct rpccli_lsa_CREDRDELETE_state {
10642         struct lsa_CREDRDELETE orig;
10643         struct lsa_CREDRDELETE tmp;
10644         TALLOC_CTX *out_mem_ctx;
10645         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10646 };
10647
10648 static void rpccli_lsa_CREDRDELETE_done(struct tevent_req *subreq);
10649
10650 struct tevent_req *rpccli_lsa_CREDRDELETE_send(TALLOC_CTX *mem_ctx,
10651                                                struct tevent_context *ev,
10652                                                struct rpc_pipe_client *cli)
10653 {
10654         struct tevent_req *req;
10655         struct rpccli_lsa_CREDRDELETE_state *state;
10656         struct tevent_req *subreq;
10657
10658         req = tevent_req_create(mem_ctx, &state,
10659                                 struct rpccli_lsa_CREDRDELETE_state);
10660         if (req == NULL) {
10661                 return NULL;
10662         }
10663         state->out_mem_ctx = NULL;
10664         state->dispatch_recv = cli->dispatch_recv;
10665
10666         /* In parameters */
10667
10668         /* Out parameters */
10669
10670         /* Result */
10671         ZERO_STRUCT(state->orig.out.result);
10672
10673         if (DEBUGLEVEL >= 10) {
10674                 NDR_PRINT_IN_DEBUG(lsa_CREDRDELETE, &state->orig);
10675         }
10676
10677         /* make a temporary copy, that we pass to the dispatch function */
10678         state->tmp = state->orig;
10679
10680         subreq = cli->dispatch_send(state, ev, cli,
10681                                     &ndr_table_lsarpc,
10682                                     NDR_LSA_CREDRDELETE,
10683                                     &state->tmp);
10684         if (tevent_req_nomem(subreq, req)) {
10685                 return tevent_req_post(req, ev);
10686         }
10687         tevent_req_set_callback(subreq, rpccli_lsa_CREDRDELETE_done, req);
10688         return req;
10689 }
10690
10691 static void rpccli_lsa_CREDRDELETE_done(struct tevent_req *subreq)
10692 {
10693         struct tevent_req *req = tevent_req_callback_data(
10694                 subreq, struct tevent_req);
10695         struct rpccli_lsa_CREDRDELETE_state *state = tevent_req_data(
10696                 req, struct rpccli_lsa_CREDRDELETE_state);
10697         NTSTATUS status;
10698         TALLOC_CTX *mem_ctx;
10699
10700         if (state->out_mem_ctx) {
10701                 mem_ctx = state->out_mem_ctx;
10702         } else {
10703                 mem_ctx = state;
10704         }
10705
10706         status = state->dispatch_recv(subreq, mem_ctx);
10707         TALLOC_FREE(subreq);
10708         if (!NT_STATUS_IS_OK(status)) {
10709                 tevent_req_nterror(req, status);
10710                 return;
10711         }
10712
10713         /* Copy out parameters */
10714
10715         /* Copy result */
10716         state->orig.out.result = state->tmp.out.result;
10717
10718         /* Reset temporary structure */
10719         ZERO_STRUCT(state->tmp);
10720
10721         if (DEBUGLEVEL >= 10) {
10722                 NDR_PRINT_OUT_DEBUG(lsa_CREDRDELETE, &state->orig);
10723         }
10724
10725         tevent_req_done(req);
10726 }
10727
10728 NTSTATUS rpccli_lsa_CREDRDELETE_recv(struct tevent_req *req,
10729                                      TALLOC_CTX *mem_ctx,
10730                                      NTSTATUS *result)
10731 {
10732         struct rpccli_lsa_CREDRDELETE_state *state = tevent_req_data(
10733                 req, struct rpccli_lsa_CREDRDELETE_state);
10734         NTSTATUS status;
10735
10736         if (tevent_req_is_nterror(req, &status)) {
10737                 tevent_req_received(req);
10738                 return status;
10739         }
10740
10741         /* Steal possbile out parameters to the callers context */
10742         talloc_steal(mem_ctx, state->out_mem_ctx);
10743
10744         /* Return result */
10745         *result = state->orig.out.result;
10746
10747         tevent_req_received(req);
10748         return NT_STATUS_OK;
10749 }
10750
10751 NTSTATUS rpccli_lsa_CREDRDELETE(struct rpc_pipe_client *cli,
10752                                 TALLOC_CTX *mem_ctx)
10753 {
10754         struct lsa_CREDRDELETE r;
10755         NTSTATUS status;
10756
10757         /* In parameters */
10758
10759         if (DEBUGLEVEL >= 10) {
10760                 NDR_PRINT_IN_DEBUG(lsa_CREDRDELETE, &r);
10761         }
10762
10763         status = cli->dispatch(cli,
10764                                 mem_ctx,
10765                                 &ndr_table_lsarpc,
10766                                 NDR_LSA_CREDRDELETE,
10767                                 &r);
10768
10769         if (!NT_STATUS_IS_OK(status)) {
10770                 return status;
10771         }
10772
10773         if (DEBUGLEVEL >= 10) {
10774                 NDR_PRINT_OUT_DEBUG(lsa_CREDRDELETE, &r);
10775         }
10776
10777         if (NT_STATUS_IS_ERR(status)) {
10778                 return status;
10779         }
10780
10781         /* Return variables */
10782
10783         /* Return result */
10784         return r.out.result;
10785 }
10786
10787 struct rpccli_lsa_CREDRGETTARGETINFO_state {
10788         struct lsa_CREDRGETTARGETINFO orig;
10789         struct lsa_CREDRGETTARGETINFO tmp;
10790         TALLOC_CTX *out_mem_ctx;
10791         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10792 };
10793
10794 static void rpccli_lsa_CREDRGETTARGETINFO_done(struct tevent_req *subreq);
10795
10796 struct tevent_req *rpccli_lsa_CREDRGETTARGETINFO_send(TALLOC_CTX *mem_ctx,
10797                                                       struct tevent_context *ev,
10798                                                       struct rpc_pipe_client *cli)
10799 {
10800         struct tevent_req *req;
10801         struct rpccli_lsa_CREDRGETTARGETINFO_state *state;
10802         struct tevent_req *subreq;
10803
10804         req = tevent_req_create(mem_ctx, &state,
10805                                 struct rpccli_lsa_CREDRGETTARGETINFO_state);
10806         if (req == NULL) {
10807                 return NULL;
10808         }
10809         state->out_mem_ctx = NULL;
10810         state->dispatch_recv = cli->dispatch_recv;
10811
10812         /* In parameters */
10813
10814         /* Out parameters */
10815
10816         /* Result */
10817         ZERO_STRUCT(state->orig.out.result);
10818
10819         if (DEBUGLEVEL >= 10) {
10820                 NDR_PRINT_IN_DEBUG(lsa_CREDRGETTARGETINFO, &state->orig);
10821         }
10822
10823         /* make a temporary copy, that we pass to the dispatch function */
10824         state->tmp = state->orig;
10825
10826         subreq = cli->dispatch_send(state, ev, cli,
10827                                     &ndr_table_lsarpc,
10828                                     NDR_LSA_CREDRGETTARGETINFO,
10829                                     &state->tmp);
10830         if (tevent_req_nomem(subreq, req)) {
10831                 return tevent_req_post(req, ev);
10832         }
10833         tevent_req_set_callback(subreq, rpccli_lsa_CREDRGETTARGETINFO_done, req);
10834         return req;
10835 }
10836
10837 static void rpccli_lsa_CREDRGETTARGETINFO_done(struct tevent_req *subreq)
10838 {
10839         struct tevent_req *req = tevent_req_callback_data(
10840                 subreq, struct tevent_req);
10841         struct rpccli_lsa_CREDRGETTARGETINFO_state *state = tevent_req_data(
10842                 req, struct rpccli_lsa_CREDRGETTARGETINFO_state);
10843         NTSTATUS status;
10844         TALLOC_CTX *mem_ctx;
10845
10846         if (state->out_mem_ctx) {
10847                 mem_ctx = state->out_mem_ctx;
10848         } else {
10849                 mem_ctx = state;
10850         }
10851
10852         status = state->dispatch_recv(subreq, mem_ctx);
10853         TALLOC_FREE(subreq);
10854         if (!NT_STATUS_IS_OK(status)) {
10855                 tevent_req_nterror(req, status);
10856                 return;
10857         }
10858
10859         /* Copy out parameters */
10860
10861         /* Copy result */
10862         state->orig.out.result = state->tmp.out.result;
10863
10864         /* Reset temporary structure */
10865         ZERO_STRUCT(state->tmp);
10866
10867         if (DEBUGLEVEL >= 10) {
10868                 NDR_PRINT_OUT_DEBUG(lsa_CREDRGETTARGETINFO, &state->orig);
10869         }
10870
10871         tevent_req_done(req);
10872 }
10873
10874 NTSTATUS rpccli_lsa_CREDRGETTARGETINFO_recv(struct tevent_req *req,
10875                                             TALLOC_CTX *mem_ctx,
10876                                             NTSTATUS *result)
10877 {
10878         struct rpccli_lsa_CREDRGETTARGETINFO_state *state = tevent_req_data(
10879                 req, struct rpccli_lsa_CREDRGETTARGETINFO_state);
10880         NTSTATUS status;
10881
10882         if (tevent_req_is_nterror(req, &status)) {
10883                 tevent_req_received(req);
10884                 return status;
10885         }
10886
10887         /* Steal possbile out parameters to the callers context */
10888         talloc_steal(mem_ctx, state->out_mem_ctx);
10889
10890         /* Return result */
10891         *result = state->orig.out.result;
10892
10893         tevent_req_received(req);
10894         return NT_STATUS_OK;
10895 }
10896
10897 NTSTATUS rpccli_lsa_CREDRGETTARGETINFO(struct rpc_pipe_client *cli,
10898                                        TALLOC_CTX *mem_ctx)
10899 {
10900         struct lsa_CREDRGETTARGETINFO r;
10901         NTSTATUS status;
10902
10903         /* In parameters */
10904
10905         if (DEBUGLEVEL >= 10) {
10906                 NDR_PRINT_IN_DEBUG(lsa_CREDRGETTARGETINFO, &r);
10907         }
10908
10909         status = cli->dispatch(cli,
10910                                 mem_ctx,
10911                                 &ndr_table_lsarpc,
10912                                 NDR_LSA_CREDRGETTARGETINFO,
10913                                 &r);
10914
10915         if (!NT_STATUS_IS_OK(status)) {
10916                 return status;
10917         }
10918
10919         if (DEBUGLEVEL >= 10) {
10920                 NDR_PRINT_OUT_DEBUG(lsa_CREDRGETTARGETINFO, &r);
10921         }
10922
10923         if (NT_STATUS_IS_ERR(status)) {
10924                 return status;
10925         }
10926
10927         /* Return variables */
10928
10929         /* Return result */
10930         return r.out.result;
10931 }
10932
10933 struct rpccli_lsa_CREDRPROFILELOADED_state {
10934         struct lsa_CREDRPROFILELOADED orig;
10935         struct lsa_CREDRPROFILELOADED tmp;
10936         TALLOC_CTX *out_mem_ctx;
10937         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10938 };
10939
10940 static void rpccli_lsa_CREDRPROFILELOADED_done(struct tevent_req *subreq);
10941
10942 struct tevent_req *rpccli_lsa_CREDRPROFILELOADED_send(TALLOC_CTX *mem_ctx,
10943                                                       struct tevent_context *ev,
10944                                                       struct rpc_pipe_client *cli)
10945 {
10946         struct tevent_req *req;
10947         struct rpccli_lsa_CREDRPROFILELOADED_state *state;
10948         struct tevent_req *subreq;
10949
10950         req = tevent_req_create(mem_ctx, &state,
10951                                 struct rpccli_lsa_CREDRPROFILELOADED_state);
10952         if (req == NULL) {
10953                 return NULL;
10954         }
10955         state->out_mem_ctx = NULL;
10956         state->dispatch_recv = cli->dispatch_recv;
10957
10958         /* In parameters */
10959
10960         /* Out parameters */
10961
10962         /* Result */
10963         ZERO_STRUCT(state->orig.out.result);
10964
10965         if (DEBUGLEVEL >= 10) {
10966                 NDR_PRINT_IN_DEBUG(lsa_CREDRPROFILELOADED, &state->orig);
10967         }
10968
10969         /* make a temporary copy, that we pass to the dispatch function */
10970         state->tmp = state->orig;
10971
10972         subreq = cli->dispatch_send(state, ev, cli,
10973                                     &ndr_table_lsarpc,
10974                                     NDR_LSA_CREDRPROFILELOADED,
10975                                     &state->tmp);
10976         if (tevent_req_nomem(subreq, req)) {
10977                 return tevent_req_post(req, ev);
10978         }
10979         tevent_req_set_callback(subreq, rpccli_lsa_CREDRPROFILELOADED_done, req);
10980         return req;
10981 }
10982
10983 static void rpccli_lsa_CREDRPROFILELOADED_done(struct tevent_req *subreq)
10984 {
10985         struct tevent_req *req = tevent_req_callback_data(
10986                 subreq, struct tevent_req);
10987         struct rpccli_lsa_CREDRPROFILELOADED_state *state = tevent_req_data(
10988                 req, struct rpccli_lsa_CREDRPROFILELOADED_state);
10989         NTSTATUS status;
10990         TALLOC_CTX *mem_ctx;
10991
10992         if (state->out_mem_ctx) {
10993                 mem_ctx = state->out_mem_ctx;
10994         } else {
10995                 mem_ctx = state;
10996         }
10997
10998         status = state->dispatch_recv(subreq, mem_ctx);
10999         TALLOC_FREE(subreq);
11000         if (!NT_STATUS_IS_OK(status)) {
11001                 tevent_req_nterror(req, status);
11002                 return;
11003         }
11004
11005         /* Copy out parameters */
11006
11007         /* Copy result */
11008         state->orig.out.result = state->tmp.out.result;
11009
11010         /* Reset temporary structure */
11011         ZERO_STRUCT(state->tmp);
11012
11013         if (DEBUGLEVEL >= 10) {
11014                 NDR_PRINT_OUT_DEBUG(lsa_CREDRPROFILELOADED, &state->orig);
11015         }
11016
11017         tevent_req_done(req);
11018 }
11019
11020 NTSTATUS rpccli_lsa_CREDRPROFILELOADED_recv(struct tevent_req *req,
11021                                             TALLOC_CTX *mem_ctx,
11022                                             NTSTATUS *result)
11023 {
11024         struct rpccli_lsa_CREDRPROFILELOADED_state *state = tevent_req_data(
11025                 req, struct rpccli_lsa_CREDRPROFILELOADED_state);
11026         NTSTATUS status;
11027
11028         if (tevent_req_is_nterror(req, &status)) {
11029                 tevent_req_received(req);
11030                 return status;
11031         }
11032
11033         /* Steal possbile out parameters to the callers context */
11034         talloc_steal(mem_ctx, state->out_mem_ctx);
11035
11036         /* Return result */
11037         *result = state->orig.out.result;
11038
11039         tevent_req_received(req);
11040         return NT_STATUS_OK;
11041 }
11042
11043 NTSTATUS rpccli_lsa_CREDRPROFILELOADED(struct rpc_pipe_client *cli,
11044                                        TALLOC_CTX *mem_ctx)
11045 {
11046         struct lsa_CREDRPROFILELOADED r;
11047         NTSTATUS status;
11048
11049         /* In parameters */
11050
11051         if (DEBUGLEVEL >= 10) {
11052                 NDR_PRINT_IN_DEBUG(lsa_CREDRPROFILELOADED, &r);
11053         }
11054
11055         status = cli->dispatch(cli,
11056                                 mem_ctx,
11057                                 &ndr_table_lsarpc,
11058                                 NDR_LSA_CREDRPROFILELOADED,
11059                                 &r);
11060
11061         if (!NT_STATUS_IS_OK(status)) {
11062                 return status;
11063         }
11064
11065         if (DEBUGLEVEL >= 10) {
11066                 NDR_PRINT_OUT_DEBUG(lsa_CREDRPROFILELOADED, &r);
11067         }
11068
11069         if (NT_STATUS_IS_ERR(status)) {
11070                 return status;
11071         }
11072
11073         /* Return variables */
11074
11075         /* Return result */
11076         return r.out.result;
11077 }
11078
11079 struct rpccli_lsa_LookupNames3_state {
11080         struct lsa_LookupNames3 orig;
11081         struct lsa_LookupNames3 tmp;
11082         TALLOC_CTX *out_mem_ctx;
11083         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11084 };
11085
11086 static void rpccli_lsa_LookupNames3_done(struct tevent_req *subreq);
11087
11088 struct tevent_req *rpccli_lsa_LookupNames3_send(TALLOC_CTX *mem_ctx,
11089                                                 struct tevent_context *ev,
11090                                                 struct rpc_pipe_client *cli,
11091                                                 struct policy_handle *_handle /* [in] [ref] */,
11092                                                 uint32_t _num_names /* [in] [range(0,1000)] */,
11093                                                 struct lsa_String *_names /* [in] [size_is(num_names)] */,
11094                                                 struct lsa_RefDomainList **_domains /* [out] [ref] */,
11095                                                 struct lsa_TransSidArray3 *_sids /* [in,out] [ref] */,
11096                                                 enum lsa_LookupNamesLevel _level /* [in]  */,
11097                                                 uint32_t *_count /* [in,out] [ref] */,
11098                                                 uint32_t _lookup_options /* [in]  */,
11099                                                 uint32_t _client_revision /* [in]  */)
11100 {
11101         struct tevent_req *req;
11102         struct rpccli_lsa_LookupNames3_state *state;
11103         struct tevent_req *subreq;
11104
11105         req = tevent_req_create(mem_ctx, &state,
11106                                 struct rpccli_lsa_LookupNames3_state);
11107         if (req == NULL) {
11108                 return NULL;
11109         }
11110         state->out_mem_ctx = NULL;
11111         state->dispatch_recv = cli->dispatch_recv;
11112
11113         /* In parameters */
11114         state->orig.in.handle = _handle;
11115         state->orig.in.num_names = _num_names;
11116         state->orig.in.names = _names;
11117         state->orig.in.sids = _sids;
11118         state->orig.in.level = _level;
11119         state->orig.in.count = _count;
11120         state->orig.in.lookup_options = _lookup_options;
11121         state->orig.in.client_revision = _client_revision;
11122
11123         /* Out parameters */
11124         state->orig.out.domains = _domains;
11125         state->orig.out.sids = _sids;
11126         state->orig.out.count = _count;
11127
11128         /* Result */
11129         ZERO_STRUCT(state->orig.out.result);
11130
11131         if (DEBUGLEVEL >= 10) {
11132                 NDR_PRINT_IN_DEBUG(lsa_LookupNames3, &state->orig);
11133         }
11134
11135         state->out_mem_ctx = talloc_named_const(state, 0,
11136                              "rpccli_lsa_LookupNames3_out_memory");
11137         if (tevent_req_nomem(state->out_mem_ctx, req)) {
11138                 return tevent_req_post(req, ev);
11139         }
11140
11141         /* make a temporary copy, that we pass to the dispatch function */
11142         state->tmp = state->orig;
11143
11144         subreq = cli->dispatch_send(state, ev, cli,
11145                                     &ndr_table_lsarpc,
11146                                     NDR_LSA_LOOKUPNAMES3,
11147                                     &state->tmp);
11148         if (tevent_req_nomem(subreq, req)) {
11149                 return tevent_req_post(req, ev);
11150         }
11151         tevent_req_set_callback(subreq, rpccli_lsa_LookupNames3_done, req);
11152         return req;
11153 }
11154
11155 static void rpccli_lsa_LookupNames3_done(struct tevent_req *subreq)
11156 {
11157         struct tevent_req *req = tevent_req_callback_data(
11158                 subreq, struct tevent_req);
11159         struct rpccli_lsa_LookupNames3_state *state = tevent_req_data(
11160                 req, struct rpccli_lsa_LookupNames3_state);
11161         NTSTATUS status;
11162         TALLOC_CTX *mem_ctx;
11163
11164         if (state->out_mem_ctx) {
11165                 mem_ctx = state->out_mem_ctx;
11166         } else {
11167                 mem_ctx = state;
11168         }
11169
11170         status = state->dispatch_recv(subreq, mem_ctx);
11171         TALLOC_FREE(subreq);
11172         if (!NT_STATUS_IS_OK(status)) {
11173                 tevent_req_nterror(req, status);
11174                 return;
11175         }
11176
11177         /* Copy out parameters */
11178         *state->orig.out.domains = *state->tmp.out.domains;
11179         *state->orig.out.sids = *state->tmp.out.sids;
11180         *state->orig.out.count = *state->tmp.out.count;
11181
11182         /* Copy result */
11183         state->orig.out.result = state->tmp.out.result;
11184
11185         /* Reset temporary structure */
11186         ZERO_STRUCT(state->tmp);
11187
11188         if (DEBUGLEVEL >= 10) {
11189                 NDR_PRINT_OUT_DEBUG(lsa_LookupNames3, &state->orig);
11190         }
11191
11192         tevent_req_done(req);
11193 }
11194
11195 NTSTATUS rpccli_lsa_LookupNames3_recv(struct tevent_req *req,
11196                                       TALLOC_CTX *mem_ctx,
11197                                       NTSTATUS *result)
11198 {
11199         struct rpccli_lsa_LookupNames3_state *state = tevent_req_data(
11200                 req, struct rpccli_lsa_LookupNames3_state);
11201         NTSTATUS status;
11202
11203         if (tevent_req_is_nterror(req, &status)) {
11204                 tevent_req_received(req);
11205                 return status;
11206         }
11207
11208         /* Steal possbile out parameters to the callers context */
11209         talloc_steal(mem_ctx, state->out_mem_ctx);
11210
11211         /* Return result */
11212         *result = state->orig.out.result;
11213
11214         tevent_req_received(req);
11215         return NT_STATUS_OK;
11216 }
11217
11218 NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli,
11219                                  TALLOC_CTX *mem_ctx,
11220                                  struct policy_handle *handle /* [in] [ref] */,
11221                                  uint32_t num_names /* [in] [range(0,1000)] */,
11222                                  struct lsa_String *names /* [in] [size_is(num_names)] */,
11223                                  struct lsa_RefDomainList **domains /* [out] [ref] */,
11224                                  struct lsa_TransSidArray3 *sids /* [in,out] [ref] */,
11225                                  enum lsa_LookupNamesLevel level /* [in]  */,
11226                                  uint32_t *count /* [in,out] [ref] */,
11227                                  uint32_t lookup_options /* [in]  */,
11228                                  uint32_t client_revision /* [in]  */)
11229 {
11230         struct lsa_LookupNames3 r;
11231         NTSTATUS status;
11232
11233         /* In parameters */
11234         r.in.handle = handle;
11235         r.in.num_names = num_names;
11236         r.in.names = names;
11237         r.in.sids = sids;
11238         r.in.level = level;
11239         r.in.count = count;
11240         r.in.lookup_options = lookup_options;
11241         r.in.client_revision = client_revision;
11242
11243         if (DEBUGLEVEL >= 10) {
11244                 NDR_PRINT_IN_DEBUG(lsa_LookupNames3, &r);
11245         }
11246
11247         status = cli->dispatch(cli,
11248                                 mem_ctx,
11249                                 &ndr_table_lsarpc,
11250                                 NDR_LSA_LOOKUPNAMES3,
11251                                 &r);
11252
11253         if (!NT_STATUS_IS_OK(status)) {
11254                 return status;
11255         }
11256
11257         if (DEBUGLEVEL >= 10) {
11258                 NDR_PRINT_OUT_DEBUG(lsa_LookupNames3, &r);
11259         }
11260
11261         if (NT_STATUS_IS_ERR(status)) {
11262                 return status;
11263         }
11264
11265         /* Return variables */
11266         *domains = *r.out.domains;
11267         *sids = *r.out.sids;
11268         *count = *r.out.count;
11269
11270         /* Return result */
11271         return r.out.result;
11272 }
11273
11274 struct rpccli_lsa_CREDRGETSESSIONTYPES_state {
11275         struct lsa_CREDRGETSESSIONTYPES orig;
11276         struct lsa_CREDRGETSESSIONTYPES tmp;
11277         TALLOC_CTX *out_mem_ctx;
11278         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11279 };
11280
11281 static void rpccli_lsa_CREDRGETSESSIONTYPES_done(struct tevent_req *subreq);
11282
11283 struct tevent_req *rpccli_lsa_CREDRGETSESSIONTYPES_send(TALLOC_CTX *mem_ctx,
11284                                                         struct tevent_context *ev,
11285                                                         struct rpc_pipe_client *cli)
11286 {
11287         struct tevent_req *req;
11288         struct rpccli_lsa_CREDRGETSESSIONTYPES_state *state;
11289         struct tevent_req *subreq;
11290
11291         req = tevent_req_create(mem_ctx, &state,
11292                                 struct rpccli_lsa_CREDRGETSESSIONTYPES_state);
11293         if (req == NULL) {
11294                 return NULL;
11295         }
11296         state->out_mem_ctx = NULL;
11297         state->dispatch_recv = cli->dispatch_recv;
11298
11299         /* In parameters */
11300
11301         /* Out parameters */
11302
11303         /* Result */
11304         ZERO_STRUCT(state->orig.out.result);
11305
11306         if (DEBUGLEVEL >= 10) {
11307                 NDR_PRINT_IN_DEBUG(lsa_CREDRGETSESSIONTYPES, &state->orig);
11308         }
11309
11310         /* make a temporary copy, that we pass to the dispatch function */
11311         state->tmp = state->orig;
11312
11313         subreq = cli->dispatch_send(state, ev, cli,
11314                                     &ndr_table_lsarpc,
11315                                     NDR_LSA_CREDRGETSESSIONTYPES,
11316                                     &state->tmp);
11317         if (tevent_req_nomem(subreq, req)) {
11318                 return tevent_req_post(req, ev);
11319         }
11320         tevent_req_set_callback(subreq, rpccli_lsa_CREDRGETSESSIONTYPES_done, req);
11321         return req;
11322 }
11323
11324 static void rpccli_lsa_CREDRGETSESSIONTYPES_done(struct tevent_req *subreq)
11325 {
11326         struct tevent_req *req = tevent_req_callback_data(
11327                 subreq, struct tevent_req);
11328         struct rpccli_lsa_CREDRGETSESSIONTYPES_state *state = tevent_req_data(
11329                 req, struct rpccli_lsa_CREDRGETSESSIONTYPES_state);
11330         NTSTATUS status;
11331         TALLOC_CTX *mem_ctx;
11332
11333         if (state->out_mem_ctx) {
11334                 mem_ctx = state->out_mem_ctx;
11335         } else {
11336                 mem_ctx = state;
11337         }
11338
11339         status = state->dispatch_recv(subreq, mem_ctx);
11340         TALLOC_FREE(subreq);
11341         if (!NT_STATUS_IS_OK(status)) {
11342                 tevent_req_nterror(req, status);
11343                 return;
11344         }
11345
11346         /* Copy out parameters */
11347
11348         /* Copy result */
11349         state->orig.out.result = state->tmp.out.result;
11350
11351         /* Reset temporary structure */
11352         ZERO_STRUCT(state->tmp);
11353
11354         if (DEBUGLEVEL >= 10) {
11355                 NDR_PRINT_OUT_DEBUG(lsa_CREDRGETSESSIONTYPES, &state->orig);
11356         }
11357
11358         tevent_req_done(req);
11359 }
11360
11361 NTSTATUS rpccli_lsa_CREDRGETSESSIONTYPES_recv(struct tevent_req *req,
11362                                               TALLOC_CTX *mem_ctx,
11363                                               NTSTATUS *result)
11364 {
11365         struct rpccli_lsa_CREDRGETSESSIONTYPES_state *state = tevent_req_data(
11366                 req, struct rpccli_lsa_CREDRGETSESSIONTYPES_state);
11367         NTSTATUS status;
11368
11369         if (tevent_req_is_nterror(req, &status)) {
11370                 tevent_req_received(req);
11371                 return status;
11372         }
11373
11374         /* Steal possbile out parameters to the callers context */
11375         talloc_steal(mem_ctx, state->out_mem_ctx);
11376
11377         /* Return result */
11378         *result = state->orig.out.result;
11379
11380         tevent_req_received(req);
11381         return NT_STATUS_OK;
11382 }
11383
11384 NTSTATUS rpccli_lsa_CREDRGETSESSIONTYPES(struct rpc_pipe_client *cli,
11385                                          TALLOC_CTX *mem_ctx)
11386 {
11387         struct lsa_CREDRGETSESSIONTYPES r;
11388         NTSTATUS status;
11389
11390         /* In parameters */
11391
11392         if (DEBUGLEVEL >= 10) {
11393                 NDR_PRINT_IN_DEBUG(lsa_CREDRGETSESSIONTYPES, &r);
11394         }
11395
11396         status = cli->dispatch(cli,
11397                                 mem_ctx,
11398                                 &ndr_table_lsarpc,
11399                                 NDR_LSA_CREDRGETSESSIONTYPES,
11400                                 &r);
11401
11402         if (!NT_STATUS_IS_OK(status)) {
11403                 return status;
11404         }
11405
11406         if (DEBUGLEVEL >= 10) {
11407                 NDR_PRINT_OUT_DEBUG(lsa_CREDRGETSESSIONTYPES, &r);
11408         }
11409
11410         if (NT_STATUS_IS_ERR(status)) {
11411                 return status;
11412         }
11413
11414         /* Return variables */
11415
11416         /* Return result */
11417         return r.out.result;
11418 }
11419
11420 struct rpccli_lsa_LSARREGISTERAUDITEVENT_state {
11421         struct lsa_LSARREGISTERAUDITEVENT orig;
11422         struct lsa_LSARREGISTERAUDITEVENT tmp;
11423         TALLOC_CTX *out_mem_ctx;
11424         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11425 };
11426
11427 static void rpccli_lsa_LSARREGISTERAUDITEVENT_done(struct tevent_req *subreq);
11428
11429 struct tevent_req *rpccli_lsa_LSARREGISTERAUDITEVENT_send(TALLOC_CTX *mem_ctx,
11430                                                           struct tevent_context *ev,
11431                                                           struct rpc_pipe_client *cli)
11432 {
11433         struct tevent_req *req;
11434         struct rpccli_lsa_LSARREGISTERAUDITEVENT_state *state;
11435         struct tevent_req *subreq;
11436
11437         req = tevent_req_create(mem_ctx, &state,
11438                                 struct rpccli_lsa_LSARREGISTERAUDITEVENT_state);
11439         if (req == NULL) {
11440                 return NULL;
11441         }
11442         state->out_mem_ctx = NULL;
11443         state->dispatch_recv = cli->dispatch_recv;
11444
11445         /* In parameters */
11446
11447         /* Out parameters */
11448
11449         /* Result */
11450         ZERO_STRUCT(state->orig.out.result);
11451
11452         if (DEBUGLEVEL >= 10) {
11453                 NDR_PRINT_IN_DEBUG(lsa_LSARREGISTERAUDITEVENT, &state->orig);
11454         }
11455
11456         /* make a temporary copy, that we pass to the dispatch function */
11457         state->tmp = state->orig;
11458
11459         subreq = cli->dispatch_send(state, ev, cli,
11460                                     &ndr_table_lsarpc,
11461                                     NDR_LSA_LSARREGISTERAUDITEVENT,
11462                                     &state->tmp);
11463         if (tevent_req_nomem(subreq, req)) {
11464                 return tevent_req_post(req, ev);
11465         }
11466         tevent_req_set_callback(subreq, rpccli_lsa_LSARREGISTERAUDITEVENT_done, req);
11467         return req;
11468 }
11469
11470 static void rpccli_lsa_LSARREGISTERAUDITEVENT_done(struct tevent_req *subreq)
11471 {
11472         struct tevent_req *req = tevent_req_callback_data(
11473                 subreq, struct tevent_req);
11474         struct rpccli_lsa_LSARREGISTERAUDITEVENT_state *state = tevent_req_data(
11475                 req, struct rpccli_lsa_LSARREGISTERAUDITEVENT_state);
11476         NTSTATUS status;
11477         TALLOC_CTX *mem_ctx;
11478
11479         if (state->out_mem_ctx) {
11480                 mem_ctx = state->out_mem_ctx;
11481         } else {
11482                 mem_ctx = state;
11483         }
11484
11485         status = state->dispatch_recv(subreq, mem_ctx);
11486         TALLOC_FREE(subreq);
11487         if (!NT_STATUS_IS_OK(status)) {
11488                 tevent_req_nterror(req, status);
11489                 return;
11490         }
11491
11492         /* Copy out parameters */
11493
11494         /* Copy result */
11495         state->orig.out.result = state->tmp.out.result;
11496
11497         /* Reset temporary structure */
11498         ZERO_STRUCT(state->tmp);
11499
11500         if (DEBUGLEVEL >= 10) {
11501                 NDR_PRINT_OUT_DEBUG(lsa_LSARREGISTERAUDITEVENT, &state->orig);
11502         }
11503
11504         tevent_req_done(req);
11505 }
11506
11507 NTSTATUS rpccli_lsa_LSARREGISTERAUDITEVENT_recv(struct tevent_req *req,
11508                                                 TALLOC_CTX *mem_ctx,
11509                                                 NTSTATUS *result)
11510 {
11511         struct rpccli_lsa_LSARREGISTERAUDITEVENT_state *state = tevent_req_data(
11512                 req, struct rpccli_lsa_LSARREGISTERAUDITEVENT_state);
11513         NTSTATUS status;
11514
11515         if (tevent_req_is_nterror(req, &status)) {
11516                 tevent_req_received(req);
11517                 return status;
11518         }
11519
11520         /* Steal possbile out parameters to the callers context */
11521         talloc_steal(mem_ctx, state->out_mem_ctx);
11522
11523         /* Return result */
11524         *result = state->orig.out.result;
11525
11526         tevent_req_received(req);
11527         return NT_STATUS_OK;
11528 }
11529
11530 NTSTATUS rpccli_lsa_LSARREGISTERAUDITEVENT(struct rpc_pipe_client *cli,
11531                                            TALLOC_CTX *mem_ctx)
11532 {
11533         struct lsa_LSARREGISTERAUDITEVENT r;
11534         NTSTATUS status;
11535
11536         /* In parameters */
11537
11538         if (DEBUGLEVEL >= 10) {
11539                 NDR_PRINT_IN_DEBUG(lsa_LSARREGISTERAUDITEVENT, &r);
11540         }
11541
11542         status = cli->dispatch(cli,
11543                                 mem_ctx,
11544                                 &ndr_table_lsarpc,
11545                                 NDR_LSA_LSARREGISTERAUDITEVENT,
11546                                 &r);
11547
11548         if (!NT_STATUS_IS_OK(status)) {
11549                 return status;
11550         }
11551
11552         if (DEBUGLEVEL >= 10) {
11553                 NDR_PRINT_OUT_DEBUG(lsa_LSARREGISTERAUDITEVENT, &r);
11554         }
11555
11556         if (NT_STATUS_IS_ERR(status)) {
11557                 return status;
11558         }
11559
11560         /* Return variables */
11561
11562         /* Return result */
11563         return r.out.result;
11564 }
11565
11566 struct rpccli_lsa_LSARGENAUDITEVENT_state {
11567         struct lsa_LSARGENAUDITEVENT orig;
11568         struct lsa_LSARGENAUDITEVENT tmp;
11569         TALLOC_CTX *out_mem_ctx;
11570         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11571 };
11572
11573 static void rpccli_lsa_LSARGENAUDITEVENT_done(struct tevent_req *subreq);
11574
11575 struct tevent_req *rpccli_lsa_LSARGENAUDITEVENT_send(TALLOC_CTX *mem_ctx,
11576                                                      struct tevent_context *ev,
11577                                                      struct rpc_pipe_client *cli)
11578 {
11579         struct tevent_req *req;
11580         struct rpccli_lsa_LSARGENAUDITEVENT_state *state;
11581         struct tevent_req *subreq;
11582
11583         req = tevent_req_create(mem_ctx, &state,
11584                                 struct rpccli_lsa_LSARGENAUDITEVENT_state);
11585         if (req == NULL) {
11586                 return NULL;
11587         }
11588         state->out_mem_ctx = NULL;
11589         state->dispatch_recv = cli->dispatch_recv;
11590
11591         /* In parameters */
11592
11593         /* Out parameters */
11594
11595         /* Result */
11596         ZERO_STRUCT(state->orig.out.result);
11597
11598         if (DEBUGLEVEL >= 10) {
11599                 NDR_PRINT_IN_DEBUG(lsa_LSARGENAUDITEVENT, &state->orig);
11600         }
11601
11602         /* make a temporary copy, that we pass to the dispatch function */
11603         state->tmp = state->orig;
11604
11605         subreq = cli->dispatch_send(state, ev, cli,
11606                                     &ndr_table_lsarpc,
11607                                     NDR_LSA_LSARGENAUDITEVENT,
11608                                     &state->tmp);
11609         if (tevent_req_nomem(subreq, req)) {
11610                 return tevent_req_post(req, ev);
11611         }
11612         tevent_req_set_callback(subreq, rpccli_lsa_LSARGENAUDITEVENT_done, req);
11613         return req;
11614 }
11615
11616 static void rpccli_lsa_LSARGENAUDITEVENT_done(struct tevent_req *subreq)
11617 {
11618         struct tevent_req *req = tevent_req_callback_data(
11619                 subreq, struct tevent_req);
11620         struct rpccli_lsa_LSARGENAUDITEVENT_state *state = tevent_req_data(
11621                 req, struct rpccli_lsa_LSARGENAUDITEVENT_state);
11622         NTSTATUS status;
11623         TALLOC_CTX *mem_ctx;
11624
11625         if (state->out_mem_ctx) {
11626                 mem_ctx = state->out_mem_ctx;
11627         } else {
11628                 mem_ctx = state;
11629         }
11630
11631         status = state->dispatch_recv(subreq, mem_ctx);
11632         TALLOC_FREE(subreq);
11633         if (!NT_STATUS_IS_OK(status)) {
11634                 tevent_req_nterror(req, status);
11635                 return;
11636         }
11637
11638         /* Copy out parameters */
11639
11640         /* Copy result */
11641         state->orig.out.result = state->tmp.out.result;
11642
11643         /* Reset temporary structure */
11644         ZERO_STRUCT(state->tmp);
11645
11646         if (DEBUGLEVEL >= 10) {
11647                 NDR_PRINT_OUT_DEBUG(lsa_LSARGENAUDITEVENT, &state->orig);
11648         }
11649
11650         tevent_req_done(req);
11651 }
11652
11653 NTSTATUS rpccli_lsa_LSARGENAUDITEVENT_recv(struct tevent_req *req,
11654                                            TALLOC_CTX *mem_ctx,
11655                                            NTSTATUS *result)
11656 {
11657         struct rpccli_lsa_LSARGENAUDITEVENT_state *state = tevent_req_data(
11658                 req, struct rpccli_lsa_LSARGENAUDITEVENT_state);
11659         NTSTATUS status;
11660
11661         if (tevent_req_is_nterror(req, &status)) {
11662                 tevent_req_received(req);
11663                 return status;
11664         }
11665
11666         /* Steal possbile out parameters to the callers context */
11667         talloc_steal(mem_ctx, state->out_mem_ctx);
11668
11669         /* Return result */
11670         *result = state->orig.out.result;
11671
11672         tevent_req_received(req);
11673         return NT_STATUS_OK;
11674 }
11675
11676 NTSTATUS rpccli_lsa_LSARGENAUDITEVENT(struct rpc_pipe_client *cli,
11677                                       TALLOC_CTX *mem_ctx)
11678 {
11679         struct lsa_LSARGENAUDITEVENT r;
11680         NTSTATUS status;
11681
11682         /* In parameters */
11683
11684         if (DEBUGLEVEL >= 10) {
11685                 NDR_PRINT_IN_DEBUG(lsa_LSARGENAUDITEVENT, &r);
11686         }
11687
11688         status = cli->dispatch(cli,
11689                                 mem_ctx,
11690                                 &ndr_table_lsarpc,
11691                                 NDR_LSA_LSARGENAUDITEVENT,
11692                                 &r);
11693
11694         if (!NT_STATUS_IS_OK(status)) {
11695                 return status;
11696         }
11697
11698         if (DEBUGLEVEL >= 10) {
11699                 NDR_PRINT_OUT_DEBUG(lsa_LSARGENAUDITEVENT, &r);
11700         }
11701
11702         if (NT_STATUS_IS_ERR(status)) {
11703                 return status;
11704         }
11705
11706         /* Return variables */
11707
11708         /* Return result */
11709         return r.out.result;
11710 }
11711
11712 struct rpccli_lsa_LSARUNREGISTERAUDITEVENT_state {
11713         struct lsa_LSARUNREGISTERAUDITEVENT orig;
11714         struct lsa_LSARUNREGISTERAUDITEVENT tmp;
11715         TALLOC_CTX *out_mem_ctx;
11716         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11717 };
11718
11719 static void rpccli_lsa_LSARUNREGISTERAUDITEVENT_done(struct tevent_req *subreq);
11720
11721 struct tevent_req *rpccli_lsa_LSARUNREGISTERAUDITEVENT_send(TALLOC_CTX *mem_ctx,
11722                                                             struct tevent_context *ev,
11723                                                             struct rpc_pipe_client *cli)
11724 {
11725         struct tevent_req *req;
11726         struct rpccli_lsa_LSARUNREGISTERAUDITEVENT_state *state;
11727         struct tevent_req *subreq;
11728
11729         req = tevent_req_create(mem_ctx, &state,
11730                                 struct rpccli_lsa_LSARUNREGISTERAUDITEVENT_state);
11731         if (req == NULL) {
11732                 return NULL;
11733         }
11734         state->out_mem_ctx = NULL;
11735         state->dispatch_recv = cli->dispatch_recv;
11736
11737         /* In parameters */
11738
11739         /* Out parameters */
11740
11741         /* Result */
11742         ZERO_STRUCT(state->orig.out.result);
11743
11744         if (DEBUGLEVEL >= 10) {
11745                 NDR_PRINT_IN_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, &state->orig);
11746         }
11747
11748         /* make a temporary copy, that we pass to the dispatch function */
11749         state->tmp = state->orig;
11750
11751         subreq = cli->dispatch_send(state, ev, cli,
11752                                     &ndr_table_lsarpc,
11753                                     NDR_LSA_LSARUNREGISTERAUDITEVENT,
11754                                     &state->tmp);
11755         if (tevent_req_nomem(subreq, req)) {
11756                 return tevent_req_post(req, ev);
11757         }
11758         tevent_req_set_callback(subreq, rpccli_lsa_LSARUNREGISTERAUDITEVENT_done, req);
11759         return req;
11760 }
11761
11762 static void rpccli_lsa_LSARUNREGISTERAUDITEVENT_done(struct tevent_req *subreq)
11763 {
11764         struct tevent_req *req = tevent_req_callback_data(
11765                 subreq, struct tevent_req);
11766         struct rpccli_lsa_LSARUNREGISTERAUDITEVENT_state *state = tevent_req_data(
11767                 req, struct rpccli_lsa_LSARUNREGISTERAUDITEVENT_state);
11768         NTSTATUS status;
11769         TALLOC_CTX *mem_ctx;
11770
11771         if (state->out_mem_ctx) {
11772                 mem_ctx = state->out_mem_ctx;
11773         } else {
11774                 mem_ctx = state;
11775         }
11776
11777         status = state->dispatch_recv(subreq, mem_ctx);
11778         TALLOC_FREE(subreq);
11779         if (!NT_STATUS_IS_OK(status)) {
11780                 tevent_req_nterror(req, status);
11781                 return;
11782         }
11783
11784         /* Copy out parameters */
11785
11786         /* Copy result */
11787         state->orig.out.result = state->tmp.out.result;
11788
11789         /* Reset temporary structure */
11790         ZERO_STRUCT(state->tmp);
11791
11792         if (DEBUGLEVEL >= 10) {
11793                 NDR_PRINT_OUT_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, &state->orig);
11794         }
11795
11796         tevent_req_done(req);
11797 }
11798
11799 NTSTATUS rpccli_lsa_LSARUNREGISTERAUDITEVENT_recv(struct tevent_req *req,
11800                                                   TALLOC_CTX *mem_ctx,
11801                                                   NTSTATUS *result)
11802 {
11803         struct rpccli_lsa_LSARUNREGISTERAUDITEVENT_state *state = tevent_req_data(
11804                 req, struct rpccli_lsa_LSARUNREGISTERAUDITEVENT_state);
11805         NTSTATUS status;
11806
11807         if (tevent_req_is_nterror(req, &status)) {
11808                 tevent_req_received(req);
11809                 return status;
11810         }
11811
11812         /* Steal possbile out parameters to the callers context */
11813         talloc_steal(mem_ctx, state->out_mem_ctx);
11814
11815         /* Return result */
11816         *result = state->orig.out.result;
11817
11818         tevent_req_received(req);
11819         return NT_STATUS_OK;
11820 }
11821
11822 NTSTATUS rpccli_lsa_LSARUNREGISTERAUDITEVENT(struct rpc_pipe_client *cli,
11823                                              TALLOC_CTX *mem_ctx)
11824 {
11825         struct lsa_LSARUNREGISTERAUDITEVENT r;
11826         NTSTATUS status;
11827
11828         /* In parameters */
11829
11830         if (DEBUGLEVEL >= 10) {
11831                 NDR_PRINT_IN_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, &r);
11832         }
11833
11834         status = cli->dispatch(cli,
11835                                 mem_ctx,
11836                                 &ndr_table_lsarpc,
11837                                 NDR_LSA_LSARUNREGISTERAUDITEVENT,
11838                                 &r);
11839
11840         if (!NT_STATUS_IS_OK(status)) {
11841                 return status;
11842         }
11843
11844         if (DEBUGLEVEL >= 10) {
11845                 NDR_PRINT_OUT_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, &r);
11846         }
11847
11848         if (NT_STATUS_IS_ERR(status)) {
11849                 return status;
11850         }
11851
11852         /* Return variables */
11853
11854         /* Return result */
11855         return r.out.result;
11856 }
11857
11858 struct rpccli_lsa_lsaRQueryForestTrustInformation_state {
11859         struct lsa_lsaRQueryForestTrustInformation orig;
11860         struct lsa_lsaRQueryForestTrustInformation tmp;
11861         TALLOC_CTX *out_mem_ctx;
11862         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11863 };
11864
11865 static void rpccli_lsa_lsaRQueryForestTrustInformation_done(struct tevent_req *subreq);
11866
11867 struct tevent_req *rpccli_lsa_lsaRQueryForestTrustInformation_send(TALLOC_CTX *mem_ctx,
11868                                                                    struct tevent_context *ev,
11869                                                                    struct rpc_pipe_client *cli,
11870                                                                    struct policy_handle *_handle /* [in] [ref] */,
11871                                                                    struct lsa_String *_trusted_domain_name /* [in] [ref] */,
11872                                                                    uint16_t _unknown /* [in]  */,
11873                                                                    struct lsa_ForestTrustInformation **_forest_trust_info /* [out] [ref] */)
11874 {
11875         struct tevent_req *req;
11876         struct rpccli_lsa_lsaRQueryForestTrustInformation_state *state;
11877         struct tevent_req *subreq;
11878
11879         req = tevent_req_create(mem_ctx, &state,
11880                                 struct rpccli_lsa_lsaRQueryForestTrustInformation_state);
11881         if (req == NULL) {
11882                 return NULL;
11883         }
11884         state->out_mem_ctx = NULL;
11885         state->dispatch_recv = cli->dispatch_recv;
11886
11887         /* In parameters */
11888         state->orig.in.handle = _handle;
11889         state->orig.in.trusted_domain_name = _trusted_domain_name;
11890         state->orig.in.unknown = _unknown;
11891
11892         /* Out parameters */
11893         state->orig.out.forest_trust_info = _forest_trust_info;
11894
11895         /* Result */
11896         ZERO_STRUCT(state->orig.out.result);
11897
11898         if (DEBUGLEVEL >= 10) {
11899                 NDR_PRINT_IN_DEBUG(lsa_lsaRQueryForestTrustInformation, &state->orig);
11900         }
11901
11902         state->out_mem_ctx = talloc_named_const(state, 0,
11903                              "rpccli_lsa_lsaRQueryForestTrustInformation_out_memory");
11904         if (tevent_req_nomem(state->out_mem_ctx, req)) {
11905                 return tevent_req_post(req, ev);
11906         }
11907
11908         /* make a temporary copy, that we pass to the dispatch function */
11909         state->tmp = state->orig;
11910
11911         subreq = cli->dispatch_send(state, ev, cli,
11912                                     &ndr_table_lsarpc,
11913                                     NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION,
11914                                     &state->tmp);
11915         if (tevent_req_nomem(subreq, req)) {
11916                 return tevent_req_post(req, ev);
11917         }
11918         tevent_req_set_callback(subreq, rpccli_lsa_lsaRQueryForestTrustInformation_done, req);
11919         return req;
11920 }
11921
11922 static void rpccli_lsa_lsaRQueryForestTrustInformation_done(struct tevent_req *subreq)
11923 {
11924         struct tevent_req *req = tevent_req_callback_data(
11925                 subreq, struct tevent_req);
11926         struct rpccli_lsa_lsaRQueryForestTrustInformation_state *state = tevent_req_data(
11927                 req, struct rpccli_lsa_lsaRQueryForestTrustInformation_state);
11928         NTSTATUS status;
11929         TALLOC_CTX *mem_ctx;
11930
11931         if (state->out_mem_ctx) {
11932                 mem_ctx = state->out_mem_ctx;
11933         } else {
11934                 mem_ctx = state;
11935         }
11936
11937         status = state->dispatch_recv(subreq, mem_ctx);
11938         TALLOC_FREE(subreq);
11939         if (!NT_STATUS_IS_OK(status)) {
11940                 tevent_req_nterror(req, status);
11941                 return;
11942         }
11943
11944         /* Copy out parameters */
11945         *state->orig.out.forest_trust_info = *state->tmp.out.forest_trust_info;
11946
11947         /* Copy result */
11948         state->orig.out.result = state->tmp.out.result;
11949
11950         /* Reset temporary structure */
11951         ZERO_STRUCT(state->tmp);
11952
11953         if (DEBUGLEVEL >= 10) {
11954                 NDR_PRINT_OUT_DEBUG(lsa_lsaRQueryForestTrustInformation, &state->orig);
11955         }
11956
11957         tevent_req_done(req);
11958 }
11959
11960 NTSTATUS rpccli_lsa_lsaRQueryForestTrustInformation_recv(struct tevent_req *req,
11961                                                          TALLOC_CTX *mem_ctx,
11962                                                          NTSTATUS *result)
11963 {
11964         struct rpccli_lsa_lsaRQueryForestTrustInformation_state *state = tevent_req_data(
11965                 req, struct rpccli_lsa_lsaRQueryForestTrustInformation_state);
11966         NTSTATUS status;
11967
11968         if (tevent_req_is_nterror(req, &status)) {
11969                 tevent_req_received(req);
11970                 return status;
11971         }
11972
11973         /* Steal possbile out parameters to the callers context */
11974         talloc_steal(mem_ctx, state->out_mem_ctx);
11975
11976         /* Return result */
11977         *result = state->orig.out.result;
11978
11979         tevent_req_received(req);
11980         return NT_STATUS_OK;
11981 }
11982
11983 NTSTATUS rpccli_lsa_lsaRQueryForestTrustInformation(struct rpc_pipe_client *cli,
11984                                                     TALLOC_CTX *mem_ctx,
11985                                                     struct policy_handle *handle /* [in] [ref] */,
11986                                                     struct lsa_String *trusted_domain_name /* [in] [ref] */,
11987                                                     uint16_t unknown /* [in]  */,
11988                                                     struct lsa_ForestTrustInformation **forest_trust_info /* [out] [ref] */)
11989 {
11990         struct lsa_lsaRQueryForestTrustInformation r;
11991         NTSTATUS status;
11992
11993         /* In parameters */
11994         r.in.handle = handle;
11995         r.in.trusted_domain_name = trusted_domain_name;
11996         r.in.unknown = unknown;
11997
11998         if (DEBUGLEVEL >= 10) {
11999                 NDR_PRINT_IN_DEBUG(lsa_lsaRQueryForestTrustInformation, &r);
12000         }
12001
12002         status = cli->dispatch(cli,
12003                                 mem_ctx,
12004                                 &ndr_table_lsarpc,
12005                                 NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION,
12006                                 &r);
12007
12008         if (!NT_STATUS_IS_OK(status)) {
12009                 return status;
12010         }
12011
12012         if (DEBUGLEVEL >= 10) {
12013                 NDR_PRINT_OUT_DEBUG(lsa_lsaRQueryForestTrustInformation, &r);
12014         }
12015
12016         if (NT_STATUS_IS_ERR(status)) {
12017                 return status;
12018         }
12019
12020         /* Return variables */
12021         *forest_trust_info = *r.out.forest_trust_info;
12022
12023         /* Return result */
12024         return r.out.result;
12025 }
12026
12027 struct rpccli_lsa_LSARSETFORESTTRUSTINFORMATION_state {
12028         struct lsa_LSARSETFORESTTRUSTINFORMATION orig;
12029         struct lsa_LSARSETFORESTTRUSTINFORMATION tmp;
12030         TALLOC_CTX *out_mem_ctx;
12031         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12032 };
12033
12034 static void rpccli_lsa_LSARSETFORESTTRUSTINFORMATION_done(struct tevent_req *subreq);
12035
12036 struct tevent_req *rpccli_lsa_LSARSETFORESTTRUSTINFORMATION_send(TALLOC_CTX *mem_ctx,
12037                                                                  struct tevent_context *ev,
12038                                                                  struct rpc_pipe_client *cli)
12039 {
12040         struct tevent_req *req;
12041         struct rpccli_lsa_LSARSETFORESTTRUSTINFORMATION_state *state;
12042         struct tevent_req *subreq;
12043
12044         req = tevent_req_create(mem_ctx, &state,
12045                                 struct rpccli_lsa_LSARSETFORESTTRUSTINFORMATION_state);
12046         if (req == NULL) {
12047                 return NULL;
12048         }
12049         state->out_mem_ctx = NULL;
12050         state->dispatch_recv = cli->dispatch_recv;
12051
12052         /* In parameters */
12053
12054         /* Out parameters */
12055
12056         /* Result */
12057         ZERO_STRUCT(state->orig.out.result);
12058
12059         if (DEBUGLEVEL >= 10) {
12060                 NDR_PRINT_IN_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, &state->orig);
12061         }
12062
12063         /* make a temporary copy, that we pass to the dispatch function */
12064         state->tmp = state->orig;
12065
12066         subreq = cli->dispatch_send(state, ev, cli,
12067                                     &ndr_table_lsarpc,
12068                                     NDR_LSA_LSARSETFORESTTRUSTINFORMATION,
12069                                     &state->tmp);
12070         if (tevent_req_nomem(subreq, req)) {
12071                 return tevent_req_post(req, ev);
12072         }
12073         tevent_req_set_callback(subreq, rpccli_lsa_LSARSETFORESTTRUSTINFORMATION_done, req);
12074         return req;
12075 }
12076
12077 static void rpccli_lsa_LSARSETFORESTTRUSTINFORMATION_done(struct tevent_req *subreq)
12078 {
12079         struct tevent_req *req = tevent_req_callback_data(
12080                 subreq, struct tevent_req);
12081         struct rpccli_lsa_LSARSETFORESTTRUSTINFORMATION_state *state = tevent_req_data(
12082                 req, struct rpccli_lsa_LSARSETFORESTTRUSTINFORMATION_state);
12083         NTSTATUS status;
12084         TALLOC_CTX *mem_ctx;
12085
12086         if (state->out_mem_ctx) {
12087                 mem_ctx = state->out_mem_ctx;
12088         } else {
12089                 mem_ctx = state;
12090         }
12091
12092         status = state->dispatch_recv(subreq, mem_ctx);
12093         TALLOC_FREE(subreq);
12094         if (!NT_STATUS_IS_OK(status)) {
12095                 tevent_req_nterror(req, status);
12096                 return;
12097         }
12098
12099         /* Copy out parameters */
12100
12101         /* Copy result */
12102         state->orig.out.result = state->tmp.out.result;
12103
12104         /* Reset temporary structure */
12105         ZERO_STRUCT(state->tmp);
12106
12107         if (DEBUGLEVEL >= 10) {
12108                 NDR_PRINT_OUT_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, &state->orig);
12109         }
12110
12111         tevent_req_done(req);
12112 }
12113
12114 NTSTATUS rpccli_lsa_LSARSETFORESTTRUSTINFORMATION_recv(struct tevent_req *req,
12115                                                        TALLOC_CTX *mem_ctx,
12116                                                        NTSTATUS *result)
12117 {
12118         struct rpccli_lsa_LSARSETFORESTTRUSTINFORMATION_state *state = tevent_req_data(
12119                 req, struct rpccli_lsa_LSARSETFORESTTRUSTINFORMATION_state);
12120         NTSTATUS status;
12121
12122         if (tevent_req_is_nterror(req, &status)) {
12123                 tevent_req_received(req);
12124                 return status;
12125         }
12126
12127         /* Steal possbile out parameters to the callers context */
12128         talloc_steal(mem_ctx, state->out_mem_ctx);
12129
12130         /* Return result */
12131         *result = state->orig.out.result;
12132
12133         tevent_req_received(req);
12134         return NT_STATUS_OK;
12135 }
12136
12137 NTSTATUS rpccli_lsa_LSARSETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli,
12138                                                   TALLOC_CTX *mem_ctx)
12139 {
12140         struct lsa_LSARSETFORESTTRUSTINFORMATION r;
12141         NTSTATUS status;
12142
12143         /* In parameters */
12144
12145         if (DEBUGLEVEL >= 10) {
12146                 NDR_PRINT_IN_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, &r);
12147         }
12148
12149         status = cli->dispatch(cli,
12150                                 mem_ctx,
12151                                 &ndr_table_lsarpc,
12152                                 NDR_LSA_LSARSETFORESTTRUSTINFORMATION,
12153                                 &r);
12154
12155         if (!NT_STATUS_IS_OK(status)) {
12156                 return status;
12157         }
12158
12159         if (DEBUGLEVEL >= 10) {
12160                 NDR_PRINT_OUT_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, &r);
12161         }
12162
12163         if (NT_STATUS_IS_ERR(status)) {
12164                 return status;
12165         }
12166
12167         /* Return variables */
12168
12169         /* Return result */
12170         return r.out.result;
12171 }
12172
12173 struct rpccli_lsa_CREDRRENAME_state {
12174         struct lsa_CREDRRENAME orig;
12175         struct lsa_CREDRRENAME tmp;
12176         TALLOC_CTX *out_mem_ctx;
12177         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12178 };
12179
12180 static void rpccli_lsa_CREDRRENAME_done(struct tevent_req *subreq);
12181
12182 struct tevent_req *rpccli_lsa_CREDRRENAME_send(TALLOC_CTX *mem_ctx,
12183                                                struct tevent_context *ev,
12184                                                struct rpc_pipe_client *cli)
12185 {
12186         struct tevent_req *req;
12187         struct rpccli_lsa_CREDRRENAME_state *state;
12188         struct tevent_req *subreq;
12189
12190         req = tevent_req_create(mem_ctx, &state,
12191                                 struct rpccli_lsa_CREDRRENAME_state);
12192         if (req == NULL) {
12193                 return NULL;
12194         }
12195         state->out_mem_ctx = NULL;
12196         state->dispatch_recv = cli->dispatch_recv;
12197
12198         /* In parameters */
12199
12200         /* Out parameters */
12201
12202         /* Result */
12203         ZERO_STRUCT(state->orig.out.result);
12204
12205         if (DEBUGLEVEL >= 10) {
12206                 NDR_PRINT_IN_DEBUG(lsa_CREDRRENAME, &state->orig);
12207         }
12208
12209         /* make a temporary copy, that we pass to the dispatch function */
12210         state->tmp = state->orig;
12211
12212         subreq = cli->dispatch_send(state, ev, cli,
12213                                     &ndr_table_lsarpc,
12214                                     NDR_LSA_CREDRRENAME,
12215                                     &state->tmp);
12216         if (tevent_req_nomem(subreq, req)) {
12217                 return tevent_req_post(req, ev);
12218         }
12219         tevent_req_set_callback(subreq, rpccli_lsa_CREDRRENAME_done, req);
12220         return req;
12221 }
12222
12223 static void rpccli_lsa_CREDRRENAME_done(struct tevent_req *subreq)
12224 {
12225         struct tevent_req *req = tevent_req_callback_data(
12226                 subreq, struct tevent_req);
12227         struct rpccli_lsa_CREDRRENAME_state *state = tevent_req_data(
12228                 req, struct rpccli_lsa_CREDRRENAME_state);
12229         NTSTATUS status;
12230         TALLOC_CTX *mem_ctx;
12231
12232         if (state->out_mem_ctx) {
12233                 mem_ctx = state->out_mem_ctx;
12234         } else {
12235                 mem_ctx = state;
12236         }
12237
12238         status = state->dispatch_recv(subreq, mem_ctx);
12239         TALLOC_FREE(subreq);
12240         if (!NT_STATUS_IS_OK(status)) {
12241                 tevent_req_nterror(req, status);
12242                 return;
12243         }
12244
12245         /* Copy out parameters */
12246
12247         /* Copy result */
12248         state->orig.out.result = state->tmp.out.result;
12249
12250         /* Reset temporary structure */
12251         ZERO_STRUCT(state->tmp);
12252
12253         if (DEBUGLEVEL >= 10) {
12254                 NDR_PRINT_OUT_DEBUG(lsa_CREDRRENAME, &state->orig);
12255         }
12256
12257         tevent_req_done(req);
12258 }
12259
12260 NTSTATUS rpccli_lsa_CREDRRENAME_recv(struct tevent_req *req,
12261                                      TALLOC_CTX *mem_ctx,
12262                                      NTSTATUS *result)
12263 {
12264         struct rpccli_lsa_CREDRRENAME_state *state = tevent_req_data(
12265                 req, struct rpccli_lsa_CREDRRENAME_state);
12266         NTSTATUS status;
12267
12268         if (tevent_req_is_nterror(req, &status)) {
12269                 tevent_req_received(req);
12270                 return status;
12271         }
12272
12273         /* Steal possbile out parameters to the callers context */
12274         talloc_steal(mem_ctx, state->out_mem_ctx);
12275
12276         /* Return result */
12277         *result = state->orig.out.result;
12278
12279         tevent_req_received(req);
12280         return NT_STATUS_OK;
12281 }
12282
12283 NTSTATUS rpccli_lsa_CREDRRENAME(struct rpc_pipe_client *cli,
12284                                 TALLOC_CTX *mem_ctx)
12285 {
12286         struct lsa_CREDRRENAME r;
12287         NTSTATUS status;
12288
12289         /* In parameters */
12290
12291         if (DEBUGLEVEL >= 10) {
12292                 NDR_PRINT_IN_DEBUG(lsa_CREDRRENAME, &r);
12293         }
12294
12295         status = cli->dispatch(cli,
12296                                 mem_ctx,
12297                                 &ndr_table_lsarpc,
12298                                 NDR_LSA_CREDRRENAME,
12299                                 &r);
12300
12301         if (!NT_STATUS_IS_OK(status)) {
12302                 return status;
12303         }
12304
12305         if (DEBUGLEVEL >= 10) {
12306                 NDR_PRINT_OUT_DEBUG(lsa_CREDRRENAME, &r);
12307         }
12308
12309         if (NT_STATUS_IS_ERR(status)) {
12310                 return status;
12311         }
12312
12313         /* Return variables */
12314
12315         /* Return result */
12316         return r.out.result;
12317 }
12318
12319 struct rpccli_lsa_LookupSids3_state {
12320         struct lsa_LookupSids3 orig;
12321         struct lsa_LookupSids3 tmp;
12322         TALLOC_CTX *out_mem_ctx;
12323         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12324 };
12325
12326 static void rpccli_lsa_LookupSids3_done(struct tevent_req *subreq);
12327
12328 struct tevent_req *rpccli_lsa_LookupSids3_send(TALLOC_CTX *mem_ctx,
12329                                                struct tevent_context *ev,
12330                                                struct rpc_pipe_client *cli,
12331                                                struct lsa_SidArray *_sids /* [in] [ref] */,
12332                                                struct lsa_RefDomainList **_domains /* [out] [ref] */,
12333                                                struct lsa_TransNameArray2 *_names /* [in,out] [ref] */,
12334                                                uint16_t _level /* [in]  */,
12335                                                uint32_t *_count /* [in,out] [ref] */,
12336                                                uint32_t _unknown1 /* [in]  */,
12337                                                uint32_t _unknown2 /* [in]  */)
12338 {
12339         struct tevent_req *req;
12340         struct rpccli_lsa_LookupSids3_state *state;
12341         struct tevent_req *subreq;
12342
12343         req = tevent_req_create(mem_ctx, &state,
12344                                 struct rpccli_lsa_LookupSids3_state);
12345         if (req == NULL) {
12346                 return NULL;
12347         }
12348         state->out_mem_ctx = NULL;
12349         state->dispatch_recv = cli->dispatch_recv;
12350
12351         /* In parameters */
12352         state->orig.in.sids = _sids;
12353         state->orig.in.names = _names;
12354         state->orig.in.level = _level;
12355         state->orig.in.count = _count;
12356         state->orig.in.unknown1 = _unknown1;
12357         state->orig.in.unknown2 = _unknown2;
12358
12359         /* Out parameters */
12360         state->orig.out.domains = _domains;
12361         state->orig.out.names = _names;
12362         state->orig.out.count = _count;
12363
12364         /* Result */
12365         ZERO_STRUCT(state->orig.out.result);
12366
12367         if (DEBUGLEVEL >= 10) {
12368                 NDR_PRINT_IN_DEBUG(lsa_LookupSids3, &state->orig);
12369         }
12370
12371         state->out_mem_ctx = talloc_named_const(state, 0,
12372                              "rpccli_lsa_LookupSids3_out_memory");
12373         if (tevent_req_nomem(state->out_mem_ctx, req)) {
12374                 return tevent_req_post(req, ev);
12375         }
12376
12377         /* make a temporary copy, that we pass to the dispatch function */
12378         state->tmp = state->orig;
12379
12380         subreq = cli->dispatch_send(state, ev, cli,
12381                                     &ndr_table_lsarpc,
12382                                     NDR_LSA_LOOKUPSIDS3,
12383                                     &state->tmp);
12384         if (tevent_req_nomem(subreq, req)) {
12385                 return tevent_req_post(req, ev);
12386         }
12387         tevent_req_set_callback(subreq, rpccli_lsa_LookupSids3_done, req);
12388         return req;
12389 }
12390
12391 static void rpccli_lsa_LookupSids3_done(struct tevent_req *subreq)
12392 {
12393         struct tevent_req *req = tevent_req_callback_data(
12394                 subreq, struct tevent_req);
12395         struct rpccli_lsa_LookupSids3_state *state = tevent_req_data(
12396                 req, struct rpccli_lsa_LookupSids3_state);
12397         NTSTATUS status;
12398         TALLOC_CTX *mem_ctx;
12399
12400         if (state->out_mem_ctx) {
12401                 mem_ctx = state->out_mem_ctx;
12402         } else {
12403                 mem_ctx = state;
12404         }
12405
12406         status = state->dispatch_recv(subreq, mem_ctx);
12407         TALLOC_FREE(subreq);
12408         if (!NT_STATUS_IS_OK(status)) {
12409                 tevent_req_nterror(req, status);
12410                 return;
12411         }
12412
12413         /* Copy out parameters */
12414         *state->orig.out.domains = *state->tmp.out.domains;
12415         *state->orig.out.names = *state->tmp.out.names;
12416         *state->orig.out.count = *state->tmp.out.count;
12417
12418         /* Copy result */
12419         state->orig.out.result = state->tmp.out.result;
12420
12421         /* Reset temporary structure */
12422         ZERO_STRUCT(state->tmp);
12423
12424         if (DEBUGLEVEL >= 10) {
12425                 NDR_PRINT_OUT_DEBUG(lsa_LookupSids3, &state->orig);
12426         }
12427
12428         tevent_req_done(req);
12429 }
12430
12431 NTSTATUS rpccli_lsa_LookupSids3_recv(struct tevent_req *req,
12432                                      TALLOC_CTX *mem_ctx,
12433                                      NTSTATUS *result)
12434 {
12435         struct rpccli_lsa_LookupSids3_state *state = tevent_req_data(
12436                 req, struct rpccli_lsa_LookupSids3_state);
12437         NTSTATUS status;
12438
12439         if (tevent_req_is_nterror(req, &status)) {
12440                 tevent_req_received(req);
12441                 return status;
12442         }
12443
12444         /* Steal possbile out parameters to the callers context */
12445         talloc_steal(mem_ctx, state->out_mem_ctx);
12446
12447         /* Return result */
12448         *result = state->orig.out.result;
12449
12450         tevent_req_received(req);
12451         return NT_STATUS_OK;
12452 }
12453
12454 NTSTATUS rpccli_lsa_LookupSids3(struct rpc_pipe_client *cli,
12455                                 TALLOC_CTX *mem_ctx,
12456                                 struct lsa_SidArray *sids /* [in] [ref] */,
12457                                 struct lsa_RefDomainList **domains /* [out] [ref] */,
12458                                 struct lsa_TransNameArray2 *names /* [in,out] [ref] */,
12459                                 uint16_t level /* [in]  */,
12460                                 uint32_t *count /* [in,out] [ref] */,
12461                                 uint32_t unknown1 /* [in]  */,
12462                                 uint32_t unknown2 /* [in]  */)
12463 {
12464         struct lsa_LookupSids3 r;
12465         NTSTATUS status;
12466
12467         /* In parameters */
12468         r.in.sids = sids;
12469         r.in.names = names;
12470         r.in.level = level;
12471         r.in.count = count;
12472         r.in.unknown1 = unknown1;
12473         r.in.unknown2 = unknown2;
12474
12475         if (DEBUGLEVEL >= 10) {
12476                 NDR_PRINT_IN_DEBUG(lsa_LookupSids3, &r);
12477         }
12478
12479         status = cli->dispatch(cli,
12480                                 mem_ctx,
12481                                 &ndr_table_lsarpc,
12482                                 NDR_LSA_LOOKUPSIDS3,
12483                                 &r);
12484
12485         if (!NT_STATUS_IS_OK(status)) {
12486                 return status;
12487         }
12488
12489         if (DEBUGLEVEL >= 10) {
12490                 NDR_PRINT_OUT_DEBUG(lsa_LookupSids3, &r);
12491         }
12492
12493         if (NT_STATUS_IS_ERR(status)) {
12494                 return status;
12495         }
12496
12497         /* Return variables */
12498         *domains = *r.out.domains;
12499         *names = *r.out.names;
12500         *count = *r.out.count;
12501
12502         /* Return result */
12503         return r.out.result;
12504 }
12505
12506 struct rpccli_lsa_LookupNames4_state {
12507         struct lsa_LookupNames4 orig;
12508         struct lsa_LookupNames4 tmp;
12509         TALLOC_CTX *out_mem_ctx;
12510         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12511 };
12512
12513 static void rpccli_lsa_LookupNames4_done(struct tevent_req *subreq);
12514
12515 struct tevent_req *rpccli_lsa_LookupNames4_send(TALLOC_CTX *mem_ctx,
12516                                                 struct tevent_context *ev,
12517                                                 struct rpc_pipe_client *cli,
12518                                                 uint32_t _num_names /* [in] [range(0,1000)] */,
12519                                                 struct lsa_String *_names /* [in] [size_is(num_names)] */,
12520                                                 struct lsa_RefDomainList **_domains /* [out] [ref] */,
12521                                                 struct lsa_TransSidArray3 *_sids /* [in,out] [ref] */,
12522                                                 enum lsa_LookupNamesLevel _level /* [in]  */,
12523                                                 uint32_t *_count /* [in,out] [ref] */,
12524                                                 uint32_t _lookup_options /* [in]  */,
12525                                                 uint32_t _client_revision /* [in]  */)
12526 {
12527         struct tevent_req *req;
12528         struct rpccli_lsa_LookupNames4_state *state;
12529         struct tevent_req *subreq;
12530
12531         req = tevent_req_create(mem_ctx, &state,
12532                                 struct rpccli_lsa_LookupNames4_state);
12533         if (req == NULL) {
12534                 return NULL;
12535         }
12536         state->out_mem_ctx = NULL;
12537         state->dispatch_recv = cli->dispatch_recv;
12538
12539         /* In parameters */
12540         state->orig.in.num_names = _num_names;
12541         state->orig.in.names = _names;
12542         state->orig.in.sids = _sids;
12543         state->orig.in.level = _level;
12544         state->orig.in.count = _count;
12545         state->orig.in.lookup_options = _lookup_options;
12546         state->orig.in.client_revision = _client_revision;
12547
12548         /* Out parameters */
12549         state->orig.out.domains = _domains;
12550         state->orig.out.sids = _sids;
12551         state->orig.out.count = _count;
12552
12553         /* Result */
12554         ZERO_STRUCT(state->orig.out.result);
12555
12556         if (DEBUGLEVEL >= 10) {
12557                 NDR_PRINT_IN_DEBUG(lsa_LookupNames4, &state->orig);
12558         }
12559
12560         state->out_mem_ctx = talloc_named_const(state, 0,
12561                              "rpccli_lsa_LookupNames4_out_memory");
12562         if (tevent_req_nomem(state->out_mem_ctx, req)) {
12563                 return tevent_req_post(req, ev);
12564         }
12565
12566         /* make a temporary copy, that we pass to the dispatch function */
12567         state->tmp = state->orig;
12568
12569         subreq = cli->dispatch_send(state, ev, cli,
12570                                     &ndr_table_lsarpc,
12571                                     NDR_LSA_LOOKUPNAMES4,
12572                                     &state->tmp);
12573         if (tevent_req_nomem(subreq, req)) {
12574                 return tevent_req_post(req, ev);
12575         }
12576         tevent_req_set_callback(subreq, rpccli_lsa_LookupNames4_done, req);
12577         return req;
12578 }
12579
12580 static void rpccli_lsa_LookupNames4_done(struct tevent_req *subreq)
12581 {
12582         struct tevent_req *req = tevent_req_callback_data(
12583                 subreq, struct tevent_req);
12584         struct rpccli_lsa_LookupNames4_state *state = tevent_req_data(
12585                 req, struct rpccli_lsa_LookupNames4_state);
12586         NTSTATUS status;
12587         TALLOC_CTX *mem_ctx;
12588
12589         if (state->out_mem_ctx) {
12590                 mem_ctx = state->out_mem_ctx;
12591         } else {
12592                 mem_ctx = state;
12593         }
12594
12595         status = state->dispatch_recv(subreq, mem_ctx);
12596         TALLOC_FREE(subreq);
12597         if (!NT_STATUS_IS_OK(status)) {
12598                 tevent_req_nterror(req, status);
12599                 return;
12600         }
12601
12602         /* Copy out parameters */
12603         *state->orig.out.domains = *state->tmp.out.domains;
12604         *state->orig.out.sids = *state->tmp.out.sids;
12605         *state->orig.out.count = *state->tmp.out.count;
12606
12607         /* Copy result */
12608         state->orig.out.result = state->tmp.out.result;
12609
12610         /* Reset temporary structure */
12611         ZERO_STRUCT(state->tmp);
12612
12613         if (DEBUGLEVEL >= 10) {
12614                 NDR_PRINT_OUT_DEBUG(lsa_LookupNames4, &state->orig);
12615         }
12616
12617         tevent_req_done(req);
12618 }
12619
12620 NTSTATUS rpccli_lsa_LookupNames4_recv(struct tevent_req *req,
12621                                       TALLOC_CTX *mem_ctx,
12622                                       NTSTATUS *result)
12623 {
12624         struct rpccli_lsa_LookupNames4_state *state = tevent_req_data(
12625                 req, struct rpccli_lsa_LookupNames4_state);
12626         NTSTATUS status;
12627
12628         if (tevent_req_is_nterror(req, &status)) {
12629                 tevent_req_received(req);
12630                 return status;
12631         }
12632
12633         /* Steal possbile out parameters to the callers context */
12634         talloc_steal(mem_ctx, state->out_mem_ctx);
12635
12636         /* Return result */
12637         *result = state->orig.out.result;
12638
12639         tevent_req_received(req);
12640         return NT_STATUS_OK;
12641 }
12642
12643 NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli,
12644                                  TALLOC_CTX *mem_ctx,
12645                                  uint32_t num_names /* [in] [range(0,1000)] */,
12646                                  struct lsa_String *names /* [in] [size_is(num_names)] */,
12647                                  struct lsa_RefDomainList **domains /* [out] [ref] */,
12648                                  struct lsa_TransSidArray3 *sids /* [in,out] [ref] */,
12649                                  enum lsa_LookupNamesLevel level /* [in]  */,
12650                                  uint32_t *count /* [in,out] [ref] */,
12651                                  uint32_t lookup_options /* [in]  */,
12652                                  uint32_t client_revision /* [in]  */)
12653 {
12654         struct lsa_LookupNames4 r;
12655         NTSTATUS status;
12656
12657         /* In parameters */
12658         r.in.num_names = num_names;
12659         r.in.names = names;
12660         r.in.sids = sids;
12661         r.in.level = level;
12662         r.in.count = count;
12663         r.in.lookup_options = lookup_options;
12664         r.in.client_revision = client_revision;
12665
12666         if (DEBUGLEVEL >= 10) {
12667                 NDR_PRINT_IN_DEBUG(lsa_LookupNames4, &r);
12668         }
12669
12670         status = cli->dispatch(cli,
12671                                 mem_ctx,
12672                                 &ndr_table_lsarpc,
12673                                 NDR_LSA_LOOKUPNAMES4,
12674                                 &r);
12675
12676         if (!NT_STATUS_IS_OK(status)) {
12677                 return status;
12678         }
12679
12680         if (DEBUGLEVEL >= 10) {
12681                 NDR_PRINT_OUT_DEBUG(lsa_LookupNames4, &r);
12682         }
12683
12684         if (NT_STATUS_IS_ERR(status)) {
12685                 return status;
12686         }
12687
12688         /* Return variables */
12689         *domains = *r.out.domains;
12690         *sids = *r.out.sids;
12691         *count = *r.out.count;
12692
12693         /* Return result */
12694         return r.out.result;
12695 }
12696
12697 struct rpccli_lsa_LSAROPENPOLICYSCE_state {
12698         struct lsa_LSAROPENPOLICYSCE orig;
12699         struct lsa_LSAROPENPOLICYSCE tmp;
12700         TALLOC_CTX *out_mem_ctx;
12701         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12702 };
12703
12704 static void rpccli_lsa_LSAROPENPOLICYSCE_done(struct tevent_req *subreq);
12705
12706 struct tevent_req *rpccli_lsa_LSAROPENPOLICYSCE_send(TALLOC_CTX *mem_ctx,
12707                                                      struct tevent_context *ev,
12708                                                      struct rpc_pipe_client *cli)
12709 {
12710         struct tevent_req *req;
12711         struct rpccli_lsa_LSAROPENPOLICYSCE_state *state;
12712         struct tevent_req *subreq;
12713
12714         req = tevent_req_create(mem_ctx, &state,
12715                                 struct rpccli_lsa_LSAROPENPOLICYSCE_state);
12716         if (req == NULL) {
12717                 return NULL;
12718         }
12719         state->out_mem_ctx = NULL;
12720         state->dispatch_recv = cli->dispatch_recv;
12721
12722         /* In parameters */
12723
12724         /* Out parameters */
12725
12726         /* Result */
12727         ZERO_STRUCT(state->orig.out.result);
12728
12729         if (DEBUGLEVEL >= 10) {
12730                 NDR_PRINT_IN_DEBUG(lsa_LSAROPENPOLICYSCE, &state->orig);
12731         }
12732
12733         /* make a temporary copy, that we pass to the dispatch function */
12734         state->tmp = state->orig;
12735
12736         subreq = cli->dispatch_send(state, ev, cli,
12737                                     &ndr_table_lsarpc,
12738                                     NDR_LSA_LSAROPENPOLICYSCE,
12739                                     &state->tmp);
12740         if (tevent_req_nomem(subreq, req)) {
12741                 return tevent_req_post(req, ev);
12742         }
12743         tevent_req_set_callback(subreq, rpccli_lsa_LSAROPENPOLICYSCE_done, req);
12744         return req;
12745 }
12746
12747 static void rpccli_lsa_LSAROPENPOLICYSCE_done(struct tevent_req *subreq)
12748 {
12749         struct tevent_req *req = tevent_req_callback_data(
12750                 subreq, struct tevent_req);
12751         struct rpccli_lsa_LSAROPENPOLICYSCE_state *state = tevent_req_data(
12752                 req, struct rpccli_lsa_LSAROPENPOLICYSCE_state);
12753         NTSTATUS status;
12754         TALLOC_CTX *mem_ctx;
12755
12756         if (state->out_mem_ctx) {
12757                 mem_ctx = state->out_mem_ctx;
12758         } else {
12759                 mem_ctx = state;
12760         }
12761
12762         status = state->dispatch_recv(subreq, mem_ctx);
12763         TALLOC_FREE(subreq);
12764         if (!NT_STATUS_IS_OK(status)) {
12765                 tevent_req_nterror(req, status);
12766                 return;
12767         }
12768
12769         /* Copy out parameters */
12770
12771         /* Copy result */
12772         state->orig.out.result = state->tmp.out.result;
12773
12774         /* Reset temporary structure */
12775         ZERO_STRUCT(state->tmp);
12776
12777         if (DEBUGLEVEL >= 10) {
12778                 NDR_PRINT_OUT_DEBUG(lsa_LSAROPENPOLICYSCE, &state->orig);
12779         }
12780
12781         tevent_req_done(req);
12782 }
12783
12784 NTSTATUS rpccli_lsa_LSAROPENPOLICYSCE_recv(struct tevent_req *req,
12785                                            TALLOC_CTX *mem_ctx,
12786                                            NTSTATUS *result)
12787 {
12788         struct rpccli_lsa_LSAROPENPOLICYSCE_state *state = tevent_req_data(
12789                 req, struct rpccli_lsa_LSAROPENPOLICYSCE_state);
12790         NTSTATUS status;
12791
12792         if (tevent_req_is_nterror(req, &status)) {
12793                 tevent_req_received(req);
12794                 return status;
12795         }
12796
12797         /* Steal possbile out parameters to the callers context */
12798         talloc_steal(mem_ctx, state->out_mem_ctx);
12799
12800         /* Return result */
12801         *result = state->orig.out.result;
12802
12803         tevent_req_received(req);
12804         return NT_STATUS_OK;
12805 }
12806
12807 NTSTATUS rpccli_lsa_LSAROPENPOLICYSCE(struct rpc_pipe_client *cli,
12808                                       TALLOC_CTX *mem_ctx)
12809 {
12810         struct lsa_LSAROPENPOLICYSCE r;
12811         NTSTATUS status;
12812
12813         /* In parameters */
12814
12815         if (DEBUGLEVEL >= 10) {
12816                 NDR_PRINT_IN_DEBUG(lsa_LSAROPENPOLICYSCE, &r);
12817         }
12818
12819         status = cli->dispatch(cli,
12820                                 mem_ctx,
12821                                 &ndr_table_lsarpc,
12822                                 NDR_LSA_LSAROPENPOLICYSCE,
12823                                 &r);
12824
12825         if (!NT_STATUS_IS_OK(status)) {
12826                 return status;
12827         }
12828
12829         if (DEBUGLEVEL >= 10) {
12830                 NDR_PRINT_OUT_DEBUG(lsa_LSAROPENPOLICYSCE, &r);
12831         }
12832
12833         if (NT_STATUS_IS_ERR(status)) {
12834                 return status;
12835         }
12836
12837         /* Return variables */
12838
12839         /* Return result */
12840         return r.out.result;
12841 }
12842
12843 struct rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE_state {
12844         struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE orig;
12845         struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE tmp;
12846         TALLOC_CTX *out_mem_ctx;
12847         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12848 };
12849
12850 static void rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE_done(struct tevent_req *subreq);
12851
12852 struct tevent_req *rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE_send(TALLOC_CTX *mem_ctx,
12853                                                                       struct tevent_context *ev,
12854                                                                       struct rpc_pipe_client *cli)
12855 {
12856         struct tevent_req *req;
12857         struct rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE_state *state;
12858         struct tevent_req *subreq;
12859
12860         req = tevent_req_create(mem_ctx, &state,
12861                                 struct rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE_state);
12862         if (req == NULL) {
12863                 return NULL;
12864         }
12865         state->out_mem_ctx = NULL;
12866         state->dispatch_recv = cli->dispatch_recv;
12867
12868         /* In parameters */
12869
12870         /* Out parameters */
12871
12872         /* Result */
12873         ZERO_STRUCT(state->orig.out.result);
12874
12875         if (DEBUGLEVEL >= 10) {
12876                 NDR_PRINT_IN_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, &state->orig);
12877         }
12878
12879         /* make a temporary copy, that we pass to the dispatch function */
12880         state->tmp = state->orig;
12881
12882         subreq = cli->dispatch_send(state, ev, cli,
12883                                     &ndr_table_lsarpc,
12884                                     NDR_LSA_LSARADTREGISTERSECURITYEVENTSOURCE,
12885                                     &state->tmp);
12886         if (tevent_req_nomem(subreq, req)) {
12887                 return tevent_req_post(req, ev);
12888         }
12889         tevent_req_set_callback(subreq, rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE_done, req);
12890         return req;
12891 }
12892
12893 static void rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE_done(struct tevent_req *subreq)
12894 {
12895         struct tevent_req *req = tevent_req_callback_data(
12896                 subreq, struct tevent_req);
12897         struct rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE_state *state = tevent_req_data(
12898                 req, struct rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE_state);
12899         NTSTATUS status;
12900         TALLOC_CTX *mem_ctx;
12901
12902         if (state->out_mem_ctx) {
12903                 mem_ctx = state->out_mem_ctx;
12904         } else {
12905                 mem_ctx = state;
12906         }
12907
12908         status = state->dispatch_recv(subreq, mem_ctx);
12909         TALLOC_FREE(subreq);
12910         if (!NT_STATUS_IS_OK(status)) {
12911                 tevent_req_nterror(req, status);
12912                 return;
12913         }
12914
12915         /* Copy out parameters */
12916
12917         /* Copy result */
12918         state->orig.out.result = state->tmp.out.result;
12919
12920         /* Reset temporary structure */
12921         ZERO_STRUCT(state->tmp);
12922
12923         if (DEBUGLEVEL >= 10) {
12924                 NDR_PRINT_OUT_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, &state->orig);
12925         }
12926
12927         tevent_req_done(req);
12928 }
12929
12930 NTSTATUS rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE_recv(struct tevent_req *req,
12931                                                             TALLOC_CTX *mem_ctx,
12932                                                             NTSTATUS *result)
12933 {
12934         struct rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE_state *state = tevent_req_data(
12935                 req, struct rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE_state);
12936         NTSTATUS status;
12937
12938         if (tevent_req_is_nterror(req, &status)) {
12939                 tevent_req_received(req);
12940                 return status;
12941         }
12942
12943         /* Steal possbile out parameters to the callers context */
12944         talloc_steal(mem_ctx, state->out_mem_ctx);
12945
12946         /* Return result */
12947         *result = state->orig.out.result;
12948
12949         tevent_req_received(req);
12950         return NT_STATUS_OK;
12951 }
12952
12953 NTSTATUS rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli,
12954                                                        TALLOC_CTX *mem_ctx)
12955 {
12956         struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE r;
12957         NTSTATUS status;
12958
12959         /* In parameters */
12960
12961         if (DEBUGLEVEL >= 10) {
12962                 NDR_PRINT_IN_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, &r);
12963         }
12964
12965         status = cli->dispatch(cli,
12966                                 mem_ctx,
12967                                 &ndr_table_lsarpc,
12968                                 NDR_LSA_LSARADTREGISTERSECURITYEVENTSOURCE,
12969                                 &r);
12970
12971         if (!NT_STATUS_IS_OK(status)) {
12972                 return status;
12973         }
12974
12975         if (DEBUGLEVEL >= 10) {
12976                 NDR_PRINT_OUT_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, &r);
12977         }
12978
12979         if (NT_STATUS_IS_ERR(status)) {
12980                 return status;
12981         }
12982
12983         /* Return variables */
12984
12985         /* Return result */
12986         return r.out.result;
12987 }
12988
12989 struct rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE_state {
12990         struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE orig;
12991         struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE tmp;
12992         TALLOC_CTX *out_mem_ctx;
12993         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12994 };
12995
12996 static void rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE_done(struct tevent_req *subreq);
12997
12998 struct tevent_req *rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE_send(TALLOC_CTX *mem_ctx,
12999                                                                         struct tevent_context *ev,
13000                                                                         struct rpc_pipe_client *cli)
13001 {
13002         struct tevent_req *req;
13003         struct rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE_state *state;
13004         struct tevent_req *subreq;
13005
13006         req = tevent_req_create(mem_ctx, &state,
13007                                 struct rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE_state);
13008         if (req == NULL) {
13009                 return NULL;
13010         }
13011         state->out_mem_ctx = NULL;
13012         state->dispatch_recv = cli->dispatch_recv;
13013
13014         /* In parameters */
13015
13016         /* Out parameters */
13017
13018         /* Result */
13019         ZERO_STRUCT(state->orig.out.result);
13020
13021         if (DEBUGLEVEL >= 10) {
13022                 NDR_PRINT_IN_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, &state->orig);
13023         }
13024
13025         /* make a temporary copy, that we pass to the dispatch function */
13026         state->tmp = state->orig;
13027
13028         subreq = cli->dispatch_send(state, ev, cli,
13029                                     &ndr_table_lsarpc,
13030                                     NDR_LSA_LSARADTUNREGISTERSECURITYEVENTSOURCE,
13031                                     &state->tmp);
13032         if (tevent_req_nomem(subreq, req)) {
13033                 return tevent_req_post(req, ev);
13034         }
13035         tevent_req_set_callback(subreq, rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE_done, req);
13036         return req;
13037 }
13038
13039 static void rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE_done(struct tevent_req *subreq)
13040 {
13041         struct tevent_req *req = tevent_req_callback_data(
13042                 subreq, struct tevent_req);
13043         struct rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE_state *state = tevent_req_data(
13044                 req, struct rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE_state);
13045         NTSTATUS status;
13046         TALLOC_CTX *mem_ctx;
13047
13048         if (state->out_mem_ctx) {
13049                 mem_ctx = state->out_mem_ctx;
13050         } else {
13051                 mem_ctx = state;
13052         }
13053
13054         status = state->dispatch_recv(subreq, mem_ctx);
13055         TALLOC_FREE(subreq);
13056         if (!NT_STATUS_IS_OK(status)) {
13057                 tevent_req_nterror(req, status);
13058                 return;
13059         }
13060
13061         /* Copy out parameters */
13062
13063         /* Copy result */
13064         state->orig.out.result = state->tmp.out.result;
13065
13066         /* Reset temporary structure */
13067         ZERO_STRUCT(state->tmp);
13068
13069         if (DEBUGLEVEL >= 10) {
13070                 NDR_PRINT_OUT_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, &state->orig);
13071         }
13072
13073         tevent_req_done(req);
13074 }
13075
13076 NTSTATUS rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE_recv(struct tevent_req *req,
13077                                                               TALLOC_CTX *mem_ctx,
13078                                                               NTSTATUS *result)
13079 {
13080         struct rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE_state *state = tevent_req_data(
13081                 req, struct rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE_state);
13082         NTSTATUS status;
13083
13084         if (tevent_req_is_nterror(req, &status)) {
13085                 tevent_req_received(req);
13086                 return status;
13087         }
13088
13089         /* Steal possbile out parameters to the callers context */
13090         talloc_steal(mem_ctx, state->out_mem_ctx);
13091
13092         /* Return result */
13093         *result = state->orig.out.result;
13094
13095         tevent_req_received(req);
13096         return NT_STATUS_OK;
13097 }
13098
13099 NTSTATUS rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli,
13100                                                          TALLOC_CTX *mem_ctx)
13101 {
13102         struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE r;
13103         NTSTATUS status;
13104
13105         /* In parameters */
13106
13107         if (DEBUGLEVEL >= 10) {
13108                 NDR_PRINT_IN_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, &r);
13109         }
13110
13111         status = cli->dispatch(cli,
13112                                 mem_ctx,
13113                                 &ndr_table_lsarpc,
13114                                 NDR_LSA_LSARADTUNREGISTERSECURITYEVENTSOURCE,
13115                                 &r);
13116
13117         if (!NT_STATUS_IS_OK(status)) {
13118                 return status;
13119         }
13120
13121         if (DEBUGLEVEL >= 10) {
13122                 NDR_PRINT_OUT_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, &r);
13123         }
13124
13125         if (NT_STATUS_IS_ERR(status)) {
13126                 return status;
13127         }
13128
13129         /* Return variables */
13130
13131         /* Return result */
13132         return r.out.result;
13133 }
13134
13135 struct rpccli_lsa_LSARADTREPORTSECURITYEVENT_state {
13136         struct lsa_LSARADTREPORTSECURITYEVENT orig;
13137         struct lsa_LSARADTREPORTSECURITYEVENT tmp;
13138         TALLOC_CTX *out_mem_ctx;
13139         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
13140 };
13141
13142 static void rpccli_lsa_LSARADTREPORTSECURITYEVENT_done(struct tevent_req *subreq);
13143
13144 struct tevent_req *rpccli_lsa_LSARADTREPORTSECURITYEVENT_send(TALLOC_CTX *mem_ctx,
13145                                                               struct tevent_context *ev,
13146                                                               struct rpc_pipe_client *cli)
13147 {
13148         struct tevent_req *req;
13149         struct rpccli_lsa_LSARADTREPORTSECURITYEVENT_state *state;
13150         struct tevent_req *subreq;
13151
13152         req = tevent_req_create(mem_ctx, &state,
13153                                 struct rpccli_lsa_LSARADTREPORTSECURITYEVENT_state);
13154         if (req == NULL) {
13155                 return NULL;
13156         }
13157         state->out_mem_ctx = NULL;
13158         state->dispatch_recv = cli->dispatch_recv;
13159
13160         /* In parameters */
13161
13162         /* Out parameters */
13163
13164         /* Result */
13165         ZERO_STRUCT(state->orig.out.result);
13166
13167         if (DEBUGLEVEL >= 10) {
13168                 NDR_PRINT_IN_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, &state->orig);
13169         }
13170
13171         /* make a temporary copy, that we pass to the dispatch function */
13172         state->tmp = state->orig;
13173
13174         subreq = cli->dispatch_send(state, ev, cli,
13175                                     &ndr_table_lsarpc,
13176                                     NDR_LSA_LSARADTREPORTSECURITYEVENT,
13177                                     &state->tmp);
13178         if (tevent_req_nomem(subreq, req)) {
13179                 return tevent_req_post(req, ev);
13180         }
13181         tevent_req_set_callback(subreq, rpccli_lsa_LSARADTREPORTSECURITYEVENT_done, req);
13182         return req;
13183 }
13184
13185 static void rpccli_lsa_LSARADTREPORTSECURITYEVENT_done(struct tevent_req *subreq)
13186 {
13187         struct tevent_req *req = tevent_req_callback_data(
13188                 subreq, struct tevent_req);
13189         struct rpccli_lsa_LSARADTREPORTSECURITYEVENT_state *state = tevent_req_data(
13190                 req, struct rpccli_lsa_LSARADTREPORTSECURITYEVENT_state);
13191         NTSTATUS status;
13192         TALLOC_CTX *mem_ctx;
13193
13194         if (state->out_mem_ctx) {
13195                 mem_ctx = state->out_mem_ctx;
13196         } else {
13197                 mem_ctx = state;
13198         }
13199
13200         status = state->dispatch_recv(subreq, mem_ctx);
13201         TALLOC_FREE(subreq);
13202         if (!NT_STATUS_IS_OK(status)) {
13203                 tevent_req_nterror(req, status);
13204                 return;
13205         }
13206
13207         /* Copy out parameters */
13208
13209         /* Copy result */
13210         state->orig.out.result = state->tmp.out.result;
13211
13212         /* Reset temporary structure */
13213         ZERO_STRUCT(state->tmp);
13214
13215         if (DEBUGLEVEL >= 10) {
13216                 NDR_PRINT_OUT_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, &state->orig);
13217         }
13218
13219         tevent_req_done(req);
13220 }
13221
13222 NTSTATUS rpccli_lsa_LSARADTREPORTSECURITYEVENT_recv(struct tevent_req *req,
13223                                                     TALLOC_CTX *mem_ctx,
13224                                                     NTSTATUS *result)
13225 {
13226         struct rpccli_lsa_LSARADTREPORTSECURITYEVENT_state *state = tevent_req_data(
13227                 req, struct rpccli_lsa_LSARADTREPORTSECURITYEVENT_state);
13228         NTSTATUS status;
13229
13230         if (tevent_req_is_nterror(req, &status)) {
13231                 tevent_req_received(req);
13232                 return status;
13233         }
13234
13235         /* Steal possbile out parameters to the callers context */
13236         talloc_steal(mem_ctx, state->out_mem_ctx);
13237
13238         /* Return result */
13239         *result = state->orig.out.result;
13240
13241         tevent_req_received(req);
13242         return NT_STATUS_OK;
13243 }
13244
13245 NTSTATUS rpccli_lsa_LSARADTREPORTSECURITYEVENT(struct rpc_pipe_client *cli,
13246                                                TALLOC_CTX *mem_ctx)
13247 {
13248         struct lsa_LSARADTREPORTSECURITYEVENT r;
13249         NTSTATUS status;
13250
13251         /* In parameters */
13252
13253         if (DEBUGLEVEL >= 10) {
13254                 NDR_PRINT_IN_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, &r);
13255         }
13256
13257         status = cli->dispatch(cli,
13258                                 mem_ctx,
13259                                 &ndr_table_lsarpc,
13260                                 NDR_LSA_LSARADTREPORTSECURITYEVENT,
13261                                 &r);
13262
13263         if (!NT_STATUS_IS_OK(status)) {
13264                 return status;
13265         }
13266
13267         if (DEBUGLEVEL >= 10) {
13268                 NDR_PRINT_OUT_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, &r);
13269         }
13270
13271         if (NT_STATUS_IS_ERR(status)) {
13272                 return status;
13273         }
13274
13275         /* Return variables */
13276
13277         /* Return result */
13278         return r.out.result;
13279 }
13280