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