netlogon: document some more MSVC flags.
[metze/samba/wip.git] / librpc / gen_ndr / cli_netlogon.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * client auto-generated by pidl. DO NOT MODIFY!
4  */
5
6 #include "includes.h"
7 #include "../librpc/gen_ndr/cli_netlogon.h"
8
9 struct rpccli_netr_LogonUasLogon_state {
10         struct netr_LogonUasLogon orig;
11         struct netr_LogonUasLogon tmp;
12         TALLOC_CTX *out_mem_ctx;
13         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14 };
15
16 static void rpccli_netr_LogonUasLogon_done(struct tevent_req *subreq);
17
18 struct tevent_req *rpccli_netr_LogonUasLogon_send(TALLOC_CTX *mem_ctx,
19                                                   struct tevent_context *ev,
20                                                   struct rpc_pipe_client *cli,
21                                                   const char *_server_name /* [in] [unique,charset(UTF16)] */,
22                                                   const char *_account_name /* [in] [ref,charset(UTF16)] */,
23                                                   const char *_workstation /* [in] [ref,charset(UTF16)] */,
24                                                   struct netr_UasInfo **_info /* [out] [ref] */)
25 {
26         struct tevent_req *req;
27         struct rpccli_netr_LogonUasLogon_state *state;
28         struct tevent_req *subreq;
29
30         req = tevent_req_create(mem_ctx, &state,
31                                 struct rpccli_netr_LogonUasLogon_state);
32         if (req == NULL) {
33                 return NULL;
34         }
35         state->out_mem_ctx = NULL;
36         state->dispatch_recv = cli->dispatch_recv;
37
38         /* In parameters */
39         state->orig.in.server_name = _server_name;
40         state->orig.in.account_name = _account_name;
41         state->orig.in.workstation = _workstation;
42
43         /* Out parameters */
44         state->orig.out.info = _info;
45
46         /* Result */
47         ZERO_STRUCT(state->orig.out.result);
48
49         if (DEBUGLEVEL >= 10) {
50                 NDR_PRINT_IN_DEBUG(netr_LogonUasLogon, &state->orig);
51         }
52
53         state->out_mem_ctx = talloc_named_const(state, 0,
54                              "rpccli_netr_LogonUasLogon_out_memory");
55         if (tevent_req_nomem(state->out_mem_ctx, req)) {
56                 return tevent_req_post(req, ev);
57         }
58
59         /* make a temporary copy, that we pass to the dispatch function */
60         state->tmp = state->orig;
61
62         subreq = cli->dispatch_send(state, ev, cli,
63                                     &ndr_table_netlogon,
64                                     NDR_NETR_LOGONUASLOGON,
65                                     &state->tmp);
66         if (tevent_req_nomem(subreq, req)) {
67                 return tevent_req_post(req, ev);
68         }
69         tevent_req_set_callback(subreq, rpccli_netr_LogonUasLogon_done, req);
70         return req;
71 }
72
73 static void rpccli_netr_LogonUasLogon_done(struct tevent_req *subreq)
74 {
75         struct tevent_req *req = tevent_req_callback_data(
76                 subreq, struct tevent_req);
77         struct rpccli_netr_LogonUasLogon_state *state = tevent_req_data(
78                 req, struct rpccli_netr_LogonUasLogon_state);
79         NTSTATUS status;
80         TALLOC_CTX *mem_ctx;
81
82         if (state->out_mem_ctx) {
83                 mem_ctx = state->out_mem_ctx;
84         } else {
85                 mem_ctx = state;
86         }
87
88         status = state->dispatch_recv(subreq, mem_ctx);
89         TALLOC_FREE(subreq);
90         if (!NT_STATUS_IS_OK(status)) {
91                 tevent_req_nterror(req, status);
92                 return;
93         }
94
95         /* Copy out parameters */
96         *state->orig.out.info = *state->tmp.out.info;
97
98         /* Copy result */
99         state->orig.out.result = state->tmp.out.result;
100
101         /* Reset temporary structure */
102         ZERO_STRUCT(state->tmp);
103
104         if (DEBUGLEVEL >= 10) {
105                 NDR_PRINT_OUT_DEBUG(netr_LogonUasLogon, &state->orig);
106         }
107
108         tevent_req_done(req);
109 }
110
111 NTSTATUS rpccli_netr_LogonUasLogon_recv(struct tevent_req *req,
112                                         TALLOC_CTX *mem_ctx,
113                                         WERROR *result)
114 {
115         struct rpccli_netr_LogonUasLogon_state *state = tevent_req_data(
116                 req, struct rpccli_netr_LogonUasLogon_state);
117         NTSTATUS status;
118
119         if (tevent_req_is_nterror(req, &status)) {
120                 tevent_req_received(req);
121                 return status;
122         }
123
124         /* Steal possbile out parameters to the callers context */
125         talloc_steal(mem_ctx, state->out_mem_ctx);
126
127         /* Return result */
128         *result = state->orig.out.result;
129
130         tevent_req_received(req);
131         return NT_STATUS_OK;
132 }
133
134 NTSTATUS rpccli_netr_LogonUasLogon(struct rpc_pipe_client *cli,
135                                    TALLOC_CTX *mem_ctx,
136                                    const char *server_name /* [in] [unique,charset(UTF16)] */,
137                                    const char *account_name /* [in] [ref,charset(UTF16)] */,
138                                    const char *workstation /* [in] [ref,charset(UTF16)] */,
139                                    struct netr_UasInfo **info /* [out] [ref] */,
140                                    WERROR *werror)
141 {
142         struct netr_LogonUasLogon r;
143         NTSTATUS status;
144
145         /* In parameters */
146         r.in.server_name = server_name;
147         r.in.account_name = account_name;
148         r.in.workstation = workstation;
149
150         if (DEBUGLEVEL >= 10) {
151                 NDR_PRINT_IN_DEBUG(netr_LogonUasLogon, &r);
152         }
153
154         status = cli->dispatch(cli,
155                                 mem_ctx,
156                                 &ndr_table_netlogon,
157                                 NDR_NETR_LOGONUASLOGON,
158                                 &r);
159
160         if (!NT_STATUS_IS_OK(status)) {
161                 return status;
162         }
163
164         if (DEBUGLEVEL >= 10) {
165                 NDR_PRINT_OUT_DEBUG(netr_LogonUasLogon, &r);
166         }
167
168         if (NT_STATUS_IS_ERR(status)) {
169                 return status;
170         }
171
172         /* Return variables */
173         *info = *r.out.info;
174
175         /* Return result */
176         if (werror) {
177                 *werror = r.out.result;
178         }
179
180         return werror_to_ntstatus(r.out.result);
181 }
182
183 struct rpccli_netr_LogonUasLogoff_state {
184         struct netr_LogonUasLogoff orig;
185         struct netr_LogonUasLogoff tmp;
186         TALLOC_CTX *out_mem_ctx;
187         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
188 };
189
190 static void rpccli_netr_LogonUasLogoff_done(struct tevent_req *subreq);
191
192 struct tevent_req *rpccli_netr_LogonUasLogoff_send(TALLOC_CTX *mem_ctx,
193                                                    struct tevent_context *ev,
194                                                    struct rpc_pipe_client *cli,
195                                                    const char *_server_name /* [in] [unique,charset(UTF16)] */,
196                                                    const char *_account_name /* [in] [ref,charset(UTF16)] */,
197                                                    const char *_workstation /* [in] [ref,charset(UTF16)] */,
198                                                    struct netr_UasLogoffInfo *_info /* [out] [ref] */)
199 {
200         struct tevent_req *req;
201         struct rpccli_netr_LogonUasLogoff_state *state;
202         struct tevent_req *subreq;
203
204         req = tevent_req_create(mem_ctx, &state,
205                                 struct rpccli_netr_LogonUasLogoff_state);
206         if (req == NULL) {
207                 return NULL;
208         }
209         state->out_mem_ctx = NULL;
210         state->dispatch_recv = cli->dispatch_recv;
211
212         /* In parameters */
213         state->orig.in.server_name = _server_name;
214         state->orig.in.account_name = _account_name;
215         state->orig.in.workstation = _workstation;
216
217         /* Out parameters */
218         state->orig.out.info = _info;
219
220         /* Result */
221         ZERO_STRUCT(state->orig.out.result);
222
223         if (DEBUGLEVEL >= 10) {
224                 NDR_PRINT_IN_DEBUG(netr_LogonUasLogoff, &state->orig);
225         }
226
227         state->out_mem_ctx = talloc_named_const(state, 0,
228                              "rpccli_netr_LogonUasLogoff_out_memory");
229         if (tevent_req_nomem(state->out_mem_ctx, req)) {
230                 return tevent_req_post(req, ev);
231         }
232
233         /* make a temporary copy, that we pass to the dispatch function */
234         state->tmp = state->orig;
235
236         subreq = cli->dispatch_send(state, ev, cli,
237                                     &ndr_table_netlogon,
238                                     NDR_NETR_LOGONUASLOGOFF,
239                                     &state->tmp);
240         if (tevent_req_nomem(subreq, req)) {
241                 return tevent_req_post(req, ev);
242         }
243         tevent_req_set_callback(subreq, rpccli_netr_LogonUasLogoff_done, req);
244         return req;
245 }
246
247 static void rpccli_netr_LogonUasLogoff_done(struct tevent_req *subreq)
248 {
249         struct tevent_req *req = tevent_req_callback_data(
250                 subreq, struct tevent_req);
251         struct rpccli_netr_LogonUasLogoff_state *state = tevent_req_data(
252                 req, struct rpccli_netr_LogonUasLogoff_state);
253         NTSTATUS status;
254         TALLOC_CTX *mem_ctx;
255
256         if (state->out_mem_ctx) {
257                 mem_ctx = state->out_mem_ctx;
258         } else {
259                 mem_ctx = state;
260         }
261
262         status = state->dispatch_recv(subreq, mem_ctx);
263         TALLOC_FREE(subreq);
264         if (!NT_STATUS_IS_OK(status)) {
265                 tevent_req_nterror(req, status);
266                 return;
267         }
268
269         /* Copy out parameters */
270         *state->orig.out.info = *state->tmp.out.info;
271
272         /* Copy result */
273         state->orig.out.result = state->tmp.out.result;
274
275         /* Reset temporary structure */
276         ZERO_STRUCT(state->tmp);
277
278         if (DEBUGLEVEL >= 10) {
279                 NDR_PRINT_OUT_DEBUG(netr_LogonUasLogoff, &state->orig);
280         }
281
282         tevent_req_done(req);
283 }
284
285 NTSTATUS rpccli_netr_LogonUasLogoff_recv(struct tevent_req *req,
286                                          TALLOC_CTX *mem_ctx,
287                                          WERROR *result)
288 {
289         struct rpccli_netr_LogonUasLogoff_state *state = tevent_req_data(
290                 req, struct rpccli_netr_LogonUasLogoff_state);
291         NTSTATUS status;
292
293         if (tevent_req_is_nterror(req, &status)) {
294                 tevent_req_received(req);
295                 return status;
296         }
297
298         /* Steal possbile out parameters to the callers context */
299         talloc_steal(mem_ctx, state->out_mem_ctx);
300
301         /* Return result */
302         *result = state->orig.out.result;
303
304         tevent_req_received(req);
305         return NT_STATUS_OK;
306 }
307
308 NTSTATUS rpccli_netr_LogonUasLogoff(struct rpc_pipe_client *cli,
309                                     TALLOC_CTX *mem_ctx,
310                                     const char *server_name /* [in] [unique,charset(UTF16)] */,
311                                     const char *account_name /* [in] [ref,charset(UTF16)] */,
312                                     const char *workstation /* [in] [ref,charset(UTF16)] */,
313                                     struct netr_UasLogoffInfo *info /* [out] [ref] */,
314                                     WERROR *werror)
315 {
316         struct netr_LogonUasLogoff r;
317         NTSTATUS status;
318
319         /* In parameters */
320         r.in.server_name = server_name;
321         r.in.account_name = account_name;
322         r.in.workstation = workstation;
323
324         if (DEBUGLEVEL >= 10) {
325                 NDR_PRINT_IN_DEBUG(netr_LogonUasLogoff, &r);
326         }
327
328         status = cli->dispatch(cli,
329                                 mem_ctx,
330                                 &ndr_table_netlogon,
331                                 NDR_NETR_LOGONUASLOGOFF,
332                                 &r);
333
334         if (!NT_STATUS_IS_OK(status)) {
335                 return status;
336         }
337
338         if (DEBUGLEVEL >= 10) {
339                 NDR_PRINT_OUT_DEBUG(netr_LogonUasLogoff, &r);
340         }
341
342         if (NT_STATUS_IS_ERR(status)) {
343                 return status;
344         }
345
346         /* Return variables */
347         *info = *r.out.info;
348
349         /* Return result */
350         if (werror) {
351                 *werror = r.out.result;
352         }
353
354         return werror_to_ntstatus(r.out.result);
355 }
356
357 struct rpccli_netr_LogonSamLogon_state {
358         struct netr_LogonSamLogon orig;
359         struct netr_LogonSamLogon tmp;
360         TALLOC_CTX *out_mem_ctx;
361         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
362 };
363
364 static void rpccli_netr_LogonSamLogon_done(struct tevent_req *subreq);
365
366 struct tevent_req *rpccli_netr_LogonSamLogon_send(TALLOC_CTX *mem_ctx,
367                                                   struct tevent_context *ev,
368                                                   struct rpc_pipe_client *cli,
369                                                   const char *_server_name /* [in] [unique,charset(UTF16)] */,
370                                                   const char *_computer_name /* [in] [unique,charset(UTF16)] */,
371                                                   struct netr_Authenticator *_credential /* [in] [unique] */,
372                                                   struct netr_Authenticator *_return_authenticator /* [in,out] [unique] */,
373                                                   enum netr_LogonInfoClass _logon_level /* [in]  */,
374                                                   union netr_LogonLevel *_logon /* [in] [ref,switch_is(logon_level)] */,
375                                                   uint16_t _validation_level /* [in]  */,
376                                                   union netr_Validation *_validation /* [out] [ref,switch_is(validation_level)] */,
377                                                   uint8_t *_authoritative /* [out] [ref] */)
378 {
379         struct tevent_req *req;
380         struct rpccli_netr_LogonSamLogon_state *state;
381         struct tevent_req *subreq;
382
383         req = tevent_req_create(mem_ctx, &state,
384                                 struct rpccli_netr_LogonSamLogon_state);
385         if (req == NULL) {
386                 return NULL;
387         }
388         state->out_mem_ctx = NULL;
389         state->dispatch_recv = cli->dispatch_recv;
390
391         /* In parameters */
392         state->orig.in.server_name = _server_name;
393         state->orig.in.computer_name = _computer_name;
394         state->orig.in.credential = _credential;
395         state->orig.in.return_authenticator = _return_authenticator;
396         state->orig.in.logon_level = _logon_level;
397         state->orig.in.logon = _logon;
398         state->orig.in.validation_level = _validation_level;
399
400         /* Out parameters */
401         state->orig.out.return_authenticator = _return_authenticator;
402         state->orig.out.validation = _validation;
403         state->orig.out.authoritative = _authoritative;
404
405         /* Result */
406         ZERO_STRUCT(state->orig.out.result);
407
408         if (DEBUGLEVEL >= 10) {
409                 NDR_PRINT_IN_DEBUG(netr_LogonSamLogon, &state->orig);
410         }
411
412         state->out_mem_ctx = talloc_named_const(state, 0,
413                              "rpccli_netr_LogonSamLogon_out_memory");
414         if (tevent_req_nomem(state->out_mem_ctx, req)) {
415                 return tevent_req_post(req, ev);
416         }
417
418         /* make a temporary copy, that we pass to the dispatch function */
419         state->tmp = state->orig;
420
421         subreq = cli->dispatch_send(state, ev, cli,
422                                     &ndr_table_netlogon,
423                                     NDR_NETR_LOGONSAMLOGON,
424                                     &state->tmp);
425         if (tevent_req_nomem(subreq, req)) {
426                 return tevent_req_post(req, ev);
427         }
428         tevent_req_set_callback(subreq, rpccli_netr_LogonSamLogon_done, req);
429         return req;
430 }
431
432 static void rpccli_netr_LogonSamLogon_done(struct tevent_req *subreq)
433 {
434         struct tevent_req *req = tevent_req_callback_data(
435                 subreq, struct tevent_req);
436         struct rpccli_netr_LogonSamLogon_state *state = tevent_req_data(
437                 req, struct rpccli_netr_LogonSamLogon_state);
438         NTSTATUS status;
439         TALLOC_CTX *mem_ctx;
440
441         if (state->out_mem_ctx) {
442                 mem_ctx = state->out_mem_ctx;
443         } else {
444                 mem_ctx = state;
445         }
446
447         status = state->dispatch_recv(subreq, mem_ctx);
448         TALLOC_FREE(subreq);
449         if (!NT_STATUS_IS_OK(status)) {
450                 tevent_req_nterror(req, status);
451                 return;
452         }
453
454         /* Copy out parameters */
455         if (state->orig.out.return_authenticator && state->tmp.out.return_authenticator) {
456                 *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
457         }
458         *state->orig.out.validation = *state->tmp.out.validation;
459         *state->orig.out.authoritative = *state->tmp.out.authoritative;
460
461         /* Copy result */
462         state->orig.out.result = state->tmp.out.result;
463
464         /* Reset temporary structure */
465         ZERO_STRUCT(state->tmp);
466
467         if (DEBUGLEVEL >= 10) {
468                 NDR_PRINT_OUT_DEBUG(netr_LogonSamLogon, &state->orig);
469         }
470
471         tevent_req_done(req);
472 }
473
474 NTSTATUS rpccli_netr_LogonSamLogon_recv(struct tevent_req *req,
475                                         TALLOC_CTX *mem_ctx,
476                                         NTSTATUS *result)
477 {
478         struct rpccli_netr_LogonSamLogon_state *state = tevent_req_data(
479                 req, struct rpccli_netr_LogonSamLogon_state);
480         NTSTATUS status;
481
482         if (tevent_req_is_nterror(req, &status)) {
483                 tevent_req_received(req);
484                 return status;
485         }
486
487         /* Steal possbile out parameters to the callers context */
488         talloc_steal(mem_ctx, state->out_mem_ctx);
489
490         /* Return result */
491         *result = state->orig.out.result;
492
493         tevent_req_received(req);
494         return NT_STATUS_OK;
495 }
496
497 NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli,
498                                    TALLOC_CTX *mem_ctx,
499                                    const char *server_name /* [in] [unique,charset(UTF16)] */,
500                                    const char *computer_name /* [in] [unique,charset(UTF16)] */,
501                                    struct netr_Authenticator *credential /* [in] [unique] */,
502                                    struct netr_Authenticator *return_authenticator /* [in,out] [unique] */,
503                                    enum netr_LogonInfoClass logon_level /* [in]  */,
504                                    union netr_LogonLevel *logon /* [in] [ref,switch_is(logon_level)] */,
505                                    uint16_t validation_level /* [in]  */,
506                                    union netr_Validation *validation /* [out] [ref,switch_is(validation_level)] */,
507                                    uint8_t *authoritative /* [out] [ref] */)
508 {
509         struct netr_LogonSamLogon r;
510         NTSTATUS status;
511
512         /* In parameters */
513         r.in.server_name = server_name;
514         r.in.computer_name = computer_name;
515         r.in.credential = credential;
516         r.in.return_authenticator = return_authenticator;
517         r.in.logon_level = logon_level;
518         r.in.logon = logon;
519         r.in.validation_level = validation_level;
520
521         if (DEBUGLEVEL >= 10) {
522                 NDR_PRINT_IN_DEBUG(netr_LogonSamLogon, &r);
523         }
524
525         status = cli->dispatch(cli,
526                                 mem_ctx,
527                                 &ndr_table_netlogon,
528                                 NDR_NETR_LOGONSAMLOGON,
529                                 &r);
530
531         if (!NT_STATUS_IS_OK(status)) {
532                 return status;
533         }
534
535         if (DEBUGLEVEL >= 10) {
536                 NDR_PRINT_OUT_DEBUG(netr_LogonSamLogon, &r);
537         }
538
539         if (NT_STATUS_IS_ERR(status)) {
540                 return status;
541         }
542
543         /* Return variables */
544         if (return_authenticator && r.out.return_authenticator) {
545                 *return_authenticator = *r.out.return_authenticator;
546         }
547         *validation = *r.out.validation;
548         *authoritative = *r.out.authoritative;
549
550         /* Return result */
551         return r.out.result;
552 }
553
554 struct rpccli_netr_LogonSamLogoff_state {
555         struct netr_LogonSamLogoff orig;
556         struct netr_LogonSamLogoff tmp;
557         TALLOC_CTX *out_mem_ctx;
558         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
559 };
560
561 static void rpccli_netr_LogonSamLogoff_done(struct tevent_req *subreq);
562
563 struct tevent_req *rpccli_netr_LogonSamLogoff_send(TALLOC_CTX *mem_ctx,
564                                                    struct tevent_context *ev,
565                                                    struct rpc_pipe_client *cli,
566                                                    const char *_server_name /* [in] [unique,charset(UTF16)] */,
567                                                    const char *_computer_name /* [in] [unique,charset(UTF16)] */,
568                                                    struct netr_Authenticator *_credential /* [in] [unique] */,
569                                                    struct netr_Authenticator *_return_authenticator /* [in,out] [unique] */,
570                                                    enum netr_LogonInfoClass _logon_level /* [in]  */,
571                                                    union netr_LogonLevel _logon /* [in] [switch_is(logon_level)] */)
572 {
573         struct tevent_req *req;
574         struct rpccli_netr_LogonSamLogoff_state *state;
575         struct tevent_req *subreq;
576
577         req = tevent_req_create(mem_ctx, &state,
578                                 struct rpccli_netr_LogonSamLogoff_state);
579         if (req == NULL) {
580                 return NULL;
581         }
582         state->out_mem_ctx = NULL;
583         state->dispatch_recv = cli->dispatch_recv;
584
585         /* In parameters */
586         state->orig.in.server_name = _server_name;
587         state->orig.in.computer_name = _computer_name;
588         state->orig.in.credential = _credential;
589         state->orig.in.return_authenticator = _return_authenticator;
590         state->orig.in.logon_level = _logon_level;
591         state->orig.in.logon = _logon;
592
593         /* Out parameters */
594         state->orig.out.return_authenticator = _return_authenticator;
595
596         /* Result */
597         ZERO_STRUCT(state->orig.out.result);
598
599         if (DEBUGLEVEL >= 10) {
600                 NDR_PRINT_IN_DEBUG(netr_LogonSamLogoff, &state->orig);
601         }
602
603         state->out_mem_ctx = talloc_named_const(state, 0,
604                              "rpccli_netr_LogonSamLogoff_out_memory");
605         if (tevent_req_nomem(state->out_mem_ctx, req)) {
606                 return tevent_req_post(req, ev);
607         }
608
609         /* make a temporary copy, that we pass to the dispatch function */
610         state->tmp = state->orig;
611
612         subreq = cli->dispatch_send(state, ev, cli,
613                                     &ndr_table_netlogon,
614                                     NDR_NETR_LOGONSAMLOGOFF,
615                                     &state->tmp);
616         if (tevent_req_nomem(subreq, req)) {
617                 return tevent_req_post(req, ev);
618         }
619         tevent_req_set_callback(subreq, rpccli_netr_LogonSamLogoff_done, req);
620         return req;
621 }
622
623 static void rpccli_netr_LogonSamLogoff_done(struct tevent_req *subreq)
624 {
625         struct tevent_req *req = tevent_req_callback_data(
626                 subreq, struct tevent_req);
627         struct rpccli_netr_LogonSamLogoff_state *state = tevent_req_data(
628                 req, struct rpccli_netr_LogonSamLogoff_state);
629         NTSTATUS status;
630         TALLOC_CTX *mem_ctx;
631
632         if (state->out_mem_ctx) {
633                 mem_ctx = state->out_mem_ctx;
634         } else {
635                 mem_ctx = state;
636         }
637
638         status = state->dispatch_recv(subreq, mem_ctx);
639         TALLOC_FREE(subreq);
640         if (!NT_STATUS_IS_OK(status)) {
641                 tevent_req_nterror(req, status);
642                 return;
643         }
644
645         /* Copy out parameters */
646         if (state->orig.out.return_authenticator && state->tmp.out.return_authenticator) {
647                 *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
648         }
649
650         /* Copy result */
651         state->orig.out.result = state->tmp.out.result;
652
653         /* Reset temporary structure */
654         ZERO_STRUCT(state->tmp);
655
656         if (DEBUGLEVEL >= 10) {
657                 NDR_PRINT_OUT_DEBUG(netr_LogonSamLogoff, &state->orig);
658         }
659
660         tevent_req_done(req);
661 }
662
663 NTSTATUS rpccli_netr_LogonSamLogoff_recv(struct tevent_req *req,
664                                          TALLOC_CTX *mem_ctx,
665                                          NTSTATUS *result)
666 {
667         struct rpccli_netr_LogonSamLogoff_state *state = tevent_req_data(
668                 req, struct rpccli_netr_LogonSamLogoff_state);
669         NTSTATUS status;
670
671         if (tevent_req_is_nterror(req, &status)) {
672                 tevent_req_received(req);
673                 return status;
674         }
675
676         /* Steal possbile out parameters to the callers context */
677         talloc_steal(mem_ctx, state->out_mem_ctx);
678
679         /* Return result */
680         *result = state->orig.out.result;
681
682         tevent_req_received(req);
683         return NT_STATUS_OK;
684 }
685
686 NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli,
687                                     TALLOC_CTX *mem_ctx,
688                                     const char *server_name /* [in] [unique,charset(UTF16)] */,
689                                     const char *computer_name /* [in] [unique,charset(UTF16)] */,
690                                     struct netr_Authenticator *credential /* [in] [unique] */,
691                                     struct netr_Authenticator *return_authenticator /* [in,out] [unique] */,
692                                     enum netr_LogonInfoClass logon_level /* [in]  */,
693                                     union netr_LogonLevel logon /* [in] [switch_is(logon_level)] */)
694 {
695         struct netr_LogonSamLogoff r;
696         NTSTATUS status;
697
698         /* In parameters */
699         r.in.server_name = server_name;
700         r.in.computer_name = computer_name;
701         r.in.credential = credential;
702         r.in.return_authenticator = return_authenticator;
703         r.in.logon_level = logon_level;
704         r.in.logon = logon;
705
706         if (DEBUGLEVEL >= 10) {
707                 NDR_PRINT_IN_DEBUG(netr_LogonSamLogoff, &r);
708         }
709
710         status = cli->dispatch(cli,
711                                 mem_ctx,
712                                 &ndr_table_netlogon,
713                                 NDR_NETR_LOGONSAMLOGOFF,
714                                 &r);
715
716         if (!NT_STATUS_IS_OK(status)) {
717                 return status;
718         }
719
720         if (DEBUGLEVEL >= 10) {
721                 NDR_PRINT_OUT_DEBUG(netr_LogonSamLogoff, &r);
722         }
723
724         if (NT_STATUS_IS_ERR(status)) {
725                 return status;
726         }
727
728         /* Return variables */
729         if (return_authenticator && r.out.return_authenticator) {
730                 *return_authenticator = *r.out.return_authenticator;
731         }
732
733         /* Return result */
734         return r.out.result;
735 }
736
737 struct rpccli_netr_ServerReqChallenge_state {
738         struct netr_ServerReqChallenge orig;
739         struct netr_ServerReqChallenge tmp;
740         TALLOC_CTX *out_mem_ctx;
741         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
742 };
743
744 static void rpccli_netr_ServerReqChallenge_done(struct tevent_req *subreq);
745
746 struct tevent_req *rpccli_netr_ServerReqChallenge_send(TALLOC_CTX *mem_ctx,
747                                                        struct tevent_context *ev,
748                                                        struct rpc_pipe_client *cli,
749                                                        const char *_server_name /* [in] [unique,charset(UTF16)] */,
750                                                        const char *_computer_name /* [in] [ref,charset(UTF16)] */,
751                                                        struct netr_Credential *_credentials /* [in] [ref] */,
752                                                        struct netr_Credential *_return_credentials /* [out] [ref] */)
753 {
754         struct tevent_req *req;
755         struct rpccli_netr_ServerReqChallenge_state *state;
756         struct tevent_req *subreq;
757
758         req = tevent_req_create(mem_ctx, &state,
759                                 struct rpccli_netr_ServerReqChallenge_state);
760         if (req == NULL) {
761                 return NULL;
762         }
763         state->out_mem_ctx = NULL;
764         state->dispatch_recv = cli->dispatch_recv;
765
766         /* In parameters */
767         state->orig.in.server_name = _server_name;
768         state->orig.in.computer_name = _computer_name;
769         state->orig.in.credentials = _credentials;
770
771         /* Out parameters */
772         state->orig.out.return_credentials = _return_credentials;
773
774         /* Result */
775         ZERO_STRUCT(state->orig.out.result);
776
777         if (DEBUGLEVEL >= 10) {
778                 NDR_PRINT_IN_DEBUG(netr_ServerReqChallenge, &state->orig);
779         }
780
781         state->out_mem_ctx = talloc_named_const(state, 0,
782                              "rpccli_netr_ServerReqChallenge_out_memory");
783         if (tevent_req_nomem(state->out_mem_ctx, req)) {
784                 return tevent_req_post(req, ev);
785         }
786
787         /* make a temporary copy, that we pass to the dispatch function */
788         state->tmp = state->orig;
789
790         subreq = cli->dispatch_send(state, ev, cli,
791                                     &ndr_table_netlogon,
792                                     NDR_NETR_SERVERREQCHALLENGE,
793                                     &state->tmp);
794         if (tevent_req_nomem(subreq, req)) {
795                 return tevent_req_post(req, ev);
796         }
797         tevent_req_set_callback(subreq, rpccli_netr_ServerReqChallenge_done, req);
798         return req;
799 }
800
801 static void rpccli_netr_ServerReqChallenge_done(struct tevent_req *subreq)
802 {
803         struct tevent_req *req = tevent_req_callback_data(
804                 subreq, struct tevent_req);
805         struct rpccli_netr_ServerReqChallenge_state *state = tevent_req_data(
806                 req, struct rpccli_netr_ServerReqChallenge_state);
807         NTSTATUS status;
808         TALLOC_CTX *mem_ctx;
809
810         if (state->out_mem_ctx) {
811                 mem_ctx = state->out_mem_ctx;
812         } else {
813                 mem_ctx = state;
814         }
815
816         status = state->dispatch_recv(subreq, mem_ctx);
817         TALLOC_FREE(subreq);
818         if (!NT_STATUS_IS_OK(status)) {
819                 tevent_req_nterror(req, status);
820                 return;
821         }
822
823         /* Copy out parameters */
824         *state->orig.out.return_credentials = *state->tmp.out.return_credentials;
825
826         /* Copy result */
827         state->orig.out.result = state->tmp.out.result;
828
829         /* Reset temporary structure */
830         ZERO_STRUCT(state->tmp);
831
832         if (DEBUGLEVEL >= 10) {
833                 NDR_PRINT_OUT_DEBUG(netr_ServerReqChallenge, &state->orig);
834         }
835
836         tevent_req_done(req);
837 }
838
839 NTSTATUS rpccli_netr_ServerReqChallenge_recv(struct tevent_req *req,
840                                              TALLOC_CTX *mem_ctx,
841                                              NTSTATUS *result)
842 {
843         struct rpccli_netr_ServerReqChallenge_state *state = tevent_req_data(
844                 req, struct rpccli_netr_ServerReqChallenge_state);
845         NTSTATUS status;
846
847         if (tevent_req_is_nterror(req, &status)) {
848                 tevent_req_received(req);
849                 return status;
850         }
851
852         /* Steal possbile out parameters to the callers context */
853         talloc_steal(mem_ctx, state->out_mem_ctx);
854
855         /* Return result */
856         *result = state->orig.out.result;
857
858         tevent_req_received(req);
859         return NT_STATUS_OK;
860 }
861
862 NTSTATUS rpccli_netr_ServerReqChallenge(struct rpc_pipe_client *cli,
863                                         TALLOC_CTX *mem_ctx,
864                                         const char *server_name /* [in] [unique,charset(UTF16)] */,
865                                         const char *computer_name /* [in] [ref,charset(UTF16)] */,
866                                         struct netr_Credential *credentials /* [in] [ref] */,
867                                         struct netr_Credential *return_credentials /* [out] [ref] */)
868 {
869         struct netr_ServerReqChallenge r;
870         NTSTATUS status;
871
872         /* In parameters */
873         r.in.server_name = server_name;
874         r.in.computer_name = computer_name;
875         r.in.credentials = credentials;
876
877         if (DEBUGLEVEL >= 10) {
878                 NDR_PRINT_IN_DEBUG(netr_ServerReqChallenge, &r);
879         }
880
881         status = cli->dispatch(cli,
882                                 mem_ctx,
883                                 &ndr_table_netlogon,
884                                 NDR_NETR_SERVERREQCHALLENGE,
885                                 &r);
886
887         if (!NT_STATUS_IS_OK(status)) {
888                 return status;
889         }
890
891         if (DEBUGLEVEL >= 10) {
892                 NDR_PRINT_OUT_DEBUG(netr_ServerReqChallenge, &r);
893         }
894
895         if (NT_STATUS_IS_ERR(status)) {
896                 return status;
897         }
898
899         /* Return variables */
900         *return_credentials = *r.out.return_credentials;
901
902         /* Return result */
903         return r.out.result;
904 }
905
906 struct rpccli_netr_ServerAuthenticate_state {
907         struct netr_ServerAuthenticate orig;
908         struct netr_ServerAuthenticate tmp;
909         TALLOC_CTX *out_mem_ctx;
910         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
911 };
912
913 static void rpccli_netr_ServerAuthenticate_done(struct tevent_req *subreq);
914
915 struct tevent_req *rpccli_netr_ServerAuthenticate_send(TALLOC_CTX *mem_ctx,
916                                                        struct tevent_context *ev,
917                                                        struct rpc_pipe_client *cli,
918                                                        const char *_server_name /* [in] [unique,charset(UTF16)] */,
919                                                        const char *_account_name /* [in] [ref,charset(UTF16)] */,
920                                                        enum netr_SchannelType _secure_channel_type /* [in]  */,
921                                                        const char *_computer_name /* [in] [ref,charset(UTF16)] */,
922                                                        struct netr_Credential *_credentials /* [in] [ref] */,
923                                                        struct netr_Credential *_return_credentials /* [out] [ref] */)
924 {
925         struct tevent_req *req;
926         struct rpccli_netr_ServerAuthenticate_state *state;
927         struct tevent_req *subreq;
928
929         req = tevent_req_create(mem_ctx, &state,
930                                 struct rpccli_netr_ServerAuthenticate_state);
931         if (req == NULL) {
932                 return NULL;
933         }
934         state->out_mem_ctx = NULL;
935         state->dispatch_recv = cli->dispatch_recv;
936
937         /* In parameters */
938         state->orig.in.server_name = _server_name;
939         state->orig.in.account_name = _account_name;
940         state->orig.in.secure_channel_type = _secure_channel_type;
941         state->orig.in.computer_name = _computer_name;
942         state->orig.in.credentials = _credentials;
943
944         /* Out parameters */
945         state->orig.out.return_credentials = _return_credentials;
946
947         /* Result */
948         ZERO_STRUCT(state->orig.out.result);
949
950         if (DEBUGLEVEL >= 10) {
951                 NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate, &state->orig);
952         }
953
954         state->out_mem_ctx = talloc_named_const(state, 0,
955                              "rpccli_netr_ServerAuthenticate_out_memory");
956         if (tevent_req_nomem(state->out_mem_ctx, req)) {
957                 return tevent_req_post(req, ev);
958         }
959
960         /* make a temporary copy, that we pass to the dispatch function */
961         state->tmp = state->orig;
962
963         subreq = cli->dispatch_send(state, ev, cli,
964                                     &ndr_table_netlogon,
965                                     NDR_NETR_SERVERAUTHENTICATE,
966                                     &state->tmp);
967         if (tevent_req_nomem(subreq, req)) {
968                 return tevent_req_post(req, ev);
969         }
970         tevent_req_set_callback(subreq, rpccli_netr_ServerAuthenticate_done, req);
971         return req;
972 }
973
974 static void rpccli_netr_ServerAuthenticate_done(struct tevent_req *subreq)
975 {
976         struct tevent_req *req = tevent_req_callback_data(
977                 subreq, struct tevent_req);
978         struct rpccli_netr_ServerAuthenticate_state *state = tevent_req_data(
979                 req, struct rpccli_netr_ServerAuthenticate_state);
980         NTSTATUS status;
981         TALLOC_CTX *mem_ctx;
982
983         if (state->out_mem_ctx) {
984                 mem_ctx = state->out_mem_ctx;
985         } else {
986                 mem_ctx = state;
987         }
988
989         status = state->dispatch_recv(subreq, mem_ctx);
990         TALLOC_FREE(subreq);
991         if (!NT_STATUS_IS_OK(status)) {
992                 tevent_req_nterror(req, status);
993                 return;
994         }
995
996         /* Copy out parameters */
997         *state->orig.out.return_credentials = *state->tmp.out.return_credentials;
998
999         /* Copy result */
1000         state->orig.out.result = state->tmp.out.result;
1001
1002         /* Reset temporary structure */
1003         ZERO_STRUCT(state->tmp);
1004
1005         if (DEBUGLEVEL >= 10) {
1006                 NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate, &state->orig);
1007         }
1008
1009         tevent_req_done(req);
1010 }
1011
1012 NTSTATUS rpccli_netr_ServerAuthenticate_recv(struct tevent_req *req,
1013                                              TALLOC_CTX *mem_ctx,
1014                                              NTSTATUS *result)
1015 {
1016         struct rpccli_netr_ServerAuthenticate_state *state = tevent_req_data(
1017                 req, struct rpccli_netr_ServerAuthenticate_state);
1018         NTSTATUS status;
1019
1020         if (tevent_req_is_nterror(req, &status)) {
1021                 tevent_req_received(req);
1022                 return status;
1023         }
1024
1025         /* Steal possbile out parameters to the callers context */
1026         talloc_steal(mem_ctx, state->out_mem_ctx);
1027
1028         /* Return result */
1029         *result = state->orig.out.result;
1030
1031         tevent_req_received(req);
1032         return NT_STATUS_OK;
1033 }
1034
1035 NTSTATUS rpccli_netr_ServerAuthenticate(struct rpc_pipe_client *cli,
1036                                         TALLOC_CTX *mem_ctx,
1037                                         const char *server_name /* [in] [unique,charset(UTF16)] */,
1038                                         const char *account_name /* [in] [ref,charset(UTF16)] */,
1039                                         enum netr_SchannelType secure_channel_type /* [in]  */,
1040                                         const char *computer_name /* [in] [ref,charset(UTF16)] */,
1041                                         struct netr_Credential *credentials /* [in] [ref] */,
1042                                         struct netr_Credential *return_credentials /* [out] [ref] */)
1043 {
1044         struct netr_ServerAuthenticate r;
1045         NTSTATUS status;
1046
1047         /* In parameters */
1048         r.in.server_name = server_name;
1049         r.in.account_name = account_name;
1050         r.in.secure_channel_type = secure_channel_type;
1051         r.in.computer_name = computer_name;
1052         r.in.credentials = credentials;
1053
1054         if (DEBUGLEVEL >= 10) {
1055                 NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate, &r);
1056         }
1057
1058         status = cli->dispatch(cli,
1059                                 mem_ctx,
1060                                 &ndr_table_netlogon,
1061                                 NDR_NETR_SERVERAUTHENTICATE,
1062                                 &r);
1063
1064         if (!NT_STATUS_IS_OK(status)) {
1065                 return status;
1066         }
1067
1068         if (DEBUGLEVEL >= 10) {
1069                 NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate, &r);
1070         }
1071
1072         if (NT_STATUS_IS_ERR(status)) {
1073                 return status;
1074         }
1075
1076         /* Return variables */
1077         *return_credentials = *r.out.return_credentials;
1078
1079         /* Return result */
1080         return r.out.result;
1081 }
1082
1083 struct rpccli_netr_ServerPasswordSet_state {
1084         struct netr_ServerPasswordSet orig;
1085         struct netr_ServerPasswordSet tmp;
1086         TALLOC_CTX *out_mem_ctx;
1087         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1088 };
1089
1090 static void rpccli_netr_ServerPasswordSet_done(struct tevent_req *subreq);
1091
1092 struct tevent_req *rpccli_netr_ServerPasswordSet_send(TALLOC_CTX *mem_ctx,
1093                                                       struct tevent_context *ev,
1094                                                       struct rpc_pipe_client *cli,
1095                                                       const char *_server_name /* [in] [unique,charset(UTF16)] */,
1096                                                       const char *_account_name /* [in] [ref,charset(UTF16)] */,
1097                                                       enum netr_SchannelType _secure_channel_type /* [in]  */,
1098                                                       const char *_computer_name /* [in] [ref,charset(UTF16)] */,
1099                                                       struct netr_Authenticator *_credential /* [in] [ref] */,
1100                                                       struct netr_Authenticator *_return_authenticator /* [out] [ref] */,
1101                                                       struct samr_Password *_new_password /* [in] [ref] */)
1102 {
1103         struct tevent_req *req;
1104         struct rpccli_netr_ServerPasswordSet_state *state;
1105         struct tevent_req *subreq;
1106
1107         req = tevent_req_create(mem_ctx, &state,
1108                                 struct rpccli_netr_ServerPasswordSet_state);
1109         if (req == NULL) {
1110                 return NULL;
1111         }
1112         state->out_mem_ctx = NULL;
1113         state->dispatch_recv = cli->dispatch_recv;
1114
1115         /* In parameters */
1116         state->orig.in.server_name = _server_name;
1117         state->orig.in.account_name = _account_name;
1118         state->orig.in.secure_channel_type = _secure_channel_type;
1119         state->orig.in.computer_name = _computer_name;
1120         state->orig.in.credential = _credential;
1121         state->orig.in.new_password = _new_password;
1122
1123         /* Out parameters */
1124         state->orig.out.return_authenticator = _return_authenticator;
1125
1126         /* Result */
1127         ZERO_STRUCT(state->orig.out.result);
1128
1129         if (DEBUGLEVEL >= 10) {
1130                 NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet, &state->orig);
1131         }
1132
1133         state->out_mem_ctx = talloc_named_const(state, 0,
1134                              "rpccli_netr_ServerPasswordSet_out_memory");
1135         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1136                 return tevent_req_post(req, ev);
1137         }
1138
1139         /* make a temporary copy, that we pass to the dispatch function */
1140         state->tmp = state->orig;
1141
1142         subreq = cli->dispatch_send(state, ev, cli,
1143                                     &ndr_table_netlogon,
1144                                     NDR_NETR_SERVERPASSWORDSET,
1145                                     &state->tmp);
1146         if (tevent_req_nomem(subreq, req)) {
1147                 return tevent_req_post(req, ev);
1148         }
1149         tevent_req_set_callback(subreq, rpccli_netr_ServerPasswordSet_done, req);
1150         return req;
1151 }
1152
1153 static void rpccli_netr_ServerPasswordSet_done(struct tevent_req *subreq)
1154 {
1155         struct tevent_req *req = tevent_req_callback_data(
1156                 subreq, struct tevent_req);
1157         struct rpccli_netr_ServerPasswordSet_state *state = tevent_req_data(
1158                 req, struct rpccli_netr_ServerPasswordSet_state);
1159         NTSTATUS status;
1160         TALLOC_CTX *mem_ctx;
1161
1162         if (state->out_mem_ctx) {
1163                 mem_ctx = state->out_mem_ctx;
1164         } else {
1165                 mem_ctx = state;
1166         }
1167
1168         status = state->dispatch_recv(subreq, mem_ctx);
1169         TALLOC_FREE(subreq);
1170         if (!NT_STATUS_IS_OK(status)) {
1171                 tevent_req_nterror(req, status);
1172                 return;
1173         }
1174
1175         /* Copy out parameters */
1176         *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
1177
1178         /* Copy result */
1179         state->orig.out.result = state->tmp.out.result;
1180
1181         /* Reset temporary structure */
1182         ZERO_STRUCT(state->tmp);
1183
1184         if (DEBUGLEVEL >= 10) {
1185                 NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet, &state->orig);
1186         }
1187
1188         tevent_req_done(req);
1189 }
1190
1191 NTSTATUS rpccli_netr_ServerPasswordSet_recv(struct tevent_req *req,
1192                                             TALLOC_CTX *mem_ctx,
1193                                             NTSTATUS *result)
1194 {
1195         struct rpccli_netr_ServerPasswordSet_state *state = tevent_req_data(
1196                 req, struct rpccli_netr_ServerPasswordSet_state);
1197         NTSTATUS status;
1198
1199         if (tevent_req_is_nterror(req, &status)) {
1200                 tevent_req_received(req);
1201                 return status;
1202         }
1203
1204         /* Steal possbile out parameters to the callers context */
1205         talloc_steal(mem_ctx, state->out_mem_ctx);
1206
1207         /* Return result */
1208         *result = state->orig.out.result;
1209
1210         tevent_req_received(req);
1211         return NT_STATUS_OK;
1212 }
1213
1214 NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli,
1215                                        TALLOC_CTX *mem_ctx,
1216                                        const char *server_name /* [in] [unique,charset(UTF16)] */,
1217                                        const char *account_name /* [in] [ref,charset(UTF16)] */,
1218                                        enum netr_SchannelType secure_channel_type /* [in]  */,
1219                                        const char *computer_name /* [in] [ref,charset(UTF16)] */,
1220                                        struct netr_Authenticator *credential /* [in] [ref] */,
1221                                        struct netr_Authenticator *return_authenticator /* [out] [ref] */,
1222                                        struct samr_Password *new_password /* [in] [ref] */)
1223 {
1224         struct netr_ServerPasswordSet r;
1225         NTSTATUS status;
1226
1227         /* In parameters */
1228         r.in.server_name = server_name;
1229         r.in.account_name = account_name;
1230         r.in.secure_channel_type = secure_channel_type;
1231         r.in.computer_name = computer_name;
1232         r.in.credential = credential;
1233         r.in.new_password = new_password;
1234
1235         if (DEBUGLEVEL >= 10) {
1236                 NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet, &r);
1237         }
1238
1239         status = cli->dispatch(cli,
1240                                 mem_ctx,
1241                                 &ndr_table_netlogon,
1242                                 NDR_NETR_SERVERPASSWORDSET,
1243                                 &r);
1244
1245         if (!NT_STATUS_IS_OK(status)) {
1246                 return status;
1247         }
1248
1249         if (DEBUGLEVEL >= 10) {
1250                 NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet, &r);
1251         }
1252
1253         if (NT_STATUS_IS_ERR(status)) {
1254                 return status;
1255         }
1256
1257         /* Return variables */
1258         *return_authenticator = *r.out.return_authenticator;
1259
1260         /* Return result */
1261         return r.out.result;
1262 }
1263
1264 struct rpccli_netr_DatabaseDeltas_state {
1265         struct netr_DatabaseDeltas orig;
1266         struct netr_DatabaseDeltas tmp;
1267         TALLOC_CTX *out_mem_ctx;
1268         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1269 };
1270
1271 static void rpccli_netr_DatabaseDeltas_done(struct tevent_req *subreq);
1272
1273 struct tevent_req *rpccli_netr_DatabaseDeltas_send(TALLOC_CTX *mem_ctx,
1274                                                    struct tevent_context *ev,
1275                                                    struct rpc_pipe_client *cli,
1276                                                    const char *_logon_server /* [in] [ref,charset(UTF16)] */,
1277                                                    const char *_computername /* [in] [ref,charset(UTF16)] */,
1278                                                    struct netr_Authenticator *_credential /* [in] [ref] */,
1279                                                    struct netr_Authenticator *_return_authenticator /* [in,out] [ref] */,
1280                                                    enum netr_SamDatabaseID _database_id /* [in]  */,
1281                                                    uint64_t *_sequence_num /* [in,out] [ref] */,
1282                                                    struct netr_DELTA_ENUM_ARRAY **_delta_enum_array /* [out] [ref] */,
1283                                                    uint32_t _preferredmaximumlength /* [in]  */)
1284 {
1285         struct tevent_req *req;
1286         struct rpccli_netr_DatabaseDeltas_state *state;
1287         struct tevent_req *subreq;
1288
1289         req = tevent_req_create(mem_ctx, &state,
1290                                 struct rpccli_netr_DatabaseDeltas_state);
1291         if (req == NULL) {
1292                 return NULL;
1293         }
1294         state->out_mem_ctx = NULL;
1295         state->dispatch_recv = cli->dispatch_recv;
1296
1297         /* In parameters */
1298         state->orig.in.logon_server = _logon_server;
1299         state->orig.in.computername = _computername;
1300         state->orig.in.credential = _credential;
1301         state->orig.in.return_authenticator = _return_authenticator;
1302         state->orig.in.database_id = _database_id;
1303         state->orig.in.sequence_num = _sequence_num;
1304         state->orig.in.preferredmaximumlength = _preferredmaximumlength;
1305
1306         /* Out parameters */
1307         state->orig.out.return_authenticator = _return_authenticator;
1308         state->orig.out.sequence_num = _sequence_num;
1309         state->orig.out.delta_enum_array = _delta_enum_array;
1310
1311         /* Result */
1312         ZERO_STRUCT(state->orig.out.result);
1313
1314         if (DEBUGLEVEL >= 10) {
1315                 NDR_PRINT_IN_DEBUG(netr_DatabaseDeltas, &state->orig);
1316         }
1317
1318         state->out_mem_ctx = talloc_named_const(state, 0,
1319                              "rpccli_netr_DatabaseDeltas_out_memory");
1320         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1321                 return tevent_req_post(req, ev);
1322         }
1323
1324         /* make a temporary copy, that we pass to the dispatch function */
1325         state->tmp = state->orig;
1326
1327         subreq = cli->dispatch_send(state, ev, cli,
1328                                     &ndr_table_netlogon,
1329                                     NDR_NETR_DATABASEDELTAS,
1330                                     &state->tmp);
1331         if (tevent_req_nomem(subreq, req)) {
1332                 return tevent_req_post(req, ev);
1333         }
1334         tevent_req_set_callback(subreq, rpccli_netr_DatabaseDeltas_done, req);
1335         return req;
1336 }
1337
1338 static void rpccli_netr_DatabaseDeltas_done(struct tevent_req *subreq)
1339 {
1340         struct tevent_req *req = tevent_req_callback_data(
1341                 subreq, struct tevent_req);
1342         struct rpccli_netr_DatabaseDeltas_state *state = tevent_req_data(
1343                 req, struct rpccli_netr_DatabaseDeltas_state);
1344         NTSTATUS status;
1345         TALLOC_CTX *mem_ctx;
1346
1347         if (state->out_mem_ctx) {
1348                 mem_ctx = state->out_mem_ctx;
1349         } else {
1350                 mem_ctx = state;
1351         }
1352
1353         status = state->dispatch_recv(subreq, mem_ctx);
1354         TALLOC_FREE(subreq);
1355         if (!NT_STATUS_IS_OK(status)) {
1356                 tevent_req_nterror(req, status);
1357                 return;
1358         }
1359
1360         /* Copy out parameters */
1361         *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
1362         *state->orig.out.sequence_num = *state->tmp.out.sequence_num;
1363         *state->orig.out.delta_enum_array = *state->tmp.out.delta_enum_array;
1364
1365         /* Copy result */
1366         state->orig.out.result = state->tmp.out.result;
1367
1368         /* Reset temporary structure */
1369         ZERO_STRUCT(state->tmp);
1370
1371         if (DEBUGLEVEL >= 10) {
1372                 NDR_PRINT_OUT_DEBUG(netr_DatabaseDeltas, &state->orig);
1373         }
1374
1375         tevent_req_done(req);
1376 }
1377
1378 NTSTATUS rpccli_netr_DatabaseDeltas_recv(struct tevent_req *req,
1379                                          TALLOC_CTX *mem_ctx,
1380                                          NTSTATUS *result)
1381 {
1382         struct rpccli_netr_DatabaseDeltas_state *state = tevent_req_data(
1383                 req, struct rpccli_netr_DatabaseDeltas_state);
1384         NTSTATUS status;
1385
1386         if (tevent_req_is_nterror(req, &status)) {
1387                 tevent_req_received(req);
1388                 return status;
1389         }
1390
1391         /* Steal possbile out parameters to the callers context */
1392         talloc_steal(mem_ctx, state->out_mem_ctx);
1393
1394         /* Return result */
1395         *result = state->orig.out.result;
1396
1397         tevent_req_received(req);
1398         return NT_STATUS_OK;
1399 }
1400
1401 NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli,
1402                                     TALLOC_CTX *mem_ctx,
1403                                     const char *logon_server /* [in] [ref,charset(UTF16)] */,
1404                                     const char *computername /* [in] [ref,charset(UTF16)] */,
1405                                     struct netr_Authenticator *credential /* [in] [ref] */,
1406                                     struct netr_Authenticator *return_authenticator /* [in,out] [ref] */,
1407                                     enum netr_SamDatabaseID database_id /* [in]  */,
1408                                     uint64_t *sequence_num /* [in,out] [ref] */,
1409                                     struct netr_DELTA_ENUM_ARRAY **delta_enum_array /* [out] [ref] */,
1410                                     uint32_t preferredmaximumlength /* [in]  */)
1411 {
1412         struct netr_DatabaseDeltas r;
1413         NTSTATUS status;
1414
1415         /* In parameters */
1416         r.in.logon_server = logon_server;
1417         r.in.computername = computername;
1418         r.in.credential = credential;
1419         r.in.return_authenticator = return_authenticator;
1420         r.in.database_id = database_id;
1421         r.in.sequence_num = sequence_num;
1422         r.in.preferredmaximumlength = preferredmaximumlength;
1423
1424         if (DEBUGLEVEL >= 10) {
1425                 NDR_PRINT_IN_DEBUG(netr_DatabaseDeltas, &r);
1426         }
1427
1428         status = cli->dispatch(cli,
1429                                 mem_ctx,
1430                                 &ndr_table_netlogon,
1431                                 NDR_NETR_DATABASEDELTAS,
1432                                 &r);
1433
1434         if (!NT_STATUS_IS_OK(status)) {
1435                 return status;
1436         }
1437
1438         if (DEBUGLEVEL >= 10) {
1439                 NDR_PRINT_OUT_DEBUG(netr_DatabaseDeltas, &r);
1440         }
1441
1442         if (NT_STATUS_IS_ERR(status)) {
1443                 return status;
1444         }
1445
1446         /* Return variables */
1447         *return_authenticator = *r.out.return_authenticator;
1448         *sequence_num = *r.out.sequence_num;
1449         *delta_enum_array = *r.out.delta_enum_array;
1450
1451         /* Return result */
1452         return r.out.result;
1453 }
1454
1455 struct rpccli_netr_DatabaseSync_state {
1456         struct netr_DatabaseSync orig;
1457         struct netr_DatabaseSync tmp;
1458         TALLOC_CTX *out_mem_ctx;
1459         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1460 };
1461
1462 static void rpccli_netr_DatabaseSync_done(struct tevent_req *subreq);
1463
1464 struct tevent_req *rpccli_netr_DatabaseSync_send(TALLOC_CTX *mem_ctx,
1465                                                  struct tevent_context *ev,
1466                                                  struct rpc_pipe_client *cli,
1467                                                  const char *_logon_server /* [in] [ref,charset(UTF16)] */,
1468                                                  const char *_computername /* [in] [ref,charset(UTF16)] */,
1469                                                  struct netr_Authenticator *_credential /* [in] [ref] */,
1470                                                  struct netr_Authenticator *_return_authenticator /* [in,out] [ref] */,
1471                                                  enum netr_SamDatabaseID _database_id /* [in]  */,
1472                                                  uint32_t *_sync_context /* [in,out] [ref] */,
1473                                                  struct netr_DELTA_ENUM_ARRAY **_delta_enum_array /* [out] [ref] */,
1474                                                  uint32_t _preferredmaximumlength /* [in]  */)
1475 {
1476         struct tevent_req *req;
1477         struct rpccli_netr_DatabaseSync_state *state;
1478         struct tevent_req *subreq;
1479
1480         req = tevent_req_create(mem_ctx, &state,
1481                                 struct rpccli_netr_DatabaseSync_state);
1482         if (req == NULL) {
1483                 return NULL;
1484         }
1485         state->out_mem_ctx = NULL;
1486         state->dispatch_recv = cli->dispatch_recv;
1487
1488         /* In parameters */
1489         state->orig.in.logon_server = _logon_server;
1490         state->orig.in.computername = _computername;
1491         state->orig.in.credential = _credential;
1492         state->orig.in.return_authenticator = _return_authenticator;
1493         state->orig.in.database_id = _database_id;
1494         state->orig.in.sync_context = _sync_context;
1495         state->orig.in.preferredmaximumlength = _preferredmaximumlength;
1496
1497         /* Out parameters */
1498         state->orig.out.return_authenticator = _return_authenticator;
1499         state->orig.out.sync_context = _sync_context;
1500         state->orig.out.delta_enum_array = _delta_enum_array;
1501
1502         /* Result */
1503         ZERO_STRUCT(state->orig.out.result);
1504
1505         if (DEBUGLEVEL >= 10) {
1506                 NDR_PRINT_IN_DEBUG(netr_DatabaseSync, &state->orig);
1507         }
1508
1509         state->out_mem_ctx = talloc_named_const(state, 0,
1510                              "rpccli_netr_DatabaseSync_out_memory");
1511         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1512                 return tevent_req_post(req, ev);
1513         }
1514
1515         /* make a temporary copy, that we pass to the dispatch function */
1516         state->tmp = state->orig;
1517
1518         subreq = cli->dispatch_send(state, ev, cli,
1519                                     &ndr_table_netlogon,
1520                                     NDR_NETR_DATABASESYNC,
1521                                     &state->tmp);
1522         if (tevent_req_nomem(subreq, req)) {
1523                 return tevent_req_post(req, ev);
1524         }
1525         tevent_req_set_callback(subreq, rpccli_netr_DatabaseSync_done, req);
1526         return req;
1527 }
1528
1529 static void rpccli_netr_DatabaseSync_done(struct tevent_req *subreq)
1530 {
1531         struct tevent_req *req = tevent_req_callback_data(
1532                 subreq, struct tevent_req);
1533         struct rpccli_netr_DatabaseSync_state *state = tevent_req_data(
1534                 req, struct rpccli_netr_DatabaseSync_state);
1535         NTSTATUS status;
1536         TALLOC_CTX *mem_ctx;
1537
1538         if (state->out_mem_ctx) {
1539                 mem_ctx = state->out_mem_ctx;
1540         } else {
1541                 mem_ctx = state;
1542         }
1543
1544         status = state->dispatch_recv(subreq, mem_ctx);
1545         TALLOC_FREE(subreq);
1546         if (!NT_STATUS_IS_OK(status)) {
1547                 tevent_req_nterror(req, status);
1548                 return;
1549         }
1550
1551         /* Copy out parameters */
1552         *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
1553         *state->orig.out.sync_context = *state->tmp.out.sync_context;
1554         *state->orig.out.delta_enum_array = *state->tmp.out.delta_enum_array;
1555
1556         /* Copy result */
1557         state->orig.out.result = state->tmp.out.result;
1558
1559         /* Reset temporary structure */
1560         ZERO_STRUCT(state->tmp);
1561
1562         if (DEBUGLEVEL >= 10) {
1563                 NDR_PRINT_OUT_DEBUG(netr_DatabaseSync, &state->orig);
1564         }
1565
1566         tevent_req_done(req);
1567 }
1568
1569 NTSTATUS rpccli_netr_DatabaseSync_recv(struct tevent_req *req,
1570                                        TALLOC_CTX *mem_ctx,
1571                                        NTSTATUS *result)
1572 {
1573         struct rpccli_netr_DatabaseSync_state *state = tevent_req_data(
1574                 req, struct rpccli_netr_DatabaseSync_state);
1575         NTSTATUS status;
1576
1577         if (tevent_req_is_nterror(req, &status)) {
1578                 tevent_req_received(req);
1579                 return status;
1580         }
1581
1582         /* Steal possbile out parameters to the callers context */
1583         talloc_steal(mem_ctx, state->out_mem_ctx);
1584
1585         /* Return result */
1586         *result = state->orig.out.result;
1587
1588         tevent_req_received(req);
1589         return NT_STATUS_OK;
1590 }
1591
1592 NTSTATUS rpccli_netr_DatabaseSync(struct rpc_pipe_client *cli,
1593                                   TALLOC_CTX *mem_ctx,
1594                                   const char *logon_server /* [in] [ref,charset(UTF16)] */,
1595                                   const char *computername /* [in] [ref,charset(UTF16)] */,
1596                                   struct netr_Authenticator *credential /* [in] [ref] */,
1597                                   struct netr_Authenticator *return_authenticator /* [in,out] [ref] */,
1598                                   enum netr_SamDatabaseID database_id /* [in]  */,
1599                                   uint32_t *sync_context /* [in,out] [ref] */,
1600                                   struct netr_DELTA_ENUM_ARRAY **delta_enum_array /* [out] [ref] */,
1601                                   uint32_t preferredmaximumlength /* [in]  */)
1602 {
1603         struct netr_DatabaseSync r;
1604         NTSTATUS status;
1605
1606         /* In parameters */
1607         r.in.logon_server = logon_server;
1608         r.in.computername = computername;
1609         r.in.credential = credential;
1610         r.in.return_authenticator = return_authenticator;
1611         r.in.database_id = database_id;
1612         r.in.sync_context = sync_context;
1613         r.in.preferredmaximumlength = preferredmaximumlength;
1614
1615         if (DEBUGLEVEL >= 10) {
1616                 NDR_PRINT_IN_DEBUG(netr_DatabaseSync, &r);
1617         }
1618
1619         status = cli->dispatch(cli,
1620                                 mem_ctx,
1621                                 &ndr_table_netlogon,
1622                                 NDR_NETR_DATABASESYNC,
1623                                 &r);
1624
1625         if (!NT_STATUS_IS_OK(status)) {
1626                 return status;
1627         }
1628
1629         if (DEBUGLEVEL >= 10) {
1630                 NDR_PRINT_OUT_DEBUG(netr_DatabaseSync, &r);
1631         }
1632
1633         if (NT_STATUS_IS_ERR(status)) {
1634                 return status;
1635         }
1636
1637         /* Return variables */
1638         *return_authenticator = *r.out.return_authenticator;
1639         *sync_context = *r.out.sync_context;
1640         *delta_enum_array = *r.out.delta_enum_array;
1641
1642         /* Return result */
1643         return r.out.result;
1644 }
1645
1646 struct rpccli_netr_AccountDeltas_state {
1647         struct netr_AccountDeltas orig;
1648         struct netr_AccountDeltas tmp;
1649         TALLOC_CTX *out_mem_ctx;
1650         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1651 };
1652
1653 static void rpccli_netr_AccountDeltas_done(struct tevent_req *subreq);
1654
1655 struct tevent_req *rpccli_netr_AccountDeltas_send(TALLOC_CTX *mem_ctx,
1656                                                   struct tevent_context *ev,
1657                                                   struct rpc_pipe_client *cli,
1658                                                   const char *_logon_server /* [in] [unique,charset(UTF16)] */,
1659                                                   const char *_computername /* [in] [ref,charset(UTF16)] */,
1660                                                   struct netr_Authenticator _credential /* [in]  */,
1661                                                   struct netr_Authenticator *_return_authenticator /* [in,out] [ref] */,
1662                                                   struct netr_UAS_INFO_0 _uas /* [in]  */,
1663                                                   uint32_t _count /* [in]  */,
1664                                                   uint32_t _level /* [in]  */,
1665                                                   uint32_t _buffersize /* [in]  */,
1666                                                   struct netr_AccountBuffer *_buffer /* [out] [ref,subcontext(4)] */,
1667                                                   uint32_t *_count_returned /* [out] [ref] */,
1668                                                   uint32_t *_total_entries /* [out] [ref] */,
1669                                                   struct netr_UAS_INFO_0 *_recordid /* [out] [ref] */)
1670 {
1671         struct tevent_req *req;
1672         struct rpccli_netr_AccountDeltas_state *state;
1673         struct tevent_req *subreq;
1674
1675         req = tevent_req_create(mem_ctx, &state,
1676                                 struct rpccli_netr_AccountDeltas_state);
1677         if (req == NULL) {
1678                 return NULL;
1679         }
1680         state->out_mem_ctx = NULL;
1681         state->dispatch_recv = cli->dispatch_recv;
1682
1683         /* In parameters */
1684         state->orig.in.logon_server = _logon_server;
1685         state->orig.in.computername = _computername;
1686         state->orig.in.credential = _credential;
1687         state->orig.in.return_authenticator = _return_authenticator;
1688         state->orig.in.uas = _uas;
1689         state->orig.in.count = _count;
1690         state->orig.in.level = _level;
1691         state->orig.in.buffersize = _buffersize;
1692
1693         /* Out parameters */
1694         state->orig.out.return_authenticator = _return_authenticator;
1695         state->orig.out.buffer = _buffer;
1696         state->orig.out.count_returned = _count_returned;
1697         state->orig.out.total_entries = _total_entries;
1698         state->orig.out.recordid = _recordid;
1699
1700         /* Result */
1701         ZERO_STRUCT(state->orig.out.result);
1702
1703         if (DEBUGLEVEL >= 10) {
1704                 NDR_PRINT_IN_DEBUG(netr_AccountDeltas, &state->orig);
1705         }
1706
1707         state->out_mem_ctx = talloc_named_const(state, 0,
1708                              "rpccli_netr_AccountDeltas_out_memory");
1709         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1710                 return tevent_req_post(req, ev);
1711         }
1712
1713         /* make a temporary copy, that we pass to the dispatch function */
1714         state->tmp = state->orig;
1715
1716         subreq = cli->dispatch_send(state, ev, cli,
1717                                     &ndr_table_netlogon,
1718                                     NDR_NETR_ACCOUNTDELTAS,
1719                                     &state->tmp);
1720         if (tevent_req_nomem(subreq, req)) {
1721                 return tevent_req_post(req, ev);
1722         }
1723         tevent_req_set_callback(subreq, rpccli_netr_AccountDeltas_done, req);
1724         return req;
1725 }
1726
1727 static void rpccli_netr_AccountDeltas_done(struct tevent_req *subreq)
1728 {
1729         struct tevent_req *req = tevent_req_callback_data(
1730                 subreq, struct tevent_req);
1731         struct rpccli_netr_AccountDeltas_state *state = tevent_req_data(
1732                 req, struct rpccli_netr_AccountDeltas_state);
1733         NTSTATUS status;
1734         TALLOC_CTX *mem_ctx;
1735
1736         if (state->out_mem_ctx) {
1737                 mem_ctx = state->out_mem_ctx;
1738         } else {
1739                 mem_ctx = state;
1740         }
1741
1742         status = state->dispatch_recv(subreq, mem_ctx);
1743         TALLOC_FREE(subreq);
1744         if (!NT_STATUS_IS_OK(status)) {
1745                 tevent_req_nterror(req, status);
1746                 return;
1747         }
1748
1749         /* Copy out parameters */
1750         *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
1751         *state->orig.out.buffer = *state->tmp.out.buffer;
1752         *state->orig.out.count_returned = *state->tmp.out.count_returned;
1753         *state->orig.out.total_entries = *state->tmp.out.total_entries;
1754         *state->orig.out.recordid = *state->tmp.out.recordid;
1755
1756         /* Copy result */
1757         state->orig.out.result = state->tmp.out.result;
1758
1759         /* Reset temporary structure */
1760         ZERO_STRUCT(state->tmp);
1761
1762         if (DEBUGLEVEL >= 10) {
1763                 NDR_PRINT_OUT_DEBUG(netr_AccountDeltas, &state->orig);
1764         }
1765
1766         tevent_req_done(req);
1767 }
1768
1769 NTSTATUS rpccli_netr_AccountDeltas_recv(struct tevent_req *req,
1770                                         TALLOC_CTX *mem_ctx,
1771                                         NTSTATUS *result)
1772 {
1773         struct rpccli_netr_AccountDeltas_state *state = tevent_req_data(
1774                 req, struct rpccli_netr_AccountDeltas_state);
1775         NTSTATUS status;
1776
1777         if (tevent_req_is_nterror(req, &status)) {
1778                 tevent_req_received(req);
1779                 return status;
1780         }
1781
1782         /* Steal possbile out parameters to the callers context */
1783         talloc_steal(mem_ctx, state->out_mem_ctx);
1784
1785         /* Return result */
1786         *result = state->orig.out.result;
1787
1788         tevent_req_received(req);
1789         return NT_STATUS_OK;
1790 }
1791
1792 NTSTATUS rpccli_netr_AccountDeltas(struct rpc_pipe_client *cli,
1793                                    TALLOC_CTX *mem_ctx,
1794                                    const char *logon_server /* [in] [unique,charset(UTF16)] */,
1795                                    const char *computername /* [in] [ref,charset(UTF16)] */,
1796                                    struct netr_Authenticator credential /* [in]  */,
1797                                    struct netr_Authenticator *return_authenticator /* [in,out] [ref] */,
1798                                    struct netr_UAS_INFO_0 uas /* [in]  */,
1799                                    uint32_t count /* [in]  */,
1800                                    uint32_t level /* [in]  */,
1801                                    uint32_t buffersize /* [in]  */,
1802                                    struct netr_AccountBuffer *buffer /* [out] [ref,subcontext(4)] */,
1803                                    uint32_t *count_returned /* [out] [ref] */,
1804                                    uint32_t *total_entries /* [out] [ref] */,
1805                                    struct netr_UAS_INFO_0 *recordid /* [out] [ref] */)
1806 {
1807         struct netr_AccountDeltas r;
1808         NTSTATUS status;
1809
1810         /* In parameters */
1811         r.in.logon_server = logon_server;
1812         r.in.computername = computername;
1813         r.in.credential = credential;
1814         r.in.return_authenticator = return_authenticator;
1815         r.in.uas = uas;
1816         r.in.count = count;
1817         r.in.level = level;
1818         r.in.buffersize = buffersize;
1819
1820         if (DEBUGLEVEL >= 10) {
1821                 NDR_PRINT_IN_DEBUG(netr_AccountDeltas, &r);
1822         }
1823
1824         status = cli->dispatch(cli,
1825                                 mem_ctx,
1826                                 &ndr_table_netlogon,
1827                                 NDR_NETR_ACCOUNTDELTAS,
1828                                 &r);
1829
1830         if (!NT_STATUS_IS_OK(status)) {
1831                 return status;
1832         }
1833
1834         if (DEBUGLEVEL >= 10) {
1835                 NDR_PRINT_OUT_DEBUG(netr_AccountDeltas, &r);
1836         }
1837
1838         if (NT_STATUS_IS_ERR(status)) {
1839                 return status;
1840         }
1841
1842         /* Return variables */
1843         *return_authenticator = *r.out.return_authenticator;
1844         *buffer = *r.out.buffer;
1845         *count_returned = *r.out.count_returned;
1846         *total_entries = *r.out.total_entries;
1847         *recordid = *r.out.recordid;
1848
1849         /* Return result */
1850         return r.out.result;
1851 }
1852
1853 struct rpccli_netr_AccountSync_state {
1854         struct netr_AccountSync orig;
1855         struct netr_AccountSync tmp;
1856         TALLOC_CTX *out_mem_ctx;
1857         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1858 };
1859
1860 static void rpccli_netr_AccountSync_done(struct tevent_req *subreq);
1861
1862 struct tevent_req *rpccli_netr_AccountSync_send(TALLOC_CTX *mem_ctx,
1863                                                 struct tevent_context *ev,
1864                                                 struct rpc_pipe_client *cli,
1865                                                 const char *_logon_server /* [in] [unique,charset(UTF16)] */,
1866                                                 const char *_computername /* [in] [ref,charset(UTF16)] */,
1867                                                 struct netr_Authenticator _credential /* [in]  */,
1868                                                 struct netr_Authenticator *_return_authenticator /* [in,out] [ref] */,
1869                                                 uint32_t _reference /* [in]  */,
1870                                                 uint32_t _level /* [in]  */,
1871                                                 uint32_t _buffersize /* [in]  */,
1872                                                 struct netr_AccountBuffer *_buffer /* [out] [ref,subcontext(4)] */,
1873                                                 uint32_t *_count_returned /* [out] [ref] */,
1874                                                 uint32_t *_total_entries /* [out] [ref] */,
1875                                                 uint32_t *_next_reference /* [out] [ref] */,
1876                                                 struct netr_UAS_INFO_0 *_recordid /* [in,out] [ref] */)
1877 {
1878         struct tevent_req *req;
1879         struct rpccli_netr_AccountSync_state *state;
1880         struct tevent_req *subreq;
1881
1882         req = tevent_req_create(mem_ctx, &state,
1883                                 struct rpccli_netr_AccountSync_state);
1884         if (req == NULL) {
1885                 return NULL;
1886         }
1887         state->out_mem_ctx = NULL;
1888         state->dispatch_recv = cli->dispatch_recv;
1889
1890         /* In parameters */
1891         state->orig.in.logon_server = _logon_server;
1892         state->orig.in.computername = _computername;
1893         state->orig.in.credential = _credential;
1894         state->orig.in.return_authenticator = _return_authenticator;
1895         state->orig.in.reference = _reference;
1896         state->orig.in.level = _level;
1897         state->orig.in.buffersize = _buffersize;
1898         state->orig.in.recordid = _recordid;
1899
1900         /* Out parameters */
1901         state->orig.out.return_authenticator = _return_authenticator;
1902         state->orig.out.buffer = _buffer;
1903         state->orig.out.count_returned = _count_returned;
1904         state->orig.out.total_entries = _total_entries;
1905         state->orig.out.next_reference = _next_reference;
1906         state->orig.out.recordid = _recordid;
1907
1908         /* Result */
1909         ZERO_STRUCT(state->orig.out.result);
1910
1911         if (DEBUGLEVEL >= 10) {
1912                 NDR_PRINT_IN_DEBUG(netr_AccountSync, &state->orig);
1913         }
1914
1915         state->out_mem_ctx = talloc_named_const(state, 0,
1916                              "rpccli_netr_AccountSync_out_memory");
1917         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1918                 return tevent_req_post(req, ev);
1919         }
1920
1921         /* make a temporary copy, that we pass to the dispatch function */
1922         state->tmp = state->orig;
1923
1924         subreq = cli->dispatch_send(state, ev, cli,
1925                                     &ndr_table_netlogon,
1926                                     NDR_NETR_ACCOUNTSYNC,
1927                                     &state->tmp);
1928         if (tevent_req_nomem(subreq, req)) {
1929                 return tevent_req_post(req, ev);
1930         }
1931         tevent_req_set_callback(subreq, rpccli_netr_AccountSync_done, req);
1932         return req;
1933 }
1934
1935 static void rpccli_netr_AccountSync_done(struct tevent_req *subreq)
1936 {
1937         struct tevent_req *req = tevent_req_callback_data(
1938                 subreq, struct tevent_req);
1939         struct rpccli_netr_AccountSync_state *state = tevent_req_data(
1940                 req, struct rpccli_netr_AccountSync_state);
1941         NTSTATUS status;
1942         TALLOC_CTX *mem_ctx;
1943
1944         if (state->out_mem_ctx) {
1945                 mem_ctx = state->out_mem_ctx;
1946         } else {
1947                 mem_ctx = state;
1948         }
1949
1950         status = state->dispatch_recv(subreq, mem_ctx);
1951         TALLOC_FREE(subreq);
1952         if (!NT_STATUS_IS_OK(status)) {
1953                 tevent_req_nterror(req, status);
1954                 return;
1955         }
1956
1957         /* Copy out parameters */
1958         *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
1959         *state->orig.out.buffer = *state->tmp.out.buffer;
1960         *state->orig.out.count_returned = *state->tmp.out.count_returned;
1961         *state->orig.out.total_entries = *state->tmp.out.total_entries;
1962         *state->orig.out.next_reference = *state->tmp.out.next_reference;
1963         *state->orig.out.recordid = *state->tmp.out.recordid;
1964
1965         /* Copy result */
1966         state->orig.out.result = state->tmp.out.result;
1967
1968         /* Reset temporary structure */
1969         ZERO_STRUCT(state->tmp);
1970
1971         if (DEBUGLEVEL >= 10) {
1972                 NDR_PRINT_OUT_DEBUG(netr_AccountSync, &state->orig);
1973         }
1974
1975         tevent_req_done(req);
1976 }
1977
1978 NTSTATUS rpccli_netr_AccountSync_recv(struct tevent_req *req,
1979                                       TALLOC_CTX *mem_ctx,
1980                                       NTSTATUS *result)
1981 {
1982         struct rpccli_netr_AccountSync_state *state = tevent_req_data(
1983                 req, struct rpccli_netr_AccountSync_state);
1984         NTSTATUS status;
1985
1986         if (tevent_req_is_nterror(req, &status)) {
1987                 tevent_req_received(req);
1988                 return status;
1989         }
1990
1991         /* Steal possbile out parameters to the callers context */
1992         talloc_steal(mem_ctx, state->out_mem_ctx);
1993
1994         /* Return result */
1995         *result = state->orig.out.result;
1996
1997         tevent_req_received(req);
1998         return NT_STATUS_OK;
1999 }
2000
2001 NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli,
2002                                  TALLOC_CTX *mem_ctx,
2003                                  const char *logon_server /* [in] [unique,charset(UTF16)] */,
2004                                  const char *computername /* [in] [ref,charset(UTF16)] */,
2005                                  struct netr_Authenticator credential /* [in]  */,
2006                                  struct netr_Authenticator *return_authenticator /* [in,out] [ref] */,
2007                                  uint32_t reference /* [in]  */,
2008                                  uint32_t level /* [in]  */,
2009                                  uint32_t buffersize /* [in]  */,
2010                                  struct netr_AccountBuffer *buffer /* [out] [ref,subcontext(4)] */,
2011                                  uint32_t *count_returned /* [out] [ref] */,
2012                                  uint32_t *total_entries /* [out] [ref] */,
2013                                  uint32_t *next_reference /* [out] [ref] */,
2014                                  struct netr_UAS_INFO_0 *recordid /* [in,out] [ref] */)
2015 {
2016         struct netr_AccountSync r;
2017         NTSTATUS status;
2018
2019         /* In parameters */
2020         r.in.logon_server = logon_server;
2021         r.in.computername = computername;
2022         r.in.credential = credential;
2023         r.in.return_authenticator = return_authenticator;
2024         r.in.reference = reference;
2025         r.in.level = level;
2026         r.in.buffersize = buffersize;
2027         r.in.recordid = recordid;
2028
2029         if (DEBUGLEVEL >= 10) {
2030                 NDR_PRINT_IN_DEBUG(netr_AccountSync, &r);
2031         }
2032
2033         status = cli->dispatch(cli,
2034                                 mem_ctx,
2035                                 &ndr_table_netlogon,
2036                                 NDR_NETR_ACCOUNTSYNC,
2037                                 &r);
2038
2039         if (!NT_STATUS_IS_OK(status)) {
2040                 return status;
2041         }
2042
2043         if (DEBUGLEVEL >= 10) {
2044                 NDR_PRINT_OUT_DEBUG(netr_AccountSync, &r);
2045         }
2046
2047         if (NT_STATUS_IS_ERR(status)) {
2048                 return status;
2049         }
2050
2051         /* Return variables */
2052         *return_authenticator = *r.out.return_authenticator;
2053         *buffer = *r.out.buffer;
2054         *count_returned = *r.out.count_returned;
2055         *total_entries = *r.out.total_entries;
2056         *next_reference = *r.out.next_reference;
2057         *recordid = *r.out.recordid;
2058
2059         /* Return result */
2060         return r.out.result;
2061 }
2062
2063 struct rpccli_netr_GetDcName_state {
2064         struct netr_GetDcName orig;
2065         struct netr_GetDcName tmp;
2066         TALLOC_CTX *out_mem_ctx;
2067         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2068 };
2069
2070 static void rpccli_netr_GetDcName_done(struct tevent_req *subreq);
2071
2072 struct tevent_req *rpccli_netr_GetDcName_send(TALLOC_CTX *mem_ctx,
2073                                               struct tevent_context *ev,
2074                                               struct rpc_pipe_client *cli,
2075                                               const char *_logon_server /* [in] [ref,charset(UTF16)] */,
2076                                               const char *_domainname /* [in] [unique,charset(UTF16)] */,
2077                                               const char **_dcname /* [out] [ref,charset(UTF16)] */)
2078 {
2079         struct tevent_req *req;
2080         struct rpccli_netr_GetDcName_state *state;
2081         struct tevent_req *subreq;
2082
2083         req = tevent_req_create(mem_ctx, &state,
2084                                 struct rpccli_netr_GetDcName_state);
2085         if (req == NULL) {
2086                 return NULL;
2087         }
2088         state->out_mem_ctx = NULL;
2089         state->dispatch_recv = cli->dispatch_recv;
2090
2091         /* In parameters */
2092         state->orig.in.logon_server = _logon_server;
2093         state->orig.in.domainname = _domainname;
2094
2095         /* Out parameters */
2096         state->orig.out.dcname = _dcname;
2097
2098         /* Result */
2099         ZERO_STRUCT(state->orig.out.result);
2100
2101         if (DEBUGLEVEL >= 10) {
2102                 NDR_PRINT_IN_DEBUG(netr_GetDcName, &state->orig);
2103         }
2104
2105         state->out_mem_ctx = talloc_named_const(state, 0,
2106                              "rpccli_netr_GetDcName_out_memory");
2107         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2108                 return tevent_req_post(req, ev);
2109         }
2110
2111         /* make a temporary copy, that we pass to the dispatch function */
2112         state->tmp = state->orig;
2113
2114         subreq = cli->dispatch_send(state, ev, cli,
2115                                     &ndr_table_netlogon,
2116                                     NDR_NETR_GETDCNAME,
2117                                     &state->tmp);
2118         if (tevent_req_nomem(subreq, req)) {
2119                 return tevent_req_post(req, ev);
2120         }
2121         tevent_req_set_callback(subreq, rpccli_netr_GetDcName_done, req);
2122         return req;
2123 }
2124
2125 static void rpccli_netr_GetDcName_done(struct tevent_req *subreq)
2126 {
2127         struct tevent_req *req = tevent_req_callback_data(
2128                 subreq, struct tevent_req);
2129         struct rpccli_netr_GetDcName_state *state = tevent_req_data(
2130                 req, struct rpccli_netr_GetDcName_state);
2131         NTSTATUS status;
2132         TALLOC_CTX *mem_ctx;
2133
2134         if (state->out_mem_ctx) {
2135                 mem_ctx = state->out_mem_ctx;
2136         } else {
2137                 mem_ctx = state;
2138         }
2139
2140         status = state->dispatch_recv(subreq, mem_ctx);
2141         TALLOC_FREE(subreq);
2142         if (!NT_STATUS_IS_OK(status)) {
2143                 tevent_req_nterror(req, status);
2144                 return;
2145         }
2146
2147         /* Copy out parameters */
2148         *state->orig.out.dcname = *state->tmp.out.dcname;
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         if (DEBUGLEVEL >= 10) {
2157                 NDR_PRINT_OUT_DEBUG(netr_GetDcName, &state->orig);
2158         }
2159
2160         tevent_req_done(req);
2161 }
2162
2163 NTSTATUS rpccli_netr_GetDcName_recv(struct tevent_req *req,
2164                                     TALLOC_CTX *mem_ctx,
2165                                     WERROR *result)
2166 {
2167         struct rpccli_netr_GetDcName_state *state = tevent_req_data(
2168                 req, struct rpccli_netr_GetDcName_state);
2169         NTSTATUS status;
2170
2171         if (tevent_req_is_nterror(req, &status)) {
2172                 tevent_req_received(req);
2173                 return status;
2174         }
2175
2176         /* Steal possbile out parameters to the callers context */
2177         talloc_steal(mem_ctx, state->out_mem_ctx);
2178
2179         /* Return result */
2180         *result = state->orig.out.result;
2181
2182         tevent_req_received(req);
2183         return NT_STATUS_OK;
2184 }
2185
2186 NTSTATUS rpccli_netr_GetDcName(struct rpc_pipe_client *cli,
2187                                TALLOC_CTX *mem_ctx,
2188                                const char *logon_server /* [in] [ref,charset(UTF16)] */,
2189                                const char *domainname /* [in] [unique,charset(UTF16)] */,
2190                                const char **dcname /* [out] [ref,charset(UTF16)] */,
2191                                WERROR *werror)
2192 {
2193         struct netr_GetDcName r;
2194         NTSTATUS status;
2195
2196         /* In parameters */
2197         r.in.logon_server = logon_server;
2198         r.in.domainname = domainname;
2199
2200         if (DEBUGLEVEL >= 10) {
2201                 NDR_PRINT_IN_DEBUG(netr_GetDcName, &r);
2202         }
2203
2204         status = cli->dispatch(cli,
2205                                 mem_ctx,
2206                                 &ndr_table_netlogon,
2207                                 NDR_NETR_GETDCNAME,
2208                                 &r);
2209
2210         if (!NT_STATUS_IS_OK(status)) {
2211                 return status;
2212         }
2213
2214         if (DEBUGLEVEL >= 10) {
2215                 NDR_PRINT_OUT_DEBUG(netr_GetDcName, &r);
2216         }
2217
2218         if (NT_STATUS_IS_ERR(status)) {
2219                 return status;
2220         }
2221
2222         /* Return variables */
2223         *dcname = *r.out.dcname;
2224
2225         /* Return result */
2226         if (werror) {
2227                 *werror = r.out.result;
2228         }
2229
2230         return werror_to_ntstatus(r.out.result);
2231 }
2232
2233 struct rpccli_netr_LogonControl_state {
2234         struct netr_LogonControl orig;
2235         struct netr_LogonControl tmp;
2236         TALLOC_CTX *out_mem_ctx;
2237         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2238 };
2239
2240 static void rpccli_netr_LogonControl_done(struct tevent_req *subreq);
2241
2242 struct tevent_req *rpccli_netr_LogonControl_send(TALLOC_CTX *mem_ctx,
2243                                                  struct tevent_context *ev,
2244                                                  struct rpc_pipe_client *cli,
2245                                                  const char *_logon_server /* [in] [unique,charset(UTF16)] */,
2246                                                  enum netr_LogonControlCode _function_code /* [in]  */,
2247                                                  uint32_t _level /* [in]  */,
2248                                                  union netr_CONTROL_QUERY_INFORMATION *_query /* [out] [ref,switch_is(level)] */)
2249 {
2250         struct tevent_req *req;
2251         struct rpccli_netr_LogonControl_state *state;
2252         struct tevent_req *subreq;
2253
2254         req = tevent_req_create(mem_ctx, &state,
2255                                 struct rpccli_netr_LogonControl_state);
2256         if (req == NULL) {
2257                 return NULL;
2258         }
2259         state->out_mem_ctx = NULL;
2260         state->dispatch_recv = cli->dispatch_recv;
2261
2262         /* In parameters */
2263         state->orig.in.logon_server = _logon_server;
2264         state->orig.in.function_code = _function_code;
2265         state->orig.in.level = _level;
2266
2267         /* Out parameters */
2268         state->orig.out.query = _query;
2269
2270         /* Result */
2271         ZERO_STRUCT(state->orig.out.result);
2272
2273         if (DEBUGLEVEL >= 10) {
2274                 NDR_PRINT_IN_DEBUG(netr_LogonControl, &state->orig);
2275         }
2276
2277         state->out_mem_ctx = talloc_named_const(state, 0,
2278                              "rpccli_netr_LogonControl_out_memory");
2279         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2280                 return tevent_req_post(req, ev);
2281         }
2282
2283         /* make a temporary copy, that we pass to the dispatch function */
2284         state->tmp = state->orig;
2285
2286         subreq = cli->dispatch_send(state, ev, cli,
2287                                     &ndr_table_netlogon,
2288                                     NDR_NETR_LOGONCONTROL,
2289                                     &state->tmp);
2290         if (tevent_req_nomem(subreq, req)) {
2291                 return tevent_req_post(req, ev);
2292         }
2293         tevent_req_set_callback(subreq, rpccli_netr_LogonControl_done, req);
2294         return req;
2295 }
2296
2297 static void rpccli_netr_LogonControl_done(struct tevent_req *subreq)
2298 {
2299         struct tevent_req *req = tevent_req_callback_data(
2300                 subreq, struct tevent_req);
2301         struct rpccli_netr_LogonControl_state *state = tevent_req_data(
2302                 req, struct rpccli_netr_LogonControl_state);
2303         NTSTATUS status;
2304         TALLOC_CTX *mem_ctx;
2305
2306         if (state->out_mem_ctx) {
2307                 mem_ctx = state->out_mem_ctx;
2308         } else {
2309                 mem_ctx = state;
2310         }
2311
2312         status = state->dispatch_recv(subreq, mem_ctx);
2313         TALLOC_FREE(subreq);
2314         if (!NT_STATUS_IS_OK(status)) {
2315                 tevent_req_nterror(req, status);
2316                 return;
2317         }
2318
2319         /* Copy out parameters */
2320         *state->orig.out.query = *state->tmp.out.query;
2321
2322         /* Copy result */
2323         state->orig.out.result = state->tmp.out.result;
2324
2325         /* Reset temporary structure */
2326         ZERO_STRUCT(state->tmp);
2327
2328         if (DEBUGLEVEL >= 10) {
2329                 NDR_PRINT_OUT_DEBUG(netr_LogonControl, &state->orig);
2330         }
2331
2332         tevent_req_done(req);
2333 }
2334
2335 NTSTATUS rpccli_netr_LogonControl_recv(struct tevent_req *req,
2336                                        TALLOC_CTX *mem_ctx,
2337                                        WERROR *result)
2338 {
2339         struct rpccli_netr_LogonControl_state *state = tevent_req_data(
2340                 req, struct rpccli_netr_LogonControl_state);
2341         NTSTATUS status;
2342
2343         if (tevent_req_is_nterror(req, &status)) {
2344                 tevent_req_received(req);
2345                 return status;
2346         }
2347
2348         /* Steal possbile out parameters to the callers context */
2349         talloc_steal(mem_ctx, state->out_mem_ctx);
2350
2351         /* Return result */
2352         *result = state->orig.out.result;
2353
2354         tevent_req_received(req);
2355         return NT_STATUS_OK;
2356 }
2357
2358 NTSTATUS rpccli_netr_LogonControl(struct rpc_pipe_client *cli,
2359                                   TALLOC_CTX *mem_ctx,
2360                                   const char *logon_server /* [in] [unique,charset(UTF16)] */,
2361                                   enum netr_LogonControlCode function_code /* [in]  */,
2362                                   uint32_t level /* [in]  */,
2363                                   union netr_CONTROL_QUERY_INFORMATION *query /* [out] [ref,switch_is(level)] */,
2364                                   WERROR *werror)
2365 {
2366         struct netr_LogonControl r;
2367         NTSTATUS status;
2368
2369         /* In parameters */
2370         r.in.logon_server = logon_server;
2371         r.in.function_code = function_code;
2372         r.in.level = level;
2373
2374         if (DEBUGLEVEL >= 10) {
2375                 NDR_PRINT_IN_DEBUG(netr_LogonControl, &r);
2376         }
2377
2378         status = cli->dispatch(cli,
2379                                 mem_ctx,
2380                                 &ndr_table_netlogon,
2381                                 NDR_NETR_LOGONCONTROL,
2382                                 &r);
2383
2384         if (!NT_STATUS_IS_OK(status)) {
2385                 return status;
2386         }
2387
2388         if (DEBUGLEVEL >= 10) {
2389                 NDR_PRINT_OUT_DEBUG(netr_LogonControl, &r);
2390         }
2391
2392         if (NT_STATUS_IS_ERR(status)) {
2393                 return status;
2394         }
2395
2396         /* Return variables */
2397         *query = *r.out.query;
2398
2399         /* Return result */
2400         if (werror) {
2401                 *werror = r.out.result;
2402         }
2403
2404         return werror_to_ntstatus(r.out.result);
2405 }
2406
2407 struct rpccli_netr_GetAnyDCName_state {
2408         struct netr_GetAnyDCName orig;
2409         struct netr_GetAnyDCName tmp;
2410         TALLOC_CTX *out_mem_ctx;
2411         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2412 };
2413
2414 static void rpccli_netr_GetAnyDCName_done(struct tevent_req *subreq);
2415
2416 struct tevent_req *rpccli_netr_GetAnyDCName_send(TALLOC_CTX *mem_ctx,
2417                                                  struct tevent_context *ev,
2418                                                  struct rpc_pipe_client *cli,
2419                                                  const char *_logon_server /* [in] [unique,charset(UTF16)] */,
2420                                                  const char *_domainname /* [in] [unique,charset(UTF16)] */,
2421                                                  const char **_dcname /* [out] [ref,charset(UTF16)] */)
2422 {
2423         struct tevent_req *req;
2424         struct rpccli_netr_GetAnyDCName_state *state;
2425         struct tevent_req *subreq;
2426
2427         req = tevent_req_create(mem_ctx, &state,
2428                                 struct rpccli_netr_GetAnyDCName_state);
2429         if (req == NULL) {
2430                 return NULL;
2431         }
2432         state->out_mem_ctx = NULL;
2433         state->dispatch_recv = cli->dispatch_recv;
2434
2435         /* In parameters */
2436         state->orig.in.logon_server = _logon_server;
2437         state->orig.in.domainname = _domainname;
2438
2439         /* Out parameters */
2440         state->orig.out.dcname = _dcname;
2441
2442         /* Result */
2443         ZERO_STRUCT(state->orig.out.result);
2444
2445         if (DEBUGLEVEL >= 10) {
2446                 NDR_PRINT_IN_DEBUG(netr_GetAnyDCName, &state->orig);
2447         }
2448
2449         state->out_mem_ctx = talloc_named_const(state, 0,
2450                              "rpccli_netr_GetAnyDCName_out_memory");
2451         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2452                 return tevent_req_post(req, ev);
2453         }
2454
2455         /* make a temporary copy, that we pass to the dispatch function */
2456         state->tmp = state->orig;
2457
2458         subreq = cli->dispatch_send(state, ev, cli,
2459                                     &ndr_table_netlogon,
2460                                     NDR_NETR_GETANYDCNAME,
2461                                     &state->tmp);
2462         if (tevent_req_nomem(subreq, req)) {
2463                 return tevent_req_post(req, ev);
2464         }
2465         tevent_req_set_callback(subreq, rpccli_netr_GetAnyDCName_done, req);
2466         return req;
2467 }
2468
2469 static void rpccli_netr_GetAnyDCName_done(struct tevent_req *subreq)
2470 {
2471         struct tevent_req *req = tevent_req_callback_data(
2472                 subreq, struct tevent_req);
2473         struct rpccli_netr_GetAnyDCName_state *state = tevent_req_data(
2474                 req, struct rpccli_netr_GetAnyDCName_state);
2475         NTSTATUS status;
2476         TALLOC_CTX *mem_ctx;
2477
2478         if (state->out_mem_ctx) {
2479                 mem_ctx = state->out_mem_ctx;
2480         } else {
2481                 mem_ctx = state;
2482         }
2483
2484         status = state->dispatch_recv(subreq, mem_ctx);
2485         TALLOC_FREE(subreq);
2486         if (!NT_STATUS_IS_OK(status)) {
2487                 tevent_req_nterror(req, status);
2488                 return;
2489         }
2490
2491         /* Copy out parameters */
2492         *state->orig.out.dcname = *state->tmp.out.dcname;
2493
2494         /* Copy result */
2495         state->orig.out.result = state->tmp.out.result;
2496
2497         /* Reset temporary structure */
2498         ZERO_STRUCT(state->tmp);
2499
2500         if (DEBUGLEVEL >= 10) {
2501                 NDR_PRINT_OUT_DEBUG(netr_GetAnyDCName, &state->orig);
2502         }
2503
2504         tevent_req_done(req);
2505 }
2506
2507 NTSTATUS rpccli_netr_GetAnyDCName_recv(struct tevent_req *req,
2508                                        TALLOC_CTX *mem_ctx,
2509                                        WERROR *result)
2510 {
2511         struct rpccli_netr_GetAnyDCName_state *state = tevent_req_data(
2512                 req, struct rpccli_netr_GetAnyDCName_state);
2513         NTSTATUS status;
2514
2515         if (tevent_req_is_nterror(req, &status)) {
2516                 tevent_req_received(req);
2517                 return status;
2518         }
2519
2520         /* Steal possbile out parameters to the callers context */
2521         talloc_steal(mem_ctx, state->out_mem_ctx);
2522
2523         /* Return result */
2524         *result = state->orig.out.result;
2525
2526         tevent_req_received(req);
2527         return NT_STATUS_OK;
2528 }
2529
2530 NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli,
2531                                   TALLOC_CTX *mem_ctx,
2532                                   const char *logon_server /* [in] [unique,charset(UTF16)] */,
2533                                   const char *domainname /* [in] [unique,charset(UTF16)] */,
2534                                   const char **dcname /* [out] [ref,charset(UTF16)] */,
2535                                   WERROR *werror)
2536 {
2537         struct netr_GetAnyDCName r;
2538         NTSTATUS status;
2539
2540         /* In parameters */
2541         r.in.logon_server = logon_server;
2542         r.in.domainname = domainname;
2543
2544         if (DEBUGLEVEL >= 10) {
2545                 NDR_PRINT_IN_DEBUG(netr_GetAnyDCName, &r);
2546         }
2547
2548         status = cli->dispatch(cli,
2549                                 mem_ctx,
2550                                 &ndr_table_netlogon,
2551                                 NDR_NETR_GETANYDCNAME,
2552                                 &r);
2553
2554         if (!NT_STATUS_IS_OK(status)) {
2555                 return status;
2556         }
2557
2558         if (DEBUGLEVEL >= 10) {
2559                 NDR_PRINT_OUT_DEBUG(netr_GetAnyDCName, &r);
2560         }
2561
2562         if (NT_STATUS_IS_ERR(status)) {
2563                 return status;
2564         }
2565
2566         /* Return variables */
2567         *dcname = *r.out.dcname;
2568
2569         /* Return result */
2570         if (werror) {
2571                 *werror = r.out.result;
2572         }
2573
2574         return werror_to_ntstatus(r.out.result);
2575 }
2576
2577 struct rpccli_netr_LogonControl2_state {
2578         struct netr_LogonControl2 orig;
2579         struct netr_LogonControl2 tmp;
2580         TALLOC_CTX *out_mem_ctx;
2581         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2582 };
2583
2584 static void rpccli_netr_LogonControl2_done(struct tevent_req *subreq);
2585
2586 struct tevent_req *rpccli_netr_LogonControl2_send(TALLOC_CTX *mem_ctx,
2587                                                   struct tevent_context *ev,
2588                                                   struct rpc_pipe_client *cli,
2589                                                   const char *_logon_server /* [in] [unique,charset(UTF16)] */,
2590                                                   enum netr_LogonControlCode _function_code /* [in]  */,
2591                                                   uint32_t _level /* [in]  */,
2592                                                   union netr_CONTROL_DATA_INFORMATION *_data /* [in] [ref,switch_is(function_code)] */,
2593                                                   union netr_CONTROL_QUERY_INFORMATION *_query /* [out] [ref,switch_is(level)] */)
2594 {
2595         struct tevent_req *req;
2596         struct rpccli_netr_LogonControl2_state *state;
2597         struct tevent_req *subreq;
2598
2599         req = tevent_req_create(mem_ctx, &state,
2600                                 struct rpccli_netr_LogonControl2_state);
2601         if (req == NULL) {
2602                 return NULL;
2603         }
2604         state->out_mem_ctx = NULL;
2605         state->dispatch_recv = cli->dispatch_recv;
2606
2607         /* In parameters */
2608         state->orig.in.logon_server = _logon_server;
2609         state->orig.in.function_code = _function_code;
2610         state->orig.in.level = _level;
2611         state->orig.in.data = _data;
2612
2613         /* Out parameters */
2614         state->orig.out.query = _query;
2615
2616         /* Result */
2617         ZERO_STRUCT(state->orig.out.result);
2618
2619         if (DEBUGLEVEL >= 10) {
2620                 NDR_PRINT_IN_DEBUG(netr_LogonControl2, &state->orig);
2621         }
2622
2623         state->out_mem_ctx = talloc_named_const(state, 0,
2624                              "rpccli_netr_LogonControl2_out_memory");
2625         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2626                 return tevent_req_post(req, ev);
2627         }
2628
2629         /* make a temporary copy, that we pass to the dispatch function */
2630         state->tmp = state->orig;
2631
2632         subreq = cli->dispatch_send(state, ev, cli,
2633                                     &ndr_table_netlogon,
2634                                     NDR_NETR_LOGONCONTROL2,
2635                                     &state->tmp);
2636         if (tevent_req_nomem(subreq, req)) {
2637                 return tevent_req_post(req, ev);
2638         }
2639         tevent_req_set_callback(subreq, rpccli_netr_LogonControl2_done, req);
2640         return req;
2641 }
2642
2643 static void rpccli_netr_LogonControl2_done(struct tevent_req *subreq)
2644 {
2645         struct tevent_req *req = tevent_req_callback_data(
2646                 subreq, struct tevent_req);
2647         struct rpccli_netr_LogonControl2_state *state = tevent_req_data(
2648                 req, struct rpccli_netr_LogonControl2_state);
2649         NTSTATUS status;
2650         TALLOC_CTX *mem_ctx;
2651
2652         if (state->out_mem_ctx) {
2653                 mem_ctx = state->out_mem_ctx;
2654         } else {
2655                 mem_ctx = state;
2656         }
2657
2658         status = state->dispatch_recv(subreq, mem_ctx);
2659         TALLOC_FREE(subreq);
2660         if (!NT_STATUS_IS_OK(status)) {
2661                 tevent_req_nterror(req, status);
2662                 return;
2663         }
2664
2665         /* Copy out parameters */
2666         *state->orig.out.query = *state->tmp.out.query;
2667
2668         /* Copy result */
2669         state->orig.out.result = state->tmp.out.result;
2670
2671         /* Reset temporary structure */
2672         ZERO_STRUCT(state->tmp);
2673
2674         if (DEBUGLEVEL >= 10) {
2675                 NDR_PRINT_OUT_DEBUG(netr_LogonControl2, &state->orig);
2676         }
2677
2678         tevent_req_done(req);
2679 }
2680
2681 NTSTATUS rpccli_netr_LogonControl2_recv(struct tevent_req *req,
2682                                         TALLOC_CTX *mem_ctx,
2683                                         WERROR *result)
2684 {
2685         struct rpccli_netr_LogonControl2_state *state = tevent_req_data(
2686                 req, struct rpccli_netr_LogonControl2_state);
2687         NTSTATUS status;
2688
2689         if (tevent_req_is_nterror(req, &status)) {
2690                 tevent_req_received(req);
2691                 return status;
2692         }
2693
2694         /* Steal possbile out parameters to the callers context */
2695         talloc_steal(mem_ctx, state->out_mem_ctx);
2696
2697         /* Return result */
2698         *result = state->orig.out.result;
2699
2700         tevent_req_received(req);
2701         return NT_STATUS_OK;
2702 }
2703
2704 NTSTATUS rpccli_netr_LogonControl2(struct rpc_pipe_client *cli,
2705                                    TALLOC_CTX *mem_ctx,
2706                                    const char *logon_server /* [in] [unique,charset(UTF16)] */,
2707                                    enum netr_LogonControlCode function_code /* [in]  */,
2708                                    uint32_t level /* [in]  */,
2709                                    union netr_CONTROL_DATA_INFORMATION *data /* [in] [ref,switch_is(function_code)] */,
2710                                    union netr_CONTROL_QUERY_INFORMATION *query /* [out] [ref,switch_is(level)] */,
2711                                    WERROR *werror)
2712 {
2713         struct netr_LogonControl2 r;
2714         NTSTATUS status;
2715
2716         /* In parameters */
2717         r.in.logon_server = logon_server;
2718         r.in.function_code = function_code;
2719         r.in.level = level;
2720         r.in.data = data;
2721
2722         if (DEBUGLEVEL >= 10) {
2723                 NDR_PRINT_IN_DEBUG(netr_LogonControl2, &r);
2724         }
2725
2726         status = cli->dispatch(cli,
2727                                 mem_ctx,
2728                                 &ndr_table_netlogon,
2729                                 NDR_NETR_LOGONCONTROL2,
2730                                 &r);
2731
2732         if (!NT_STATUS_IS_OK(status)) {
2733                 return status;
2734         }
2735
2736         if (DEBUGLEVEL >= 10) {
2737                 NDR_PRINT_OUT_DEBUG(netr_LogonControl2, &r);
2738         }
2739
2740         if (NT_STATUS_IS_ERR(status)) {
2741                 return status;
2742         }
2743
2744         /* Return variables */
2745         *query = *r.out.query;
2746
2747         /* Return result */
2748         if (werror) {
2749                 *werror = r.out.result;
2750         }
2751
2752         return werror_to_ntstatus(r.out.result);
2753 }
2754
2755 struct rpccli_netr_ServerAuthenticate2_state {
2756         struct netr_ServerAuthenticate2 orig;
2757         struct netr_ServerAuthenticate2 tmp;
2758         TALLOC_CTX *out_mem_ctx;
2759         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2760 };
2761
2762 static void rpccli_netr_ServerAuthenticate2_done(struct tevent_req *subreq);
2763
2764 struct tevent_req *rpccli_netr_ServerAuthenticate2_send(TALLOC_CTX *mem_ctx,
2765                                                         struct tevent_context *ev,
2766                                                         struct rpc_pipe_client *cli,
2767                                                         const char *_server_name /* [in] [unique,charset(UTF16)] */,
2768                                                         const char *_account_name /* [in] [ref,charset(UTF16)] */,
2769                                                         enum netr_SchannelType _secure_channel_type /* [in]  */,
2770                                                         const char *_computer_name /* [in] [ref,charset(UTF16)] */,
2771                                                         struct netr_Credential *_credentials /* [in] [ref] */,
2772                                                         struct netr_Credential *_return_credentials /* [out] [ref] */,
2773                                                         uint32_t *_negotiate_flags /* [in,out] [ref] */)
2774 {
2775         struct tevent_req *req;
2776         struct rpccli_netr_ServerAuthenticate2_state *state;
2777         struct tevent_req *subreq;
2778
2779         req = tevent_req_create(mem_ctx, &state,
2780                                 struct rpccli_netr_ServerAuthenticate2_state);
2781         if (req == NULL) {
2782                 return NULL;
2783         }
2784         state->out_mem_ctx = NULL;
2785         state->dispatch_recv = cli->dispatch_recv;
2786
2787         /* In parameters */
2788         state->orig.in.server_name = _server_name;
2789         state->orig.in.account_name = _account_name;
2790         state->orig.in.secure_channel_type = _secure_channel_type;
2791         state->orig.in.computer_name = _computer_name;
2792         state->orig.in.credentials = _credentials;
2793         state->orig.in.negotiate_flags = _negotiate_flags;
2794
2795         /* Out parameters */
2796         state->orig.out.return_credentials = _return_credentials;
2797         state->orig.out.negotiate_flags = _negotiate_flags;
2798
2799         /* Result */
2800         ZERO_STRUCT(state->orig.out.result);
2801
2802         if (DEBUGLEVEL >= 10) {
2803                 NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate2, &state->orig);
2804         }
2805
2806         state->out_mem_ctx = talloc_named_const(state, 0,
2807                              "rpccli_netr_ServerAuthenticate2_out_memory");
2808         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2809                 return tevent_req_post(req, ev);
2810         }
2811
2812         /* make a temporary copy, that we pass to the dispatch function */
2813         state->tmp = state->orig;
2814
2815         subreq = cli->dispatch_send(state, ev, cli,
2816                                     &ndr_table_netlogon,
2817                                     NDR_NETR_SERVERAUTHENTICATE2,
2818                                     &state->tmp);
2819         if (tevent_req_nomem(subreq, req)) {
2820                 return tevent_req_post(req, ev);
2821         }
2822         tevent_req_set_callback(subreq, rpccli_netr_ServerAuthenticate2_done, req);
2823         return req;
2824 }
2825
2826 static void rpccli_netr_ServerAuthenticate2_done(struct tevent_req *subreq)
2827 {
2828         struct tevent_req *req = tevent_req_callback_data(
2829                 subreq, struct tevent_req);
2830         struct rpccli_netr_ServerAuthenticate2_state *state = tevent_req_data(
2831                 req, struct rpccli_netr_ServerAuthenticate2_state);
2832         NTSTATUS status;
2833         TALLOC_CTX *mem_ctx;
2834
2835         if (state->out_mem_ctx) {
2836                 mem_ctx = state->out_mem_ctx;
2837         } else {
2838                 mem_ctx = state;
2839         }
2840
2841         status = state->dispatch_recv(subreq, mem_ctx);
2842         TALLOC_FREE(subreq);
2843         if (!NT_STATUS_IS_OK(status)) {
2844                 tevent_req_nterror(req, status);
2845                 return;
2846         }
2847
2848         /* Copy out parameters */
2849         *state->orig.out.return_credentials = *state->tmp.out.return_credentials;
2850         *state->orig.out.negotiate_flags = *state->tmp.out.negotiate_flags;
2851
2852         /* Copy result */
2853         state->orig.out.result = state->tmp.out.result;
2854
2855         /* Reset temporary structure */
2856         ZERO_STRUCT(state->tmp);
2857
2858         if (DEBUGLEVEL >= 10) {
2859                 NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate2, &state->orig);
2860         }
2861
2862         tevent_req_done(req);
2863 }
2864
2865 NTSTATUS rpccli_netr_ServerAuthenticate2_recv(struct tevent_req *req,
2866                                               TALLOC_CTX *mem_ctx,
2867                                               NTSTATUS *result)
2868 {
2869         struct rpccli_netr_ServerAuthenticate2_state *state = tevent_req_data(
2870                 req, struct rpccli_netr_ServerAuthenticate2_state);
2871         NTSTATUS status;
2872
2873         if (tevent_req_is_nterror(req, &status)) {
2874                 tevent_req_received(req);
2875                 return status;
2876         }
2877
2878         /* Steal possbile out parameters to the callers context */
2879         talloc_steal(mem_ctx, state->out_mem_ctx);
2880
2881         /* Return result */
2882         *result = state->orig.out.result;
2883
2884         tevent_req_received(req);
2885         return NT_STATUS_OK;
2886 }
2887
2888 NTSTATUS rpccli_netr_ServerAuthenticate2(struct rpc_pipe_client *cli,
2889                                          TALLOC_CTX *mem_ctx,
2890                                          const char *server_name /* [in] [unique,charset(UTF16)] */,
2891                                          const char *account_name /* [in] [ref,charset(UTF16)] */,
2892                                          enum netr_SchannelType secure_channel_type /* [in]  */,
2893                                          const char *computer_name /* [in] [ref,charset(UTF16)] */,
2894                                          struct netr_Credential *credentials /* [in] [ref] */,
2895                                          struct netr_Credential *return_credentials /* [out] [ref] */,
2896                                          uint32_t *negotiate_flags /* [in,out] [ref] */)
2897 {
2898         struct netr_ServerAuthenticate2 r;
2899         NTSTATUS status;
2900
2901         /* In parameters */
2902         r.in.server_name = server_name;
2903         r.in.account_name = account_name;
2904         r.in.secure_channel_type = secure_channel_type;
2905         r.in.computer_name = computer_name;
2906         r.in.credentials = credentials;
2907         r.in.negotiate_flags = negotiate_flags;
2908
2909         if (DEBUGLEVEL >= 10) {
2910                 NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate2, &r);
2911         }
2912
2913         status = cli->dispatch(cli,
2914                                 mem_ctx,
2915                                 &ndr_table_netlogon,
2916                                 NDR_NETR_SERVERAUTHENTICATE2,
2917                                 &r);
2918
2919         if (!NT_STATUS_IS_OK(status)) {
2920                 return status;
2921         }
2922
2923         if (DEBUGLEVEL >= 10) {
2924                 NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate2, &r);
2925         }
2926
2927         if (NT_STATUS_IS_ERR(status)) {
2928                 return status;
2929         }
2930
2931         /* Return variables */
2932         *return_credentials = *r.out.return_credentials;
2933         *negotiate_flags = *r.out.negotiate_flags;
2934
2935         /* Return result */
2936         return r.out.result;
2937 }
2938
2939 struct rpccli_netr_DatabaseSync2_state {
2940         struct netr_DatabaseSync2 orig;
2941         struct netr_DatabaseSync2 tmp;
2942         TALLOC_CTX *out_mem_ctx;
2943         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2944 };
2945
2946 static void rpccli_netr_DatabaseSync2_done(struct tevent_req *subreq);
2947
2948 struct tevent_req *rpccli_netr_DatabaseSync2_send(TALLOC_CTX *mem_ctx,
2949                                                   struct tevent_context *ev,
2950                                                   struct rpc_pipe_client *cli,
2951                                                   const char *_logon_server /* [in] [ref,charset(UTF16)] */,
2952                                                   const char *_computername /* [in] [ref,charset(UTF16)] */,
2953                                                   struct netr_Authenticator *_credential /* [in] [ref] */,
2954                                                   struct netr_Authenticator *_return_authenticator /* [in,out] [ref] */,
2955                                                   enum netr_SamDatabaseID _database_id /* [in]  */,
2956                                                   enum SyncStateEnum _restart_state /* [in]  */,
2957                                                   uint32_t *_sync_context /* [in,out] [ref] */,
2958                                                   struct netr_DELTA_ENUM_ARRAY **_delta_enum_array /* [out] [ref] */,
2959                                                   uint32_t _preferredmaximumlength /* [in]  */)
2960 {
2961         struct tevent_req *req;
2962         struct rpccli_netr_DatabaseSync2_state *state;
2963         struct tevent_req *subreq;
2964
2965         req = tevent_req_create(mem_ctx, &state,
2966                                 struct rpccli_netr_DatabaseSync2_state);
2967         if (req == NULL) {
2968                 return NULL;
2969         }
2970         state->out_mem_ctx = NULL;
2971         state->dispatch_recv = cli->dispatch_recv;
2972
2973         /* In parameters */
2974         state->orig.in.logon_server = _logon_server;
2975         state->orig.in.computername = _computername;
2976         state->orig.in.credential = _credential;
2977         state->orig.in.return_authenticator = _return_authenticator;
2978         state->orig.in.database_id = _database_id;
2979         state->orig.in.restart_state = _restart_state;
2980         state->orig.in.sync_context = _sync_context;
2981         state->orig.in.preferredmaximumlength = _preferredmaximumlength;
2982
2983         /* Out parameters */
2984         state->orig.out.return_authenticator = _return_authenticator;
2985         state->orig.out.sync_context = _sync_context;
2986         state->orig.out.delta_enum_array = _delta_enum_array;
2987
2988         /* Result */
2989         ZERO_STRUCT(state->orig.out.result);
2990
2991         if (DEBUGLEVEL >= 10) {
2992                 NDR_PRINT_IN_DEBUG(netr_DatabaseSync2, &state->orig);
2993         }
2994
2995         state->out_mem_ctx = talloc_named_const(state, 0,
2996                              "rpccli_netr_DatabaseSync2_out_memory");
2997         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2998                 return tevent_req_post(req, ev);
2999         }
3000
3001         /* make a temporary copy, that we pass to the dispatch function */
3002         state->tmp = state->orig;
3003
3004         subreq = cli->dispatch_send(state, ev, cli,
3005                                     &ndr_table_netlogon,
3006                                     NDR_NETR_DATABASESYNC2,
3007                                     &state->tmp);
3008         if (tevent_req_nomem(subreq, req)) {
3009                 return tevent_req_post(req, ev);
3010         }
3011         tevent_req_set_callback(subreq, rpccli_netr_DatabaseSync2_done, req);
3012         return req;
3013 }
3014
3015 static void rpccli_netr_DatabaseSync2_done(struct tevent_req *subreq)
3016 {
3017         struct tevent_req *req = tevent_req_callback_data(
3018                 subreq, struct tevent_req);
3019         struct rpccli_netr_DatabaseSync2_state *state = tevent_req_data(
3020                 req, struct rpccli_netr_DatabaseSync2_state);
3021         NTSTATUS status;
3022         TALLOC_CTX *mem_ctx;
3023
3024         if (state->out_mem_ctx) {
3025                 mem_ctx = state->out_mem_ctx;
3026         } else {
3027                 mem_ctx = state;
3028         }
3029
3030         status = state->dispatch_recv(subreq, mem_ctx);
3031         TALLOC_FREE(subreq);
3032         if (!NT_STATUS_IS_OK(status)) {
3033                 tevent_req_nterror(req, status);
3034                 return;
3035         }
3036
3037         /* Copy out parameters */
3038         *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
3039         *state->orig.out.sync_context = *state->tmp.out.sync_context;
3040         *state->orig.out.delta_enum_array = *state->tmp.out.delta_enum_array;
3041
3042         /* Copy result */
3043         state->orig.out.result = state->tmp.out.result;
3044
3045         /* Reset temporary structure */
3046         ZERO_STRUCT(state->tmp);
3047
3048         if (DEBUGLEVEL >= 10) {
3049                 NDR_PRINT_OUT_DEBUG(netr_DatabaseSync2, &state->orig);
3050         }
3051
3052         tevent_req_done(req);
3053 }
3054
3055 NTSTATUS rpccli_netr_DatabaseSync2_recv(struct tevent_req *req,
3056                                         TALLOC_CTX *mem_ctx,
3057                                         NTSTATUS *result)
3058 {
3059         struct rpccli_netr_DatabaseSync2_state *state = tevent_req_data(
3060                 req, struct rpccli_netr_DatabaseSync2_state);
3061         NTSTATUS status;
3062
3063         if (tevent_req_is_nterror(req, &status)) {
3064                 tevent_req_received(req);
3065                 return status;
3066         }
3067
3068         /* Steal possbile out parameters to the callers context */
3069         talloc_steal(mem_ctx, state->out_mem_ctx);
3070
3071         /* Return result */
3072         *result = state->orig.out.result;
3073
3074         tevent_req_received(req);
3075         return NT_STATUS_OK;
3076 }
3077
3078 NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli,
3079                                    TALLOC_CTX *mem_ctx,
3080                                    const char *logon_server /* [in] [ref,charset(UTF16)] */,
3081                                    const char *computername /* [in] [ref,charset(UTF16)] */,
3082                                    struct netr_Authenticator *credential /* [in] [ref] */,
3083                                    struct netr_Authenticator *return_authenticator /* [in,out] [ref] */,
3084                                    enum netr_SamDatabaseID database_id /* [in]  */,
3085                                    enum SyncStateEnum restart_state /* [in]  */,
3086                                    uint32_t *sync_context /* [in,out] [ref] */,
3087                                    struct netr_DELTA_ENUM_ARRAY **delta_enum_array /* [out] [ref] */,
3088                                    uint32_t preferredmaximumlength /* [in]  */)
3089 {
3090         struct netr_DatabaseSync2 r;
3091         NTSTATUS status;
3092
3093         /* In parameters */
3094         r.in.logon_server = logon_server;
3095         r.in.computername = computername;
3096         r.in.credential = credential;
3097         r.in.return_authenticator = return_authenticator;
3098         r.in.database_id = database_id;
3099         r.in.restart_state = restart_state;
3100         r.in.sync_context = sync_context;
3101         r.in.preferredmaximumlength = preferredmaximumlength;
3102
3103         if (DEBUGLEVEL >= 10) {
3104                 NDR_PRINT_IN_DEBUG(netr_DatabaseSync2, &r);
3105         }
3106
3107         status = cli->dispatch(cli,
3108                                 mem_ctx,
3109                                 &ndr_table_netlogon,
3110                                 NDR_NETR_DATABASESYNC2,
3111                                 &r);
3112
3113         if (!NT_STATUS_IS_OK(status)) {
3114                 return status;
3115         }
3116
3117         if (DEBUGLEVEL >= 10) {
3118                 NDR_PRINT_OUT_DEBUG(netr_DatabaseSync2, &r);
3119         }
3120
3121         if (NT_STATUS_IS_ERR(status)) {
3122                 return status;
3123         }
3124
3125         /* Return variables */
3126         *return_authenticator = *r.out.return_authenticator;
3127         *sync_context = *r.out.sync_context;
3128         *delta_enum_array = *r.out.delta_enum_array;
3129
3130         /* Return result */
3131         return r.out.result;
3132 }
3133
3134 struct rpccli_netr_DatabaseRedo_state {
3135         struct netr_DatabaseRedo orig;
3136         struct netr_DatabaseRedo tmp;
3137         TALLOC_CTX *out_mem_ctx;
3138         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3139 };
3140
3141 static void rpccli_netr_DatabaseRedo_done(struct tevent_req *subreq);
3142
3143 struct tevent_req *rpccli_netr_DatabaseRedo_send(TALLOC_CTX *mem_ctx,
3144                                                  struct tevent_context *ev,
3145                                                  struct rpc_pipe_client *cli,
3146                                                  const char *_logon_server /* [in] [ref,charset(UTF16)] */,
3147                                                  const char *_computername /* [in] [ref,charset(UTF16)] */,
3148                                                  struct netr_Authenticator *_credential /* [in] [ref] */,
3149                                                  struct netr_Authenticator *_return_authenticator /* [in,out] [ref] */,
3150                                                  struct netr_ChangeLogEntry _change_log_entry /* [in] [subcontext_size(change_log_entry_size),subcontext(4)] */,
3151                                                  uint32_t _change_log_entry_size /* [in] [value(ndr_size_netr_ChangeLogEntry(&change_log_entry,ndr->iconv_convenience,ndr->flags))] */,
3152                                                  struct netr_DELTA_ENUM_ARRAY **_delta_enum_array /* [out] [ref] */)
3153 {
3154         struct tevent_req *req;
3155         struct rpccli_netr_DatabaseRedo_state *state;
3156         struct tevent_req *subreq;
3157
3158         req = tevent_req_create(mem_ctx, &state,
3159                                 struct rpccli_netr_DatabaseRedo_state);
3160         if (req == NULL) {
3161                 return NULL;
3162         }
3163         state->out_mem_ctx = NULL;
3164         state->dispatch_recv = cli->dispatch_recv;
3165
3166         /* In parameters */
3167         state->orig.in.logon_server = _logon_server;
3168         state->orig.in.computername = _computername;
3169         state->orig.in.credential = _credential;
3170         state->orig.in.return_authenticator = _return_authenticator;
3171         state->orig.in.change_log_entry = _change_log_entry;
3172         state->orig.in.change_log_entry_size = _change_log_entry_size;
3173
3174         /* Out parameters */
3175         state->orig.out.return_authenticator = _return_authenticator;
3176         state->orig.out.delta_enum_array = _delta_enum_array;
3177
3178         /* Result */
3179         ZERO_STRUCT(state->orig.out.result);
3180
3181         if (DEBUGLEVEL >= 10) {
3182                 NDR_PRINT_IN_DEBUG(netr_DatabaseRedo, &state->orig);
3183         }
3184
3185         state->out_mem_ctx = talloc_named_const(state, 0,
3186                              "rpccli_netr_DatabaseRedo_out_memory");
3187         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3188                 return tevent_req_post(req, ev);
3189         }
3190
3191         /* make a temporary copy, that we pass to the dispatch function */
3192         state->tmp = state->orig;
3193
3194         subreq = cli->dispatch_send(state, ev, cli,
3195                                     &ndr_table_netlogon,
3196                                     NDR_NETR_DATABASEREDO,
3197                                     &state->tmp);
3198         if (tevent_req_nomem(subreq, req)) {
3199                 return tevent_req_post(req, ev);
3200         }
3201         tevent_req_set_callback(subreq, rpccli_netr_DatabaseRedo_done, req);
3202         return req;
3203 }
3204
3205 static void rpccli_netr_DatabaseRedo_done(struct tevent_req *subreq)
3206 {
3207         struct tevent_req *req = tevent_req_callback_data(
3208                 subreq, struct tevent_req);
3209         struct rpccli_netr_DatabaseRedo_state *state = tevent_req_data(
3210                 req, struct rpccli_netr_DatabaseRedo_state);
3211         NTSTATUS status;
3212         TALLOC_CTX *mem_ctx;
3213
3214         if (state->out_mem_ctx) {
3215                 mem_ctx = state->out_mem_ctx;
3216         } else {
3217                 mem_ctx = state;
3218         }
3219
3220         status = state->dispatch_recv(subreq, mem_ctx);
3221         TALLOC_FREE(subreq);
3222         if (!NT_STATUS_IS_OK(status)) {
3223                 tevent_req_nterror(req, status);
3224                 return;
3225         }
3226
3227         /* Copy out parameters */
3228         *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
3229         *state->orig.out.delta_enum_array = *state->tmp.out.delta_enum_array;
3230
3231         /* Copy result */
3232         state->orig.out.result = state->tmp.out.result;
3233
3234         /* Reset temporary structure */
3235         ZERO_STRUCT(state->tmp);
3236
3237         if (DEBUGLEVEL >= 10) {
3238                 NDR_PRINT_OUT_DEBUG(netr_DatabaseRedo, &state->orig);
3239         }
3240
3241         tevent_req_done(req);
3242 }
3243
3244 NTSTATUS rpccli_netr_DatabaseRedo_recv(struct tevent_req *req,
3245                                        TALLOC_CTX *mem_ctx,
3246                                        NTSTATUS *result)
3247 {
3248         struct rpccli_netr_DatabaseRedo_state *state = tevent_req_data(
3249                 req, struct rpccli_netr_DatabaseRedo_state);
3250         NTSTATUS status;
3251
3252         if (tevent_req_is_nterror(req, &status)) {
3253                 tevent_req_received(req);
3254                 return status;
3255         }
3256
3257         /* Steal possbile out parameters to the callers context */
3258         talloc_steal(mem_ctx, state->out_mem_ctx);
3259
3260         /* Return result */
3261         *result = state->orig.out.result;
3262
3263         tevent_req_received(req);
3264         return NT_STATUS_OK;
3265 }
3266
3267 NTSTATUS rpccli_netr_DatabaseRedo(struct rpc_pipe_client *cli,
3268                                   TALLOC_CTX *mem_ctx,
3269                                   const char *logon_server /* [in] [ref,charset(UTF16)] */,
3270                                   const char *computername /* [in] [ref,charset(UTF16)] */,
3271                                   struct netr_Authenticator *credential /* [in] [ref] */,
3272                                   struct netr_Authenticator *return_authenticator /* [in,out] [ref] */,
3273                                   struct netr_ChangeLogEntry change_log_entry /* [in] [subcontext_size(change_log_entry_size),subcontext(4)] */,
3274                                   uint32_t change_log_entry_size /* [in] [value(ndr_size_netr_ChangeLogEntry(&change_log_entry,ndr->iconv_convenience,ndr->flags))] */,
3275                                   struct netr_DELTA_ENUM_ARRAY **delta_enum_array /* [out] [ref] */)
3276 {
3277         struct netr_DatabaseRedo r;
3278         NTSTATUS status;
3279
3280         /* In parameters */
3281         r.in.logon_server = logon_server;
3282         r.in.computername = computername;
3283         r.in.credential = credential;
3284         r.in.return_authenticator = return_authenticator;
3285         r.in.change_log_entry = change_log_entry;
3286         r.in.change_log_entry_size = change_log_entry_size;
3287
3288         if (DEBUGLEVEL >= 10) {
3289                 NDR_PRINT_IN_DEBUG(netr_DatabaseRedo, &r);
3290         }
3291
3292         status = cli->dispatch(cli,
3293                                 mem_ctx,
3294                                 &ndr_table_netlogon,
3295                                 NDR_NETR_DATABASEREDO,
3296                                 &r);
3297
3298         if (!NT_STATUS_IS_OK(status)) {
3299                 return status;
3300         }
3301
3302         if (DEBUGLEVEL >= 10) {
3303                 NDR_PRINT_OUT_DEBUG(netr_DatabaseRedo, &r);
3304         }
3305
3306         if (NT_STATUS_IS_ERR(status)) {
3307                 return status;
3308         }
3309
3310         /* Return variables */
3311         *return_authenticator = *r.out.return_authenticator;
3312         *delta_enum_array = *r.out.delta_enum_array;
3313
3314         /* Return result */
3315         return r.out.result;
3316 }
3317
3318 struct rpccli_netr_LogonControl2Ex_state {
3319         struct netr_LogonControl2Ex orig;
3320         struct netr_LogonControl2Ex tmp;
3321         TALLOC_CTX *out_mem_ctx;
3322         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3323 };
3324
3325 static void rpccli_netr_LogonControl2Ex_done(struct tevent_req *subreq);
3326
3327 struct tevent_req *rpccli_netr_LogonControl2Ex_send(TALLOC_CTX *mem_ctx,
3328                                                     struct tevent_context *ev,
3329                                                     struct rpc_pipe_client *cli,
3330                                                     const char *_logon_server /* [in] [unique,charset(UTF16)] */,
3331                                                     enum netr_LogonControlCode _function_code /* [in]  */,
3332                                                     uint32_t _level /* [in]  */,
3333                                                     union netr_CONTROL_DATA_INFORMATION *_data /* [in] [ref,switch_is(function_code)] */,
3334                                                     union netr_CONTROL_QUERY_INFORMATION *_query /* [out] [ref,switch_is(level)] */)
3335 {
3336         struct tevent_req *req;
3337         struct rpccli_netr_LogonControl2Ex_state *state;
3338         struct tevent_req *subreq;
3339
3340         req = tevent_req_create(mem_ctx, &state,
3341                                 struct rpccli_netr_LogonControl2Ex_state);
3342         if (req == NULL) {
3343                 return NULL;
3344         }
3345         state->out_mem_ctx = NULL;
3346         state->dispatch_recv = cli->dispatch_recv;
3347
3348         /* In parameters */
3349         state->orig.in.logon_server = _logon_server;
3350         state->orig.in.function_code = _function_code;
3351         state->orig.in.level = _level;
3352         state->orig.in.data = _data;
3353
3354         /* Out parameters */
3355         state->orig.out.query = _query;
3356
3357         /* Result */
3358         ZERO_STRUCT(state->orig.out.result);
3359
3360         if (DEBUGLEVEL >= 10) {
3361                 NDR_PRINT_IN_DEBUG(netr_LogonControl2Ex, &state->orig);
3362         }
3363
3364         state->out_mem_ctx = talloc_named_const(state, 0,
3365                              "rpccli_netr_LogonControl2Ex_out_memory");
3366         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3367                 return tevent_req_post(req, ev);
3368         }
3369
3370         /* make a temporary copy, that we pass to the dispatch function */
3371         state->tmp = state->orig;
3372
3373         subreq = cli->dispatch_send(state, ev, cli,
3374                                     &ndr_table_netlogon,
3375                                     NDR_NETR_LOGONCONTROL2EX,
3376                                     &state->tmp);
3377         if (tevent_req_nomem(subreq, req)) {
3378                 return tevent_req_post(req, ev);
3379         }
3380         tevent_req_set_callback(subreq, rpccli_netr_LogonControl2Ex_done, req);
3381         return req;
3382 }
3383
3384 static void rpccli_netr_LogonControl2Ex_done(struct tevent_req *subreq)
3385 {
3386         struct tevent_req *req = tevent_req_callback_data(
3387                 subreq, struct tevent_req);
3388         struct rpccli_netr_LogonControl2Ex_state *state = tevent_req_data(
3389                 req, struct rpccli_netr_LogonControl2Ex_state);
3390         NTSTATUS status;
3391         TALLOC_CTX *mem_ctx;
3392
3393         if (state->out_mem_ctx) {
3394                 mem_ctx = state->out_mem_ctx;
3395         } else {
3396                 mem_ctx = state;
3397         }
3398
3399         status = state->dispatch_recv(subreq, mem_ctx);
3400         TALLOC_FREE(subreq);
3401         if (!NT_STATUS_IS_OK(status)) {
3402                 tevent_req_nterror(req, status);
3403                 return;
3404         }
3405
3406         /* Copy out parameters */
3407         *state->orig.out.query = *state->tmp.out.query;
3408
3409         /* Copy result */
3410         state->orig.out.result = state->tmp.out.result;
3411
3412         /* Reset temporary structure */
3413         ZERO_STRUCT(state->tmp);
3414
3415         if (DEBUGLEVEL >= 10) {
3416                 NDR_PRINT_OUT_DEBUG(netr_LogonControl2Ex, &state->orig);
3417         }
3418
3419         tevent_req_done(req);
3420 }
3421
3422 NTSTATUS rpccli_netr_LogonControl2Ex_recv(struct tevent_req *req,
3423                                           TALLOC_CTX *mem_ctx,
3424                                           WERROR *result)
3425 {
3426         struct rpccli_netr_LogonControl2Ex_state *state = tevent_req_data(
3427                 req, struct rpccli_netr_LogonControl2Ex_state);
3428         NTSTATUS status;
3429
3430         if (tevent_req_is_nterror(req, &status)) {
3431                 tevent_req_received(req);
3432                 return status;
3433         }
3434
3435         /* Steal possbile out parameters to the callers context */
3436         talloc_steal(mem_ctx, state->out_mem_ctx);
3437
3438         /* Return result */
3439         *result = state->orig.out.result;
3440
3441         tevent_req_received(req);
3442         return NT_STATUS_OK;
3443 }
3444
3445 NTSTATUS rpccli_netr_LogonControl2Ex(struct rpc_pipe_client *cli,
3446                                      TALLOC_CTX *mem_ctx,
3447                                      const char *logon_server /* [in] [unique,charset(UTF16)] */,
3448                                      enum netr_LogonControlCode function_code /* [in]  */,
3449                                      uint32_t level /* [in]  */,
3450                                      union netr_CONTROL_DATA_INFORMATION *data /* [in] [ref,switch_is(function_code)] */,
3451                                      union netr_CONTROL_QUERY_INFORMATION *query /* [out] [ref,switch_is(level)] */,
3452                                      WERROR *werror)
3453 {
3454         struct netr_LogonControl2Ex r;
3455         NTSTATUS status;
3456
3457         /* In parameters */
3458         r.in.logon_server = logon_server;
3459         r.in.function_code = function_code;
3460         r.in.level = level;
3461         r.in.data = data;
3462
3463         if (DEBUGLEVEL >= 10) {
3464                 NDR_PRINT_IN_DEBUG(netr_LogonControl2Ex, &r);
3465         }
3466
3467         status = cli->dispatch(cli,
3468                                 mem_ctx,
3469                                 &ndr_table_netlogon,
3470                                 NDR_NETR_LOGONCONTROL2EX,
3471                                 &r);
3472
3473         if (!NT_STATUS_IS_OK(status)) {
3474                 return status;
3475         }
3476
3477         if (DEBUGLEVEL >= 10) {
3478                 NDR_PRINT_OUT_DEBUG(netr_LogonControl2Ex, &r);
3479         }
3480
3481         if (NT_STATUS_IS_ERR(status)) {
3482                 return status;
3483         }
3484
3485         /* Return variables */
3486         *query = *r.out.query;
3487
3488         /* Return result */
3489         if (werror) {
3490                 *werror = r.out.result;
3491         }
3492
3493         return werror_to_ntstatus(r.out.result);
3494 }
3495
3496 struct rpccli_netr_NetrEnumerateTrustedDomains_state {
3497         struct netr_NetrEnumerateTrustedDomains orig;
3498         struct netr_NetrEnumerateTrustedDomains tmp;
3499         TALLOC_CTX *out_mem_ctx;
3500         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3501 };
3502
3503 static void rpccli_netr_NetrEnumerateTrustedDomains_done(struct tevent_req *subreq);
3504
3505 struct tevent_req *rpccli_netr_NetrEnumerateTrustedDomains_send(TALLOC_CTX *mem_ctx,
3506                                                                 struct tevent_context *ev,
3507                                                                 struct rpc_pipe_client *cli,
3508                                                                 const char *_server_name /* [in] [unique,charset(UTF16)] */,
3509                                                                 struct netr_Blob *_trusted_domains_blob /* [out] [ref] */)
3510 {
3511         struct tevent_req *req;
3512         struct rpccli_netr_NetrEnumerateTrustedDomains_state *state;
3513         struct tevent_req *subreq;
3514
3515         req = tevent_req_create(mem_ctx, &state,
3516                                 struct rpccli_netr_NetrEnumerateTrustedDomains_state);
3517         if (req == NULL) {
3518                 return NULL;
3519         }
3520         state->out_mem_ctx = NULL;
3521         state->dispatch_recv = cli->dispatch_recv;
3522
3523         /* In parameters */
3524         state->orig.in.server_name = _server_name;
3525
3526         /* Out parameters */
3527         state->orig.out.trusted_domains_blob = _trusted_domains_blob;
3528
3529         /* Result */
3530         ZERO_STRUCT(state->orig.out.result);
3531
3532         if (DEBUGLEVEL >= 10) {
3533                 NDR_PRINT_IN_DEBUG(netr_NetrEnumerateTrustedDomains, &state->orig);
3534         }
3535
3536         state->out_mem_ctx = talloc_named_const(state, 0,
3537                              "rpccli_netr_NetrEnumerateTrustedDomains_out_memory");
3538         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3539                 return tevent_req_post(req, ev);
3540         }
3541
3542         /* make a temporary copy, that we pass to the dispatch function */
3543         state->tmp = state->orig;
3544
3545         subreq = cli->dispatch_send(state, ev, cli,
3546                                     &ndr_table_netlogon,
3547                                     NDR_NETR_NETRENUMERATETRUSTEDDOMAINS,
3548                                     &state->tmp);
3549         if (tevent_req_nomem(subreq, req)) {
3550                 return tevent_req_post(req, ev);
3551         }
3552         tevent_req_set_callback(subreq, rpccli_netr_NetrEnumerateTrustedDomains_done, req);
3553         return req;
3554 }
3555
3556 static void rpccli_netr_NetrEnumerateTrustedDomains_done(struct tevent_req *subreq)
3557 {
3558         struct tevent_req *req = tevent_req_callback_data(
3559                 subreq, struct tevent_req);
3560         struct rpccli_netr_NetrEnumerateTrustedDomains_state *state = tevent_req_data(
3561                 req, struct rpccli_netr_NetrEnumerateTrustedDomains_state);
3562         NTSTATUS status;
3563         TALLOC_CTX *mem_ctx;
3564
3565         if (state->out_mem_ctx) {
3566                 mem_ctx = state->out_mem_ctx;
3567         } else {
3568                 mem_ctx = state;
3569         }
3570
3571         status = state->dispatch_recv(subreq, mem_ctx);
3572         TALLOC_FREE(subreq);
3573         if (!NT_STATUS_IS_OK(status)) {
3574                 tevent_req_nterror(req, status);
3575                 return;
3576         }
3577
3578         /* Copy out parameters */
3579         *state->orig.out.trusted_domains_blob = *state->tmp.out.trusted_domains_blob;
3580
3581         /* Copy result */
3582         state->orig.out.result = state->tmp.out.result;
3583
3584         /* Reset temporary structure */
3585         ZERO_STRUCT(state->tmp);
3586
3587         if (DEBUGLEVEL >= 10) {
3588                 NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomains, &state->orig);
3589         }
3590
3591         tevent_req_done(req);
3592 }
3593
3594 NTSTATUS rpccli_netr_NetrEnumerateTrustedDomains_recv(struct tevent_req *req,
3595                                                       TALLOC_CTX *mem_ctx,
3596                                                       WERROR *result)
3597 {
3598         struct rpccli_netr_NetrEnumerateTrustedDomains_state *state = tevent_req_data(
3599                 req, struct rpccli_netr_NetrEnumerateTrustedDomains_state);
3600         NTSTATUS status;
3601
3602         if (tevent_req_is_nterror(req, &status)) {
3603                 tevent_req_received(req);
3604                 return status;
3605         }
3606
3607         /* Steal possbile out parameters to the callers context */
3608         talloc_steal(mem_ctx, state->out_mem_ctx);
3609
3610         /* Return result */
3611         *result = state->orig.out.result;
3612
3613         tevent_req_received(req);
3614         return NT_STATUS_OK;
3615 }
3616
3617 NTSTATUS rpccli_netr_NetrEnumerateTrustedDomains(struct rpc_pipe_client *cli,
3618                                                  TALLOC_CTX *mem_ctx,
3619                                                  const char *server_name /* [in] [unique,charset(UTF16)] */,
3620                                                  struct netr_Blob *trusted_domains_blob /* [out] [ref] */,
3621                                                  WERROR *werror)
3622 {
3623         struct netr_NetrEnumerateTrustedDomains r;
3624         NTSTATUS status;
3625
3626         /* In parameters */
3627         r.in.server_name = server_name;
3628
3629         if (DEBUGLEVEL >= 10) {
3630                 NDR_PRINT_IN_DEBUG(netr_NetrEnumerateTrustedDomains, &r);
3631         }
3632
3633         status = cli->dispatch(cli,
3634                                 mem_ctx,
3635                                 &ndr_table_netlogon,
3636                                 NDR_NETR_NETRENUMERATETRUSTEDDOMAINS,
3637                                 &r);
3638
3639         if (!NT_STATUS_IS_OK(status)) {
3640                 return status;
3641         }
3642
3643         if (DEBUGLEVEL >= 10) {
3644                 NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomains, &r);
3645         }
3646
3647         if (NT_STATUS_IS_ERR(status)) {
3648                 return status;
3649         }
3650
3651         /* Return variables */
3652         *trusted_domains_blob = *r.out.trusted_domains_blob;
3653
3654         /* Return result */
3655         if (werror) {
3656                 *werror = r.out.result;
3657         }
3658
3659         return werror_to_ntstatus(r.out.result);
3660 }
3661
3662 struct rpccli_netr_DsRGetDCName_state {
3663         struct netr_DsRGetDCName orig;
3664         struct netr_DsRGetDCName tmp;
3665         TALLOC_CTX *out_mem_ctx;
3666         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3667 };
3668
3669 static void rpccli_netr_DsRGetDCName_done(struct tevent_req *subreq);
3670
3671 struct tevent_req *rpccli_netr_DsRGetDCName_send(TALLOC_CTX *mem_ctx,
3672                                                  struct tevent_context *ev,
3673                                                  struct rpc_pipe_client *cli,
3674                                                  const char *_server_unc /* [in] [unique,charset(UTF16)] */,
3675                                                  const char *_domain_name /* [in] [unique,charset(UTF16)] */,
3676                                                  struct GUID *_domain_guid /* [in] [unique] */,
3677                                                  struct GUID *_site_guid /* [in] [unique] */,
3678                                                  uint32_t _flags /* [in]  */,
3679                                                  struct netr_DsRGetDCNameInfo **_info /* [out] [ref] */)
3680 {
3681         struct tevent_req *req;
3682         struct rpccli_netr_DsRGetDCName_state *state;
3683         struct tevent_req *subreq;
3684
3685         req = tevent_req_create(mem_ctx, &state,
3686                                 struct rpccli_netr_DsRGetDCName_state);
3687         if (req == NULL) {
3688                 return NULL;
3689         }
3690         state->out_mem_ctx = NULL;
3691         state->dispatch_recv = cli->dispatch_recv;
3692
3693         /* In parameters */
3694         state->orig.in.server_unc = _server_unc;
3695         state->orig.in.domain_name = _domain_name;
3696         state->orig.in.domain_guid = _domain_guid;
3697         state->orig.in.site_guid = _site_guid;
3698         state->orig.in.flags = _flags;
3699
3700         /* Out parameters */
3701         state->orig.out.info = _info;
3702
3703         /* Result */
3704         ZERO_STRUCT(state->orig.out.result);
3705
3706         if (DEBUGLEVEL >= 10) {
3707                 NDR_PRINT_IN_DEBUG(netr_DsRGetDCName, &state->orig);
3708         }
3709
3710         state->out_mem_ctx = talloc_named_const(state, 0,
3711                              "rpccli_netr_DsRGetDCName_out_memory");
3712         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3713                 return tevent_req_post(req, ev);
3714         }
3715
3716         /* make a temporary copy, that we pass to the dispatch function */
3717         state->tmp = state->orig;
3718
3719         subreq = cli->dispatch_send(state, ev, cli,
3720                                     &ndr_table_netlogon,
3721                                     NDR_NETR_DSRGETDCNAME,
3722                                     &state->tmp);
3723         if (tevent_req_nomem(subreq, req)) {
3724                 return tevent_req_post(req, ev);
3725         }
3726         tevent_req_set_callback(subreq, rpccli_netr_DsRGetDCName_done, req);
3727         return req;
3728 }
3729
3730 static void rpccli_netr_DsRGetDCName_done(struct tevent_req *subreq)
3731 {
3732         struct tevent_req *req = tevent_req_callback_data(
3733                 subreq, struct tevent_req);
3734         struct rpccli_netr_DsRGetDCName_state *state = tevent_req_data(
3735                 req, struct rpccli_netr_DsRGetDCName_state);
3736         NTSTATUS status;
3737         TALLOC_CTX *mem_ctx;
3738
3739         if (state->out_mem_ctx) {
3740                 mem_ctx = state->out_mem_ctx;
3741         } else {
3742                 mem_ctx = state;
3743         }
3744
3745         status = state->dispatch_recv(subreq, mem_ctx);
3746         TALLOC_FREE(subreq);
3747         if (!NT_STATUS_IS_OK(status)) {
3748                 tevent_req_nterror(req, status);
3749                 return;
3750         }
3751
3752         /* Copy out parameters */
3753         *state->orig.out.info = *state->tmp.out.info;
3754
3755         /* Copy result */
3756         state->orig.out.result = state->tmp.out.result;
3757
3758         /* Reset temporary structure */
3759         ZERO_STRUCT(state->tmp);
3760
3761         if (DEBUGLEVEL >= 10) {
3762                 NDR_PRINT_OUT_DEBUG(netr_DsRGetDCName, &state->orig);
3763         }
3764
3765         tevent_req_done(req);
3766 }
3767
3768 NTSTATUS rpccli_netr_DsRGetDCName_recv(struct tevent_req *req,
3769                                        TALLOC_CTX *mem_ctx,
3770                                        WERROR *result)
3771 {
3772         struct rpccli_netr_DsRGetDCName_state *state = tevent_req_data(
3773                 req, struct rpccli_netr_DsRGetDCName_state);
3774         NTSTATUS status;
3775
3776         if (tevent_req_is_nterror(req, &status)) {
3777                 tevent_req_received(req);
3778                 return status;
3779         }
3780
3781         /* Steal possbile out parameters to the callers context */
3782         talloc_steal(mem_ctx, state->out_mem_ctx);
3783
3784         /* Return result */
3785         *result = state->orig.out.result;
3786
3787         tevent_req_received(req);
3788         return NT_STATUS_OK;
3789 }
3790
3791 NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli,
3792                                   TALLOC_CTX *mem_ctx,
3793                                   const char *server_unc /* [in] [unique,charset(UTF16)] */,
3794                                   const char *domain_name /* [in] [unique,charset(UTF16)] */,
3795                                   struct GUID *domain_guid /* [in] [unique] */,
3796                                   struct GUID *site_guid /* [in] [unique] */,
3797                                   uint32_t flags /* [in]  */,
3798                                   struct netr_DsRGetDCNameInfo **info /* [out] [ref] */,
3799                                   WERROR *werror)
3800 {
3801         struct netr_DsRGetDCName r;
3802         NTSTATUS status;
3803
3804         /* In parameters */
3805         r.in.server_unc = server_unc;
3806         r.in.domain_name = domain_name;
3807         r.in.domain_guid = domain_guid;
3808         r.in.site_guid = site_guid;
3809         r.in.flags = flags;
3810
3811         if (DEBUGLEVEL >= 10) {
3812                 NDR_PRINT_IN_DEBUG(netr_DsRGetDCName, &r);
3813         }
3814
3815         status = cli->dispatch(cli,
3816                                 mem_ctx,
3817                                 &ndr_table_netlogon,
3818                                 NDR_NETR_DSRGETDCNAME,
3819                                 &r);
3820
3821         if (!NT_STATUS_IS_OK(status)) {
3822                 return status;
3823         }
3824
3825         if (DEBUGLEVEL >= 10) {
3826                 NDR_PRINT_OUT_DEBUG(netr_DsRGetDCName, &r);
3827         }
3828
3829         if (NT_STATUS_IS_ERR(status)) {
3830                 return status;
3831         }
3832
3833         /* Return variables */
3834         *info = *r.out.info;
3835
3836         /* Return result */
3837         if (werror) {
3838                 *werror = r.out.result;
3839         }
3840
3841         return werror_to_ntstatus(r.out.result);
3842 }
3843
3844 struct rpccli_netr_LogonGetCapabilities_state {
3845         struct netr_LogonGetCapabilities orig;
3846         struct netr_LogonGetCapabilities tmp;
3847         TALLOC_CTX *out_mem_ctx;
3848         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3849 };
3850
3851 static void rpccli_netr_LogonGetCapabilities_done(struct tevent_req *subreq);
3852
3853 struct tevent_req *rpccli_netr_LogonGetCapabilities_send(TALLOC_CTX *mem_ctx,
3854                                                          struct tevent_context *ev,
3855                                                          struct rpc_pipe_client *cli,
3856                                                          const char *_server_name /* [in] [ref,charset(UTF16)] */,
3857                                                          const char *_computer_name /* [in] [unique,charset(UTF16)] */,
3858                                                          struct netr_Authenticator *_credential /* [in] [ref] */,
3859                                                          struct netr_Authenticator *_return_authenticator /* [in,out] [ref] */,
3860                                                          uint32_t _query_level /* [in]  */,
3861                                                          union netr_Capabilities *_capabilities /* [out] [ref,switch_is(query_level)] */)
3862 {
3863         struct tevent_req *req;
3864         struct rpccli_netr_LogonGetCapabilities_state *state;
3865         struct tevent_req *subreq;
3866
3867         req = tevent_req_create(mem_ctx, &state,
3868                                 struct rpccli_netr_LogonGetCapabilities_state);
3869         if (req == NULL) {
3870                 return NULL;
3871         }
3872         state->out_mem_ctx = NULL;
3873         state->dispatch_recv = cli->dispatch_recv;
3874
3875         /* In parameters */
3876         state->orig.in.server_name = _server_name;
3877         state->orig.in.computer_name = _computer_name;
3878         state->orig.in.credential = _credential;
3879         state->orig.in.return_authenticator = _return_authenticator;
3880         state->orig.in.query_level = _query_level;
3881
3882         /* Out parameters */
3883         state->orig.out.return_authenticator = _return_authenticator;
3884         state->orig.out.capabilities = _capabilities;
3885
3886         /* Result */
3887         ZERO_STRUCT(state->orig.out.result);
3888
3889         if (DEBUGLEVEL >= 10) {
3890                 NDR_PRINT_IN_DEBUG(netr_LogonGetCapabilities, &state->orig);
3891         }
3892
3893         state->out_mem_ctx = talloc_named_const(state, 0,
3894                              "rpccli_netr_LogonGetCapabilities_out_memory");
3895         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3896                 return tevent_req_post(req, ev);
3897         }
3898
3899         /* make a temporary copy, that we pass to the dispatch function */
3900         state->tmp = state->orig;
3901
3902         subreq = cli->dispatch_send(state, ev, cli,
3903                                     &ndr_table_netlogon,
3904                                     NDR_NETR_LOGONGETCAPABILITIES,
3905                                     &state->tmp);
3906         if (tevent_req_nomem(subreq, req)) {
3907                 return tevent_req_post(req, ev);
3908         }
3909         tevent_req_set_callback(subreq, rpccli_netr_LogonGetCapabilities_done, req);
3910         return req;
3911 }
3912
3913 static void rpccli_netr_LogonGetCapabilities_done(struct tevent_req *subreq)
3914 {
3915         struct tevent_req *req = tevent_req_callback_data(
3916                 subreq, struct tevent_req);
3917         struct rpccli_netr_LogonGetCapabilities_state *state = tevent_req_data(
3918                 req, struct rpccli_netr_LogonGetCapabilities_state);
3919         NTSTATUS status;
3920         TALLOC_CTX *mem_ctx;
3921
3922         if (state->out_mem_ctx) {
3923                 mem_ctx = state->out_mem_ctx;
3924         } else {
3925                 mem_ctx = state;
3926         }
3927
3928         status = state->dispatch_recv(subreq, mem_ctx);
3929         TALLOC_FREE(subreq);
3930         if (!NT_STATUS_IS_OK(status)) {
3931                 tevent_req_nterror(req, status);
3932                 return;
3933         }
3934
3935         /* Copy out parameters */
3936         *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
3937         *state->orig.out.capabilities = *state->tmp.out.capabilities;
3938
3939         /* Copy result */
3940         state->orig.out.result = state->tmp.out.result;
3941
3942         /* Reset temporary structure */
3943         ZERO_STRUCT(state->tmp);
3944
3945         if (DEBUGLEVEL >= 10) {
3946                 NDR_PRINT_OUT_DEBUG(netr_LogonGetCapabilities, &state->orig);
3947         }
3948
3949         tevent_req_done(req);
3950 }
3951
3952 NTSTATUS rpccli_netr_LogonGetCapabilities_recv(struct tevent_req *req,
3953                                                TALLOC_CTX *mem_ctx,
3954                                                NTSTATUS *result)
3955 {
3956         struct rpccli_netr_LogonGetCapabilities_state *state = tevent_req_data(
3957                 req, struct rpccli_netr_LogonGetCapabilities_state);
3958         NTSTATUS status;
3959
3960         if (tevent_req_is_nterror(req, &status)) {
3961                 tevent_req_received(req);
3962                 return status;
3963         }
3964
3965         /* Steal possbile out parameters to the callers context */
3966         talloc_steal(mem_ctx, state->out_mem_ctx);
3967
3968         /* Return result */
3969         *result = state->orig.out.result;
3970
3971         tevent_req_received(req);
3972         return NT_STATUS_OK;
3973 }
3974
3975 NTSTATUS rpccli_netr_LogonGetCapabilities(struct rpc_pipe_client *cli,
3976                                           TALLOC_CTX *mem_ctx,
3977                                           const char *server_name /* [in] [ref,charset(UTF16)] */,
3978                                           const char *computer_name /* [in] [unique,charset(UTF16)] */,
3979                                           struct netr_Authenticator *credential /* [in] [ref] */,
3980                                           struct netr_Authenticator *return_authenticator /* [in,out] [ref] */,
3981                                           uint32_t query_level /* [in]  */,
3982                                           union netr_Capabilities *capabilities /* [out] [ref,switch_is(query_level)] */)
3983 {
3984         struct netr_LogonGetCapabilities r;
3985         NTSTATUS status;
3986
3987         /* In parameters */
3988         r.in.server_name = server_name;
3989         r.in.computer_name = computer_name;
3990         r.in.credential = credential;
3991         r.in.return_authenticator = return_authenticator;
3992         r.in.query_level = query_level;
3993
3994         if (DEBUGLEVEL >= 10) {
3995                 NDR_PRINT_IN_DEBUG(netr_LogonGetCapabilities, &r);
3996         }
3997
3998         status = cli->dispatch(cli,
3999                                 mem_ctx,
4000                                 &ndr_table_netlogon,
4001                                 NDR_NETR_LOGONGETCAPABILITIES,
4002                                 &r);
4003
4004         if (!NT_STATUS_IS_OK(status)) {
4005                 return status;
4006         }
4007
4008         if (DEBUGLEVEL >= 10) {
4009                 NDR_PRINT_OUT_DEBUG(netr_LogonGetCapabilities, &r);
4010         }
4011
4012         if (NT_STATUS_IS_ERR(status)) {
4013                 return status;
4014         }
4015
4016         /* Return variables */
4017         *return_authenticator = *r.out.return_authenticator;
4018         *capabilities = *r.out.capabilities;
4019
4020         /* Return result */
4021         return r.out.result;
4022 }
4023
4024 struct rpccli_netr_NETRLOGONSETSERVICEBITS_state {
4025         struct netr_NETRLOGONSETSERVICEBITS orig;
4026         struct netr_NETRLOGONSETSERVICEBITS tmp;
4027         TALLOC_CTX *out_mem_ctx;
4028         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4029 };
4030
4031 static void rpccli_netr_NETRLOGONSETSERVICEBITS_done(struct tevent_req *subreq);
4032
4033 struct tevent_req *rpccli_netr_NETRLOGONSETSERVICEBITS_send(TALLOC_CTX *mem_ctx,
4034                                                             struct tevent_context *ev,
4035                                                             struct rpc_pipe_client *cli)
4036 {
4037         struct tevent_req *req;
4038         struct rpccli_netr_NETRLOGONSETSERVICEBITS_state *state;
4039         struct tevent_req *subreq;
4040
4041         req = tevent_req_create(mem_ctx, &state,
4042                                 struct rpccli_netr_NETRLOGONSETSERVICEBITS_state);
4043         if (req == NULL) {
4044                 return NULL;
4045         }
4046         state->out_mem_ctx = NULL;
4047         state->dispatch_recv = cli->dispatch_recv;
4048
4049         /* In parameters */
4050
4051         /* Out parameters */
4052
4053         /* Result */
4054         ZERO_STRUCT(state->orig.out.result);
4055
4056         if (DEBUGLEVEL >= 10) {
4057                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONSETSERVICEBITS, &state->orig);
4058         }
4059
4060         /* make a temporary copy, that we pass to the dispatch function */
4061         state->tmp = state->orig;
4062
4063         subreq = cli->dispatch_send(state, ev, cli,
4064                                     &ndr_table_netlogon,
4065                                     NDR_NETR_NETRLOGONSETSERVICEBITS,
4066                                     &state->tmp);
4067         if (tevent_req_nomem(subreq, req)) {
4068                 return tevent_req_post(req, ev);
4069         }
4070         tevent_req_set_callback(subreq, rpccli_netr_NETRLOGONSETSERVICEBITS_done, req);
4071         return req;
4072 }
4073
4074 static void rpccli_netr_NETRLOGONSETSERVICEBITS_done(struct tevent_req *subreq)
4075 {
4076         struct tevent_req *req = tevent_req_callback_data(
4077                 subreq, struct tevent_req);
4078         struct rpccli_netr_NETRLOGONSETSERVICEBITS_state *state = tevent_req_data(
4079                 req, struct rpccli_netr_NETRLOGONSETSERVICEBITS_state);
4080         NTSTATUS status;
4081         TALLOC_CTX *mem_ctx;
4082
4083         if (state->out_mem_ctx) {
4084                 mem_ctx = state->out_mem_ctx;
4085         } else {
4086                 mem_ctx = state;
4087         }
4088
4089         status = state->dispatch_recv(subreq, mem_ctx);
4090         TALLOC_FREE(subreq);
4091         if (!NT_STATUS_IS_OK(status)) {
4092                 tevent_req_nterror(req, status);
4093                 return;
4094         }
4095
4096         /* Copy out parameters */
4097
4098         /* Copy result */
4099         state->orig.out.result = state->tmp.out.result;
4100
4101         /* Reset temporary structure */
4102         ZERO_STRUCT(state->tmp);
4103
4104         if (DEBUGLEVEL >= 10) {
4105                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSETSERVICEBITS, &state->orig);
4106         }
4107
4108         tevent_req_done(req);
4109 }
4110
4111 NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS_recv(struct tevent_req *req,
4112                                                   TALLOC_CTX *mem_ctx,
4113                                                   WERROR *result)
4114 {
4115         struct rpccli_netr_NETRLOGONSETSERVICEBITS_state *state = tevent_req_data(
4116                 req, struct rpccli_netr_NETRLOGONSETSERVICEBITS_state);
4117         NTSTATUS status;
4118
4119         if (tevent_req_is_nterror(req, &status)) {
4120                 tevent_req_received(req);
4121                 return status;
4122         }
4123
4124         /* Steal possbile out parameters to the callers context */
4125         talloc_steal(mem_ctx, state->out_mem_ctx);
4126
4127         /* Return result */
4128         *result = state->orig.out.result;
4129
4130         tevent_req_received(req);
4131         return NT_STATUS_OK;
4132 }
4133
4134 NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS(struct rpc_pipe_client *cli,
4135                                              TALLOC_CTX *mem_ctx,
4136                                              WERROR *werror)
4137 {
4138         struct netr_NETRLOGONSETSERVICEBITS r;
4139         NTSTATUS status;
4140
4141         /* In parameters */
4142
4143         if (DEBUGLEVEL >= 10) {
4144                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONSETSERVICEBITS, &r);
4145         }
4146
4147         status = cli->dispatch(cli,
4148                                 mem_ctx,
4149                                 &ndr_table_netlogon,
4150                                 NDR_NETR_NETRLOGONSETSERVICEBITS,
4151                                 &r);
4152
4153         if (!NT_STATUS_IS_OK(status)) {
4154                 return status;
4155         }
4156
4157         if (DEBUGLEVEL >= 10) {
4158                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSETSERVICEBITS, &r);
4159         }
4160
4161         if (NT_STATUS_IS_ERR(status)) {
4162                 return status;
4163         }
4164
4165         /* Return variables */
4166
4167         /* Return result */
4168         if (werror) {
4169                 *werror = r.out.result;
4170         }
4171
4172         return werror_to_ntstatus(r.out.result);
4173 }
4174
4175 struct rpccli_netr_LogonGetTrustRid_state {
4176         struct netr_LogonGetTrustRid orig;
4177         struct netr_LogonGetTrustRid tmp;
4178         TALLOC_CTX *out_mem_ctx;
4179         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4180 };
4181
4182 static void rpccli_netr_LogonGetTrustRid_done(struct tevent_req *subreq);
4183
4184 struct tevent_req *rpccli_netr_LogonGetTrustRid_send(TALLOC_CTX *mem_ctx,
4185                                                      struct tevent_context *ev,
4186                                                      struct rpc_pipe_client *cli,
4187                                                      const char *_server_name /* [in] [unique,charset(UTF16)] */,
4188                                                      const char *_domain_name /* [in] [unique,charset(UTF16)] */,
4189                                                      uint32_t *_rid /* [out] [ref] */)
4190 {
4191         struct tevent_req *req;
4192         struct rpccli_netr_LogonGetTrustRid_state *state;
4193         struct tevent_req *subreq;
4194
4195         req = tevent_req_create(mem_ctx, &state,
4196                                 struct rpccli_netr_LogonGetTrustRid_state);
4197         if (req == NULL) {
4198                 return NULL;
4199         }
4200         state->out_mem_ctx = NULL;
4201         state->dispatch_recv = cli->dispatch_recv;
4202
4203         /* In parameters */
4204         state->orig.in.server_name = _server_name;
4205         state->orig.in.domain_name = _domain_name;
4206
4207         /* Out parameters */
4208         state->orig.out.rid = _rid;
4209
4210         /* Result */
4211         ZERO_STRUCT(state->orig.out.result);
4212
4213         if (DEBUGLEVEL >= 10) {
4214                 NDR_PRINT_IN_DEBUG(netr_LogonGetTrustRid, &state->orig);
4215         }
4216
4217         state->out_mem_ctx = talloc_named_const(state, 0,
4218                              "rpccli_netr_LogonGetTrustRid_out_memory");
4219         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4220                 return tevent_req_post(req, ev);
4221         }
4222
4223         /* make a temporary copy, that we pass to the dispatch function */
4224         state->tmp = state->orig;
4225
4226         subreq = cli->dispatch_send(state, ev, cli,
4227                                     &ndr_table_netlogon,
4228                                     NDR_NETR_LOGONGETTRUSTRID,
4229                                     &state->tmp);
4230         if (tevent_req_nomem(subreq, req)) {
4231                 return tevent_req_post(req, ev);
4232         }
4233         tevent_req_set_callback(subreq, rpccli_netr_LogonGetTrustRid_done, req);
4234         return req;
4235 }
4236
4237 static void rpccli_netr_LogonGetTrustRid_done(struct tevent_req *subreq)
4238 {
4239         struct tevent_req *req = tevent_req_callback_data(
4240                 subreq, struct tevent_req);
4241         struct rpccli_netr_LogonGetTrustRid_state *state = tevent_req_data(
4242                 req, struct rpccli_netr_LogonGetTrustRid_state);
4243         NTSTATUS status;
4244         TALLOC_CTX *mem_ctx;
4245
4246         if (state->out_mem_ctx) {
4247                 mem_ctx = state->out_mem_ctx;
4248         } else {
4249                 mem_ctx = state;
4250         }
4251
4252         status = state->dispatch_recv(subreq, mem_ctx);
4253         TALLOC_FREE(subreq);
4254         if (!NT_STATUS_IS_OK(status)) {
4255                 tevent_req_nterror(req, status);
4256                 return;
4257         }
4258
4259         /* Copy out parameters */
4260         *state->orig.out.rid = *state->tmp.out.rid;
4261
4262         /* Copy result */
4263         state->orig.out.result = state->tmp.out.result;
4264
4265         /* Reset temporary structure */
4266         ZERO_STRUCT(state->tmp);
4267
4268         if (DEBUGLEVEL >= 10) {
4269                 NDR_PRINT_OUT_DEBUG(netr_LogonGetTrustRid, &state->orig);
4270         }
4271
4272         tevent_req_done(req);
4273 }
4274
4275 NTSTATUS rpccli_netr_LogonGetTrustRid_recv(struct tevent_req *req,
4276                                            TALLOC_CTX *mem_ctx,
4277                                            WERROR *result)
4278 {
4279         struct rpccli_netr_LogonGetTrustRid_state *state = tevent_req_data(
4280                 req, struct rpccli_netr_LogonGetTrustRid_state);
4281         NTSTATUS status;
4282
4283         if (tevent_req_is_nterror(req, &status)) {
4284                 tevent_req_received(req);
4285                 return status;
4286         }
4287
4288         /* Steal possbile out parameters to the callers context */
4289         talloc_steal(mem_ctx, state->out_mem_ctx);
4290
4291         /* Return result */
4292         *result = state->orig.out.result;
4293
4294         tevent_req_received(req);
4295         return NT_STATUS_OK;
4296 }
4297
4298 NTSTATUS rpccli_netr_LogonGetTrustRid(struct rpc_pipe_client *cli,
4299                                       TALLOC_CTX *mem_ctx,
4300                                       const char *server_name /* [in] [unique,charset(UTF16)] */,
4301                                       const char *domain_name /* [in] [unique,charset(UTF16)] */,
4302                                       uint32_t *rid /* [out] [ref] */,
4303                                       WERROR *werror)
4304 {
4305         struct netr_LogonGetTrustRid r;
4306         NTSTATUS status;
4307
4308         /* In parameters */
4309         r.in.server_name = server_name;
4310         r.in.domain_name = domain_name;
4311
4312         if (DEBUGLEVEL >= 10) {
4313                 NDR_PRINT_IN_DEBUG(netr_LogonGetTrustRid, &r);
4314         }
4315
4316         status = cli->dispatch(cli,
4317                                 mem_ctx,
4318                                 &ndr_table_netlogon,
4319                                 NDR_NETR_LOGONGETTRUSTRID,
4320                                 &r);
4321
4322         if (!NT_STATUS_IS_OK(status)) {
4323                 return status;
4324         }
4325
4326         if (DEBUGLEVEL >= 10) {
4327                 NDR_PRINT_OUT_DEBUG(netr_LogonGetTrustRid, &r);
4328         }
4329
4330         if (NT_STATUS_IS_ERR(status)) {
4331                 return status;
4332         }
4333
4334         /* Return variables */
4335         *rid = *r.out.rid;
4336
4337         /* Return result */
4338         if (werror) {
4339                 *werror = r.out.result;
4340         }
4341
4342         return werror_to_ntstatus(r.out.result);
4343 }
4344
4345 struct rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST_state {
4346         struct netr_NETRLOGONCOMPUTESERVERDIGEST orig;
4347         struct netr_NETRLOGONCOMPUTESERVERDIGEST tmp;
4348         TALLOC_CTX *out_mem_ctx;
4349         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4350 };
4351
4352 static void rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST_done(struct tevent_req *subreq);
4353
4354 struct tevent_req *rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST_send(TALLOC_CTX *mem_ctx,
4355                                                                  struct tevent_context *ev,
4356                                                                  struct rpc_pipe_client *cli)
4357 {
4358         struct tevent_req *req;
4359         struct rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST_state *state;
4360         struct tevent_req *subreq;
4361
4362         req = tevent_req_create(mem_ctx, &state,
4363                                 struct rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST_state);
4364         if (req == NULL) {
4365                 return NULL;
4366         }
4367         state->out_mem_ctx = NULL;
4368         state->dispatch_recv = cli->dispatch_recv;
4369
4370         /* In parameters */
4371
4372         /* Out parameters */
4373
4374         /* Result */
4375         ZERO_STRUCT(state->orig.out.result);
4376
4377         if (DEBUGLEVEL >= 10) {
4378                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, &state->orig);
4379         }
4380
4381         /* make a temporary copy, that we pass to the dispatch function */
4382         state->tmp = state->orig;
4383
4384         subreq = cli->dispatch_send(state, ev, cli,
4385                                     &ndr_table_netlogon,
4386                                     NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST,
4387                                     &state->tmp);
4388         if (tevent_req_nomem(subreq, req)) {
4389                 return tevent_req_post(req, ev);
4390         }
4391         tevent_req_set_callback(subreq, rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST_done, req);
4392         return req;
4393 }
4394
4395 static void rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST_done(struct tevent_req *subreq)
4396 {
4397         struct tevent_req *req = tevent_req_callback_data(
4398                 subreq, struct tevent_req);
4399         struct rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST_state *state = tevent_req_data(
4400                 req, struct rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST_state);
4401         NTSTATUS status;
4402         TALLOC_CTX *mem_ctx;
4403
4404         if (state->out_mem_ctx) {
4405                 mem_ctx = state->out_mem_ctx;
4406         } else {
4407                 mem_ctx = state;
4408         }
4409
4410         status = state->dispatch_recv(subreq, mem_ctx);
4411         TALLOC_FREE(subreq);
4412         if (!NT_STATUS_IS_OK(status)) {
4413                 tevent_req_nterror(req, status);
4414                 return;
4415         }
4416
4417         /* Copy out parameters */
4418
4419         /* Copy result */
4420         state->orig.out.result = state->tmp.out.result;
4421
4422         /* Reset temporary structure */
4423         ZERO_STRUCT(state->tmp);
4424
4425         if (DEBUGLEVEL >= 10) {
4426                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, &state->orig);
4427         }
4428
4429         tevent_req_done(req);
4430 }
4431
4432 NTSTATUS rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST_recv(struct tevent_req *req,
4433                                                        TALLOC_CTX *mem_ctx,
4434                                                        WERROR *result)
4435 {
4436         struct rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST_state *state = tevent_req_data(
4437                 req, struct rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST_state);
4438         NTSTATUS status;
4439
4440         if (tevent_req_is_nterror(req, &status)) {
4441                 tevent_req_received(req);
4442                 return status;
4443         }
4444
4445         /* Steal possbile out parameters to the callers context */
4446         talloc_steal(mem_ctx, state->out_mem_ctx);
4447
4448         /* Return result */
4449         *result = state->orig.out.result;
4450
4451         tevent_req_received(req);
4452         return NT_STATUS_OK;
4453 }
4454
4455 NTSTATUS rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST(struct rpc_pipe_client *cli,
4456                                                   TALLOC_CTX *mem_ctx,
4457                                                   WERROR *werror)
4458 {
4459         struct netr_NETRLOGONCOMPUTESERVERDIGEST r;
4460         NTSTATUS status;
4461
4462         /* In parameters */
4463
4464         if (DEBUGLEVEL >= 10) {
4465                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, &r);
4466         }
4467
4468         status = cli->dispatch(cli,
4469                                 mem_ctx,
4470                                 &ndr_table_netlogon,
4471                                 NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST,
4472                                 &r);
4473
4474         if (!NT_STATUS_IS_OK(status)) {
4475                 return status;
4476         }
4477
4478         if (DEBUGLEVEL >= 10) {
4479                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, &r);
4480         }
4481
4482         if (NT_STATUS_IS_ERR(status)) {
4483                 return status;
4484         }
4485
4486         /* Return variables */
4487
4488         /* Return result */
4489         if (werror) {
4490                 *werror = r.out.result;
4491         }
4492
4493         return werror_to_ntstatus(r.out.result);
4494 }
4495
4496 struct rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST_state {
4497         struct netr_NETRLOGONCOMPUTECLIENTDIGEST orig;
4498         struct netr_NETRLOGONCOMPUTECLIENTDIGEST tmp;
4499         TALLOC_CTX *out_mem_ctx;
4500         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4501 };
4502
4503 static void rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST_done(struct tevent_req *subreq);
4504
4505 struct tevent_req *rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST_send(TALLOC_CTX *mem_ctx,
4506                                                                  struct tevent_context *ev,
4507                                                                  struct rpc_pipe_client *cli)
4508 {
4509         struct tevent_req *req;
4510         struct rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST_state *state;
4511         struct tevent_req *subreq;
4512
4513         req = tevent_req_create(mem_ctx, &state,
4514                                 struct rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST_state);
4515         if (req == NULL) {
4516                 return NULL;
4517         }
4518         state->out_mem_ctx = NULL;
4519         state->dispatch_recv = cli->dispatch_recv;
4520
4521         /* In parameters */
4522
4523         /* Out parameters */
4524
4525         /* Result */
4526         ZERO_STRUCT(state->orig.out.result);
4527
4528         if (DEBUGLEVEL >= 10) {
4529                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, &state->orig);
4530         }
4531
4532         /* make a temporary copy, that we pass to the dispatch function */
4533         state->tmp = state->orig;
4534
4535         subreq = cli->dispatch_send(state, ev, cli,
4536                                     &ndr_table_netlogon,
4537                                     NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST,
4538                                     &state->tmp);
4539         if (tevent_req_nomem(subreq, req)) {
4540                 return tevent_req_post(req, ev);
4541         }
4542         tevent_req_set_callback(subreq, rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST_done, req);
4543         return req;
4544 }
4545
4546 static void rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST_done(struct tevent_req *subreq)
4547 {
4548         struct tevent_req *req = tevent_req_callback_data(
4549                 subreq, struct tevent_req);
4550         struct rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST_state *state = tevent_req_data(
4551                 req, struct rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST_state);
4552         NTSTATUS status;
4553         TALLOC_CTX *mem_ctx;
4554
4555         if (state->out_mem_ctx) {
4556                 mem_ctx = state->out_mem_ctx;
4557         } else {
4558                 mem_ctx = state;
4559         }
4560
4561         status = state->dispatch_recv(subreq, mem_ctx);
4562         TALLOC_FREE(subreq);
4563         if (!NT_STATUS_IS_OK(status)) {
4564                 tevent_req_nterror(req, status);
4565                 return;
4566         }
4567
4568         /* Copy out parameters */
4569
4570         /* Copy result */
4571         state->orig.out.result = state->tmp.out.result;
4572
4573         /* Reset temporary structure */
4574         ZERO_STRUCT(state->tmp);
4575
4576         if (DEBUGLEVEL >= 10) {
4577                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, &state->orig);
4578         }
4579
4580         tevent_req_done(req);
4581 }
4582
4583 NTSTATUS rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST_recv(struct tevent_req *req,
4584                                                        TALLOC_CTX *mem_ctx,
4585                                                        WERROR *result)
4586 {
4587         struct rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST_state *state = tevent_req_data(
4588                 req, struct rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST_state);
4589         NTSTATUS status;
4590
4591         if (tevent_req_is_nterror(req, &status)) {
4592                 tevent_req_received(req);
4593                 return status;
4594         }
4595
4596         /* Steal possbile out parameters to the callers context */
4597         talloc_steal(mem_ctx, state->out_mem_ctx);
4598
4599         /* Return result */
4600         *result = state->orig.out.result;
4601
4602         tevent_req_received(req);
4603         return NT_STATUS_OK;
4604 }
4605
4606 NTSTATUS rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct rpc_pipe_client *cli,
4607                                                   TALLOC_CTX *mem_ctx,
4608                                                   WERROR *werror)
4609 {
4610         struct netr_NETRLOGONCOMPUTECLIENTDIGEST r;
4611         NTSTATUS status;
4612
4613         /* In parameters */
4614
4615         if (DEBUGLEVEL >= 10) {
4616                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, &r);
4617         }
4618
4619         status = cli->dispatch(cli,
4620                                 mem_ctx,
4621                                 &ndr_table_netlogon,
4622                                 NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST,
4623                                 &r);
4624
4625         if (!NT_STATUS_IS_OK(status)) {
4626                 return status;
4627         }
4628
4629         if (DEBUGLEVEL >= 10) {
4630                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, &r);
4631         }
4632
4633         if (NT_STATUS_IS_ERR(status)) {
4634                 return status;
4635         }
4636
4637         /* Return variables */
4638
4639         /* Return result */
4640         if (werror) {
4641                 *werror = r.out.result;
4642         }
4643
4644         return werror_to_ntstatus(r.out.result);
4645 }
4646
4647 struct rpccli_netr_ServerAuthenticate3_state {
4648         struct netr_ServerAuthenticate3 orig;
4649         struct netr_ServerAuthenticate3 tmp;
4650         TALLOC_CTX *out_mem_ctx;
4651         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4652 };
4653
4654 static void rpccli_netr_ServerAuthenticate3_done(struct tevent_req *subreq);
4655
4656 struct tevent_req *rpccli_netr_ServerAuthenticate3_send(TALLOC_CTX *mem_ctx,
4657                                                         struct tevent_context *ev,
4658                                                         struct rpc_pipe_client *cli,
4659                                                         const char *_server_name /* [in] [unique,charset(UTF16)] */,
4660                                                         const char *_account_name /* [in] [ref,charset(UTF16)] */,
4661                                                         enum netr_SchannelType _secure_channel_type /* [in]  */,
4662                                                         const char *_computer_name /* [in] [ref,charset(UTF16)] */,
4663                                                         struct netr_Credential *_credentials /* [in] [ref] */,
4664                                                         struct netr_Credential *_return_credentials /* [out] [ref] */,
4665                                                         uint32_t *_negotiate_flags /* [in,out] [ref] */,
4666                                                         uint32_t *_rid /* [out] [ref] */)
4667 {
4668         struct tevent_req *req;
4669         struct rpccli_netr_ServerAuthenticate3_state *state;
4670         struct tevent_req *subreq;
4671
4672         req = tevent_req_create(mem_ctx, &state,
4673                                 struct rpccli_netr_ServerAuthenticate3_state);
4674         if (req == NULL) {
4675                 return NULL;
4676         }
4677         state->out_mem_ctx = NULL;
4678         state->dispatch_recv = cli->dispatch_recv;
4679
4680         /* In parameters */
4681         state->orig.in.server_name = _server_name;
4682         state->orig.in.account_name = _account_name;
4683         state->orig.in.secure_channel_type = _secure_channel_type;
4684         state->orig.in.computer_name = _computer_name;
4685         state->orig.in.credentials = _credentials;
4686         state->orig.in.negotiate_flags = _negotiate_flags;
4687
4688         /* Out parameters */
4689         state->orig.out.return_credentials = _return_credentials;
4690         state->orig.out.negotiate_flags = _negotiate_flags;
4691         state->orig.out.rid = _rid;
4692
4693         /* Result */
4694         ZERO_STRUCT(state->orig.out.result);
4695
4696         if (DEBUGLEVEL >= 10) {
4697                 NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate3, &state->orig);
4698         }
4699
4700         state->out_mem_ctx = talloc_named_const(state, 0,
4701                              "rpccli_netr_ServerAuthenticate3_out_memory");
4702         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4703                 return tevent_req_post(req, ev);
4704         }
4705
4706         /* make a temporary copy, that we pass to the dispatch function */
4707         state->tmp = state->orig;
4708
4709         subreq = cli->dispatch_send(state, ev, cli,
4710                                     &ndr_table_netlogon,
4711                                     NDR_NETR_SERVERAUTHENTICATE3,
4712                                     &state->tmp);
4713         if (tevent_req_nomem(subreq, req)) {
4714                 return tevent_req_post(req, ev);
4715         }
4716         tevent_req_set_callback(subreq, rpccli_netr_ServerAuthenticate3_done, req);
4717         return req;
4718 }
4719
4720 static void rpccli_netr_ServerAuthenticate3_done(struct tevent_req *subreq)
4721 {
4722         struct tevent_req *req = tevent_req_callback_data(
4723                 subreq, struct tevent_req);
4724         struct rpccli_netr_ServerAuthenticate3_state *state = tevent_req_data(
4725                 req, struct rpccli_netr_ServerAuthenticate3_state);
4726         NTSTATUS status;
4727         TALLOC_CTX *mem_ctx;
4728
4729         if (state->out_mem_ctx) {
4730                 mem_ctx = state->out_mem_ctx;
4731         } else {
4732                 mem_ctx = state;
4733         }
4734
4735         status = state->dispatch_recv(subreq, mem_ctx);
4736         TALLOC_FREE(subreq);
4737         if (!NT_STATUS_IS_OK(status)) {
4738                 tevent_req_nterror(req, status);
4739                 return;
4740         }
4741
4742         /* Copy out parameters */
4743         *state->orig.out.return_credentials = *state->tmp.out.return_credentials;
4744         *state->orig.out.negotiate_flags = *state->tmp.out.negotiate_flags;
4745         *state->orig.out.rid = *state->tmp.out.rid;
4746
4747         /* Copy result */
4748         state->orig.out.result = state->tmp.out.result;
4749
4750         /* Reset temporary structure */
4751         ZERO_STRUCT(state->tmp);
4752
4753         if (DEBUGLEVEL >= 10) {
4754                 NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate3, &state->orig);
4755         }
4756
4757         tevent_req_done(req);
4758 }
4759
4760 NTSTATUS rpccli_netr_ServerAuthenticate3_recv(struct tevent_req *req,
4761                                               TALLOC_CTX *mem_ctx,
4762                                               NTSTATUS *result)
4763 {
4764         struct rpccli_netr_ServerAuthenticate3_state *state = tevent_req_data(
4765                 req, struct rpccli_netr_ServerAuthenticate3_state);
4766         NTSTATUS status;
4767
4768         if (tevent_req_is_nterror(req, &status)) {
4769                 tevent_req_received(req);
4770                 return status;
4771         }
4772
4773         /* Steal possbile out parameters to the callers context */
4774         talloc_steal(mem_ctx, state->out_mem_ctx);
4775
4776         /* Return result */
4777         *result = state->orig.out.result;
4778
4779         tevent_req_received(req);
4780         return NT_STATUS_OK;
4781 }
4782
4783 NTSTATUS rpccli_netr_ServerAuthenticate3(struct rpc_pipe_client *cli,
4784                                          TALLOC_CTX *mem_ctx,
4785                                          const char *server_name /* [in] [unique,charset(UTF16)] */,
4786                                          const char *account_name /* [in] [ref,charset(UTF16)] */,
4787                                          enum netr_SchannelType secure_channel_type /* [in]  */,
4788                                          const char *computer_name /* [in] [ref,charset(UTF16)] */,
4789                                          struct netr_Credential *credentials /* [in] [ref] */,
4790                                          struct netr_Credential *return_credentials /* [out] [ref] */,
4791                                          uint32_t *negotiate_flags /* [in,out] [ref] */,
4792                                          uint32_t *rid /* [out] [ref] */)
4793 {
4794         struct netr_ServerAuthenticate3 r;
4795         NTSTATUS status;
4796
4797         /* In parameters */
4798         r.in.server_name = server_name;
4799         r.in.account_name = account_name;
4800         r.in.secure_channel_type = secure_channel_type;
4801         r.in.computer_name = computer_name;
4802         r.in.credentials = credentials;
4803         r.in.negotiate_flags = negotiate_flags;
4804
4805         if (DEBUGLEVEL >= 10) {
4806                 NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate3, &r);
4807         }
4808
4809         status = cli->dispatch(cli,
4810                                 mem_ctx,
4811                                 &ndr_table_netlogon,
4812                                 NDR_NETR_SERVERAUTHENTICATE3,
4813                                 &r);
4814
4815         if (!NT_STATUS_IS_OK(status)) {
4816                 return status;
4817         }
4818
4819         if (DEBUGLEVEL >= 10) {
4820                 NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate3, &r);
4821         }
4822
4823         if (NT_STATUS_IS_ERR(status)) {
4824                 return status;
4825         }
4826
4827         /* Return variables */
4828         *return_credentials = *r.out.return_credentials;
4829         *negotiate_flags = *r.out.negotiate_flags;
4830         *rid = *r.out.rid;
4831
4832         /* Return result */
4833         return r.out.result;
4834 }
4835
4836 struct rpccli_netr_DsRGetDCNameEx_state {
4837         struct netr_DsRGetDCNameEx orig;
4838         struct netr_DsRGetDCNameEx tmp;
4839         TALLOC_CTX *out_mem_ctx;
4840         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4841 };
4842
4843 static void rpccli_netr_DsRGetDCNameEx_done(struct tevent_req *subreq);
4844
4845 struct tevent_req *rpccli_netr_DsRGetDCNameEx_send(TALLOC_CTX *mem_ctx,
4846                                                    struct tevent_context *ev,
4847                                                    struct rpc_pipe_client *cli,
4848                                                    const char *_server_unc /* [in] [unique,charset(UTF16)] */,
4849                                                    const char *_domain_name /* [in] [unique,charset(UTF16)] */,
4850                                                    struct GUID *_domain_guid /* [in] [unique] */,
4851                                                    const char *_site_name /* [in] [unique,charset(UTF16)] */,
4852                                                    uint32_t _flags /* [in]  */,
4853                                                    struct netr_DsRGetDCNameInfo **_info /* [out] [ref] */)
4854 {
4855         struct tevent_req *req;
4856         struct rpccli_netr_DsRGetDCNameEx_state *state;
4857         struct tevent_req *subreq;
4858
4859         req = tevent_req_create(mem_ctx, &state,
4860                                 struct rpccli_netr_DsRGetDCNameEx_state);
4861         if (req == NULL) {
4862                 return NULL;
4863         }
4864         state->out_mem_ctx = NULL;
4865         state->dispatch_recv = cli->dispatch_recv;
4866
4867         /* In parameters */
4868         state->orig.in.server_unc = _server_unc;
4869         state->orig.in.domain_name = _domain_name;
4870         state->orig.in.domain_guid = _domain_guid;
4871         state->orig.in.site_name = _site_name;
4872         state->orig.in.flags = _flags;
4873
4874         /* Out parameters */
4875         state->orig.out.info = _info;
4876
4877         /* Result */
4878         ZERO_STRUCT(state->orig.out.result);
4879
4880         if (DEBUGLEVEL >= 10) {
4881                 NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx, &state->orig);
4882         }
4883
4884         state->out_mem_ctx = talloc_named_const(state, 0,
4885                              "rpccli_netr_DsRGetDCNameEx_out_memory");
4886         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4887                 return tevent_req_post(req, ev);
4888         }
4889
4890         /* make a temporary copy, that we pass to the dispatch function */
4891         state->tmp = state->orig;
4892
4893         subreq = cli->dispatch_send(state, ev, cli,
4894                                     &ndr_table_netlogon,
4895                                     NDR_NETR_DSRGETDCNAMEEX,
4896                                     &state->tmp);
4897         if (tevent_req_nomem(subreq, req)) {
4898                 return tevent_req_post(req, ev);
4899         }
4900         tevent_req_set_callback(subreq, rpccli_netr_DsRGetDCNameEx_done, req);
4901         return req;
4902 }
4903
4904 static void rpccli_netr_DsRGetDCNameEx_done(struct tevent_req *subreq)
4905 {
4906         struct tevent_req *req = tevent_req_callback_data(
4907                 subreq, struct tevent_req);
4908         struct rpccli_netr_DsRGetDCNameEx_state *state = tevent_req_data(
4909                 req, struct rpccli_netr_DsRGetDCNameEx_state);
4910         NTSTATUS status;
4911         TALLOC_CTX *mem_ctx;
4912
4913         if (state->out_mem_ctx) {
4914                 mem_ctx = state->out_mem_ctx;
4915         } else {
4916                 mem_ctx = state;
4917         }
4918
4919         status = state->dispatch_recv(subreq, mem_ctx);
4920         TALLOC_FREE(subreq);
4921         if (!NT_STATUS_IS_OK(status)) {
4922                 tevent_req_nterror(req, status);
4923                 return;
4924         }
4925
4926         /* Copy out parameters */
4927         *state->orig.out.info = *state->tmp.out.info;
4928
4929         /* Copy result */
4930         state->orig.out.result = state->tmp.out.result;
4931
4932         /* Reset temporary structure */
4933         ZERO_STRUCT(state->tmp);
4934
4935         if (DEBUGLEVEL >= 10) {
4936                 NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx, &state->orig);
4937         }
4938
4939         tevent_req_done(req);
4940 }
4941
4942 NTSTATUS rpccli_netr_DsRGetDCNameEx_recv(struct tevent_req *req,
4943                                          TALLOC_CTX *mem_ctx,
4944                                          WERROR *result)
4945 {
4946         struct rpccli_netr_DsRGetDCNameEx_state *state = tevent_req_data(
4947                 req, struct rpccli_netr_DsRGetDCNameEx_state);
4948         NTSTATUS status;
4949
4950         if (tevent_req_is_nterror(req, &status)) {
4951                 tevent_req_received(req);
4952                 return status;
4953         }
4954
4955         /* Steal possbile out parameters to the callers context */
4956         talloc_steal(mem_ctx, state->out_mem_ctx);
4957
4958         /* Return result */
4959         *result = state->orig.out.result;
4960
4961         tevent_req_received(req);
4962         return NT_STATUS_OK;
4963 }
4964
4965 NTSTATUS rpccli_netr_DsRGetDCNameEx(struct rpc_pipe_client *cli,
4966                                     TALLOC_CTX *mem_ctx,
4967                                     const char *server_unc /* [in] [unique,charset(UTF16)] */,
4968                                     const char *domain_name /* [in] [unique,charset(UTF16)] */,
4969                                     struct GUID *domain_guid /* [in] [unique] */,
4970                                     const char *site_name /* [in] [unique,charset(UTF16)] */,
4971                                     uint32_t flags /* [in]  */,
4972                                     struct netr_DsRGetDCNameInfo **info /* [out] [ref] */,
4973                                     WERROR *werror)
4974 {
4975         struct netr_DsRGetDCNameEx r;
4976         NTSTATUS status;
4977
4978         /* In parameters */
4979         r.in.server_unc = server_unc;
4980         r.in.domain_name = domain_name;
4981         r.in.domain_guid = domain_guid;
4982         r.in.site_name = site_name;
4983         r.in.flags = flags;
4984
4985         if (DEBUGLEVEL >= 10) {
4986                 NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx, &r);
4987         }
4988
4989         status = cli->dispatch(cli,
4990                                 mem_ctx,
4991                                 &ndr_table_netlogon,
4992                                 NDR_NETR_DSRGETDCNAMEEX,
4993                                 &r);
4994
4995         if (!NT_STATUS_IS_OK(status)) {
4996                 return status;
4997         }
4998
4999         if (DEBUGLEVEL >= 10) {
5000                 NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx, &r);
5001         }
5002
5003         if (NT_STATUS_IS_ERR(status)) {
5004                 return status;
5005         }
5006
5007         /* Return variables */
5008         *info = *r.out.info;
5009
5010         /* Return result */
5011         if (werror) {
5012                 *werror = r.out.result;
5013         }
5014
5015         return werror_to_ntstatus(r.out.result);
5016 }
5017
5018 struct rpccli_netr_DsRGetSiteName_state {
5019         struct netr_DsRGetSiteName orig;
5020         struct netr_DsRGetSiteName tmp;
5021         TALLOC_CTX *out_mem_ctx;
5022         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5023 };
5024
5025 static void rpccli_netr_DsRGetSiteName_done(struct tevent_req *subreq);
5026
5027 struct tevent_req *rpccli_netr_DsRGetSiteName_send(TALLOC_CTX *mem_ctx,
5028                                                    struct tevent_context *ev,
5029                                                    struct rpc_pipe_client *cli,
5030                                                    const char *_computer_name /* [in] [unique,charset(UTF16)] */,
5031                                                    const char **_site /* [out] [ref,charset(UTF16)] */)
5032 {
5033         struct tevent_req *req;
5034         struct rpccli_netr_DsRGetSiteName_state *state;
5035         struct tevent_req *subreq;
5036
5037         req = tevent_req_create(mem_ctx, &state,
5038                                 struct rpccli_netr_DsRGetSiteName_state);
5039         if (req == NULL) {
5040                 return NULL;
5041         }
5042         state->out_mem_ctx = NULL;
5043         state->dispatch_recv = cli->dispatch_recv;
5044
5045         /* In parameters */
5046         state->orig.in.computer_name = _computer_name;
5047
5048         /* Out parameters */
5049         state->orig.out.site = _site;
5050
5051         /* Result */
5052         ZERO_STRUCT(state->orig.out.result);
5053
5054         if (DEBUGLEVEL >= 10) {
5055                 NDR_PRINT_IN_DEBUG(netr_DsRGetSiteName, &state->orig);
5056         }
5057
5058         state->out_mem_ctx = talloc_named_const(state, 0,
5059                              "rpccli_netr_DsRGetSiteName_out_memory");
5060         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5061                 return tevent_req_post(req, ev);
5062         }
5063
5064         /* make a temporary copy, that we pass to the dispatch function */
5065         state->tmp = state->orig;
5066
5067         subreq = cli->dispatch_send(state, ev, cli,
5068                                     &ndr_table_netlogon,
5069                                     NDR_NETR_DSRGETSITENAME,
5070                                     &state->tmp);
5071         if (tevent_req_nomem(subreq, req)) {
5072                 return tevent_req_post(req, ev);
5073         }
5074         tevent_req_set_callback(subreq, rpccli_netr_DsRGetSiteName_done, req);
5075         return req;
5076 }
5077
5078 static void rpccli_netr_DsRGetSiteName_done(struct tevent_req *subreq)
5079 {
5080         struct tevent_req *req = tevent_req_callback_data(
5081                 subreq, struct tevent_req);
5082         struct rpccli_netr_DsRGetSiteName_state *state = tevent_req_data(
5083                 req, struct rpccli_netr_DsRGetSiteName_state);
5084         NTSTATUS status;
5085         TALLOC_CTX *mem_ctx;
5086
5087         if (state->out_mem_ctx) {
5088                 mem_ctx = state->out_mem_ctx;
5089         } else {
5090                 mem_ctx = state;
5091         }
5092
5093         status = state->dispatch_recv(subreq, mem_ctx);
5094         TALLOC_FREE(subreq);
5095         if (!NT_STATUS_IS_OK(status)) {
5096                 tevent_req_nterror(req, status);
5097                 return;
5098         }
5099
5100         /* Copy out parameters */
5101         *state->orig.out.site = *state->tmp.out.site;
5102
5103         /* Copy result */
5104         state->orig.out.result = state->tmp.out.result;
5105
5106         /* Reset temporary structure */
5107         ZERO_STRUCT(state->tmp);
5108
5109         if (DEBUGLEVEL >= 10) {
5110                 NDR_PRINT_OUT_DEBUG(netr_DsRGetSiteName, &state->orig);
5111         }
5112
5113         tevent_req_done(req);
5114 }
5115
5116 NTSTATUS rpccli_netr_DsRGetSiteName_recv(struct tevent_req *req,
5117                                          TALLOC_CTX *mem_ctx,
5118                                          WERROR *result)
5119 {
5120         struct rpccli_netr_DsRGetSiteName_state *state = tevent_req_data(
5121                 req, struct rpccli_netr_DsRGetSiteName_state);
5122         NTSTATUS status;
5123
5124         if (tevent_req_is_nterror(req, &status)) {
5125                 tevent_req_received(req);
5126                 return status;
5127         }
5128
5129         /* Steal possbile out parameters to the callers context */
5130         talloc_steal(mem_ctx, state->out_mem_ctx);
5131
5132         /* Return result */
5133         *result = state->orig.out.result;
5134
5135         tevent_req_received(req);
5136         return NT_STATUS_OK;
5137 }
5138
5139 NTSTATUS rpccli_netr_DsRGetSiteName(struct rpc_pipe_client *cli,
5140                                     TALLOC_CTX *mem_ctx,
5141                                     const char *computer_name /* [in] [unique,charset(UTF16)] */,
5142                                     const char **site /* [out] [ref,charset(UTF16)] */,
5143                                     WERROR *werror)
5144 {
5145         struct netr_DsRGetSiteName r;
5146         NTSTATUS status;
5147
5148         /* In parameters */
5149         r.in.computer_name = computer_name;
5150
5151         if (DEBUGLEVEL >= 10) {
5152                 NDR_PRINT_IN_DEBUG(netr_DsRGetSiteName, &r);
5153         }
5154
5155         status = cli->dispatch(cli,
5156                                 mem_ctx,
5157                                 &ndr_table_netlogon,
5158                                 NDR_NETR_DSRGETSITENAME,
5159                                 &r);
5160
5161         if (!NT_STATUS_IS_OK(status)) {
5162                 return status;
5163         }
5164
5165         if (DEBUGLEVEL >= 10) {
5166                 NDR_PRINT_OUT_DEBUG(netr_DsRGetSiteName, &r);
5167         }
5168
5169         if (NT_STATUS_IS_ERR(status)) {
5170                 return status;
5171         }
5172
5173         /* Return variables */
5174         *site = *r.out.site;
5175
5176         /* Return result */
5177         if (werror) {
5178                 *werror = r.out.result;
5179         }
5180
5181         return werror_to_ntstatus(r.out.result);
5182 }
5183
5184 struct rpccli_netr_LogonGetDomainInfo_state {
5185         struct netr_LogonGetDomainInfo orig;
5186         struct netr_LogonGetDomainInfo tmp;
5187         TALLOC_CTX *out_mem_ctx;
5188         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5189 };
5190
5191 static void rpccli_netr_LogonGetDomainInfo_done(struct tevent_req *subreq);
5192
5193 struct tevent_req *rpccli_netr_LogonGetDomainInfo_send(TALLOC_CTX *mem_ctx,
5194                                                        struct tevent_context *ev,
5195                                                        struct rpc_pipe_client *cli,
5196                                                        const char *_server_name /* [in] [ref,charset(UTF16)] */,
5197                                                        const char *_computer_name /* [in] [unique,charset(UTF16)] */,
5198                                                        struct netr_Authenticator *_credential /* [in] [ref] */,
5199                                                        struct netr_Authenticator *_return_authenticator /* [in,out] [ref] */,
5200                                                        uint32_t _level /* [in]  */,
5201                                                        union netr_WorkstationInfo *_query /* [in] [ref,switch_is(level)] */,
5202                                                        union netr_DomainInfo *_info /* [out] [ref,switch_is(level)] */)
5203 {
5204         struct tevent_req *req;
5205         struct rpccli_netr_LogonGetDomainInfo_state *state;
5206         struct tevent_req *subreq;
5207
5208         req = tevent_req_create(mem_ctx, &state,
5209                                 struct rpccli_netr_LogonGetDomainInfo_state);
5210         if (req == NULL) {
5211                 return NULL;
5212         }
5213         state->out_mem_ctx = NULL;
5214         state->dispatch_recv = cli->dispatch_recv;
5215
5216         /* In parameters */
5217         state->orig.in.server_name = _server_name;
5218         state->orig.in.computer_name = _computer_name;
5219         state->orig.in.credential = _credential;
5220         state->orig.in.return_authenticator = _return_authenticator;
5221         state->orig.in.level = _level;
5222         state->orig.in.query = _query;
5223
5224         /* Out parameters */
5225         state->orig.out.return_authenticator = _return_authenticator;
5226         state->orig.out.info = _info;
5227
5228         /* Result */
5229         ZERO_STRUCT(state->orig.out.result);
5230
5231         if (DEBUGLEVEL >= 10) {
5232                 NDR_PRINT_IN_DEBUG(netr_LogonGetDomainInfo, &state->orig);
5233         }
5234
5235         state->out_mem_ctx = talloc_named_const(state, 0,
5236                              "rpccli_netr_LogonGetDomainInfo_out_memory");
5237         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5238                 return tevent_req_post(req, ev);
5239         }
5240
5241         /* make a temporary copy, that we pass to the dispatch function */
5242         state->tmp = state->orig;
5243
5244         subreq = cli->dispatch_send(state, ev, cli,
5245                                     &ndr_table_netlogon,
5246                                     NDR_NETR_LOGONGETDOMAININFO,
5247                                     &state->tmp);
5248         if (tevent_req_nomem(subreq, req)) {
5249                 return tevent_req_post(req, ev);
5250         }
5251         tevent_req_set_callback(subreq, rpccli_netr_LogonGetDomainInfo_done, req);
5252         return req;
5253 }
5254
5255 static void rpccli_netr_LogonGetDomainInfo_done(struct tevent_req *subreq)
5256 {
5257         struct tevent_req *req = tevent_req_callback_data(
5258                 subreq, struct tevent_req);
5259         struct rpccli_netr_LogonGetDomainInfo_state *state = tevent_req_data(
5260                 req, struct rpccli_netr_LogonGetDomainInfo_state);
5261         NTSTATUS status;
5262         TALLOC_CTX *mem_ctx;
5263
5264         if (state->out_mem_ctx) {
5265                 mem_ctx = state->out_mem_ctx;
5266         } else {
5267                 mem_ctx = state;
5268         }
5269
5270         status = state->dispatch_recv(subreq, mem_ctx);
5271         TALLOC_FREE(subreq);
5272         if (!NT_STATUS_IS_OK(status)) {
5273                 tevent_req_nterror(req, status);
5274                 return;
5275         }
5276
5277         /* Copy out parameters */
5278         *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
5279         *state->orig.out.info = *state->tmp.out.info;
5280
5281         /* Copy result */
5282         state->orig.out.result = state->tmp.out.result;
5283
5284         /* Reset temporary structure */
5285         ZERO_STRUCT(state->tmp);
5286
5287         if (DEBUGLEVEL >= 10) {
5288                 NDR_PRINT_OUT_DEBUG(netr_LogonGetDomainInfo, &state->orig);
5289         }
5290
5291         tevent_req_done(req);
5292 }
5293
5294 NTSTATUS rpccli_netr_LogonGetDomainInfo_recv(struct tevent_req *req,
5295                                              TALLOC_CTX *mem_ctx,
5296                                              NTSTATUS *result)
5297 {
5298         struct rpccli_netr_LogonGetDomainInfo_state *state = tevent_req_data(
5299                 req, struct rpccli_netr_LogonGetDomainInfo_state);
5300         NTSTATUS status;
5301
5302         if (tevent_req_is_nterror(req, &status)) {
5303                 tevent_req_received(req);
5304                 return status;
5305         }
5306
5307         /* Steal possbile out parameters to the callers context */
5308         talloc_steal(mem_ctx, state->out_mem_ctx);
5309
5310         /* Return result */
5311         *result = state->orig.out.result;
5312
5313         tevent_req_received(req);
5314         return NT_STATUS_OK;
5315 }
5316
5317 NTSTATUS rpccli_netr_LogonGetDomainInfo(struct rpc_pipe_client *cli,
5318                                         TALLOC_CTX *mem_ctx,
5319                                         const char *server_name /* [in] [ref,charset(UTF16)] */,
5320                                         const char *computer_name /* [in] [unique,charset(UTF16)] */,
5321                                         struct netr_Authenticator *credential /* [in] [ref] */,
5322                                         struct netr_Authenticator *return_authenticator /* [in,out] [ref] */,
5323                                         uint32_t level /* [in]  */,
5324                                         union netr_WorkstationInfo *query /* [in] [ref,switch_is(level)] */,
5325                                         union netr_DomainInfo *info /* [out] [ref,switch_is(level)] */)
5326 {
5327         struct netr_LogonGetDomainInfo r;
5328         NTSTATUS status;
5329
5330         /* In parameters */
5331         r.in.server_name = server_name;
5332         r.in.computer_name = computer_name;
5333         r.in.credential = credential;
5334         r.in.return_authenticator = return_authenticator;
5335         r.in.level = level;
5336         r.in.query = query;
5337
5338         if (DEBUGLEVEL >= 10) {
5339                 NDR_PRINT_IN_DEBUG(netr_LogonGetDomainInfo, &r);
5340         }
5341
5342         status = cli->dispatch(cli,
5343                                 mem_ctx,
5344                                 &ndr_table_netlogon,
5345                                 NDR_NETR_LOGONGETDOMAININFO,
5346                                 &r);
5347
5348         if (!NT_STATUS_IS_OK(status)) {
5349                 return status;
5350         }
5351
5352         if (DEBUGLEVEL >= 10) {
5353                 NDR_PRINT_OUT_DEBUG(netr_LogonGetDomainInfo, &r);
5354         }
5355
5356         if (NT_STATUS_IS_ERR(status)) {
5357                 return status;
5358         }
5359
5360         /* Return variables */
5361         *return_authenticator = *r.out.return_authenticator;
5362         *info = *r.out.info;
5363
5364         /* Return result */
5365         return r.out.result;
5366 }
5367
5368 struct rpccli_netr_ServerPasswordSet2_state {
5369         struct netr_ServerPasswordSet2 orig;
5370         struct netr_ServerPasswordSet2 tmp;
5371         TALLOC_CTX *out_mem_ctx;
5372         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5373 };
5374
5375 static void rpccli_netr_ServerPasswordSet2_done(struct tevent_req *subreq);
5376
5377 struct tevent_req *rpccli_netr_ServerPasswordSet2_send(TALLOC_CTX *mem_ctx,
5378                                                        struct tevent_context *ev,
5379                                                        struct rpc_pipe_client *cli,
5380                                                        const char *_server_name /* [in] [unique,charset(UTF16)] */,
5381                                                        const char *_account_name /* [in] [ref,charset(UTF16)] */,
5382                                                        enum netr_SchannelType _secure_channel_type /* [in]  */,
5383                                                        const char *_computer_name /* [in] [ref,charset(UTF16)] */,
5384                                                        struct netr_Authenticator *_credential /* [in] [ref] */,
5385                                                        struct netr_Authenticator *_return_authenticator /* [out] [ref] */,
5386                                                        struct netr_CryptPassword *_new_password /* [in] [ref] */)
5387 {
5388         struct tevent_req *req;
5389         struct rpccli_netr_ServerPasswordSet2_state *state;
5390         struct tevent_req *subreq;
5391
5392         req = tevent_req_create(mem_ctx, &state,
5393                                 struct rpccli_netr_ServerPasswordSet2_state);
5394         if (req == NULL) {
5395                 return NULL;
5396         }
5397         state->out_mem_ctx = NULL;
5398         state->dispatch_recv = cli->dispatch_recv;
5399
5400         /* In parameters */
5401         state->orig.in.server_name = _server_name;
5402         state->orig.in.account_name = _account_name;
5403         state->orig.in.secure_channel_type = _secure_channel_type;
5404         state->orig.in.computer_name = _computer_name;
5405         state->orig.in.credential = _credential;
5406         state->orig.in.new_password = _new_password;
5407
5408         /* Out parameters */
5409         state->orig.out.return_authenticator = _return_authenticator;
5410
5411         /* Result */
5412         ZERO_STRUCT(state->orig.out.result);
5413
5414         if (DEBUGLEVEL >= 10) {
5415                 NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet2, &state->orig);
5416         }
5417
5418         state->out_mem_ctx = talloc_named_const(state, 0,
5419                              "rpccli_netr_ServerPasswordSet2_out_memory");
5420         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5421                 return tevent_req_post(req, ev);
5422         }
5423
5424         /* make a temporary copy, that we pass to the dispatch function */
5425         state->tmp = state->orig;
5426
5427         subreq = cli->dispatch_send(state, ev, cli,
5428                                     &ndr_table_netlogon,
5429                                     NDR_NETR_SERVERPASSWORDSET2,
5430                                     &state->tmp);
5431         if (tevent_req_nomem(subreq, req)) {
5432                 return tevent_req_post(req, ev);
5433         }
5434         tevent_req_set_callback(subreq, rpccli_netr_ServerPasswordSet2_done, req);
5435         return req;
5436 }
5437
5438 static void rpccli_netr_ServerPasswordSet2_done(struct tevent_req *subreq)
5439 {
5440         struct tevent_req *req = tevent_req_callback_data(
5441                 subreq, struct tevent_req);
5442         struct rpccli_netr_ServerPasswordSet2_state *state = tevent_req_data(
5443                 req, struct rpccli_netr_ServerPasswordSet2_state);
5444         NTSTATUS status;
5445         TALLOC_CTX *mem_ctx;
5446
5447         if (state->out_mem_ctx) {
5448                 mem_ctx = state->out_mem_ctx;
5449         } else {
5450                 mem_ctx = state;
5451         }
5452
5453         status = state->dispatch_recv(subreq, mem_ctx);
5454         TALLOC_FREE(subreq);
5455         if (!NT_STATUS_IS_OK(status)) {
5456                 tevent_req_nterror(req, status);
5457                 return;
5458         }
5459
5460         /* Copy out parameters */
5461         *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
5462
5463         /* Copy result */
5464         state->orig.out.result = state->tmp.out.result;
5465
5466         /* Reset temporary structure */
5467         ZERO_STRUCT(state->tmp);
5468
5469         if (DEBUGLEVEL >= 10) {
5470                 NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet2, &state->orig);
5471         }
5472
5473         tevent_req_done(req);
5474 }
5475
5476 NTSTATUS rpccli_netr_ServerPasswordSet2_recv(struct tevent_req *req,
5477                                              TALLOC_CTX *mem_ctx,
5478                                              NTSTATUS *result)
5479 {
5480         struct rpccli_netr_ServerPasswordSet2_state *state = tevent_req_data(
5481                 req, struct rpccli_netr_ServerPasswordSet2_state);
5482         NTSTATUS status;
5483
5484         if (tevent_req_is_nterror(req, &status)) {
5485                 tevent_req_received(req);
5486                 return status;
5487         }
5488
5489         /* Steal possbile out parameters to the callers context */
5490         talloc_steal(mem_ctx, state->out_mem_ctx);
5491
5492         /* Return result */
5493         *result = state->orig.out.result;
5494
5495         tevent_req_received(req);
5496         return NT_STATUS_OK;
5497 }
5498
5499 NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli,
5500                                         TALLOC_CTX *mem_ctx,
5501                                         const char *server_name /* [in] [unique,charset(UTF16)] */,
5502                                         const char *account_name /* [in] [ref,charset(UTF16)] */,
5503                                         enum netr_SchannelType secure_channel_type /* [in]  */,
5504                                         const char *computer_name /* [in] [ref,charset(UTF16)] */,
5505                                         struct netr_Authenticator *credential /* [in] [ref] */,
5506                                         struct netr_Authenticator *return_authenticator /* [out] [ref] */,
5507                                         struct netr_CryptPassword *new_password /* [in] [ref] */)
5508 {
5509         struct netr_ServerPasswordSet2 r;
5510         NTSTATUS status;
5511
5512         /* In parameters */
5513         r.in.server_name = server_name;
5514         r.in.account_name = account_name;
5515         r.in.secure_channel_type = secure_channel_type;
5516         r.in.computer_name = computer_name;
5517         r.in.credential = credential;
5518         r.in.new_password = new_password;
5519
5520         if (DEBUGLEVEL >= 10) {
5521                 NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet2, &r);
5522         }
5523
5524         status = cli->dispatch(cli,
5525                                 mem_ctx,
5526                                 &ndr_table_netlogon,
5527                                 NDR_NETR_SERVERPASSWORDSET2,
5528                                 &r);
5529
5530         if (!NT_STATUS_IS_OK(status)) {
5531                 return status;
5532         }
5533
5534         if (DEBUGLEVEL >= 10) {
5535                 NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet2, &r);
5536         }
5537
5538         if (NT_STATUS_IS_ERR(status)) {
5539                 return status;
5540         }
5541
5542         /* Return variables */
5543         *return_authenticator = *r.out.return_authenticator;
5544
5545         /* Return result */
5546         return r.out.result;
5547 }
5548
5549 struct rpccli_netr_ServerPasswordGet_state {
5550         struct netr_ServerPasswordGet orig;
5551         struct netr_ServerPasswordGet tmp;
5552         TALLOC_CTX *out_mem_ctx;
5553         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5554 };
5555
5556 static void rpccli_netr_ServerPasswordGet_done(struct tevent_req *subreq);
5557
5558 struct tevent_req *rpccli_netr_ServerPasswordGet_send(TALLOC_CTX *mem_ctx,
5559                                                       struct tevent_context *ev,
5560                                                       struct rpc_pipe_client *cli,
5561                                                       const char *_server_name /* [in] [unique,charset(UTF16)] */,
5562                                                       const char *_account_name /* [in] [ref,charset(UTF16)] */,
5563                                                       enum netr_SchannelType _secure_channel_type /* [in]  */,
5564                                                       const char *_computer_name /* [in] [ref,charset(UTF16)] */,
5565                                                       struct netr_Authenticator *_credential /* [in] [ref] */,
5566                                                       struct netr_Authenticator *_return_authenticator /* [out] [ref] */,
5567                                                       struct samr_Password *_password /* [out] [ref] */)
5568 {
5569         struct tevent_req *req;
5570         struct rpccli_netr_ServerPasswordGet_state *state;
5571         struct tevent_req *subreq;
5572
5573         req = tevent_req_create(mem_ctx, &state,
5574                                 struct rpccli_netr_ServerPasswordGet_state);
5575         if (req == NULL) {
5576                 return NULL;
5577         }
5578         state->out_mem_ctx = NULL;
5579         state->dispatch_recv = cli->dispatch_recv;
5580
5581         /* In parameters */
5582         state->orig.in.server_name = _server_name;
5583         state->orig.in.account_name = _account_name;
5584         state->orig.in.secure_channel_type = _secure_channel_type;
5585         state->orig.in.computer_name = _computer_name;
5586         state->orig.in.credential = _credential;
5587
5588         /* Out parameters */
5589         state->orig.out.return_authenticator = _return_authenticator;
5590         state->orig.out.password = _password;
5591
5592         /* Result */
5593         ZERO_STRUCT(state->orig.out.result);
5594
5595         if (DEBUGLEVEL >= 10) {
5596                 NDR_PRINT_IN_DEBUG(netr_ServerPasswordGet, &state->orig);
5597         }
5598
5599         state->out_mem_ctx = talloc_named_const(state, 0,
5600                              "rpccli_netr_ServerPasswordGet_out_memory");
5601         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5602                 return tevent_req_post(req, ev);
5603         }
5604
5605         /* make a temporary copy, that we pass to the dispatch function */
5606         state->tmp = state->orig;
5607
5608         subreq = cli->dispatch_send(state, ev, cli,
5609                                     &ndr_table_netlogon,
5610                                     NDR_NETR_SERVERPASSWORDGET,
5611                                     &state->tmp);
5612         if (tevent_req_nomem(subreq, req)) {
5613                 return tevent_req_post(req, ev);
5614         }
5615         tevent_req_set_callback(subreq, rpccli_netr_ServerPasswordGet_done, req);
5616         return req;
5617 }
5618
5619 static void rpccli_netr_ServerPasswordGet_done(struct tevent_req *subreq)
5620 {
5621         struct tevent_req *req = tevent_req_callback_data(
5622                 subreq, struct tevent_req);
5623         struct rpccli_netr_ServerPasswordGet_state *state = tevent_req_data(
5624                 req, struct rpccli_netr_ServerPasswordGet_state);
5625         NTSTATUS status;
5626         TALLOC_CTX *mem_ctx;
5627
5628         if (state->out_mem_ctx) {
5629                 mem_ctx = state->out_mem_ctx;
5630         } else {
5631                 mem_ctx = state;
5632         }
5633
5634         status = state->dispatch_recv(subreq, mem_ctx);
5635         TALLOC_FREE(subreq);
5636         if (!NT_STATUS_IS_OK(status)) {
5637                 tevent_req_nterror(req, status);
5638                 return;
5639         }
5640
5641         /* Copy out parameters */
5642         *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
5643         *state->orig.out.password = *state->tmp.out.password;
5644
5645         /* Copy result */
5646         state->orig.out.result = state->tmp.out.result;
5647
5648         /* Reset temporary structure */
5649         ZERO_STRUCT(state->tmp);
5650
5651         if (DEBUGLEVEL >= 10) {
5652                 NDR_PRINT_OUT_DEBUG(netr_ServerPasswordGet, &state->orig);
5653         }
5654
5655         tevent_req_done(req);
5656 }
5657
5658 NTSTATUS rpccli_netr_ServerPasswordGet_recv(struct tevent_req *req,
5659                                             TALLOC_CTX *mem_ctx,
5660                                             WERROR *result)
5661 {
5662         struct rpccli_netr_ServerPasswordGet_state *state = tevent_req_data(
5663                 req, struct rpccli_netr_ServerPasswordGet_state);
5664         NTSTATUS status;
5665
5666         if (tevent_req_is_nterror(req, &status)) {
5667                 tevent_req_received(req);
5668                 return status;
5669         }
5670
5671         /* Steal possbile out parameters to the callers context */
5672         talloc_steal(mem_ctx, state->out_mem_ctx);
5673
5674         /* Return result */
5675         *result = state->orig.out.result;
5676
5677         tevent_req_received(req);
5678         return NT_STATUS_OK;
5679 }
5680
5681 NTSTATUS rpccli_netr_ServerPasswordGet(struct rpc_pipe_client *cli,
5682                                        TALLOC_CTX *mem_ctx,
5683                                        const char *server_name /* [in] [unique,charset(UTF16)] */,
5684                                        const char *account_name /* [in] [ref,charset(UTF16)] */,
5685                                        enum netr_SchannelType secure_channel_type /* [in]  */,
5686                                        const char *computer_name /* [in] [ref,charset(UTF16)] */,
5687                                        struct netr_Authenticator *credential /* [in] [ref] */,
5688                                        struct netr_Authenticator *return_authenticator /* [out] [ref] */,
5689                                        struct samr_Password *password /* [out] [ref] */,
5690                                        WERROR *werror)
5691 {
5692         struct netr_ServerPasswordGet r;
5693         NTSTATUS status;
5694
5695         /* In parameters */
5696         r.in.server_name = server_name;
5697         r.in.account_name = account_name;
5698         r.in.secure_channel_type = secure_channel_type;
5699         r.in.computer_name = computer_name;
5700         r.in.credential = credential;
5701
5702         if (DEBUGLEVEL >= 10) {
5703                 NDR_PRINT_IN_DEBUG(netr_ServerPasswordGet, &r);
5704         }
5705
5706         status = cli->dispatch(cli,
5707                                 mem_ctx,
5708                                 &ndr_table_netlogon,
5709                                 NDR_NETR_SERVERPASSWORDGET,
5710                                 &r);
5711
5712         if (!NT_STATUS_IS_OK(status)) {
5713                 return status;
5714         }
5715
5716         if (DEBUGLEVEL >= 10) {
5717                 NDR_PRINT_OUT_DEBUG(netr_ServerPasswordGet, &r);
5718         }
5719
5720         if (NT_STATUS_IS_ERR(status)) {
5721                 return status;
5722         }
5723
5724         /* Return variables */
5725         *return_authenticator = *r.out.return_authenticator;
5726         *password = *r.out.password;
5727
5728         /* Return result */
5729         if (werror) {
5730                 *werror = r.out.result;
5731         }
5732
5733         return werror_to_ntstatus(r.out.result);
5734 }
5735
5736 struct rpccli_netr_NETRLOGONSENDTOSAM_state {
5737         struct netr_NETRLOGONSENDTOSAM orig;
5738         struct netr_NETRLOGONSENDTOSAM tmp;
5739         TALLOC_CTX *out_mem_ctx;
5740         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5741 };
5742
5743 static void rpccli_netr_NETRLOGONSENDTOSAM_done(struct tevent_req *subreq);
5744
5745 struct tevent_req *rpccli_netr_NETRLOGONSENDTOSAM_send(TALLOC_CTX *mem_ctx,
5746                                                        struct tevent_context *ev,
5747                                                        struct rpc_pipe_client *cli)
5748 {
5749         struct tevent_req *req;
5750         struct rpccli_netr_NETRLOGONSENDTOSAM_state *state;
5751         struct tevent_req *subreq;
5752
5753         req = tevent_req_create(mem_ctx, &state,
5754                                 struct rpccli_netr_NETRLOGONSENDTOSAM_state);
5755         if (req == NULL) {
5756                 return NULL;
5757         }
5758         state->out_mem_ctx = NULL;
5759         state->dispatch_recv = cli->dispatch_recv;
5760
5761         /* In parameters */
5762
5763         /* Out parameters */
5764
5765         /* Result */
5766         ZERO_STRUCT(state->orig.out.result);
5767
5768         if (DEBUGLEVEL >= 10) {
5769                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONSENDTOSAM, &state->orig);
5770         }
5771
5772         /* make a temporary copy, that we pass to the dispatch function */
5773         state->tmp = state->orig;
5774
5775         subreq = cli->dispatch_send(state, ev, cli,
5776                                     &ndr_table_netlogon,
5777                                     NDR_NETR_NETRLOGONSENDTOSAM,
5778                                     &state->tmp);
5779         if (tevent_req_nomem(subreq, req)) {
5780                 return tevent_req_post(req, ev);
5781         }
5782         tevent_req_set_callback(subreq, rpccli_netr_NETRLOGONSENDTOSAM_done, req);
5783         return req;
5784 }
5785
5786 static void rpccli_netr_NETRLOGONSENDTOSAM_done(struct tevent_req *subreq)
5787 {
5788         struct tevent_req *req = tevent_req_callback_data(
5789                 subreq, struct tevent_req);
5790         struct rpccli_netr_NETRLOGONSENDTOSAM_state *state = tevent_req_data(
5791                 req, struct rpccli_netr_NETRLOGONSENDTOSAM_state);
5792         NTSTATUS status;
5793         TALLOC_CTX *mem_ctx;
5794
5795         if (state->out_mem_ctx) {
5796                 mem_ctx = state->out_mem_ctx;
5797         } else {
5798                 mem_ctx = state;
5799         }
5800
5801         status = state->dispatch_recv(subreq, mem_ctx);
5802         TALLOC_FREE(subreq);
5803         if (!NT_STATUS_IS_OK(status)) {
5804                 tevent_req_nterror(req, status);
5805                 return;
5806         }
5807
5808         /* Copy out parameters */
5809
5810         /* Copy result */
5811         state->orig.out.result = state->tmp.out.result;
5812
5813         /* Reset temporary structure */
5814         ZERO_STRUCT(state->tmp);
5815
5816         if (DEBUGLEVEL >= 10) {
5817                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSENDTOSAM, &state->orig);
5818         }
5819
5820         tevent_req_done(req);
5821 }
5822
5823 NTSTATUS rpccli_netr_NETRLOGONSENDTOSAM_recv(struct tevent_req *req,
5824                                              TALLOC_CTX *mem_ctx,
5825                                              WERROR *result)
5826 {
5827         struct rpccli_netr_NETRLOGONSENDTOSAM_state *state = tevent_req_data(
5828                 req, struct rpccli_netr_NETRLOGONSENDTOSAM_state);
5829         NTSTATUS status;
5830
5831         if (tevent_req_is_nterror(req, &status)) {
5832                 tevent_req_received(req);
5833                 return status;
5834         }
5835
5836         /* Steal possbile out parameters to the callers context */
5837         talloc_steal(mem_ctx, state->out_mem_ctx);
5838
5839         /* Return result */
5840         *result = state->orig.out.result;
5841
5842         tevent_req_received(req);
5843         return NT_STATUS_OK;
5844 }
5845
5846 NTSTATUS rpccli_netr_NETRLOGONSENDTOSAM(struct rpc_pipe_client *cli,
5847                                         TALLOC_CTX *mem_ctx,
5848                                         WERROR *werror)
5849 {
5850         struct netr_NETRLOGONSENDTOSAM r;
5851         NTSTATUS status;
5852
5853         /* In parameters */
5854
5855         if (DEBUGLEVEL >= 10) {
5856                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONSENDTOSAM, &r);
5857         }
5858
5859         status = cli->dispatch(cli,
5860                                 mem_ctx,
5861                                 &ndr_table_netlogon,
5862                                 NDR_NETR_NETRLOGONSENDTOSAM,
5863                                 &r);
5864
5865         if (!NT_STATUS_IS_OK(status)) {
5866                 return status;
5867         }
5868
5869         if (DEBUGLEVEL >= 10) {
5870                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSENDTOSAM, &r);
5871         }
5872
5873         if (NT_STATUS_IS_ERR(status)) {
5874                 return status;
5875         }
5876
5877         /* Return variables */
5878
5879         /* Return result */
5880         if (werror) {
5881                 *werror = r.out.result;
5882         }
5883
5884         return werror_to_ntstatus(r.out.result);
5885 }
5886
5887 struct rpccli_netr_DsRAddressToSitenamesW_state {
5888         struct netr_DsRAddressToSitenamesW orig;
5889         struct netr_DsRAddressToSitenamesW tmp;
5890         TALLOC_CTX *out_mem_ctx;
5891         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5892 };
5893
5894 static void rpccli_netr_DsRAddressToSitenamesW_done(struct tevent_req *subreq);
5895
5896 struct tevent_req *rpccli_netr_DsRAddressToSitenamesW_send(TALLOC_CTX *mem_ctx,
5897                                                            struct tevent_context *ev,
5898                                                            struct rpc_pipe_client *cli,
5899                                                            const char *_server_name /* [in] [unique,charset(UTF16)] */,
5900                                                            uint32_t _count /* [in] [range(0,32000)] */,
5901                                                            struct netr_DsRAddress *_addresses /* [in] [ref,size_is(count)] */,
5902                                                            struct netr_DsRAddressToSitenamesWCtr **_ctr /* [out] [ref] */)
5903 {
5904         struct tevent_req *req;
5905         struct rpccli_netr_DsRAddressToSitenamesW_state *state;
5906         struct tevent_req *subreq;
5907
5908         req = tevent_req_create(mem_ctx, &state,
5909                                 struct rpccli_netr_DsRAddressToSitenamesW_state);
5910         if (req == NULL) {
5911                 return NULL;
5912         }
5913         state->out_mem_ctx = NULL;
5914         state->dispatch_recv = cli->dispatch_recv;
5915
5916         /* In parameters */
5917         state->orig.in.server_name = _server_name;
5918         state->orig.in.count = _count;
5919         state->orig.in.addresses = _addresses;
5920
5921         /* Out parameters */
5922         state->orig.out.ctr = _ctr;
5923
5924         /* Result */
5925         ZERO_STRUCT(state->orig.out.result);
5926
5927         if (DEBUGLEVEL >= 10) {
5928                 NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesW, &state->orig);
5929         }
5930
5931         state->out_mem_ctx = talloc_named_const(state, 0,
5932                              "rpccli_netr_DsRAddressToSitenamesW_out_memory");
5933         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5934                 return tevent_req_post(req, ev);
5935         }
5936
5937         /* make a temporary copy, that we pass to the dispatch function */
5938         state->tmp = state->orig;
5939
5940         subreq = cli->dispatch_send(state, ev, cli,
5941                                     &ndr_table_netlogon,
5942                                     NDR_NETR_DSRADDRESSTOSITENAMESW,
5943                                     &state->tmp);
5944         if (tevent_req_nomem(subreq, req)) {
5945                 return tevent_req_post(req, ev);
5946         }
5947         tevent_req_set_callback(subreq, rpccli_netr_DsRAddressToSitenamesW_done, req);
5948         return req;
5949 }
5950
5951 static void rpccli_netr_DsRAddressToSitenamesW_done(struct tevent_req *subreq)
5952 {
5953         struct tevent_req *req = tevent_req_callback_data(
5954                 subreq, struct tevent_req);
5955         struct rpccli_netr_DsRAddressToSitenamesW_state *state = tevent_req_data(
5956                 req, struct rpccli_netr_DsRAddressToSitenamesW_state);
5957         NTSTATUS status;
5958         TALLOC_CTX *mem_ctx;
5959
5960         if (state->out_mem_ctx) {
5961                 mem_ctx = state->out_mem_ctx;
5962         } else {
5963                 mem_ctx = state;
5964         }
5965
5966         status = state->dispatch_recv(subreq, mem_ctx);
5967         TALLOC_FREE(subreq);
5968         if (!NT_STATUS_IS_OK(status)) {
5969                 tevent_req_nterror(req, status);
5970                 return;
5971         }
5972
5973         /* Copy out parameters */
5974         *state->orig.out.ctr = *state->tmp.out.ctr;
5975
5976         /* Copy result */
5977         state->orig.out.result = state->tmp.out.result;
5978
5979         /* Reset temporary structure */
5980         ZERO_STRUCT(state->tmp);
5981
5982         if (DEBUGLEVEL >= 10) {
5983                 NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesW, &state->orig);
5984         }
5985
5986         tevent_req_done(req);
5987 }
5988
5989 NTSTATUS rpccli_netr_DsRAddressToSitenamesW_recv(struct tevent_req *req,
5990                                                  TALLOC_CTX *mem_ctx,
5991                                                  WERROR *result)
5992 {
5993         struct rpccli_netr_DsRAddressToSitenamesW_state *state = tevent_req_data(
5994                 req, struct rpccli_netr_DsRAddressToSitenamesW_state);
5995         NTSTATUS status;
5996
5997         if (tevent_req_is_nterror(req, &status)) {
5998                 tevent_req_received(req);
5999                 return status;
6000         }
6001
6002         /* Steal possbile out parameters to the callers context */
6003         talloc_steal(mem_ctx, state->out_mem_ctx);
6004
6005         /* Return result */
6006         *result = state->orig.out.result;
6007
6008         tevent_req_received(req);
6009         return NT_STATUS_OK;
6010 }
6011
6012 NTSTATUS rpccli_netr_DsRAddressToSitenamesW(struct rpc_pipe_client *cli,
6013                                             TALLOC_CTX *mem_ctx,
6014                                             const char *server_name /* [in] [unique,charset(UTF16)] */,
6015                                             uint32_t count /* [in] [range(0,32000)] */,
6016                                             struct netr_DsRAddress *addresses /* [in] [ref,size_is(count)] */,
6017                                             struct netr_DsRAddressToSitenamesWCtr **ctr /* [out] [ref] */,
6018                                             WERROR *werror)
6019 {
6020         struct netr_DsRAddressToSitenamesW r;
6021         NTSTATUS status;
6022
6023         /* In parameters */
6024         r.in.server_name = server_name;
6025         r.in.count = count;
6026         r.in.addresses = addresses;
6027
6028         if (DEBUGLEVEL >= 10) {
6029                 NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesW, &r);
6030         }
6031
6032         status = cli->dispatch(cli,
6033                                 mem_ctx,
6034                                 &ndr_table_netlogon,
6035                                 NDR_NETR_DSRADDRESSTOSITENAMESW,
6036                                 &r);
6037
6038         if (!NT_STATUS_IS_OK(status)) {
6039                 return status;
6040         }
6041
6042         if (DEBUGLEVEL >= 10) {
6043                 NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesW, &r);
6044         }
6045
6046         if (NT_STATUS_IS_ERR(status)) {
6047                 return status;
6048         }
6049
6050         /* Return variables */
6051         *ctr = *r.out.ctr;
6052
6053         /* Return result */
6054         if (werror) {
6055                 *werror = r.out.result;
6056         }
6057
6058         return werror_to_ntstatus(r.out.result);
6059 }
6060
6061 struct rpccli_netr_DsRGetDCNameEx2_state {
6062         struct netr_DsRGetDCNameEx2 orig;
6063         struct netr_DsRGetDCNameEx2 tmp;
6064         TALLOC_CTX *out_mem_ctx;
6065         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6066 };
6067
6068 static void rpccli_netr_DsRGetDCNameEx2_done(struct tevent_req *subreq);
6069
6070 struct tevent_req *rpccli_netr_DsRGetDCNameEx2_send(TALLOC_CTX *mem_ctx,
6071                                                     struct tevent_context *ev,
6072                                                     struct rpc_pipe_client *cli,
6073                                                     const char *_server_unc /* [in] [unique,charset(UTF16)] */,
6074                                                     const char *_client_account /* [in] [unique,charset(UTF16)] */,
6075                                                     uint32_t _mask /* [in]  */,
6076                                                     const char *_domain_name /* [in] [unique,charset(UTF16)] */,
6077                                                     struct GUID *_domain_guid /* [in] [unique] */,
6078                                                     const char *_site_name /* [in] [unique,charset(UTF16)] */,
6079                                                     uint32_t _flags /* [in]  */,
6080                                                     struct netr_DsRGetDCNameInfo **_info /* [out] [ref] */)
6081 {
6082         struct tevent_req *req;
6083         struct rpccli_netr_DsRGetDCNameEx2_state *state;
6084         struct tevent_req *subreq;
6085
6086         req = tevent_req_create(mem_ctx, &state,
6087                                 struct rpccli_netr_DsRGetDCNameEx2_state);
6088         if (req == NULL) {
6089                 return NULL;
6090         }
6091         state->out_mem_ctx = NULL;
6092         state->dispatch_recv = cli->dispatch_recv;
6093
6094         /* In parameters */
6095         state->orig.in.server_unc = _server_unc;
6096         state->orig.in.client_account = _client_account;
6097         state->orig.in.mask = _mask;
6098         state->orig.in.domain_name = _domain_name;
6099         state->orig.in.domain_guid = _domain_guid;
6100         state->orig.in.site_name = _site_name;
6101         state->orig.in.flags = _flags;
6102
6103         /* Out parameters */
6104         state->orig.out.info = _info;
6105
6106         /* Result */
6107         ZERO_STRUCT(state->orig.out.result);
6108
6109         if (DEBUGLEVEL >= 10) {
6110                 NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx2, &state->orig);
6111         }
6112
6113         state->out_mem_ctx = talloc_named_const(state, 0,
6114                              "rpccli_netr_DsRGetDCNameEx2_out_memory");
6115         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6116                 return tevent_req_post(req, ev);
6117         }
6118
6119         /* make a temporary copy, that we pass to the dispatch function */
6120         state->tmp = state->orig;
6121
6122         subreq = cli->dispatch_send(state, ev, cli,
6123                                     &ndr_table_netlogon,
6124                                     NDR_NETR_DSRGETDCNAMEEX2,
6125                                     &state->tmp);
6126         if (tevent_req_nomem(subreq, req)) {
6127                 return tevent_req_post(req, ev);
6128         }
6129         tevent_req_set_callback(subreq, rpccli_netr_DsRGetDCNameEx2_done, req);
6130         return req;
6131 }
6132
6133 static void rpccli_netr_DsRGetDCNameEx2_done(struct tevent_req *subreq)
6134 {
6135         struct tevent_req *req = tevent_req_callback_data(
6136                 subreq, struct tevent_req);
6137         struct rpccli_netr_DsRGetDCNameEx2_state *state = tevent_req_data(
6138                 req, struct rpccli_netr_DsRGetDCNameEx2_state);
6139         NTSTATUS status;
6140         TALLOC_CTX *mem_ctx;
6141
6142         if (state->out_mem_ctx) {
6143                 mem_ctx = state->out_mem_ctx;
6144         } else {
6145                 mem_ctx = state;
6146         }
6147
6148         status = state->dispatch_recv(subreq, mem_ctx);
6149         TALLOC_FREE(subreq);
6150         if (!NT_STATUS_IS_OK(status)) {
6151                 tevent_req_nterror(req, status);
6152                 return;
6153         }
6154
6155         /* Copy out parameters */
6156         *state->orig.out.info = *state->tmp.out.info;
6157
6158         /* Copy result */
6159         state->orig.out.result = state->tmp.out.result;
6160
6161         /* Reset temporary structure */
6162         ZERO_STRUCT(state->tmp);
6163
6164         if (DEBUGLEVEL >= 10) {
6165                 NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx2, &state->orig);
6166         }
6167
6168         tevent_req_done(req);
6169 }
6170
6171 NTSTATUS rpccli_netr_DsRGetDCNameEx2_recv(struct tevent_req *req,
6172                                           TALLOC_CTX *mem_ctx,
6173                                           WERROR *result)
6174 {
6175         struct rpccli_netr_DsRGetDCNameEx2_state *state = tevent_req_data(
6176                 req, struct rpccli_netr_DsRGetDCNameEx2_state);
6177         NTSTATUS status;
6178
6179         if (tevent_req_is_nterror(req, &status)) {
6180                 tevent_req_received(req);
6181                 return status;
6182         }
6183
6184         /* Steal possbile out parameters to the callers context */
6185         talloc_steal(mem_ctx, state->out_mem_ctx);
6186
6187         /* Return result */
6188         *result = state->orig.out.result;
6189
6190         tevent_req_received(req);
6191         return NT_STATUS_OK;
6192 }
6193
6194 NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli,
6195                                      TALLOC_CTX *mem_ctx,
6196                                      const char *server_unc /* [in] [unique,charset(UTF16)] */,
6197                                      const char *client_account /* [in] [unique,charset(UTF16)] */,
6198                                      uint32_t mask /* [in]  */,
6199                                      const char *domain_name /* [in] [unique,charset(UTF16)] */,
6200                                      struct GUID *domain_guid /* [in] [unique] */,
6201                                      const char *site_name /* [in] [unique,charset(UTF16)] */,
6202                                      uint32_t flags /* [in]  */,
6203                                      struct netr_DsRGetDCNameInfo **info /* [out] [ref] */,
6204                                      WERROR *werror)
6205 {
6206         struct netr_DsRGetDCNameEx2 r;
6207         NTSTATUS status;
6208
6209         /* In parameters */
6210         r.in.server_unc = server_unc;
6211         r.in.client_account = client_account;
6212         r.in.mask = mask;
6213         r.in.domain_name = domain_name;
6214         r.in.domain_guid = domain_guid;
6215         r.in.site_name = site_name;
6216         r.in.flags = flags;
6217
6218         if (DEBUGLEVEL >= 10) {
6219                 NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx2, &r);
6220         }
6221
6222         status = cli->dispatch(cli,
6223                                 mem_ctx,
6224                                 &ndr_table_netlogon,
6225                                 NDR_NETR_DSRGETDCNAMEEX2,
6226                                 &r);
6227
6228         if (!NT_STATUS_IS_OK(status)) {
6229                 return status;
6230         }
6231
6232         if (DEBUGLEVEL >= 10) {
6233                 NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx2, &r);
6234         }
6235
6236         if (NT_STATUS_IS_ERR(status)) {
6237                 return status;
6238         }
6239
6240         /* Return variables */
6241         *info = *r.out.info;
6242
6243         /* Return result */
6244         if (werror) {
6245                 *werror = r.out.result;
6246         }
6247
6248         return werror_to_ntstatus(r.out.result);
6249 }
6250
6251 struct rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN_state {
6252         struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN orig;
6253         struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN tmp;
6254         TALLOC_CTX *out_mem_ctx;
6255         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6256 };
6257
6258 static void rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN_done(struct tevent_req *subreq);
6259
6260 struct tevent_req *rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN_send(TALLOC_CTX *mem_ctx,
6261                                                                         struct tevent_context *ev,
6262                                                                         struct rpc_pipe_client *cli)
6263 {
6264         struct tevent_req *req;
6265         struct rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN_state *state;
6266         struct tevent_req *subreq;
6267
6268         req = tevent_req_create(mem_ctx, &state,
6269                                 struct rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN_state);
6270         if (req == NULL) {
6271                 return NULL;
6272         }
6273         state->out_mem_ctx = NULL;
6274         state->dispatch_recv = cli->dispatch_recv;
6275
6276         /* In parameters */
6277
6278         /* Out parameters */
6279
6280         /* Result */
6281         ZERO_STRUCT(state->orig.out.result);
6282
6283         if (DEBUGLEVEL >= 10) {
6284                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, &state->orig);
6285         }
6286
6287         /* make a temporary copy, that we pass to the dispatch function */
6288         state->tmp = state->orig;
6289
6290         subreq = cli->dispatch_send(state, ev, cli,
6291                                     &ndr_table_netlogon,
6292                                     NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN,
6293                                     &state->tmp);
6294         if (tevent_req_nomem(subreq, req)) {
6295                 return tevent_req_post(req, ev);
6296         }
6297         tevent_req_set_callback(subreq, rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN_done, req);
6298         return req;
6299 }
6300
6301 static void rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN_done(struct tevent_req *subreq)
6302 {
6303         struct tevent_req *req = tevent_req_callback_data(
6304                 subreq, struct tevent_req);
6305         struct rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN_state *state = tevent_req_data(
6306                 req, struct rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN_state);
6307         NTSTATUS status;
6308         TALLOC_CTX *mem_ctx;
6309
6310         if (state->out_mem_ctx) {
6311                 mem_ctx = state->out_mem_ctx;
6312         } else {
6313                 mem_ctx = state;
6314         }
6315
6316         status = state->dispatch_recv(subreq, mem_ctx);
6317         TALLOC_FREE(subreq);
6318         if (!NT_STATUS_IS_OK(status)) {
6319                 tevent_req_nterror(req, status);
6320                 return;
6321         }
6322
6323         /* Copy out parameters */
6324
6325         /* Copy result */
6326         state->orig.out.result = state->tmp.out.result;
6327
6328         /* Reset temporary structure */
6329         ZERO_STRUCT(state->tmp);
6330
6331         if (DEBUGLEVEL >= 10) {
6332                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, &state->orig);
6333         }
6334
6335         tevent_req_done(req);
6336 }
6337
6338 NTSTATUS rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN_recv(struct tevent_req *req,
6339                                                               TALLOC_CTX *mem_ctx,
6340                                                               WERROR *result)
6341 {
6342         struct rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN_state *state = tevent_req_data(
6343                 req, struct rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN_state);
6344         NTSTATUS status;
6345
6346         if (tevent_req_is_nterror(req, &status)) {
6347                 tevent_req_received(req);
6348                 return status;
6349         }
6350
6351         /* Steal possbile out parameters to the callers context */
6352         talloc_steal(mem_ctx, state->out_mem_ctx);
6353
6354         /* Return result */
6355         *result = state->orig.out.result;
6356
6357         tevent_req_received(req);
6358         return NT_STATUS_OK;
6359 }
6360
6361 NTSTATUS rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct rpc_pipe_client *cli,
6362                                                          TALLOC_CTX *mem_ctx,
6363                                                          WERROR *werror)
6364 {
6365         struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN r;
6366         NTSTATUS status;
6367
6368         /* In parameters */
6369
6370         if (DEBUGLEVEL >= 10) {
6371                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, &r);
6372         }
6373
6374         status = cli->dispatch(cli,
6375                                 mem_ctx,
6376                                 &ndr_table_netlogon,
6377                                 NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN,
6378                                 &r);
6379
6380         if (!NT_STATUS_IS_OK(status)) {
6381                 return status;
6382         }
6383
6384         if (DEBUGLEVEL >= 10) {
6385                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, &r);
6386         }
6387
6388         if (NT_STATUS_IS_ERR(status)) {
6389                 return status;
6390         }
6391
6392         /* Return variables */
6393
6394         /* Return result */
6395         if (werror) {
6396                 *werror = r.out.result;
6397         }
6398
6399         return werror_to_ntstatus(r.out.result);
6400 }
6401
6402 struct rpccli_netr_NetrEnumerateTrustedDomainsEx_state {
6403         struct netr_NetrEnumerateTrustedDomainsEx orig;
6404         struct netr_NetrEnumerateTrustedDomainsEx tmp;
6405         TALLOC_CTX *out_mem_ctx;
6406         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6407 };
6408
6409 static void rpccli_netr_NetrEnumerateTrustedDomainsEx_done(struct tevent_req *subreq);
6410
6411 struct tevent_req *rpccli_netr_NetrEnumerateTrustedDomainsEx_send(TALLOC_CTX *mem_ctx,
6412                                                                   struct tevent_context *ev,
6413                                                                   struct rpc_pipe_client *cli,
6414                                                                   const char *_server_name /* [in] [unique,charset(UTF16)] */,
6415                                                                   struct netr_DomainTrustList *_dom_trust_list /* [out] [ref] */)
6416 {
6417         struct tevent_req *req;
6418         struct rpccli_netr_NetrEnumerateTrustedDomainsEx_state *state;
6419         struct tevent_req *subreq;
6420
6421         req = tevent_req_create(mem_ctx, &state,
6422                                 struct rpccli_netr_NetrEnumerateTrustedDomainsEx_state);
6423         if (req == NULL) {
6424                 return NULL;
6425         }
6426         state->out_mem_ctx = NULL;
6427         state->dispatch_recv = cli->dispatch_recv;
6428
6429         /* In parameters */
6430         state->orig.in.server_name = _server_name;
6431
6432         /* Out parameters */
6433         state->orig.out.dom_trust_list = _dom_trust_list;
6434
6435         /* Result */
6436         ZERO_STRUCT(state->orig.out.result);
6437
6438         if (DEBUGLEVEL >= 10) {
6439                 NDR_PRINT_IN_DEBUG(netr_NetrEnumerateTrustedDomainsEx, &state->orig);
6440         }
6441
6442         state->out_mem_ctx = talloc_named_const(state, 0,
6443                              "rpccli_netr_NetrEnumerateTrustedDomainsEx_out_memory");
6444         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6445                 return tevent_req_post(req, ev);
6446         }
6447
6448         /* make a temporary copy, that we pass to the dispatch function */
6449         state->tmp = state->orig;
6450
6451         subreq = cli->dispatch_send(state, ev, cli,
6452                                     &ndr_table_netlogon,
6453                                     NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX,
6454                                     &state->tmp);
6455         if (tevent_req_nomem(subreq, req)) {
6456                 return tevent_req_post(req, ev);
6457         }
6458         tevent_req_set_callback(subreq, rpccli_netr_NetrEnumerateTrustedDomainsEx_done, req);
6459         return req;
6460 }
6461
6462 static void rpccli_netr_NetrEnumerateTrustedDomainsEx_done(struct tevent_req *subreq)
6463 {
6464         struct tevent_req *req = tevent_req_callback_data(
6465                 subreq, struct tevent_req);
6466         struct rpccli_netr_NetrEnumerateTrustedDomainsEx_state *state = tevent_req_data(
6467                 req, struct rpccli_netr_NetrEnumerateTrustedDomainsEx_state);
6468         NTSTATUS status;
6469         TALLOC_CTX *mem_ctx;
6470
6471         if (state->out_mem_ctx) {
6472                 mem_ctx = state->out_mem_ctx;
6473         } else {
6474                 mem_ctx = state;
6475         }
6476
6477         status = state->dispatch_recv(subreq, mem_ctx);
6478         TALLOC_FREE(subreq);
6479         if (!NT_STATUS_IS_OK(status)) {
6480                 tevent_req_nterror(req, status);
6481                 return;
6482         }
6483
6484         /* Copy out parameters */
6485         *state->orig.out.dom_trust_list = *state->tmp.out.dom_trust_list;
6486
6487         /* Copy result */
6488         state->orig.out.result = state->tmp.out.result;
6489
6490         /* Reset temporary structure */
6491         ZERO_STRUCT(state->tmp);
6492
6493         if (DEBUGLEVEL >= 10) {
6494                 NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomainsEx, &state->orig);
6495         }
6496
6497         tevent_req_done(req);
6498 }
6499
6500 NTSTATUS rpccli_netr_NetrEnumerateTrustedDomainsEx_recv(struct tevent_req *req,
6501                                                         TALLOC_CTX *mem_ctx,
6502                                                         WERROR *result)
6503 {
6504         struct rpccli_netr_NetrEnumerateTrustedDomainsEx_state *state = tevent_req_data(
6505                 req, struct rpccli_netr_NetrEnumerateTrustedDomainsEx_state);
6506         NTSTATUS status;
6507
6508         if (tevent_req_is_nterror(req, &status)) {
6509                 tevent_req_received(req);
6510                 return status;
6511         }
6512
6513         /* Steal possbile out parameters to the callers context */
6514         talloc_steal(mem_ctx, state->out_mem_ctx);
6515
6516         /* Return result */
6517         *result = state->orig.out.result;
6518
6519         tevent_req_received(req);
6520         return NT_STATUS_OK;
6521 }
6522
6523 NTSTATUS rpccli_netr_NetrEnumerateTrustedDomainsEx(struct rpc_pipe_client *cli,
6524                                                    TALLOC_CTX *mem_ctx,
6525                                                    const char *server_name /* [in] [unique,charset(UTF16)] */,
6526                                                    struct netr_DomainTrustList *dom_trust_list /* [out] [ref] */,
6527                                                    WERROR *werror)
6528 {
6529         struct netr_NetrEnumerateTrustedDomainsEx r;
6530         NTSTATUS status;
6531
6532         /* In parameters */
6533         r.in.server_name = server_name;
6534
6535         if (DEBUGLEVEL >= 10) {
6536                 NDR_PRINT_IN_DEBUG(netr_NetrEnumerateTrustedDomainsEx, &r);
6537         }
6538
6539         status = cli->dispatch(cli,
6540                                 mem_ctx,
6541                                 &ndr_table_netlogon,
6542                                 NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX,
6543                                 &r);
6544
6545         if (!NT_STATUS_IS_OK(status)) {
6546                 return status;
6547         }
6548
6549         if (DEBUGLEVEL >= 10) {
6550                 NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomainsEx, &r);
6551         }
6552
6553         if (NT_STATUS_IS_ERR(status)) {
6554                 return status;
6555         }
6556
6557         /* Return variables */
6558         *dom_trust_list = *r.out.dom_trust_list;
6559
6560         /* Return result */
6561         if (werror) {
6562                 *werror = r.out.result;
6563         }
6564
6565         return werror_to_ntstatus(r.out.result);
6566 }
6567
6568 struct rpccli_netr_DsRAddressToSitenamesExW_state {
6569         struct netr_DsRAddressToSitenamesExW orig;
6570         struct netr_DsRAddressToSitenamesExW tmp;
6571         TALLOC_CTX *out_mem_ctx;
6572         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6573 };
6574
6575 static void rpccli_netr_DsRAddressToSitenamesExW_done(struct tevent_req *subreq);
6576
6577 struct tevent_req *rpccli_netr_DsRAddressToSitenamesExW_send(TALLOC_CTX *mem_ctx,
6578                                                              struct tevent_context *ev,
6579                                                              struct rpc_pipe_client *cli,
6580                                                              const char *_server_name /* [in] [unique,charset(UTF16)] */,
6581                                                              uint32_t _count /* [in] [range(0,32000)] */,
6582                                                              struct netr_DsRAddress *_addresses /* [in] [ref,size_is(count)] */,
6583                                                              struct netr_DsRAddressToSitenamesExWCtr **_ctr /* [out] [ref] */)
6584 {
6585         struct tevent_req *req;
6586         struct rpccli_netr_DsRAddressToSitenamesExW_state *state;
6587         struct tevent_req *subreq;
6588
6589         req = tevent_req_create(mem_ctx, &state,
6590                                 struct rpccli_netr_DsRAddressToSitenamesExW_state);
6591         if (req == NULL) {
6592                 return NULL;
6593         }
6594         state->out_mem_ctx = NULL;
6595         state->dispatch_recv = cli->dispatch_recv;
6596
6597         /* In parameters */
6598         state->orig.in.server_name = _server_name;
6599         state->orig.in.count = _count;
6600         state->orig.in.addresses = _addresses;
6601
6602         /* Out parameters */
6603         state->orig.out.ctr = _ctr;
6604
6605         /* Result */
6606         ZERO_STRUCT(state->orig.out.result);
6607
6608         if (DEBUGLEVEL >= 10) {
6609                 NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesExW, &state->orig);
6610         }
6611
6612         state->out_mem_ctx = talloc_named_const(state, 0,
6613                              "rpccli_netr_DsRAddressToSitenamesExW_out_memory");
6614         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6615                 return tevent_req_post(req, ev);
6616         }
6617
6618         /* make a temporary copy, that we pass to the dispatch function */
6619         state->tmp = state->orig;
6620
6621         subreq = cli->dispatch_send(state, ev, cli,
6622                                     &ndr_table_netlogon,
6623                                     NDR_NETR_DSRADDRESSTOSITENAMESEXW,
6624                                     &state->tmp);
6625         if (tevent_req_nomem(subreq, req)) {
6626                 return tevent_req_post(req, ev);
6627         }
6628         tevent_req_set_callback(subreq, rpccli_netr_DsRAddressToSitenamesExW_done, req);
6629         return req;
6630 }
6631
6632 static void rpccli_netr_DsRAddressToSitenamesExW_done(struct tevent_req *subreq)
6633 {
6634         struct tevent_req *req = tevent_req_callback_data(
6635                 subreq, struct tevent_req);
6636         struct rpccli_netr_DsRAddressToSitenamesExW_state *state = tevent_req_data(
6637                 req, struct rpccli_netr_DsRAddressToSitenamesExW_state);
6638         NTSTATUS status;
6639         TALLOC_CTX *mem_ctx;
6640
6641         if (state->out_mem_ctx) {
6642                 mem_ctx = state->out_mem_ctx;
6643         } else {
6644                 mem_ctx = state;
6645         }
6646
6647         status = state->dispatch_recv(subreq, mem_ctx);
6648         TALLOC_FREE(subreq);
6649         if (!NT_STATUS_IS_OK(status)) {
6650                 tevent_req_nterror(req, status);
6651                 return;
6652         }
6653
6654         /* Copy out parameters */
6655         *state->orig.out.ctr = *state->tmp.out.ctr;
6656
6657         /* Copy result */
6658         state->orig.out.result = state->tmp.out.result;
6659
6660         /* Reset temporary structure */
6661         ZERO_STRUCT(state->tmp);
6662
6663         if (DEBUGLEVEL >= 10) {
6664                 NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesExW, &state->orig);
6665         }
6666
6667         tevent_req_done(req);
6668 }
6669
6670 NTSTATUS rpccli_netr_DsRAddressToSitenamesExW_recv(struct tevent_req *req,
6671                                                    TALLOC_CTX *mem_ctx,
6672                                                    WERROR *result)
6673 {
6674         struct rpccli_netr_DsRAddressToSitenamesExW_state *state = tevent_req_data(
6675                 req, struct rpccli_netr_DsRAddressToSitenamesExW_state);
6676         NTSTATUS status;
6677
6678         if (tevent_req_is_nterror(req, &status)) {
6679                 tevent_req_received(req);
6680                 return status;
6681         }
6682
6683         /* Steal possbile out parameters to the callers context */
6684         talloc_steal(mem_ctx, state->out_mem_ctx);
6685
6686         /* Return result */
6687         *result = state->orig.out.result;
6688
6689         tevent_req_received(req);
6690         return NT_STATUS_OK;
6691 }
6692
6693 NTSTATUS rpccli_netr_DsRAddressToSitenamesExW(struct rpc_pipe_client *cli,
6694                                               TALLOC_CTX *mem_ctx,
6695                                               const char *server_name /* [in] [unique,charset(UTF16)] */,
6696                                               uint32_t count /* [in] [range(0,32000)] */,
6697                                               struct netr_DsRAddress *addresses /* [in] [ref,size_is(count)] */,
6698                                               struct netr_DsRAddressToSitenamesExWCtr **ctr /* [out] [ref] */,
6699                                               WERROR *werror)
6700 {
6701         struct netr_DsRAddressToSitenamesExW r;
6702         NTSTATUS status;
6703
6704         /* In parameters */
6705         r.in.server_name = server_name;
6706         r.in.count = count;
6707         r.in.addresses = addresses;
6708
6709         if (DEBUGLEVEL >= 10) {
6710                 NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesExW, &r);
6711         }
6712
6713         status = cli->dispatch(cli,
6714                                 mem_ctx,
6715                                 &ndr_table_netlogon,
6716                                 NDR_NETR_DSRADDRESSTOSITENAMESEXW,
6717                                 &r);
6718
6719         if (!NT_STATUS_IS_OK(status)) {
6720                 return status;
6721         }
6722
6723         if (DEBUGLEVEL >= 10) {
6724                 NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesExW, &r);
6725         }
6726
6727         if (NT_STATUS_IS_ERR(status)) {
6728                 return status;
6729         }
6730
6731         /* Return variables */
6732         *ctr = *r.out.ctr;
6733
6734         /* Return result */
6735         if (werror) {
6736                 *werror = r.out.result;
6737         }
6738
6739         return werror_to_ntstatus(r.out.result);
6740 }
6741
6742 struct rpccli_netr_DsrGetDcSiteCoverageW_state {
6743         struct netr_DsrGetDcSiteCoverageW orig;
6744         struct netr_DsrGetDcSiteCoverageW tmp;
6745         TALLOC_CTX *out_mem_ctx;
6746         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6747 };
6748
6749 static void rpccli_netr_DsrGetDcSiteCoverageW_done(struct tevent_req *subreq);
6750
6751 struct tevent_req *rpccli_netr_DsrGetDcSiteCoverageW_send(TALLOC_CTX *mem_ctx,
6752                                                           struct tevent_context *ev,
6753                                                           struct rpc_pipe_client *cli,
6754                                                           const char *_server_name /* [in] [unique,charset(UTF16)] */,
6755                                                           struct DcSitesCtr **_ctr /* [out] [ref] */)
6756 {
6757         struct tevent_req *req;
6758         struct rpccli_netr_DsrGetDcSiteCoverageW_state *state;
6759         struct tevent_req *subreq;
6760
6761         req = tevent_req_create(mem_ctx, &state,
6762                                 struct rpccli_netr_DsrGetDcSiteCoverageW_state);
6763         if (req == NULL) {
6764                 return NULL;
6765         }
6766         state->out_mem_ctx = NULL;
6767         state->dispatch_recv = cli->dispatch_recv;
6768
6769         /* In parameters */
6770         state->orig.in.server_name = _server_name;
6771
6772         /* Out parameters */
6773         state->orig.out.ctr = _ctr;
6774
6775         /* Result */
6776         ZERO_STRUCT(state->orig.out.result);
6777
6778         if (DEBUGLEVEL >= 10) {
6779                 NDR_PRINT_IN_DEBUG(netr_DsrGetDcSiteCoverageW, &state->orig);
6780         }
6781
6782         state->out_mem_ctx = talloc_named_const(state, 0,
6783                              "rpccli_netr_DsrGetDcSiteCoverageW_out_memory");
6784         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6785                 return tevent_req_post(req, ev);
6786         }
6787
6788         /* make a temporary copy, that we pass to the dispatch function */
6789         state->tmp = state->orig;
6790
6791         subreq = cli->dispatch_send(state, ev, cli,
6792                                     &ndr_table_netlogon,
6793                                     NDR_NETR_DSRGETDCSITECOVERAGEW,
6794                                     &state->tmp);
6795         if (tevent_req_nomem(subreq, req)) {
6796                 return tevent_req_post(req, ev);
6797         }
6798         tevent_req_set_callback(subreq, rpccli_netr_DsrGetDcSiteCoverageW_done, req);
6799         return req;
6800 }
6801
6802 static void rpccli_netr_DsrGetDcSiteCoverageW_done(struct tevent_req *subreq)
6803 {
6804         struct tevent_req *req = tevent_req_callback_data(
6805                 subreq, struct tevent_req);
6806         struct rpccli_netr_DsrGetDcSiteCoverageW_state *state = tevent_req_data(
6807                 req, struct rpccli_netr_DsrGetDcSiteCoverageW_state);
6808         NTSTATUS status;
6809         TALLOC_CTX *mem_ctx;
6810
6811         if (state->out_mem_ctx) {
6812                 mem_ctx = state->out_mem_ctx;
6813         } else {
6814                 mem_ctx = state;
6815         }
6816
6817         status = state->dispatch_recv(subreq, mem_ctx);
6818         TALLOC_FREE(subreq);
6819         if (!NT_STATUS_IS_OK(status)) {
6820                 tevent_req_nterror(req, status);
6821                 return;
6822         }
6823
6824         /* Copy out parameters */
6825         *state->orig.out.ctr = *state->tmp.out.ctr;
6826
6827         /* Copy result */
6828         state->orig.out.result = state->tmp.out.result;
6829
6830         /* Reset temporary structure */
6831         ZERO_STRUCT(state->tmp);
6832
6833         if (DEBUGLEVEL >= 10) {
6834                 NDR_PRINT_OUT_DEBUG(netr_DsrGetDcSiteCoverageW, &state->orig);
6835         }
6836
6837         tevent_req_done(req);
6838 }
6839
6840 NTSTATUS rpccli_netr_DsrGetDcSiteCoverageW_recv(struct tevent_req *req,
6841                                                 TALLOC_CTX *mem_ctx,
6842                                                 WERROR *result)
6843 {
6844         struct rpccli_netr_DsrGetDcSiteCoverageW_state *state = tevent_req_data(
6845                 req, struct rpccli_netr_DsrGetDcSiteCoverageW_state);
6846         NTSTATUS status;
6847
6848         if (tevent_req_is_nterror(req, &status)) {
6849                 tevent_req_received(req);
6850                 return status;
6851         }
6852
6853         /* Steal possbile out parameters to the callers context */
6854         talloc_steal(mem_ctx, state->out_mem_ctx);
6855
6856         /* Return result */
6857         *result = state->orig.out.result;
6858
6859         tevent_req_received(req);
6860         return NT_STATUS_OK;
6861 }
6862
6863 NTSTATUS rpccli_netr_DsrGetDcSiteCoverageW(struct rpc_pipe_client *cli,
6864                                            TALLOC_CTX *mem_ctx,
6865                                            const char *server_name /* [in] [unique,charset(UTF16)] */,
6866                                            struct DcSitesCtr **ctr /* [out] [ref] */,
6867                                            WERROR *werror)
6868 {
6869         struct netr_DsrGetDcSiteCoverageW r;
6870         NTSTATUS status;
6871
6872         /* In parameters */
6873         r.in.server_name = server_name;
6874
6875         if (DEBUGLEVEL >= 10) {
6876                 NDR_PRINT_IN_DEBUG(netr_DsrGetDcSiteCoverageW, &r);
6877         }
6878
6879         status = cli->dispatch(cli,
6880                                 mem_ctx,
6881                                 &ndr_table_netlogon,
6882                                 NDR_NETR_DSRGETDCSITECOVERAGEW,
6883                                 &r);
6884
6885         if (!NT_STATUS_IS_OK(status)) {
6886                 return status;
6887         }
6888
6889         if (DEBUGLEVEL >= 10) {
6890                 NDR_PRINT_OUT_DEBUG(netr_DsrGetDcSiteCoverageW, &r);
6891         }
6892
6893         if (NT_STATUS_IS_ERR(status)) {
6894                 return status;
6895         }
6896
6897         /* Return variables */
6898         *ctr = *r.out.ctr;
6899
6900         /* Return result */
6901         if (werror) {
6902                 *werror = r.out.result;
6903         }
6904
6905         return werror_to_ntstatus(r.out.result);
6906 }
6907
6908 struct rpccli_netr_LogonSamLogonEx_state {
6909         struct netr_LogonSamLogonEx orig;
6910         struct netr_LogonSamLogonEx tmp;
6911         TALLOC_CTX *out_mem_ctx;
6912         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6913 };
6914
6915 static void rpccli_netr_LogonSamLogonEx_done(struct tevent_req *subreq);
6916
6917 struct tevent_req *rpccli_netr_LogonSamLogonEx_send(TALLOC_CTX *mem_ctx,
6918                                                     struct tevent_context *ev,
6919                                                     struct rpc_pipe_client *cli,
6920                                                     const char *_server_name /* [in] [unique,charset(UTF16)] */,
6921                                                     const char *_computer_name /* [in] [unique,charset(UTF16)] */,
6922                                                     enum netr_LogonInfoClass _logon_level /* [in]  */,
6923                                                     union netr_LogonLevel *_logon /* [in] [ref,switch_is(logon_level)] */,
6924                                                     uint16_t _validation_level /* [in]  */,
6925                                                     union netr_Validation *_validation /* [out] [ref,switch_is(validation_level)] */,
6926                                                     uint8_t *_authoritative /* [out] [ref] */,
6927                                                     uint32_t *_flags /* [in,out] [ref] */)
6928 {
6929         struct tevent_req *req;
6930         struct rpccli_netr_LogonSamLogonEx_state *state;
6931         struct tevent_req *subreq;
6932
6933         req = tevent_req_create(mem_ctx, &state,
6934                                 struct rpccli_netr_LogonSamLogonEx_state);
6935         if (req == NULL) {
6936                 return NULL;
6937         }
6938         state->out_mem_ctx = NULL;
6939         state->dispatch_recv = cli->dispatch_recv;
6940
6941         /* In parameters */
6942         state->orig.in.server_name = _server_name;
6943         state->orig.in.computer_name = _computer_name;
6944         state->orig.in.logon_level = _logon_level;
6945         state->orig.in.logon = _logon;
6946         state->orig.in.validation_level = _validation_level;
6947         state->orig.in.flags = _flags;
6948
6949         /* Out parameters */
6950         state->orig.out.validation = _validation;
6951         state->orig.out.authoritative = _authoritative;
6952         state->orig.out.flags = _flags;
6953
6954         /* Result */
6955         ZERO_STRUCT(state->orig.out.result);
6956
6957         if (DEBUGLEVEL >= 10) {
6958                 NDR_PRINT_IN_DEBUG(netr_LogonSamLogonEx, &state->orig);
6959         }
6960
6961         state->out_mem_ctx = talloc_named_const(state, 0,
6962                              "rpccli_netr_LogonSamLogonEx_out_memory");
6963         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6964                 return tevent_req_post(req, ev);
6965         }
6966
6967         /* make a temporary copy, that we pass to the dispatch function */
6968         state->tmp = state->orig;
6969
6970         subreq = cli->dispatch_send(state, ev, cli,
6971                                     &ndr_table_netlogon,
6972                                     NDR_NETR_LOGONSAMLOGONEX,
6973                                     &state->tmp);
6974         if (tevent_req_nomem(subreq, req)) {
6975                 return tevent_req_post(req, ev);
6976         }
6977         tevent_req_set_callback(subreq, rpccli_netr_LogonSamLogonEx_done, req);
6978         return req;
6979 }
6980
6981 static void rpccli_netr_LogonSamLogonEx_done(struct tevent_req *subreq)
6982 {
6983         struct tevent_req *req = tevent_req_callback_data(
6984                 subreq, struct tevent_req);
6985         struct rpccli_netr_LogonSamLogonEx_state *state = tevent_req_data(
6986                 req, struct rpccli_netr_LogonSamLogonEx_state);
6987         NTSTATUS status;
6988         TALLOC_CTX *mem_ctx;
6989
6990         if (state->out_mem_ctx) {
6991                 mem_ctx = state->out_mem_ctx;
6992         } else {
6993                 mem_ctx = state;
6994         }
6995
6996         status = state->dispatch_recv(subreq, mem_ctx);
6997         TALLOC_FREE(subreq);
6998         if (!NT_STATUS_IS_OK(status)) {
6999                 tevent_req_nterror(req, status);
7000                 return;
7001         }
7002
7003         /* Copy out parameters */
7004         *state->orig.out.validation = *state->tmp.out.validation;
7005         *state->orig.out.authoritative = *state->tmp.out.authoritative;
7006         *state->orig.out.flags = *state->tmp.out.flags;
7007
7008         /* Copy result */
7009         state->orig.out.result = state->tmp.out.result;
7010
7011         /* Reset temporary structure */
7012         ZERO_STRUCT(state->tmp);
7013
7014         if (DEBUGLEVEL >= 10) {
7015                 NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonEx, &state->orig);
7016         }
7017
7018         tevent_req_done(req);
7019 }
7020
7021 NTSTATUS rpccli_netr_LogonSamLogonEx_recv(struct tevent_req *req,
7022                                           TALLOC_CTX *mem_ctx,
7023                                           NTSTATUS *result)
7024 {
7025         struct rpccli_netr_LogonSamLogonEx_state *state = tevent_req_data(
7026                 req, struct rpccli_netr_LogonSamLogonEx_state);
7027         NTSTATUS status;
7028
7029         if (tevent_req_is_nterror(req, &status)) {
7030                 tevent_req_received(req);
7031                 return status;
7032         }
7033
7034         /* Steal possbile out parameters to the callers context */
7035         talloc_steal(mem_ctx, state->out_mem_ctx);
7036
7037         /* Return result */
7038         *result = state->orig.out.result;
7039
7040         tevent_req_received(req);
7041         return NT_STATUS_OK;
7042 }
7043
7044 NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli,
7045                                      TALLOC_CTX *mem_ctx,
7046                                      const char *server_name /* [in] [unique,charset(UTF16)] */,
7047                                      const char *computer_name /* [in] [unique,charset(UTF16)] */,
7048                                      enum netr_LogonInfoClass logon_level /* [in]  */,
7049                                      union netr_LogonLevel *logon /* [in] [ref,switch_is(logon_level)] */,
7050                                      uint16_t validation_level /* [in]  */,
7051                                      union netr_Validation *validation /* [out] [ref,switch_is(validation_level)] */,
7052                                      uint8_t *authoritative /* [out] [ref] */,
7053                                      uint32_t *flags /* [in,out] [ref] */)
7054 {
7055         struct netr_LogonSamLogonEx r;
7056         NTSTATUS status;
7057
7058         /* In parameters */
7059         r.in.server_name = server_name;
7060         r.in.computer_name = computer_name;
7061         r.in.logon_level = logon_level;
7062         r.in.logon = logon;
7063         r.in.validation_level = validation_level;
7064         r.in.flags = flags;
7065
7066         if (DEBUGLEVEL >= 10) {
7067                 NDR_PRINT_IN_DEBUG(netr_LogonSamLogonEx, &r);
7068         }
7069
7070         status = cli->dispatch(cli,
7071                                 mem_ctx,
7072                                 &ndr_table_netlogon,
7073                                 NDR_NETR_LOGONSAMLOGONEX,
7074                                 &r);
7075
7076         if (!NT_STATUS_IS_OK(status)) {
7077                 return status;
7078         }
7079
7080         if (DEBUGLEVEL >= 10) {
7081                 NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonEx, &r);
7082         }
7083
7084         if (NT_STATUS_IS_ERR(status)) {
7085                 return status;
7086         }
7087
7088         /* Return variables */
7089         *validation = *r.out.validation;
7090         *authoritative = *r.out.authoritative;
7091         *flags = *r.out.flags;
7092
7093         /* Return result */
7094         return r.out.result;
7095 }
7096
7097 struct rpccli_netr_DsrEnumerateDomainTrusts_state {
7098         struct netr_DsrEnumerateDomainTrusts orig;
7099         struct netr_DsrEnumerateDomainTrusts tmp;
7100         TALLOC_CTX *out_mem_ctx;
7101         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7102 };
7103
7104 static void rpccli_netr_DsrEnumerateDomainTrusts_done(struct tevent_req *subreq);
7105
7106 struct tevent_req *rpccli_netr_DsrEnumerateDomainTrusts_send(TALLOC_CTX *mem_ctx,
7107                                                              struct tevent_context *ev,
7108                                                              struct rpc_pipe_client *cli,
7109                                                              const char *_server_name /* [in] [unique,charset(UTF16)] */,
7110                                                              uint32_t _trust_flags /* [in]  */,
7111                                                              struct netr_DomainTrustList *_trusts /* [out] [ref] */)
7112 {
7113         struct tevent_req *req;
7114         struct rpccli_netr_DsrEnumerateDomainTrusts_state *state;
7115         struct tevent_req *subreq;
7116
7117         req = tevent_req_create(mem_ctx, &state,
7118                                 struct rpccli_netr_DsrEnumerateDomainTrusts_state);
7119         if (req == NULL) {
7120                 return NULL;
7121         }
7122         state->out_mem_ctx = NULL;
7123         state->dispatch_recv = cli->dispatch_recv;
7124
7125         /* In parameters */
7126         state->orig.in.server_name = _server_name;
7127         state->orig.in.trust_flags = _trust_flags;
7128
7129         /* Out parameters */
7130         state->orig.out.trusts = _trusts;
7131
7132         /* Result */
7133         ZERO_STRUCT(state->orig.out.result);
7134
7135         if (DEBUGLEVEL >= 10) {
7136                 NDR_PRINT_IN_DEBUG(netr_DsrEnumerateDomainTrusts, &state->orig);
7137         }
7138
7139         state->out_mem_ctx = talloc_named_const(state, 0,
7140                              "rpccli_netr_DsrEnumerateDomainTrusts_out_memory");
7141         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7142                 return tevent_req_post(req, ev);
7143         }
7144
7145         /* make a temporary copy, that we pass to the dispatch function */
7146         state->tmp = state->orig;
7147
7148         subreq = cli->dispatch_send(state, ev, cli,
7149                                     &ndr_table_netlogon,
7150                                     NDR_NETR_DSRENUMERATEDOMAINTRUSTS,
7151                                     &state->tmp);
7152         if (tevent_req_nomem(subreq, req)) {
7153                 return tevent_req_post(req, ev);
7154         }
7155         tevent_req_set_callback(subreq, rpccli_netr_DsrEnumerateDomainTrusts_done, req);
7156         return req;
7157 }
7158
7159 static void rpccli_netr_DsrEnumerateDomainTrusts_done(struct tevent_req *subreq)
7160 {
7161         struct tevent_req *req = tevent_req_callback_data(
7162                 subreq, struct tevent_req);
7163         struct rpccli_netr_DsrEnumerateDomainTrusts_state *state = tevent_req_data(
7164                 req, struct rpccli_netr_DsrEnumerateDomainTrusts_state);
7165         NTSTATUS status;
7166         TALLOC_CTX *mem_ctx;
7167
7168         if (state->out_mem_ctx) {
7169                 mem_ctx = state->out_mem_ctx;
7170         } else {
7171                 mem_ctx = state;
7172         }
7173
7174         status = state->dispatch_recv(subreq, mem_ctx);
7175         TALLOC_FREE(subreq);
7176         if (!NT_STATUS_IS_OK(status)) {
7177                 tevent_req_nterror(req, status);
7178                 return;
7179         }
7180
7181         /* Copy out parameters */
7182         *state->orig.out.trusts = *state->tmp.out.trusts;
7183
7184         /* Copy result */
7185         state->orig.out.result = state->tmp.out.result;
7186
7187         /* Reset temporary structure */
7188         ZERO_STRUCT(state->tmp);
7189
7190         if (DEBUGLEVEL >= 10) {
7191                 NDR_PRINT_OUT_DEBUG(netr_DsrEnumerateDomainTrusts, &state->orig);
7192         }
7193
7194         tevent_req_done(req);
7195 }
7196
7197 NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts_recv(struct tevent_req *req,
7198                                                    TALLOC_CTX *mem_ctx,
7199                                                    WERROR *result)
7200 {
7201         struct rpccli_netr_DsrEnumerateDomainTrusts_state *state = tevent_req_data(
7202                 req, struct rpccli_netr_DsrEnumerateDomainTrusts_state);
7203         NTSTATUS status;
7204
7205         if (tevent_req_is_nterror(req, &status)) {
7206                 tevent_req_received(req);
7207                 return status;
7208         }
7209
7210         /* Steal possbile out parameters to the callers context */
7211         talloc_steal(mem_ctx, state->out_mem_ctx);
7212
7213         /* Return result */
7214         *result = state->orig.out.result;
7215
7216         tevent_req_received(req);
7217         return NT_STATUS_OK;
7218 }
7219
7220 NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli,
7221                                               TALLOC_CTX *mem_ctx,
7222                                               const char *server_name /* [in] [unique,charset(UTF16)] */,
7223                                               uint32_t trust_flags /* [in]  */,
7224                                               struct netr_DomainTrustList *trusts /* [out] [ref] */,
7225                                               WERROR *werror)
7226 {
7227         struct netr_DsrEnumerateDomainTrusts r;
7228         NTSTATUS status;
7229
7230         /* In parameters */
7231         r.in.server_name = server_name;
7232         r.in.trust_flags = trust_flags;
7233
7234         if (DEBUGLEVEL >= 10) {
7235                 NDR_PRINT_IN_DEBUG(netr_DsrEnumerateDomainTrusts, &r);
7236         }
7237
7238         status = cli->dispatch(cli,
7239                                 mem_ctx,
7240                                 &ndr_table_netlogon,
7241                                 NDR_NETR_DSRENUMERATEDOMAINTRUSTS,
7242                                 &r);
7243
7244         if (!NT_STATUS_IS_OK(status)) {
7245                 return status;
7246         }
7247
7248         if (DEBUGLEVEL >= 10) {
7249                 NDR_PRINT_OUT_DEBUG(netr_DsrEnumerateDomainTrusts, &r);
7250         }
7251
7252         if (NT_STATUS_IS_ERR(status)) {
7253                 return status;
7254         }
7255
7256         /* Return variables */
7257         *trusts = *r.out.trusts;
7258
7259         /* Return result */
7260         if (werror) {
7261                 *werror = r.out.result;
7262         }
7263
7264         return werror_to_ntstatus(r.out.result);
7265 }
7266
7267 struct rpccli_netr_DsrDeregisterDNSHostRecords_state {
7268         struct netr_DsrDeregisterDNSHostRecords orig;
7269         struct netr_DsrDeregisterDNSHostRecords tmp;
7270         TALLOC_CTX *out_mem_ctx;
7271         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7272 };
7273
7274 static void rpccli_netr_DsrDeregisterDNSHostRecords_done(struct tevent_req *subreq);
7275
7276 struct tevent_req *rpccli_netr_DsrDeregisterDNSHostRecords_send(TALLOC_CTX *mem_ctx,
7277                                                                 struct tevent_context *ev,
7278                                                                 struct rpc_pipe_client *cli,
7279                                                                 const char *_server_name /* [in] [unique,charset(UTF16)] */,
7280                                                                 const char *_domain /* [in] [unique,charset(UTF16)] */,
7281                                                                 struct GUID *_domain_guid /* [in] [unique] */,
7282                                                                 struct GUID *_dsa_guid /* [in] [unique] */,
7283                                                                 const char *_dns_host /* [in] [ref,charset(UTF16)] */)
7284 {
7285         struct tevent_req *req;
7286         struct rpccli_netr_DsrDeregisterDNSHostRecords_state *state;
7287         struct tevent_req *subreq;
7288
7289         req = tevent_req_create(mem_ctx, &state,
7290                                 struct rpccli_netr_DsrDeregisterDNSHostRecords_state);
7291         if (req == NULL) {
7292                 return NULL;
7293         }
7294         state->out_mem_ctx = NULL;
7295         state->dispatch_recv = cli->dispatch_recv;
7296
7297         /* In parameters */
7298         state->orig.in.server_name = _server_name;
7299         state->orig.in.domain = _domain;
7300         state->orig.in.domain_guid = _domain_guid;
7301         state->orig.in.dsa_guid = _dsa_guid;
7302         state->orig.in.dns_host = _dns_host;
7303
7304         /* Out parameters */
7305
7306         /* Result */
7307         ZERO_STRUCT(state->orig.out.result);
7308
7309         if (DEBUGLEVEL >= 10) {
7310                 NDR_PRINT_IN_DEBUG(netr_DsrDeregisterDNSHostRecords, &state->orig);
7311         }
7312
7313         /* make a temporary copy, that we pass to the dispatch function */
7314         state->tmp = state->orig;
7315
7316         subreq = cli->dispatch_send(state, ev, cli,
7317                                     &ndr_table_netlogon,
7318                                     NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS,
7319                                     &state->tmp);
7320         if (tevent_req_nomem(subreq, req)) {
7321                 return tevent_req_post(req, ev);
7322         }
7323         tevent_req_set_callback(subreq, rpccli_netr_DsrDeregisterDNSHostRecords_done, req);
7324         return req;
7325 }
7326
7327 static void rpccli_netr_DsrDeregisterDNSHostRecords_done(struct tevent_req *subreq)
7328 {
7329         struct tevent_req *req = tevent_req_callback_data(
7330                 subreq, struct tevent_req);
7331         struct rpccli_netr_DsrDeregisterDNSHostRecords_state *state = tevent_req_data(
7332                 req, struct rpccli_netr_DsrDeregisterDNSHostRecords_state);
7333         NTSTATUS status;
7334         TALLOC_CTX *mem_ctx;
7335
7336         if (state->out_mem_ctx) {
7337                 mem_ctx = state->out_mem_ctx;
7338         } else {
7339                 mem_ctx = state;
7340         }
7341
7342         status = state->dispatch_recv(subreq, mem_ctx);
7343         TALLOC_FREE(subreq);
7344         if (!NT_STATUS_IS_OK(status)) {
7345                 tevent_req_nterror(req, status);
7346                 return;
7347         }
7348
7349         /* Copy out parameters */
7350
7351         /* Copy result */
7352         state->orig.out.result = state->tmp.out.result;
7353
7354         /* Reset temporary structure */
7355         ZERO_STRUCT(state->tmp);
7356
7357         if (DEBUGLEVEL >= 10) {
7358                 NDR_PRINT_OUT_DEBUG(netr_DsrDeregisterDNSHostRecords, &state->orig);
7359         }
7360
7361         tevent_req_done(req);
7362 }
7363
7364 NTSTATUS rpccli_netr_DsrDeregisterDNSHostRecords_recv(struct tevent_req *req,
7365                                                       TALLOC_CTX *mem_ctx,
7366                                                       WERROR *result)
7367 {
7368         struct rpccli_netr_DsrDeregisterDNSHostRecords_state *state = tevent_req_data(
7369                 req, struct rpccli_netr_DsrDeregisterDNSHostRecords_state);
7370         NTSTATUS status;
7371
7372         if (tevent_req_is_nterror(req, &status)) {
7373                 tevent_req_received(req);
7374                 return status;
7375         }
7376
7377         /* Steal possbile out parameters to the callers context */
7378         talloc_steal(mem_ctx, state->out_mem_ctx);
7379
7380         /* Return result */
7381         *result = state->orig.out.result;
7382
7383         tevent_req_received(req);
7384         return NT_STATUS_OK;
7385 }
7386
7387 NTSTATUS rpccli_netr_DsrDeregisterDNSHostRecords(struct rpc_pipe_client *cli,
7388                                                  TALLOC_CTX *mem_ctx,
7389                                                  const char *server_name /* [in] [unique,charset(UTF16)] */,
7390                                                  const char *domain /* [in] [unique,charset(UTF16)] */,
7391                                                  struct GUID *domain_guid /* [in] [unique] */,
7392                                                  struct GUID *dsa_guid /* [in] [unique] */,
7393                                                  const char *dns_host /* [in] [ref,charset(UTF16)] */,
7394                                                  WERROR *werror)
7395 {
7396         struct netr_DsrDeregisterDNSHostRecords r;
7397         NTSTATUS status;
7398
7399         /* In parameters */
7400         r.in.server_name = server_name;
7401         r.in.domain = domain;
7402         r.in.domain_guid = domain_guid;
7403         r.in.dsa_guid = dsa_guid;
7404         r.in.dns_host = dns_host;
7405
7406         if (DEBUGLEVEL >= 10) {
7407                 NDR_PRINT_IN_DEBUG(netr_DsrDeregisterDNSHostRecords, &r);
7408         }
7409
7410         status = cli->dispatch(cli,
7411                                 mem_ctx,
7412                                 &ndr_table_netlogon,
7413                                 NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS,
7414                                 &r);
7415
7416         if (!NT_STATUS_IS_OK(status)) {
7417                 return status;
7418         }
7419
7420         if (DEBUGLEVEL >= 10) {
7421                 NDR_PRINT_OUT_DEBUG(netr_DsrDeregisterDNSHostRecords, &r);
7422         }
7423
7424         if (NT_STATUS_IS_ERR(status)) {
7425                 return status;
7426         }
7427
7428         /* Return variables */
7429
7430         /* Return result */
7431         if (werror) {
7432                 *werror = r.out.result;
7433         }
7434
7435         return werror_to_ntstatus(r.out.result);
7436 }
7437
7438 struct rpccli_netr_ServerTrustPasswordsGet_state {
7439         struct netr_ServerTrustPasswordsGet orig;
7440         struct netr_ServerTrustPasswordsGet tmp;
7441         TALLOC_CTX *out_mem_ctx;
7442         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7443 };
7444
7445 static void rpccli_netr_ServerTrustPasswordsGet_done(struct tevent_req *subreq);
7446
7447 struct tevent_req *rpccli_netr_ServerTrustPasswordsGet_send(TALLOC_CTX *mem_ctx,
7448                                                             struct tevent_context *ev,
7449                                                             struct rpc_pipe_client *cli,
7450                                                             const char *_server_name /* [in] [unique,charset(UTF16)] */,
7451                                                             const char *_account_name /* [in] [ref,charset(UTF16)] */,
7452                                                             enum netr_SchannelType _secure_channel_type /* [in]  */,
7453                                                             const char *_computer_name /* [in] [ref,charset(UTF16)] */,
7454                                                             struct netr_Authenticator *_credential /* [in] [ref] */,
7455                                                             struct netr_Authenticator *_return_authenticator /* [out] [ref] */,
7456                                                             struct samr_Password *_password /* [out] [ref] */,
7457                                                             struct samr_Password *_password2 /* [out] [ref] */)
7458 {
7459         struct tevent_req *req;
7460         struct rpccli_netr_ServerTrustPasswordsGet_state *state;
7461         struct tevent_req *subreq;
7462
7463         req = tevent_req_create(mem_ctx, &state,
7464                                 struct rpccli_netr_ServerTrustPasswordsGet_state);
7465         if (req == NULL) {
7466                 return NULL;
7467         }
7468         state->out_mem_ctx = NULL;
7469         state->dispatch_recv = cli->dispatch_recv;
7470
7471         /* In parameters */
7472         state->orig.in.server_name = _server_name;
7473         state->orig.in.account_name = _account_name;
7474         state->orig.in.secure_channel_type = _secure_channel_type;
7475         state->orig.in.computer_name = _computer_name;
7476         state->orig.in.credential = _credential;
7477
7478         /* Out parameters */
7479         state->orig.out.return_authenticator = _return_authenticator;
7480         state->orig.out.password = _password;
7481         state->orig.out.password2 = _password2;
7482
7483         /* Result */
7484         ZERO_STRUCT(state->orig.out.result);
7485
7486         if (DEBUGLEVEL >= 10) {
7487                 NDR_PRINT_IN_DEBUG(netr_ServerTrustPasswordsGet, &state->orig);
7488         }
7489
7490         state->out_mem_ctx = talloc_named_const(state, 0,
7491                              "rpccli_netr_ServerTrustPasswordsGet_out_memory");
7492         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7493                 return tevent_req_post(req, ev);
7494         }
7495
7496         /* make a temporary copy, that we pass to the dispatch function */
7497         state->tmp = state->orig;
7498
7499         subreq = cli->dispatch_send(state, ev, cli,
7500                                     &ndr_table_netlogon,
7501                                     NDR_NETR_SERVERTRUSTPASSWORDSGET,
7502                                     &state->tmp);
7503         if (tevent_req_nomem(subreq, req)) {
7504                 return tevent_req_post(req, ev);
7505         }
7506         tevent_req_set_callback(subreq, rpccli_netr_ServerTrustPasswordsGet_done, req);
7507         return req;
7508 }
7509
7510 static void rpccli_netr_ServerTrustPasswordsGet_done(struct tevent_req *subreq)
7511 {
7512         struct tevent_req *req = tevent_req_callback_data(
7513                 subreq, struct tevent_req);
7514         struct rpccli_netr_ServerTrustPasswordsGet_state *state = tevent_req_data(
7515                 req, struct rpccli_netr_ServerTrustPasswordsGet_state);
7516         NTSTATUS status;
7517         TALLOC_CTX *mem_ctx;
7518
7519         if (state->out_mem_ctx) {
7520                 mem_ctx = state->out_mem_ctx;
7521         } else {
7522                 mem_ctx = state;
7523         }
7524
7525         status = state->dispatch_recv(subreq, mem_ctx);
7526         TALLOC_FREE(subreq);
7527         if (!NT_STATUS_IS_OK(status)) {
7528                 tevent_req_nterror(req, status);
7529                 return;
7530         }
7531
7532         /* Copy out parameters */
7533         *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
7534         *state->orig.out.password = *state->tmp.out.password;
7535         *state->orig.out.password2 = *state->tmp.out.password2;
7536
7537         /* Copy result */
7538         state->orig.out.result = state->tmp.out.result;
7539
7540         /* Reset temporary structure */
7541         ZERO_STRUCT(state->tmp);
7542
7543         if (DEBUGLEVEL >= 10) {
7544                 NDR_PRINT_OUT_DEBUG(netr_ServerTrustPasswordsGet, &state->orig);
7545         }
7546
7547         tevent_req_done(req);
7548 }
7549
7550 NTSTATUS rpccli_netr_ServerTrustPasswordsGet_recv(struct tevent_req *req,
7551                                                   TALLOC_CTX *mem_ctx,
7552                                                   NTSTATUS *result)
7553 {
7554         struct rpccli_netr_ServerTrustPasswordsGet_state *state = tevent_req_data(
7555                 req, struct rpccli_netr_ServerTrustPasswordsGet_state);
7556         NTSTATUS status;
7557
7558         if (tevent_req_is_nterror(req, &status)) {
7559                 tevent_req_received(req);
7560                 return status;
7561         }
7562
7563         /* Steal possbile out parameters to the callers context */
7564         talloc_steal(mem_ctx, state->out_mem_ctx);
7565
7566         /* Return result */
7567         *result = state->orig.out.result;
7568
7569         tevent_req_received(req);
7570         return NT_STATUS_OK;
7571 }
7572
7573 NTSTATUS rpccli_netr_ServerTrustPasswordsGet(struct rpc_pipe_client *cli,
7574                                              TALLOC_CTX *mem_ctx,
7575                                              const char *server_name /* [in] [unique,charset(UTF16)] */,
7576                                              const char *account_name /* [in] [ref,charset(UTF16)] */,
7577                                              enum netr_SchannelType secure_channel_type /* [in]  */,
7578                                              const char *computer_name /* [in] [ref,charset(UTF16)] */,
7579                                              struct netr_Authenticator *credential /* [in] [ref] */,
7580                                              struct netr_Authenticator *return_authenticator /* [out] [ref] */,
7581                                              struct samr_Password *password /* [out] [ref] */,
7582                                              struct samr_Password *password2 /* [out] [ref] */)
7583 {
7584         struct netr_ServerTrustPasswordsGet r;
7585         NTSTATUS status;
7586
7587         /* In parameters */
7588         r.in.server_name = server_name;
7589         r.in.account_name = account_name;
7590         r.in.secure_channel_type = secure_channel_type;
7591         r.in.computer_name = computer_name;
7592         r.in.credential = credential;
7593
7594         if (DEBUGLEVEL >= 10) {
7595                 NDR_PRINT_IN_DEBUG(netr_ServerTrustPasswordsGet, &r);
7596         }
7597
7598         status = cli->dispatch(cli,
7599                                 mem_ctx,
7600                                 &ndr_table_netlogon,
7601                                 NDR_NETR_SERVERTRUSTPASSWORDSGET,
7602                                 &r);
7603
7604         if (!NT_STATUS_IS_OK(status)) {
7605                 return status;
7606         }
7607
7608         if (DEBUGLEVEL >= 10) {
7609                 NDR_PRINT_OUT_DEBUG(netr_ServerTrustPasswordsGet, &r);
7610         }
7611
7612         if (NT_STATUS_IS_ERR(status)) {
7613                 return status;
7614         }
7615
7616         /* Return variables */
7617         *return_authenticator = *r.out.return_authenticator;
7618         *password = *r.out.password;
7619         *password2 = *r.out.password2;
7620
7621         /* Return result */
7622         return r.out.result;
7623 }
7624
7625 struct rpccli_netr_DsRGetForestTrustInformation_state {
7626         struct netr_DsRGetForestTrustInformation orig;
7627         struct netr_DsRGetForestTrustInformation tmp;
7628         TALLOC_CTX *out_mem_ctx;
7629         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7630 };
7631
7632 static void rpccli_netr_DsRGetForestTrustInformation_done(struct tevent_req *subreq);
7633
7634 struct tevent_req *rpccli_netr_DsRGetForestTrustInformation_send(TALLOC_CTX *mem_ctx,
7635                                                                  struct tevent_context *ev,
7636                                                                  struct rpc_pipe_client *cli,
7637                                                                  const char *_server_name /* [in] [unique,charset(UTF16)] */,
7638                                                                  const char *_trusted_domain_name /* [in] [unique,charset(UTF16)] */,
7639                                                                  uint32_t _flags /* [in]  */,
7640                                                                  struct lsa_ForestTrustInformation **_forest_trust_info /* [out] [ref] */)
7641 {
7642         struct tevent_req *req;
7643         struct rpccli_netr_DsRGetForestTrustInformation_state *state;
7644         struct tevent_req *subreq;
7645
7646         req = tevent_req_create(mem_ctx, &state,
7647                                 struct rpccli_netr_DsRGetForestTrustInformation_state);
7648         if (req == NULL) {
7649                 return NULL;
7650         }
7651         state->out_mem_ctx = NULL;
7652         state->dispatch_recv = cli->dispatch_recv;
7653
7654         /* In parameters */
7655         state->orig.in.server_name = _server_name;
7656         state->orig.in.trusted_domain_name = _trusted_domain_name;
7657         state->orig.in.flags = _flags;
7658
7659         /* Out parameters */
7660         state->orig.out.forest_trust_info = _forest_trust_info;
7661
7662         /* Result */
7663         ZERO_STRUCT(state->orig.out.result);
7664
7665         if (DEBUGLEVEL >= 10) {
7666                 NDR_PRINT_IN_DEBUG(netr_DsRGetForestTrustInformation, &state->orig);
7667         }
7668
7669         state->out_mem_ctx = talloc_named_const(state, 0,
7670                              "rpccli_netr_DsRGetForestTrustInformation_out_memory");
7671         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7672                 return tevent_req_post(req, ev);
7673         }
7674
7675         /* make a temporary copy, that we pass to the dispatch function */
7676         state->tmp = state->orig;
7677
7678         subreq = cli->dispatch_send(state, ev, cli,
7679                                     &ndr_table_netlogon,
7680                                     NDR_NETR_DSRGETFORESTTRUSTINFORMATION,
7681                                     &state->tmp);
7682         if (tevent_req_nomem(subreq, req)) {
7683                 return tevent_req_post(req, ev);
7684         }
7685         tevent_req_set_callback(subreq, rpccli_netr_DsRGetForestTrustInformation_done, req);
7686         return req;
7687 }
7688
7689 static void rpccli_netr_DsRGetForestTrustInformation_done(struct tevent_req *subreq)
7690 {
7691         struct tevent_req *req = tevent_req_callback_data(
7692                 subreq, struct tevent_req);
7693         struct rpccli_netr_DsRGetForestTrustInformation_state *state = tevent_req_data(
7694                 req, struct rpccli_netr_DsRGetForestTrustInformation_state);
7695         NTSTATUS status;
7696         TALLOC_CTX *mem_ctx;
7697
7698         if (state->out_mem_ctx) {
7699                 mem_ctx = state->out_mem_ctx;
7700         } else {
7701                 mem_ctx = state;
7702         }
7703
7704         status = state->dispatch_recv(subreq, mem_ctx);
7705         TALLOC_FREE(subreq);
7706         if (!NT_STATUS_IS_OK(status)) {
7707                 tevent_req_nterror(req, status);
7708                 return;
7709         }
7710
7711         /* Copy out parameters */
7712         *state->orig.out.forest_trust_info = *state->tmp.out.forest_trust_info;
7713
7714         /* Copy result */
7715         state->orig.out.result = state->tmp.out.result;
7716
7717         /* Reset temporary structure */
7718         ZERO_STRUCT(state->tmp);
7719
7720         if (DEBUGLEVEL >= 10) {
7721                 NDR_PRINT_OUT_DEBUG(netr_DsRGetForestTrustInformation, &state->orig);
7722         }
7723
7724         tevent_req_done(req);
7725 }
7726
7727 NTSTATUS rpccli_netr_DsRGetForestTrustInformation_recv(struct tevent_req *req,
7728                                                        TALLOC_CTX *mem_ctx,
7729                                                        WERROR *result)
7730 {
7731         struct rpccli_netr_DsRGetForestTrustInformation_state *state = tevent_req_data(
7732                 req, struct rpccli_netr_DsRGetForestTrustInformation_state);
7733         NTSTATUS status;
7734
7735         if (tevent_req_is_nterror(req, &status)) {
7736                 tevent_req_received(req);
7737                 return status;
7738         }
7739
7740         /* Steal possbile out parameters to the callers context */
7741         talloc_steal(mem_ctx, state->out_mem_ctx);
7742
7743         /* Return result */
7744         *result = state->orig.out.result;
7745
7746         tevent_req_received(req);
7747         return NT_STATUS_OK;
7748 }
7749
7750 NTSTATUS rpccli_netr_DsRGetForestTrustInformation(struct rpc_pipe_client *cli,
7751                                                   TALLOC_CTX *mem_ctx,
7752                                                   const char *server_name /* [in] [unique,charset(UTF16)] */,
7753                                                   const char *trusted_domain_name /* [in] [unique,charset(UTF16)] */,
7754                                                   uint32_t flags /* [in]  */,
7755                                                   struct lsa_ForestTrustInformation **forest_trust_info /* [out] [ref] */,
7756                                                   WERROR *werror)
7757 {
7758         struct netr_DsRGetForestTrustInformation r;
7759         NTSTATUS status;
7760
7761         /* In parameters */
7762         r.in.server_name = server_name;
7763         r.in.trusted_domain_name = trusted_domain_name;
7764         r.in.flags = flags;
7765
7766         if (DEBUGLEVEL >= 10) {
7767                 NDR_PRINT_IN_DEBUG(netr_DsRGetForestTrustInformation, &r);
7768         }
7769
7770         status = cli->dispatch(cli,
7771                                 mem_ctx,
7772                                 &ndr_table_netlogon,
7773                                 NDR_NETR_DSRGETFORESTTRUSTINFORMATION,
7774                                 &r);
7775
7776         if (!NT_STATUS_IS_OK(status)) {
7777                 return status;
7778         }
7779
7780         if (DEBUGLEVEL >= 10) {
7781                 NDR_PRINT_OUT_DEBUG(netr_DsRGetForestTrustInformation, &r);
7782         }
7783
7784         if (NT_STATUS_IS_ERR(status)) {
7785                 return status;
7786         }
7787
7788         /* Return variables */
7789         *forest_trust_info = *r.out.forest_trust_info;
7790
7791         /* Return result */
7792         if (werror) {
7793                 *werror = r.out.result;
7794         }
7795
7796         return werror_to_ntstatus(r.out.result);
7797 }
7798
7799 struct rpccli_netr_GetForestTrustInformation_state {
7800         struct netr_GetForestTrustInformation orig;
7801         struct netr_GetForestTrustInformation tmp;
7802         TALLOC_CTX *out_mem_ctx;
7803         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7804 };
7805
7806 static void rpccli_netr_GetForestTrustInformation_done(struct tevent_req *subreq);
7807
7808 struct tevent_req *rpccli_netr_GetForestTrustInformation_send(TALLOC_CTX *mem_ctx,
7809                                                               struct tevent_context *ev,
7810                                                               struct rpc_pipe_client *cli,
7811                                                               const char *_server_name /* [in] [unique,charset(UTF16)] */,
7812                                                               const char *_trusted_domain_name /* [in] [ref,charset(UTF16)] */,
7813                                                               struct netr_Authenticator *_credential /* [in] [ref] */,
7814                                                               struct netr_Authenticator *_return_authenticator /* [out] [ref] */,
7815                                                               uint32_t _flags /* [in]  */,
7816                                                               struct lsa_ForestTrustInformation **_forest_trust_info /* [out] [ref] */)
7817 {
7818         struct tevent_req *req;
7819         struct rpccli_netr_GetForestTrustInformation_state *state;
7820         struct tevent_req *subreq;
7821
7822         req = tevent_req_create(mem_ctx, &state,
7823                                 struct rpccli_netr_GetForestTrustInformation_state);
7824         if (req == NULL) {
7825                 return NULL;
7826         }
7827         state->out_mem_ctx = NULL;
7828         state->dispatch_recv = cli->dispatch_recv;
7829
7830         /* In parameters */
7831         state->orig.in.server_name = _server_name;
7832         state->orig.in.trusted_domain_name = _trusted_domain_name;
7833         state->orig.in.credential = _credential;
7834         state->orig.in.flags = _flags;
7835
7836         /* Out parameters */
7837         state->orig.out.return_authenticator = _return_authenticator;
7838         state->orig.out.forest_trust_info = _forest_trust_info;
7839
7840         /* Result */
7841         ZERO_STRUCT(state->orig.out.result);
7842
7843         if (DEBUGLEVEL >= 10) {
7844                 NDR_PRINT_IN_DEBUG(netr_GetForestTrustInformation, &state->orig);
7845         }
7846
7847         state->out_mem_ctx = talloc_named_const(state, 0,
7848                              "rpccli_netr_GetForestTrustInformation_out_memory");
7849         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7850                 return tevent_req_post(req, ev);
7851         }
7852
7853         /* make a temporary copy, that we pass to the dispatch function */
7854         state->tmp = state->orig;
7855
7856         subreq = cli->dispatch_send(state, ev, cli,
7857                                     &ndr_table_netlogon,
7858                                     NDR_NETR_GETFORESTTRUSTINFORMATION,
7859                                     &state->tmp);
7860         if (tevent_req_nomem(subreq, req)) {
7861                 return tevent_req_post(req, ev);
7862         }
7863         tevent_req_set_callback(subreq, rpccli_netr_GetForestTrustInformation_done, req);
7864         return req;
7865 }
7866
7867 static void rpccli_netr_GetForestTrustInformation_done(struct tevent_req *subreq)
7868 {
7869         struct tevent_req *req = tevent_req_callback_data(
7870                 subreq, struct tevent_req);
7871         struct rpccli_netr_GetForestTrustInformation_state *state = tevent_req_data(
7872                 req, struct rpccli_netr_GetForestTrustInformation_state);
7873         NTSTATUS status;
7874         TALLOC_CTX *mem_ctx;
7875
7876         if (state->out_mem_ctx) {
7877                 mem_ctx = state->out_mem_ctx;
7878         } else {
7879                 mem_ctx = state;
7880         }
7881
7882         status = state->dispatch_recv(subreq, mem_ctx);
7883         TALLOC_FREE(subreq);
7884         if (!NT_STATUS_IS_OK(status)) {
7885                 tevent_req_nterror(req, status);
7886                 return;
7887         }
7888
7889         /* Copy out parameters */
7890         *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
7891         *state->orig.out.forest_trust_info = *state->tmp.out.forest_trust_info;
7892
7893         /* Copy result */
7894         state->orig.out.result = state->tmp.out.result;
7895
7896         /* Reset temporary structure */
7897         ZERO_STRUCT(state->tmp);
7898
7899         if (DEBUGLEVEL >= 10) {
7900                 NDR_PRINT_OUT_DEBUG(netr_GetForestTrustInformation, &state->orig);
7901         }
7902
7903         tevent_req_done(req);
7904 }
7905
7906 NTSTATUS rpccli_netr_GetForestTrustInformation_recv(struct tevent_req *req,
7907                                                     TALLOC_CTX *mem_ctx,
7908                                                     WERROR *result)
7909 {
7910         struct rpccli_netr_GetForestTrustInformation_state *state = tevent_req_data(
7911                 req, struct rpccli_netr_GetForestTrustInformation_state);
7912         NTSTATUS status;
7913
7914         if (tevent_req_is_nterror(req, &status)) {
7915                 tevent_req_received(req);
7916                 return status;
7917         }
7918
7919         /* Steal possbile out parameters to the callers context */
7920         talloc_steal(mem_ctx, state->out_mem_ctx);
7921
7922         /* Return result */
7923         *result = state->orig.out.result;
7924
7925         tevent_req_received(req);
7926         return NT_STATUS_OK;
7927 }
7928
7929 NTSTATUS rpccli_netr_GetForestTrustInformation(struct rpc_pipe_client *cli,
7930                                                TALLOC_CTX *mem_ctx,
7931                                                const char *server_name /* [in] [unique,charset(UTF16)] */,
7932                                                const char *trusted_domain_name /* [in] [ref,charset(UTF16)] */,
7933                                                struct netr_Authenticator *credential /* [in] [ref] */,
7934                                                struct netr_Authenticator *return_authenticator /* [out] [ref] */,
7935                                                uint32_t flags /* [in]  */,
7936                                                struct lsa_ForestTrustInformation **forest_trust_info /* [out] [ref] */,
7937                                                WERROR *werror)
7938 {
7939         struct netr_GetForestTrustInformation r;
7940         NTSTATUS status;
7941
7942         /* In parameters */
7943         r.in.server_name = server_name;
7944         r.in.trusted_domain_name = trusted_domain_name;
7945         r.in.credential = credential;
7946         r.in.flags = flags;
7947
7948         if (DEBUGLEVEL >= 10) {
7949                 NDR_PRINT_IN_DEBUG(netr_GetForestTrustInformation, &r);
7950         }
7951
7952         status = cli->dispatch(cli,
7953                                 mem_ctx,
7954                                 &ndr_table_netlogon,
7955                                 NDR_NETR_GETFORESTTRUSTINFORMATION,
7956                                 &r);
7957
7958         if (!NT_STATUS_IS_OK(status)) {
7959                 return status;
7960         }
7961
7962         if (DEBUGLEVEL >= 10) {
7963                 NDR_PRINT_OUT_DEBUG(netr_GetForestTrustInformation, &r);
7964         }
7965
7966         if (NT_STATUS_IS_ERR(status)) {
7967                 return status;
7968         }
7969
7970         /* Return variables */
7971         *return_authenticator = *r.out.return_authenticator;
7972         *forest_trust_info = *r.out.forest_trust_info;
7973
7974         /* Return result */
7975         if (werror) {
7976                 *werror = r.out.result;
7977         }
7978
7979         return werror_to_ntstatus(r.out.result);
7980 }
7981
7982 struct rpccli_netr_LogonSamLogonWithFlags_state {
7983         struct netr_LogonSamLogonWithFlags orig;
7984         struct netr_LogonSamLogonWithFlags tmp;
7985         TALLOC_CTX *out_mem_ctx;
7986         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7987 };
7988
7989 static void rpccli_netr_LogonSamLogonWithFlags_done(struct tevent_req *subreq);
7990
7991 struct tevent_req *rpccli_netr_LogonSamLogonWithFlags_send(TALLOC_CTX *mem_ctx,
7992                                                            struct tevent_context *ev,
7993                                                            struct rpc_pipe_client *cli,
7994                                                            const char *_server_name /* [in] [unique,charset(UTF16)] */,
7995                                                            const char *_computer_name /* [in] [unique,charset(UTF16)] */,
7996                                                            struct netr_Authenticator *_credential /* [in] [unique] */,
7997                                                            struct netr_Authenticator *_return_authenticator /* [in,out] [unique] */,
7998                                                            enum netr_LogonInfoClass _logon_level /* [in]  */,
7999                                                            union netr_LogonLevel *_logon /* [in] [ref,switch_is(logon_level)] */,
8000                                                            uint16_t _validation_level /* [in]  */,
8001                                                            union netr_Validation *_validation /* [out] [ref,switch_is(validation_level)] */,
8002                                                            uint8_t *_authoritative /* [out] [ref] */,
8003                                                            uint32_t *_flags /* [in,out] [ref] */)
8004 {
8005         struct tevent_req *req;
8006         struct rpccli_netr_LogonSamLogonWithFlags_state *state;
8007         struct tevent_req *subreq;
8008
8009         req = tevent_req_create(mem_ctx, &state,
8010                                 struct rpccli_netr_LogonSamLogonWithFlags_state);
8011         if (req == NULL) {
8012                 return NULL;
8013         }
8014         state->out_mem_ctx = NULL;
8015         state->dispatch_recv = cli->dispatch_recv;
8016
8017         /* In parameters */
8018         state->orig.in.server_name = _server_name;
8019         state->orig.in.computer_name = _computer_name;
8020         state->orig.in.credential = _credential;
8021         state->orig.in.return_authenticator = _return_authenticator;
8022         state->orig.in.logon_level = _logon_level;
8023         state->orig.in.logon = _logon;
8024         state->orig.in.validation_level = _validation_level;
8025         state->orig.in.flags = _flags;
8026
8027         /* Out parameters */
8028         state->orig.out.return_authenticator = _return_authenticator;
8029         state->orig.out.validation = _validation;
8030         state->orig.out.authoritative = _authoritative;
8031         state->orig.out.flags = _flags;
8032
8033         /* Result */
8034         ZERO_STRUCT(state->orig.out.result);
8035
8036         if (DEBUGLEVEL >= 10) {
8037                 NDR_PRINT_IN_DEBUG(netr_LogonSamLogonWithFlags, &state->orig);
8038         }
8039
8040         state->out_mem_ctx = talloc_named_const(state, 0,
8041                              "rpccli_netr_LogonSamLogonWithFlags_out_memory");
8042         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8043                 return tevent_req_post(req, ev);
8044         }
8045
8046         /* make a temporary copy, that we pass to the dispatch function */
8047         state->tmp = state->orig;
8048
8049         subreq = cli->dispatch_send(state, ev, cli,
8050                                     &ndr_table_netlogon,
8051                                     NDR_NETR_LOGONSAMLOGONWITHFLAGS,
8052                                     &state->tmp);
8053         if (tevent_req_nomem(subreq, req)) {
8054                 return tevent_req_post(req, ev);
8055         }
8056         tevent_req_set_callback(subreq, rpccli_netr_LogonSamLogonWithFlags_done, req);
8057         return req;
8058 }
8059
8060 static void rpccli_netr_LogonSamLogonWithFlags_done(struct tevent_req *subreq)
8061 {
8062         struct tevent_req *req = tevent_req_callback_data(
8063                 subreq, struct tevent_req);
8064         struct rpccli_netr_LogonSamLogonWithFlags_state *state = tevent_req_data(
8065                 req, struct rpccli_netr_LogonSamLogonWithFlags_state);
8066         NTSTATUS status;
8067         TALLOC_CTX *mem_ctx;
8068
8069         if (state->out_mem_ctx) {
8070                 mem_ctx = state->out_mem_ctx;
8071         } else {
8072                 mem_ctx = state;
8073         }
8074
8075         status = state->dispatch_recv(subreq, mem_ctx);
8076         TALLOC_FREE(subreq);
8077         if (!NT_STATUS_IS_OK(status)) {
8078                 tevent_req_nterror(req, status);
8079                 return;
8080         }
8081
8082         /* Copy out parameters */
8083         if (state->orig.out.return_authenticator && state->tmp.out.return_authenticator) {
8084                 *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
8085         }
8086         *state->orig.out.validation = *state->tmp.out.validation;
8087         *state->orig.out.authoritative = *state->tmp.out.authoritative;
8088         *state->orig.out.flags = *state->tmp.out.flags;
8089
8090         /* Copy result */
8091         state->orig.out.result = state->tmp.out.result;
8092
8093         /* Reset temporary structure */
8094         ZERO_STRUCT(state->tmp);
8095
8096         if (DEBUGLEVEL >= 10) {
8097                 NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonWithFlags, &state->orig);
8098         }
8099
8100         tevent_req_done(req);
8101 }
8102
8103 NTSTATUS rpccli_netr_LogonSamLogonWithFlags_recv(struct tevent_req *req,
8104                                                  TALLOC_CTX *mem_ctx,
8105                                                  NTSTATUS *result)
8106 {
8107         struct rpccli_netr_LogonSamLogonWithFlags_state *state = tevent_req_data(
8108                 req, struct rpccli_netr_LogonSamLogonWithFlags_state);
8109         NTSTATUS status;
8110
8111         if (tevent_req_is_nterror(req, &status)) {
8112                 tevent_req_received(req);
8113                 return status;
8114         }
8115
8116         /* Steal possbile out parameters to the callers context */
8117         talloc_steal(mem_ctx, state->out_mem_ctx);
8118
8119         /* Return result */
8120         *result = state->orig.out.result;
8121
8122         tevent_req_received(req);
8123         return NT_STATUS_OK;
8124 }
8125
8126 NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli,
8127                                             TALLOC_CTX *mem_ctx,
8128                                             const char *server_name /* [in] [unique,charset(UTF16)] */,
8129                                             const char *computer_name /* [in] [unique,charset(UTF16)] */,
8130                                             struct netr_Authenticator *credential /* [in] [unique] */,
8131                                             struct netr_Authenticator *return_authenticator /* [in,out] [unique] */,
8132                                             enum netr_LogonInfoClass logon_level /* [in]  */,
8133                                             union netr_LogonLevel *logon /* [in] [ref,switch_is(logon_level)] */,
8134                                             uint16_t validation_level /* [in]  */,
8135                                             union netr_Validation *validation /* [out] [ref,switch_is(validation_level)] */,
8136                                             uint8_t *authoritative /* [out] [ref] */,
8137                                             uint32_t *flags /* [in,out] [ref] */)
8138 {
8139         struct netr_LogonSamLogonWithFlags r;
8140         NTSTATUS status;
8141
8142         /* In parameters */
8143         r.in.server_name = server_name;
8144         r.in.computer_name = computer_name;
8145         r.in.credential = credential;
8146         r.in.return_authenticator = return_authenticator;
8147         r.in.logon_level = logon_level;
8148         r.in.logon = logon;
8149         r.in.validation_level = validation_level;
8150         r.in.flags = flags;
8151
8152         if (DEBUGLEVEL >= 10) {
8153                 NDR_PRINT_IN_DEBUG(netr_LogonSamLogonWithFlags, &r);
8154         }
8155
8156         status = cli->dispatch(cli,
8157                                 mem_ctx,
8158                                 &ndr_table_netlogon,
8159                                 NDR_NETR_LOGONSAMLOGONWITHFLAGS,
8160                                 &r);
8161
8162         if (!NT_STATUS_IS_OK(status)) {
8163                 return status;
8164         }
8165
8166         if (DEBUGLEVEL >= 10) {
8167                 NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonWithFlags, &r);
8168         }
8169
8170         if (NT_STATUS_IS_ERR(status)) {
8171                 return status;
8172         }
8173
8174         /* Return variables */
8175         if (return_authenticator && r.out.return_authenticator) {
8176                 *return_authenticator = *r.out.return_authenticator;
8177         }
8178         *validation = *r.out.validation;
8179         *authoritative = *r.out.authoritative;
8180         *flags = *r.out.flags;
8181
8182         /* Return result */
8183         return r.out.result;
8184 }
8185
8186 struct rpccli_netr_ServerGetTrustInfo_state {
8187         struct netr_ServerGetTrustInfo orig;
8188         struct netr_ServerGetTrustInfo tmp;
8189         TALLOC_CTX *out_mem_ctx;
8190         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8191 };
8192
8193 static void rpccli_netr_ServerGetTrustInfo_done(struct tevent_req *subreq);
8194
8195 struct tevent_req *rpccli_netr_ServerGetTrustInfo_send(TALLOC_CTX *mem_ctx,
8196                                                        struct tevent_context *ev,
8197                                                        struct rpc_pipe_client *cli,
8198                                                        const char *_server_name /* [in] [unique,charset(UTF16)] */,
8199                                                        const char *_account_name /* [in] [ref,charset(UTF16)] */,
8200                                                        enum netr_SchannelType _secure_channel_type /* [in]  */,
8201                                                        const char *_computer_name /* [in] [ref,charset(UTF16)] */,
8202                                                        struct netr_Authenticator *_credential /* [in] [ref] */,
8203                                                        struct netr_Authenticator *_return_authenticator /* [out] [ref] */,
8204                                                        struct samr_Password *_new_owf_password /* [out] [ref] */,
8205                                                        struct samr_Password *_old_owf_password /* [out] [ref] */,
8206                                                        struct netr_TrustInfo **_trust_info /* [out] [ref] */)
8207 {
8208         struct tevent_req *req;
8209         struct rpccli_netr_ServerGetTrustInfo_state *state;
8210         struct tevent_req *subreq;
8211
8212         req = tevent_req_create(mem_ctx, &state,
8213                                 struct rpccli_netr_ServerGetTrustInfo_state);
8214         if (req == NULL) {
8215                 return NULL;
8216         }
8217         state->out_mem_ctx = NULL;
8218         state->dispatch_recv = cli->dispatch_recv;
8219
8220         /* In parameters */
8221         state->orig.in.server_name = _server_name;
8222         state->orig.in.account_name = _account_name;
8223         state->orig.in.secure_channel_type = _secure_channel_type;
8224         state->orig.in.computer_name = _computer_name;
8225         state->orig.in.credential = _credential;
8226
8227         /* Out parameters */
8228         state->orig.out.return_authenticator = _return_authenticator;
8229         state->orig.out.new_owf_password = _new_owf_password;
8230         state->orig.out.old_owf_password = _old_owf_password;
8231         state->orig.out.trust_info = _trust_info;
8232
8233         /* Result */
8234         ZERO_STRUCT(state->orig.out.result);
8235
8236         if (DEBUGLEVEL >= 10) {
8237                 NDR_PRINT_IN_DEBUG(netr_ServerGetTrustInfo, &state->orig);
8238         }
8239
8240         state->out_mem_ctx = talloc_named_const(state, 0,
8241                              "rpccli_netr_ServerGetTrustInfo_out_memory");
8242         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8243                 return tevent_req_post(req, ev);
8244         }
8245
8246         /* make a temporary copy, that we pass to the dispatch function */
8247         state->tmp = state->orig;
8248
8249         subreq = cli->dispatch_send(state, ev, cli,
8250                                     &ndr_table_netlogon,
8251                                     NDR_NETR_SERVERGETTRUSTINFO,
8252                                     &state->tmp);
8253         if (tevent_req_nomem(subreq, req)) {
8254                 return tevent_req_post(req, ev);
8255         }
8256         tevent_req_set_callback(subreq, rpccli_netr_ServerGetTrustInfo_done, req);
8257         return req;
8258 }
8259
8260 static void rpccli_netr_ServerGetTrustInfo_done(struct tevent_req *subreq)
8261 {
8262         struct tevent_req *req = tevent_req_callback_data(
8263                 subreq, struct tevent_req);
8264         struct rpccli_netr_ServerGetTrustInfo_state *state = tevent_req_data(
8265                 req, struct rpccli_netr_ServerGetTrustInfo_state);
8266         NTSTATUS status;
8267         TALLOC_CTX *mem_ctx;
8268
8269         if (state->out_mem_ctx) {
8270                 mem_ctx = state->out_mem_ctx;
8271         } else {
8272                 mem_ctx = state;
8273         }
8274
8275         status = state->dispatch_recv(subreq, mem_ctx);
8276         TALLOC_FREE(subreq);
8277         if (!NT_STATUS_IS_OK(status)) {
8278                 tevent_req_nterror(req, status);
8279                 return;
8280         }
8281
8282         /* Copy out parameters */
8283         *state->orig.out.return_authenticator = *state->tmp.out.return_authenticator;
8284         *state->orig.out.new_owf_password = *state->tmp.out.new_owf_password;
8285         *state->orig.out.old_owf_password = *state->tmp.out.old_owf_password;
8286         *state->orig.out.trust_info = *state->tmp.out.trust_info;
8287
8288         /* Copy result */
8289         state->orig.out.result = state->tmp.out.result;
8290
8291         /* Reset temporary structure */
8292         ZERO_STRUCT(state->tmp);
8293
8294         if (DEBUGLEVEL >= 10) {
8295                 NDR_PRINT_OUT_DEBUG(netr_ServerGetTrustInfo, &state->orig);
8296         }
8297
8298         tevent_req_done(req);
8299 }
8300
8301 NTSTATUS rpccli_netr_ServerGetTrustInfo_recv(struct tevent_req *req,
8302                                              TALLOC_CTX *mem_ctx,
8303                                              NTSTATUS *result)
8304 {
8305         struct rpccli_netr_ServerGetTrustInfo_state *state = tevent_req_data(
8306                 req, struct rpccli_netr_ServerGetTrustInfo_state);
8307         NTSTATUS status;
8308
8309         if (tevent_req_is_nterror(req, &status)) {
8310                 tevent_req_received(req);
8311                 return status;
8312         }
8313
8314         /* Steal possbile out parameters to the callers context */
8315         talloc_steal(mem_ctx, state->out_mem_ctx);
8316
8317         /* Return result */
8318         *result = state->orig.out.result;
8319
8320         tevent_req_received(req);
8321         return NT_STATUS_OK;
8322 }
8323
8324 NTSTATUS rpccli_netr_ServerGetTrustInfo(struct rpc_pipe_client *cli,
8325                                         TALLOC_CTX *mem_ctx,
8326                                         const char *server_name /* [in] [unique,charset(UTF16)] */,
8327                                         const char *account_name /* [in] [ref,charset(UTF16)] */,
8328                                         enum netr_SchannelType secure_channel_type /* [in]  */,
8329                                         const char *computer_name /* [in] [ref,charset(UTF16)] */,
8330                                         struct netr_Authenticator *credential /* [in] [ref] */,
8331                                         struct netr_Authenticator *return_authenticator /* [out] [ref] */,
8332                                         struct samr_Password *new_owf_password /* [out] [ref] */,
8333                                         struct samr_Password *old_owf_password /* [out] [ref] */,
8334                                         struct netr_TrustInfo **trust_info /* [out] [ref] */)
8335 {
8336         struct netr_ServerGetTrustInfo r;
8337         NTSTATUS status;
8338
8339         /* In parameters */
8340         r.in.server_name = server_name;
8341         r.in.account_name = account_name;
8342         r.in.secure_channel_type = secure_channel_type;
8343         r.in.computer_name = computer_name;
8344         r.in.credential = credential;
8345
8346         if (DEBUGLEVEL >= 10) {
8347                 NDR_PRINT_IN_DEBUG(netr_ServerGetTrustInfo, &r);
8348         }
8349
8350         status = cli->dispatch(cli,
8351                                 mem_ctx,
8352                                 &ndr_table_netlogon,
8353                                 NDR_NETR_SERVERGETTRUSTINFO,
8354                                 &r);
8355
8356         if (!NT_STATUS_IS_OK(status)) {
8357                 return status;
8358         }
8359
8360         if (DEBUGLEVEL >= 10) {
8361                 NDR_PRINT_OUT_DEBUG(netr_ServerGetTrustInfo, &r);
8362         }
8363
8364         if (NT_STATUS_IS_ERR(status)) {
8365                 return status;
8366         }
8367
8368         /* Return variables */
8369         *return_authenticator = *r.out.return_authenticator;
8370         *new_owf_password = *r.out.new_owf_password;
8371         *old_owf_password = *r.out.old_owf_password;
8372         *trust_info = *r.out.trust_info;
8373
8374         /* Return result */
8375         return r.out.result;
8376 }
8377