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