Revert "s3: Do not reference ndr_table_<pipe> in the cli_ routines directly"
[ira/wip.git] / librpc / gen_ndr / cli_wkssvc.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_wkssvc.h"
8
9 struct rpccli_wkssvc_NetWkstaGetInfo_state {
10         struct wkssvc_NetWkstaGetInfo orig;
11         struct wkssvc_NetWkstaGetInfo 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_wkssvc_NetWkstaGetInfo_done(struct tevent_req *subreq);
17
18 struct tevent_req *rpccli_wkssvc_NetWkstaGetInfo_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                                                       uint32_t _level /* [in]  */,
23                                                       union wkssvc_NetWkstaInfo *_info /* [out] [ref,switch_is(level)] */)
24 {
25         struct tevent_req *req;
26         struct rpccli_wkssvc_NetWkstaGetInfo_state *state;
27         struct tevent_req *subreq;
28
29         req = tevent_req_create(mem_ctx, &state,
30                                 struct rpccli_wkssvc_NetWkstaGetInfo_state);
31         if (req == NULL) {
32                 return NULL;
33         }
34         state->out_mem_ctx = NULL;
35         state->dispatch_recv = cli->dispatch_recv;
36
37         /* In parameters */
38         state->orig.in.server_name = _server_name;
39         state->orig.in.level = _level;
40
41         /* Out parameters */
42         state->orig.out.info = _info;
43
44         /* Result */
45         ZERO_STRUCT(state->orig.out.result);
46
47         state->out_mem_ctx = talloc_named_const(state, 0,
48                              "rpccli_wkssvc_NetWkstaGetInfo_out_memory");
49         if (tevent_req_nomem(state->out_mem_ctx, req)) {
50                 return tevent_req_post(req, ev);
51         }
52
53         /* make a temporary copy, that we pass to the dispatch function */
54         state->tmp = state->orig;
55
56         subreq = cli->dispatch_send(state, ev, cli,
57                                     &ndr_table_wkssvc,
58                                     NDR_WKSSVC_NETWKSTAGETINFO,
59                                     &state->tmp);
60         if (tevent_req_nomem(subreq, req)) {
61                 return tevent_req_post(req, ev);
62         }
63         tevent_req_set_callback(subreq, rpccli_wkssvc_NetWkstaGetInfo_done, req);
64         return req;
65 }
66
67 static void rpccli_wkssvc_NetWkstaGetInfo_done(struct tevent_req *subreq)
68 {
69         struct tevent_req *req = tevent_req_callback_data(
70                 subreq, struct tevent_req);
71         struct rpccli_wkssvc_NetWkstaGetInfo_state *state = tevent_req_data(
72                 req, struct rpccli_wkssvc_NetWkstaGetInfo_state);
73         NTSTATUS status;
74         TALLOC_CTX *mem_ctx;
75
76         if (state->out_mem_ctx) {
77                 mem_ctx = state->out_mem_ctx;
78         } else {
79                 mem_ctx = state;
80         }
81
82         status = state->dispatch_recv(subreq, mem_ctx);
83         TALLOC_FREE(subreq);
84         if (!NT_STATUS_IS_OK(status)) {
85                 tevent_req_nterror(req, status);
86                 return;
87         }
88
89         /* Copy out parameters */
90         *state->orig.out.info = *state->tmp.out.info;
91
92         /* Copy result */
93         state->orig.out.result = state->tmp.out.result;
94
95         /* Reset temporary structure */
96         ZERO_STRUCT(state->tmp);
97
98         tevent_req_done(req);
99 }
100
101 NTSTATUS rpccli_wkssvc_NetWkstaGetInfo_recv(struct tevent_req *req,
102                                             TALLOC_CTX *mem_ctx,
103                                             WERROR *result)
104 {
105         struct rpccli_wkssvc_NetWkstaGetInfo_state *state = tevent_req_data(
106                 req, struct rpccli_wkssvc_NetWkstaGetInfo_state);
107         NTSTATUS status;
108
109         if (tevent_req_is_nterror(req, &status)) {
110                 tevent_req_received(req);
111                 return status;
112         }
113
114         /* Steal possbile out parameters to the callers context */
115         talloc_steal(mem_ctx, state->out_mem_ctx);
116
117         /* Return result */
118         *result = state->orig.out.result;
119
120         tevent_req_received(req);
121         return NT_STATUS_OK;
122 }
123
124 NTSTATUS rpccli_wkssvc_NetWkstaGetInfo(struct rpc_pipe_client *cli,
125                                        TALLOC_CTX *mem_ctx,
126                                        const char *server_name /* [in] [unique,charset(UTF16)] */,
127                                        uint32_t level /* [in]  */,
128                                        union wkssvc_NetWkstaInfo *info /* [out] [ref,switch_is(level)] */,
129                                        WERROR *werror)
130 {
131         struct wkssvc_NetWkstaGetInfo r;
132         NTSTATUS status;
133
134         /* In parameters */
135         r.in.server_name = server_name;
136         r.in.level = level;
137
138         status = cli->dispatch(cli,
139                                 mem_ctx,
140                                 &ndr_table_wkssvc,
141                                 NDR_WKSSVC_NETWKSTAGETINFO,
142                                 &r);
143
144         if (!NT_STATUS_IS_OK(status)) {
145                 return status;
146         }
147
148         if (NT_STATUS_IS_ERR(status)) {
149                 return status;
150         }
151
152         /* Return variables */
153         *info = *r.out.info;
154
155         /* Return result */
156         if (werror) {
157                 *werror = r.out.result;
158         }
159
160         return werror_to_ntstatus(r.out.result);
161 }
162
163 struct rpccli_wkssvc_NetWkstaSetInfo_state {
164         struct wkssvc_NetWkstaSetInfo orig;
165         struct wkssvc_NetWkstaSetInfo tmp;
166         TALLOC_CTX *out_mem_ctx;
167         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
168 };
169
170 static void rpccli_wkssvc_NetWkstaSetInfo_done(struct tevent_req *subreq);
171
172 struct tevent_req *rpccli_wkssvc_NetWkstaSetInfo_send(TALLOC_CTX *mem_ctx,
173                                                       struct tevent_context *ev,
174                                                       struct rpc_pipe_client *cli,
175                                                       const char *_server_name /* [in] [unique,charset(UTF16)] */,
176                                                       uint32_t _level /* [in]  */,
177                                                       union wkssvc_NetWkstaInfo *_info /* [in] [ref,switch_is(level)] */,
178                                                       uint32_t *_parm_error /* [in,out] [ref] */)
179 {
180         struct tevent_req *req;
181         struct rpccli_wkssvc_NetWkstaSetInfo_state *state;
182         struct tevent_req *subreq;
183
184         req = tevent_req_create(mem_ctx, &state,
185                                 struct rpccli_wkssvc_NetWkstaSetInfo_state);
186         if (req == NULL) {
187                 return NULL;
188         }
189         state->out_mem_ctx = NULL;
190         state->dispatch_recv = cli->dispatch_recv;
191
192         /* In parameters */
193         state->orig.in.server_name = _server_name;
194         state->orig.in.level = _level;
195         state->orig.in.info = _info;
196         state->orig.in.parm_error = _parm_error;
197
198         /* Out parameters */
199         state->orig.out.parm_error = _parm_error;
200
201         /* Result */
202         ZERO_STRUCT(state->orig.out.result);
203
204         state->out_mem_ctx = talloc_named_const(state, 0,
205                              "rpccli_wkssvc_NetWkstaSetInfo_out_memory");
206         if (tevent_req_nomem(state->out_mem_ctx, req)) {
207                 return tevent_req_post(req, ev);
208         }
209
210         /* make a temporary copy, that we pass to the dispatch function */
211         state->tmp = state->orig;
212
213         subreq = cli->dispatch_send(state, ev, cli,
214                                     &ndr_table_wkssvc,
215                                     NDR_WKSSVC_NETWKSTASETINFO,
216                                     &state->tmp);
217         if (tevent_req_nomem(subreq, req)) {
218                 return tevent_req_post(req, ev);
219         }
220         tevent_req_set_callback(subreq, rpccli_wkssvc_NetWkstaSetInfo_done, req);
221         return req;
222 }
223
224 static void rpccli_wkssvc_NetWkstaSetInfo_done(struct tevent_req *subreq)
225 {
226         struct tevent_req *req = tevent_req_callback_data(
227                 subreq, struct tevent_req);
228         struct rpccli_wkssvc_NetWkstaSetInfo_state *state = tevent_req_data(
229                 req, struct rpccli_wkssvc_NetWkstaSetInfo_state);
230         NTSTATUS status;
231         TALLOC_CTX *mem_ctx;
232
233         if (state->out_mem_ctx) {
234                 mem_ctx = state->out_mem_ctx;
235         } else {
236                 mem_ctx = state;
237         }
238
239         status = state->dispatch_recv(subreq, mem_ctx);
240         TALLOC_FREE(subreq);
241         if (!NT_STATUS_IS_OK(status)) {
242                 tevent_req_nterror(req, status);
243                 return;
244         }
245
246         /* Copy out parameters */
247         *state->orig.out.parm_error = *state->tmp.out.parm_error;
248
249         /* Copy result */
250         state->orig.out.result = state->tmp.out.result;
251
252         /* Reset temporary structure */
253         ZERO_STRUCT(state->tmp);
254
255         tevent_req_done(req);
256 }
257
258 NTSTATUS rpccli_wkssvc_NetWkstaSetInfo_recv(struct tevent_req *req,
259                                             TALLOC_CTX *mem_ctx,
260                                             WERROR *result)
261 {
262         struct rpccli_wkssvc_NetWkstaSetInfo_state *state = tevent_req_data(
263                 req, struct rpccli_wkssvc_NetWkstaSetInfo_state);
264         NTSTATUS status;
265
266         if (tevent_req_is_nterror(req, &status)) {
267                 tevent_req_received(req);
268                 return status;
269         }
270
271         /* Steal possbile out parameters to the callers context */
272         talloc_steal(mem_ctx, state->out_mem_ctx);
273
274         /* Return result */
275         *result = state->orig.out.result;
276
277         tevent_req_received(req);
278         return NT_STATUS_OK;
279 }
280
281 NTSTATUS rpccli_wkssvc_NetWkstaSetInfo(struct rpc_pipe_client *cli,
282                                        TALLOC_CTX *mem_ctx,
283                                        const char *server_name /* [in] [unique,charset(UTF16)] */,
284                                        uint32_t level /* [in]  */,
285                                        union wkssvc_NetWkstaInfo *info /* [in] [ref,switch_is(level)] */,
286                                        uint32_t *parm_error /* [in,out] [ref] */,
287                                        WERROR *werror)
288 {
289         struct wkssvc_NetWkstaSetInfo r;
290         NTSTATUS status;
291
292         /* In parameters */
293         r.in.server_name = server_name;
294         r.in.level = level;
295         r.in.info = info;
296         r.in.parm_error = parm_error;
297
298         status = cli->dispatch(cli,
299                                 mem_ctx,
300                                 &ndr_table_wkssvc,
301                                 NDR_WKSSVC_NETWKSTASETINFO,
302                                 &r);
303
304         if (!NT_STATUS_IS_OK(status)) {
305                 return status;
306         }
307
308         if (NT_STATUS_IS_ERR(status)) {
309                 return status;
310         }
311
312         /* Return variables */
313         *parm_error = *r.out.parm_error;
314
315         /* Return result */
316         if (werror) {
317                 *werror = r.out.result;
318         }
319
320         return werror_to_ntstatus(r.out.result);
321 }
322
323 struct rpccli_wkssvc_NetWkstaEnumUsers_state {
324         struct wkssvc_NetWkstaEnumUsers orig;
325         struct wkssvc_NetWkstaEnumUsers tmp;
326         TALLOC_CTX *out_mem_ctx;
327         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
328 };
329
330 static void rpccli_wkssvc_NetWkstaEnumUsers_done(struct tevent_req *subreq);
331
332 struct tevent_req *rpccli_wkssvc_NetWkstaEnumUsers_send(TALLOC_CTX *mem_ctx,
333                                                         struct tevent_context *ev,
334                                                         struct rpc_pipe_client *cli,
335                                                         const char *_server_name /* [in] [unique,charset(UTF16)] */,
336                                                         struct wkssvc_NetWkstaEnumUsersInfo *_info /* [in,out] [ref] */,
337                                                         uint32_t _prefmaxlen /* [in]  */,
338                                                         uint32_t *_entries_read /* [out] [ref] */,
339                                                         uint32_t *_resume_handle /* [in,out] [unique] */)
340 {
341         struct tevent_req *req;
342         struct rpccli_wkssvc_NetWkstaEnumUsers_state *state;
343         struct tevent_req *subreq;
344
345         req = tevent_req_create(mem_ctx, &state,
346                                 struct rpccli_wkssvc_NetWkstaEnumUsers_state);
347         if (req == NULL) {
348                 return NULL;
349         }
350         state->out_mem_ctx = NULL;
351         state->dispatch_recv = cli->dispatch_recv;
352
353         /* In parameters */
354         state->orig.in.server_name = _server_name;
355         state->orig.in.info = _info;
356         state->orig.in.prefmaxlen = _prefmaxlen;
357         state->orig.in.resume_handle = _resume_handle;
358
359         /* Out parameters */
360         state->orig.out.info = _info;
361         state->orig.out.entries_read = _entries_read;
362         state->orig.out.resume_handle = _resume_handle;
363
364         /* Result */
365         ZERO_STRUCT(state->orig.out.result);
366
367         state->out_mem_ctx = talloc_named_const(state, 0,
368                              "rpccli_wkssvc_NetWkstaEnumUsers_out_memory");
369         if (tevent_req_nomem(state->out_mem_ctx, req)) {
370                 return tevent_req_post(req, ev);
371         }
372
373         /* make a temporary copy, that we pass to the dispatch function */
374         state->tmp = state->orig;
375
376         subreq = cli->dispatch_send(state, ev, cli,
377                                     &ndr_table_wkssvc,
378                                     NDR_WKSSVC_NETWKSTAENUMUSERS,
379                                     &state->tmp);
380         if (tevent_req_nomem(subreq, req)) {
381                 return tevent_req_post(req, ev);
382         }
383         tevent_req_set_callback(subreq, rpccli_wkssvc_NetWkstaEnumUsers_done, req);
384         return req;
385 }
386
387 static void rpccli_wkssvc_NetWkstaEnumUsers_done(struct tevent_req *subreq)
388 {
389         struct tevent_req *req = tevent_req_callback_data(
390                 subreq, struct tevent_req);
391         struct rpccli_wkssvc_NetWkstaEnumUsers_state *state = tevent_req_data(
392                 req, struct rpccli_wkssvc_NetWkstaEnumUsers_state);
393         NTSTATUS status;
394         TALLOC_CTX *mem_ctx;
395
396         if (state->out_mem_ctx) {
397                 mem_ctx = state->out_mem_ctx;
398         } else {
399                 mem_ctx = state;
400         }
401
402         status = state->dispatch_recv(subreq, mem_ctx);
403         TALLOC_FREE(subreq);
404         if (!NT_STATUS_IS_OK(status)) {
405                 tevent_req_nterror(req, status);
406                 return;
407         }
408
409         /* Copy out parameters */
410         *state->orig.out.info = *state->tmp.out.info;
411         *state->orig.out.entries_read = *state->tmp.out.entries_read;
412         if (state->orig.out.resume_handle && state->tmp.out.resume_handle) {
413                 *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
414         }
415
416         /* Copy result */
417         state->orig.out.result = state->tmp.out.result;
418
419         /* Reset temporary structure */
420         ZERO_STRUCT(state->tmp);
421
422         tevent_req_done(req);
423 }
424
425 NTSTATUS rpccli_wkssvc_NetWkstaEnumUsers_recv(struct tevent_req *req,
426                                               TALLOC_CTX *mem_ctx,
427                                               WERROR *result)
428 {
429         struct rpccli_wkssvc_NetWkstaEnumUsers_state *state = tevent_req_data(
430                 req, struct rpccli_wkssvc_NetWkstaEnumUsers_state);
431         NTSTATUS status;
432
433         if (tevent_req_is_nterror(req, &status)) {
434                 tevent_req_received(req);
435                 return status;
436         }
437
438         /* Steal possbile out parameters to the callers context */
439         talloc_steal(mem_ctx, state->out_mem_ctx);
440
441         /* Return result */
442         *result = state->orig.out.result;
443
444         tevent_req_received(req);
445         return NT_STATUS_OK;
446 }
447
448 NTSTATUS rpccli_wkssvc_NetWkstaEnumUsers(struct rpc_pipe_client *cli,
449                                          TALLOC_CTX *mem_ctx,
450                                          const char *server_name /* [in] [unique,charset(UTF16)] */,
451                                          struct wkssvc_NetWkstaEnumUsersInfo *info /* [in,out] [ref] */,
452                                          uint32_t prefmaxlen /* [in]  */,
453                                          uint32_t *entries_read /* [out] [ref] */,
454                                          uint32_t *resume_handle /* [in,out] [unique] */,
455                                          WERROR *werror)
456 {
457         struct wkssvc_NetWkstaEnumUsers r;
458         NTSTATUS status;
459
460         /* In parameters */
461         r.in.server_name = server_name;
462         r.in.info = info;
463         r.in.prefmaxlen = prefmaxlen;
464         r.in.resume_handle = resume_handle;
465
466         status = cli->dispatch(cli,
467                                 mem_ctx,
468                                 &ndr_table_wkssvc,
469                                 NDR_WKSSVC_NETWKSTAENUMUSERS,
470                                 &r);
471
472         if (!NT_STATUS_IS_OK(status)) {
473                 return status;
474         }
475
476         if (NT_STATUS_IS_ERR(status)) {
477                 return status;
478         }
479
480         /* Return variables */
481         *info = *r.out.info;
482         *entries_read = *r.out.entries_read;
483         if (resume_handle && r.out.resume_handle) {
484                 *resume_handle = *r.out.resume_handle;
485         }
486
487         /* Return result */
488         if (werror) {
489                 *werror = r.out.result;
490         }
491
492         return werror_to_ntstatus(r.out.result);
493 }
494
495 struct rpccli_wkssvc_NetrWkstaUserGetInfo_state {
496         struct wkssvc_NetrWkstaUserGetInfo orig;
497         struct wkssvc_NetrWkstaUserGetInfo tmp;
498         TALLOC_CTX *out_mem_ctx;
499         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
500 };
501
502 static void rpccli_wkssvc_NetrWkstaUserGetInfo_done(struct tevent_req *subreq);
503
504 struct tevent_req *rpccli_wkssvc_NetrWkstaUserGetInfo_send(TALLOC_CTX *mem_ctx,
505                                                            struct tevent_context *ev,
506                                                            struct rpc_pipe_client *cli,
507                                                            const char *_unknown /* [in] [unique,charset(UTF16)] */,
508                                                            uint32_t _level /* [in]  */,
509                                                            union wkssvc_NetrWkstaUserInfo *_info /* [out] [ref,switch_is(level)] */)
510 {
511         struct tevent_req *req;
512         struct rpccli_wkssvc_NetrWkstaUserGetInfo_state *state;
513         struct tevent_req *subreq;
514
515         req = tevent_req_create(mem_ctx, &state,
516                                 struct rpccli_wkssvc_NetrWkstaUserGetInfo_state);
517         if (req == NULL) {
518                 return NULL;
519         }
520         state->out_mem_ctx = NULL;
521         state->dispatch_recv = cli->dispatch_recv;
522
523         /* In parameters */
524         state->orig.in.unknown = _unknown;
525         state->orig.in.level = _level;
526
527         /* Out parameters */
528         state->orig.out.info = _info;
529
530         /* Result */
531         ZERO_STRUCT(state->orig.out.result);
532
533         state->out_mem_ctx = talloc_named_const(state, 0,
534                              "rpccli_wkssvc_NetrWkstaUserGetInfo_out_memory");
535         if (tevent_req_nomem(state->out_mem_ctx, req)) {
536                 return tevent_req_post(req, ev);
537         }
538
539         /* make a temporary copy, that we pass to the dispatch function */
540         state->tmp = state->orig;
541
542         subreq = cli->dispatch_send(state, ev, cli,
543                                     &ndr_table_wkssvc,
544                                     NDR_WKSSVC_NETRWKSTAUSERGETINFO,
545                                     &state->tmp);
546         if (tevent_req_nomem(subreq, req)) {
547                 return tevent_req_post(req, ev);
548         }
549         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrWkstaUserGetInfo_done, req);
550         return req;
551 }
552
553 static void rpccli_wkssvc_NetrWkstaUserGetInfo_done(struct tevent_req *subreq)
554 {
555         struct tevent_req *req = tevent_req_callback_data(
556                 subreq, struct tevent_req);
557         struct rpccli_wkssvc_NetrWkstaUserGetInfo_state *state = tevent_req_data(
558                 req, struct rpccli_wkssvc_NetrWkstaUserGetInfo_state);
559         NTSTATUS status;
560         TALLOC_CTX *mem_ctx;
561
562         if (state->out_mem_ctx) {
563                 mem_ctx = state->out_mem_ctx;
564         } else {
565                 mem_ctx = state;
566         }
567
568         status = state->dispatch_recv(subreq, mem_ctx);
569         TALLOC_FREE(subreq);
570         if (!NT_STATUS_IS_OK(status)) {
571                 tevent_req_nterror(req, status);
572                 return;
573         }
574
575         /* Copy out parameters */
576         *state->orig.out.info = *state->tmp.out.info;
577
578         /* Copy result */
579         state->orig.out.result = state->tmp.out.result;
580
581         /* Reset temporary structure */
582         ZERO_STRUCT(state->tmp);
583
584         tevent_req_done(req);
585 }
586
587 NTSTATUS rpccli_wkssvc_NetrWkstaUserGetInfo_recv(struct tevent_req *req,
588                                                  TALLOC_CTX *mem_ctx,
589                                                  WERROR *result)
590 {
591         struct rpccli_wkssvc_NetrWkstaUserGetInfo_state *state = tevent_req_data(
592                 req, struct rpccli_wkssvc_NetrWkstaUserGetInfo_state);
593         NTSTATUS status;
594
595         if (tevent_req_is_nterror(req, &status)) {
596                 tevent_req_received(req);
597                 return status;
598         }
599
600         /* Steal possbile out parameters to the callers context */
601         talloc_steal(mem_ctx, state->out_mem_ctx);
602
603         /* Return result */
604         *result = state->orig.out.result;
605
606         tevent_req_received(req);
607         return NT_STATUS_OK;
608 }
609
610 NTSTATUS rpccli_wkssvc_NetrWkstaUserGetInfo(struct rpc_pipe_client *cli,
611                                             TALLOC_CTX *mem_ctx,
612                                             const char *unknown /* [in] [unique,charset(UTF16)] */,
613                                             uint32_t level /* [in]  */,
614                                             union wkssvc_NetrWkstaUserInfo *info /* [out] [ref,switch_is(level)] */,
615                                             WERROR *werror)
616 {
617         struct wkssvc_NetrWkstaUserGetInfo r;
618         NTSTATUS status;
619
620         /* In parameters */
621         r.in.unknown = unknown;
622         r.in.level = level;
623
624         status = cli->dispatch(cli,
625                                 mem_ctx,
626                                 &ndr_table_wkssvc,
627                                 NDR_WKSSVC_NETRWKSTAUSERGETINFO,
628                                 &r);
629
630         if (!NT_STATUS_IS_OK(status)) {
631                 return status;
632         }
633
634         if (NT_STATUS_IS_ERR(status)) {
635                 return status;
636         }
637
638         /* Return variables */
639         *info = *r.out.info;
640
641         /* Return result */
642         if (werror) {
643                 *werror = r.out.result;
644         }
645
646         return werror_to_ntstatus(r.out.result);
647 }
648
649 struct rpccli_wkssvc_NetrWkstaUserSetInfo_state {
650         struct wkssvc_NetrWkstaUserSetInfo orig;
651         struct wkssvc_NetrWkstaUserSetInfo tmp;
652         TALLOC_CTX *out_mem_ctx;
653         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
654 };
655
656 static void rpccli_wkssvc_NetrWkstaUserSetInfo_done(struct tevent_req *subreq);
657
658 struct tevent_req *rpccli_wkssvc_NetrWkstaUserSetInfo_send(TALLOC_CTX *mem_ctx,
659                                                            struct tevent_context *ev,
660                                                            struct rpc_pipe_client *cli,
661                                                            const char *_unknown /* [in] [unique,charset(UTF16)] */,
662                                                            uint32_t _level /* [in]  */,
663                                                            union wkssvc_NetrWkstaUserInfo *_info /* [in] [ref,switch_is(level)] */,
664                                                            uint32_t *_parm_err /* [in,out] [unique] */)
665 {
666         struct tevent_req *req;
667         struct rpccli_wkssvc_NetrWkstaUserSetInfo_state *state;
668         struct tevent_req *subreq;
669
670         req = tevent_req_create(mem_ctx, &state,
671                                 struct rpccli_wkssvc_NetrWkstaUserSetInfo_state);
672         if (req == NULL) {
673                 return NULL;
674         }
675         state->out_mem_ctx = NULL;
676         state->dispatch_recv = cli->dispatch_recv;
677
678         /* In parameters */
679         state->orig.in.unknown = _unknown;
680         state->orig.in.level = _level;
681         state->orig.in.info = _info;
682         state->orig.in.parm_err = _parm_err;
683
684         /* Out parameters */
685         state->orig.out.parm_err = _parm_err;
686
687         /* Result */
688         ZERO_STRUCT(state->orig.out.result);
689
690         state->out_mem_ctx = talloc_named_const(state, 0,
691                              "rpccli_wkssvc_NetrWkstaUserSetInfo_out_memory");
692         if (tevent_req_nomem(state->out_mem_ctx, req)) {
693                 return tevent_req_post(req, ev);
694         }
695
696         /* make a temporary copy, that we pass to the dispatch function */
697         state->tmp = state->orig;
698
699         subreq = cli->dispatch_send(state, ev, cli,
700                                     &ndr_table_wkssvc,
701                                     NDR_WKSSVC_NETRWKSTAUSERSETINFO,
702                                     &state->tmp);
703         if (tevent_req_nomem(subreq, req)) {
704                 return tevent_req_post(req, ev);
705         }
706         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrWkstaUserSetInfo_done, req);
707         return req;
708 }
709
710 static void rpccli_wkssvc_NetrWkstaUserSetInfo_done(struct tevent_req *subreq)
711 {
712         struct tevent_req *req = tevent_req_callback_data(
713                 subreq, struct tevent_req);
714         struct rpccli_wkssvc_NetrWkstaUserSetInfo_state *state = tevent_req_data(
715                 req, struct rpccli_wkssvc_NetrWkstaUserSetInfo_state);
716         NTSTATUS status;
717         TALLOC_CTX *mem_ctx;
718
719         if (state->out_mem_ctx) {
720                 mem_ctx = state->out_mem_ctx;
721         } else {
722                 mem_ctx = state;
723         }
724
725         status = state->dispatch_recv(subreq, mem_ctx);
726         TALLOC_FREE(subreq);
727         if (!NT_STATUS_IS_OK(status)) {
728                 tevent_req_nterror(req, status);
729                 return;
730         }
731
732         /* Copy out parameters */
733         if (state->orig.out.parm_err && state->tmp.out.parm_err) {
734                 *state->orig.out.parm_err = *state->tmp.out.parm_err;
735         }
736
737         /* Copy result */
738         state->orig.out.result = state->tmp.out.result;
739
740         /* Reset temporary structure */
741         ZERO_STRUCT(state->tmp);
742
743         tevent_req_done(req);
744 }
745
746 NTSTATUS rpccli_wkssvc_NetrWkstaUserSetInfo_recv(struct tevent_req *req,
747                                                  TALLOC_CTX *mem_ctx,
748                                                  WERROR *result)
749 {
750         struct rpccli_wkssvc_NetrWkstaUserSetInfo_state *state = tevent_req_data(
751                 req, struct rpccli_wkssvc_NetrWkstaUserSetInfo_state);
752         NTSTATUS status;
753
754         if (tevent_req_is_nterror(req, &status)) {
755                 tevent_req_received(req);
756                 return status;
757         }
758
759         /* Steal possbile out parameters to the callers context */
760         talloc_steal(mem_ctx, state->out_mem_ctx);
761
762         /* Return result */
763         *result = state->orig.out.result;
764
765         tevent_req_received(req);
766         return NT_STATUS_OK;
767 }
768
769 NTSTATUS rpccli_wkssvc_NetrWkstaUserSetInfo(struct rpc_pipe_client *cli,
770                                             TALLOC_CTX *mem_ctx,
771                                             const char *unknown /* [in] [unique,charset(UTF16)] */,
772                                             uint32_t level /* [in]  */,
773                                             union wkssvc_NetrWkstaUserInfo *info /* [in] [ref,switch_is(level)] */,
774                                             uint32_t *parm_err /* [in,out] [unique] */,
775                                             WERROR *werror)
776 {
777         struct wkssvc_NetrWkstaUserSetInfo r;
778         NTSTATUS status;
779
780         /* In parameters */
781         r.in.unknown = unknown;
782         r.in.level = level;
783         r.in.info = info;
784         r.in.parm_err = parm_err;
785
786         status = cli->dispatch(cli,
787                                 mem_ctx,
788                                 &ndr_table_wkssvc,
789                                 NDR_WKSSVC_NETRWKSTAUSERSETINFO,
790                                 &r);
791
792         if (!NT_STATUS_IS_OK(status)) {
793                 return status;
794         }
795
796         if (NT_STATUS_IS_ERR(status)) {
797                 return status;
798         }
799
800         /* Return variables */
801         if (parm_err && r.out.parm_err) {
802                 *parm_err = *r.out.parm_err;
803         }
804
805         /* Return result */
806         if (werror) {
807                 *werror = r.out.result;
808         }
809
810         return werror_to_ntstatus(r.out.result);
811 }
812
813 struct rpccli_wkssvc_NetWkstaTransportEnum_state {
814         struct wkssvc_NetWkstaTransportEnum orig;
815         struct wkssvc_NetWkstaTransportEnum tmp;
816         TALLOC_CTX *out_mem_ctx;
817         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
818 };
819
820 static void rpccli_wkssvc_NetWkstaTransportEnum_done(struct tevent_req *subreq);
821
822 struct tevent_req *rpccli_wkssvc_NetWkstaTransportEnum_send(TALLOC_CTX *mem_ctx,
823                                                             struct tevent_context *ev,
824                                                             struct rpc_pipe_client *cli,
825                                                             const char *_server_name /* [in] [unique,charset(UTF16)] */,
826                                                             struct wkssvc_NetWkstaTransportInfo *_info /* [in,out] [ref] */,
827                                                             uint32_t _max_buffer /* [in]  */,
828                                                             uint32_t *_total_entries /* [out] [ref] */,
829                                                             uint32_t *_resume_handle /* [in,out] [unique] */)
830 {
831         struct tevent_req *req;
832         struct rpccli_wkssvc_NetWkstaTransportEnum_state *state;
833         struct tevent_req *subreq;
834
835         req = tevent_req_create(mem_ctx, &state,
836                                 struct rpccli_wkssvc_NetWkstaTransportEnum_state);
837         if (req == NULL) {
838                 return NULL;
839         }
840         state->out_mem_ctx = NULL;
841         state->dispatch_recv = cli->dispatch_recv;
842
843         /* In parameters */
844         state->orig.in.server_name = _server_name;
845         state->orig.in.info = _info;
846         state->orig.in.max_buffer = _max_buffer;
847         state->orig.in.resume_handle = _resume_handle;
848
849         /* Out parameters */
850         state->orig.out.info = _info;
851         state->orig.out.total_entries = _total_entries;
852         state->orig.out.resume_handle = _resume_handle;
853
854         /* Result */
855         ZERO_STRUCT(state->orig.out.result);
856
857         state->out_mem_ctx = talloc_named_const(state, 0,
858                              "rpccli_wkssvc_NetWkstaTransportEnum_out_memory");
859         if (tevent_req_nomem(state->out_mem_ctx, req)) {
860                 return tevent_req_post(req, ev);
861         }
862
863         /* make a temporary copy, that we pass to the dispatch function */
864         state->tmp = state->orig;
865
866         subreq = cli->dispatch_send(state, ev, cli,
867                                     &ndr_table_wkssvc,
868                                     NDR_WKSSVC_NETWKSTATRANSPORTENUM,
869                                     &state->tmp);
870         if (tevent_req_nomem(subreq, req)) {
871                 return tevent_req_post(req, ev);
872         }
873         tevent_req_set_callback(subreq, rpccli_wkssvc_NetWkstaTransportEnum_done, req);
874         return req;
875 }
876
877 static void rpccli_wkssvc_NetWkstaTransportEnum_done(struct tevent_req *subreq)
878 {
879         struct tevent_req *req = tevent_req_callback_data(
880                 subreq, struct tevent_req);
881         struct rpccli_wkssvc_NetWkstaTransportEnum_state *state = tevent_req_data(
882                 req, struct rpccli_wkssvc_NetWkstaTransportEnum_state);
883         NTSTATUS status;
884         TALLOC_CTX *mem_ctx;
885
886         if (state->out_mem_ctx) {
887                 mem_ctx = state->out_mem_ctx;
888         } else {
889                 mem_ctx = state;
890         }
891
892         status = state->dispatch_recv(subreq, mem_ctx);
893         TALLOC_FREE(subreq);
894         if (!NT_STATUS_IS_OK(status)) {
895                 tevent_req_nterror(req, status);
896                 return;
897         }
898
899         /* Copy out parameters */
900         *state->orig.out.info = *state->tmp.out.info;
901         *state->orig.out.total_entries = *state->tmp.out.total_entries;
902         if (state->orig.out.resume_handle && state->tmp.out.resume_handle) {
903                 *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
904         }
905
906         /* Copy result */
907         state->orig.out.result = state->tmp.out.result;
908
909         /* Reset temporary structure */
910         ZERO_STRUCT(state->tmp);
911
912         tevent_req_done(req);
913 }
914
915 NTSTATUS rpccli_wkssvc_NetWkstaTransportEnum_recv(struct tevent_req *req,
916                                                   TALLOC_CTX *mem_ctx,
917                                                   WERROR *result)
918 {
919         struct rpccli_wkssvc_NetWkstaTransportEnum_state *state = tevent_req_data(
920                 req, struct rpccli_wkssvc_NetWkstaTransportEnum_state);
921         NTSTATUS status;
922
923         if (tevent_req_is_nterror(req, &status)) {
924                 tevent_req_received(req);
925                 return status;
926         }
927
928         /* Steal possbile out parameters to the callers context */
929         talloc_steal(mem_ctx, state->out_mem_ctx);
930
931         /* Return result */
932         *result = state->orig.out.result;
933
934         tevent_req_received(req);
935         return NT_STATUS_OK;
936 }
937
938 NTSTATUS rpccli_wkssvc_NetWkstaTransportEnum(struct rpc_pipe_client *cli,
939                                              TALLOC_CTX *mem_ctx,
940                                              const char *server_name /* [in] [unique,charset(UTF16)] */,
941                                              struct wkssvc_NetWkstaTransportInfo *info /* [in,out] [ref] */,
942                                              uint32_t max_buffer /* [in]  */,
943                                              uint32_t *total_entries /* [out] [ref] */,
944                                              uint32_t *resume_handle /* [in,out] [unique] */,
945                                              WERROR *werror)
946 {
947         struct wkssvc_NetWkstaTransportEnum r;
948         NTSTATUS status;
949
950         /* In parameters */
951         r.in.server_name = server_name;
952         r.in.info = info;
953         r.in.max_buffer = max_buffer;
954         r.in.resume_handle = resume_handle;
955
956         status = cli->dispatch(cli,
957                                 mem_ctx,
958                                 &ndr_table_wkssvc,
959                                 NDR_WKSSVC_NETWKSTATRANSPORTENUM,
960                                 &r);
961
962         if (!NT_STATUS_IS_OK(status)) {
963                 return status;
964         }
965
966         if (NT_STATUS_IS_ERR(status)) {
967                 return status;
968         }
969
970         /* Return variables */
971         *info = *r.out.info;
972         *total_entries = *r.out.total_entries;
973         if (resume_handle && r.out.resume_handle) {
974                 *resume_handle = *r.out.resume_handle;
975         }
976
977         /* Return result */
978         if (werror) {
979                 *werror = r.out.result;
980         }
981
982         return werror_to_ntstatus(r.out.result);
983 }
984
985 struct rpccli_wkssvc_NetrWkstaTransportAdd_state {
986         struct wkssvc_NetrWkstaTransportAdd orig;
987         struct wkssvc_NetrWkstaTransportAdd tmp;
988         TALLOC_CTX *out_mem_ctx;
989         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
990 };
991
992 static void rpccli_wkssvc_NetrWkstaTransportAdd_done(struct tevent_req *subreq);
993
994 struct tevent_req *rpccli_wkssvc_NetrWkstaTransportAdd_send(TALLOC_CTX *mem_ctx,
995                                                             struct tevent_context *ev,
996                                                             struct rpc_pipe_client *cli,
997                                                             const char *_server_name /* [in] [unique,charset(UTF16)] */,
998                                                             uint32_t _level /* [in]  */,
999                                                             struct wkssvc_NetWkstaTransportInfo0 *_info0 /* [in] [ref] */,
1000                                                             uint32_t *_parm_err /* [in,out] [unique] */)
1001 {
1002         struct tevent_req *req;
1003         struct rpccli_wkssvc_NetrWkstaTransportAdd_state *state;
1004         struct tevent_req *subreq;
1005
1006         req = tevent_req_create(mem_ctx, &state,
1007                                 struct rpccli_wkssvc_NetrWkstaTransportAdd_state);
1008         if (req == NULL) {
1009                 return NULL;
1010         }
1011         state->out_mem_ctx = NULL;
1012         state->dispatch_recv = cli->dispatch_recv;
1013
1014         /* In parameters */
1015         state->orig.in.server_name = _server_name;
1016         state->orig.in.level = _level;
1017         state->orig.in.info0 = _info0;
1018         state->orig.in.parm_err = _parm_err;
1019
1020         /* Out parameters */
1021         state->orig.out.parm_err = _parm_err;
1022
1023         /* Result */
1024         ZERO_STRUCT(state->orig.out.result);
1025
1026         state->out_mem_ctx = talloc_named_const(state, 0,
1027                              "rpccli_wkssvc_NetrWkstaTransportAdd_out_memory");
1028         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1029                 return tevent_req_post(req, ev);
1030         }
1031
1032         /* make a temporary copy, that we pass to the dispatch function */
1033         state->tmp = state->orig;
1034
1035         subreq = cli->dispatch_send(state, ev, cli,
1036                                     &ndr_table_wkssvc,
1037                                     NDR_WKSSVC_NETRWKSTATRANSPORTADD,
1038                                     &state->tmp);
1039         if (tevent_req_nomem(subreq, req)) {
1040                 return tevent_req_post(req, ev);
1041         }
1042         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrWkstaTransportAdd_done, req);
1043         return req;
1044 }
1045
1046 static void rpccli_wkssvc_NetrWkstaTransportAdd_done(struct tevent_req *subreq)
1047 {
1048         struct tevent_req *req = tevent_req_callback_data(
1049                 subreq, struct tevent_req);
1050         struct rpccli_wkssvc_NetrWkstaTransportAdd_state *state = tevent_req_data(
1051                 req, struct rpccli_wkssvc_NetrWkstaTransportAdd_state);
1052         NTSTATUS status;
1053         TALLOC_CTX *mem_ctx;
1054
1055         if (state->out_mem_ctx) {
1056                 mem_ctx = state->out_mem_ctx;
1057         } else {
1058                 mem_ctx = state;
1059         }
1060
1061         status = state->dispatch_recv(subreq, mem_ctx);
1062         TALLOC_FREE(subreq);
1063         if (!NT_STATUS_IS_OK(status)) {
1064                 tevent_req_nterror(req, status);
1065                 return;
1066         }
1067
1068         /* Copy out parameters */
1069         if (state->orig.out.parm_err && state->tmp.out.parm_err) {
1070                 *state->orig.out.parm_err = *state->tmp.out.parm_err;
1071         }
1072
1073         /* Copy result */
1074         state->orig.out.result = state->tmp.out.result;
1075
1076         /* Reset temporary structure */
1077         ZERO_STRUCT(state->tmp);
1078
1079         tevent_req_done(req);
1080 }
1081
1082 NTSTATUS rpccli_wkssvc_NetrWkstaTransportAdd_recv(struct tevent_req *req,
1083                                                   TALLOC_CTX *mem_ctx,
1084                                                   WERROR *result)
1085 {
1086         struct rpccli_wkssvc_NetrWkstaTransportAdd_state *state = tevent_req_data(
1087                 req, struct rpccli_wkssvc_NetrWkstaTransportAdd_state);
1088         NTSTATUS status;
1089
1090         if (tevent_req_is_nterror(req, &status)) {
1091                 tevent_req_received(req);
1092                 return status;
1093         }
1094
1095         /* Steal possbile out parameters to the callers context */
1096         talloc_steal(mem_ctx, state->out_mem_ctx);
1097
1098         /* Return result */
1099         *result = state->orig.out.result;
1100
1101         tevent_req_received(req);
1102         return NT_STATUS_OK;
1103 }
1104
1105 NTSTATUS rpccli_wkssvc_NetrWkstaTransportAdd(struct rpc_pipe_client *cli,
1106                                              TALLOC_CTX *mem_ctx,
1107                                              const char *server_name /* [in] [unique,charset(UTF16)] */,
1108                                              uint32_t level /* [in]  */,
1109                                              struct wkssvc_NetWkstaTransportInfo0 *info0 /* [in] [ref] */,
1110                                              uint32_t *parm_err /* [in,out] [unique] */,
1111                                              WERROR *werror)
1112 {
1113         struct wkssvc_NetrWkstaTransportAdd r;
1114         NTSTATUS status;
1115
1116         /* In parameters */
1117         r.in.server_name = server_name;
1118         r.in.level = level;
1119         r.in.info0 = info0;
1120         r.in.parm_err = parm_err;
1121
1122         status = cli->dispatch(cli,
1123                                 mem_ctx,
1124                                 &ndr_table_wkssvc,
1125                                 NDR_WKSSVC_NETRWKSTATRANSPORTADD,
1126                                 &r);
1127
1128         if (!NT_STATUS_IS_OK(status)) {
1129                 return status;
1130         }
1131
1132         if (NT_STATUS_IS_ERR(status)) {
1133                 return status;
1134         }
1135
1136         /* Return variables */
1137         if (parm_err && r.out.parm_err) {
1138                 *parm_err = *r.out.parm_err;
1139         }
1140
1141         /* Return result */
1142         if (werror) {
1143                 *werror = r.out.result;
1144         }
1145
1146         return werror_to_ntstatus(r.out.result);
1147 }
1148
1149 struct rpccli_wkssvc_NetrWkstaTransportDel_state {
1150         struct wkssvc_NetrWkstaTransportDel orig;
1151         struct wkssvc_NetrWkstaTransportDel tmp;
1152         TALLOC_CTX *out_mem_ctx;
1153         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1154 };
1155
1156 static void rpccli_wkssvc_NetrWkstaTransportDel_done(struct tevent_req *subreq);
1157
1158 struct tevent_req *rpccli_wkssvc_NetrWkstaTransportDel_send(TALLOC_CTX *mem_ctx,
1159                                                             struct tevent_context *ev,
1160                                                             struct rpc_pipe_client *cli,
1161                                                             const char *_server_name /* [in] [unique,charset(UTF16)] */,
1162                                                             const char *_transport_name /* [in] [unique,charset(UTF16)] */,
1163                                                             uint32_t _unknown3 /* [in]  */)
1164 {
1165         struct tevent_req *req;
1166         struct rpccli_wkssvc_NetrWkstaTransportDel_state *state;
1167         struct tevent_req *subreq;
1168
1169         req = tevent_req_create(mem_ctx, &state,
1170                                 struct rpccli_wkssvc_NetrWkstaTransportDel_state);
1171         if (req == NULL) {
1172                 return NULL;
1173         }
1174         state->out_mem_ctx = NULL;
1175         state->dispatch_recv = cli->dispatch_recv;
1176
1177         /* In parameters */
1178         state->orig.in.server_name = _server_name;
1179         state->orig.in.transport_name = _transport_name;
1180         state->orig.in.unknown3 = _unknown3;
1181
1182         /* Out parameters */
1183
1184         /* Result */
1185         ZERO_STRUCT(state->orig.out.result);
1186
1187         /* make a temporary copy, that we pass to the dispatch function */
1188         state->tmp = state->orig;
1189
1190         subreq = cli->dispatch_send(state, ev, cli,
1191                                     &ndr_table_wkssvc,
1192                                     NDR_WKSSVC_NETRWKSTATRANSPORTDEL,
1193                                     &state->tmp);
1194         if (tevent_req_nomem(subreq, req)) {
1195                 return tevent_req_post(req, ev);
1196         }
1197         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrWkstaTransportDel_done, req);
1198         return req;
1199 }
1200
1201 static void rpccli_wkssvc_NetrWkstaTransportDel_done(struct tevent_req *subreq)
1202 {
1203         struct tevent_req *req = tevent_req_callback_data(
1204                 subreq, struct tevent_req);
1205         struct rpccli_wkssvc_NetrWkstaTransportDel_state *state = tevent_req_data(
1206                 req, struct rpccli_wkssvc_NetrWkstaTransportDel_state);
1207         NTSTATUS status;
1208         TALLOC_CTX *mem_ctx;
1209
1210         if (state->out_mem_ctx) {
1211                 mem_ctx = state->out_mem_ctx;
1212         } else {
1213                 mem_ctx = state;
1214         }
1215
1216         status = state->dispatch_recv(subreq, mem_ctx);
1217         TALLOC_FREE(subreq);
1218         if (!NT_STATUS_IS_OK(status)) {
1219                 tevent_req_nterror(req, status);
1220                 return;
1221         }
1222
1223         /* Copy out parameters */
1224
1225         /* Copy result */
1226         state->orig.out.result = state->tmp.out.result;
1227
1228         /* Reset temporary structure */
1229         ZERO_STRUCT(state->tmp);
1230
1231         tevent_req_done(req);
1232 }
1233
1234 NTSTATUS rpccli_wkssvc_NetrWkstaTransportDel_recv(struct tevent_req *req,
1235                                                   TALLOC_CTX *mem_ctx,
1236                                                   WERROR *result)
1237 {
1238         struct rpccli_wkssvc_NetrWkstaTransportDel_state *state = tevent_req_data(
1239                 req, struct rpccli_wkssvc_NetrWkstaTransportDel_state);
1240         NTSTATUS status;
1241
1242         if (tevent_req_is_nterror(req, &status)) {
1243                 tevent_req_received(req);
1244                 return status;
1245         }
1246
1247         /* Steal possbile out parameters to the callers context */
1248         talloc_steal(mem_ctx, state->out_mem_ctx);
1249
1250         /* Return result */
1251         *result = state->orig.out.result;
1252
1253         tevent_req_received(req);
1254         return NT_STATUS_OK;
1255 }
1256
1257 NTSTATUS rpccli_wkssvc_NetrWkstaTransportDel(struct rpc_pipe_client *cli,
1258                                              TALLOC_CTX *mem_ctx,
1259                                              const char *server_name /* [in] [unique,charset(UTF16)] */,
1260                                              const char *transport_name /* [in] [unique,charset(UTF16)] */,
1261                                              uint32_t unknown3 /* [in]  */,
1262                                              WERROR *werror)
1263 {
1264         struct wkssvc_NetrWkstaTransportDel r;
1265         NTSTATUS status;
1266
1267         /* In parameters */
1268         r.in.server_name = server_name;
1269         r.in.transport_name = transport_name;
1270         r.in.unknown3 = unknown3;
1271
1272         status = cli->dispatch(cli,
1273                                 mem_ctx,
1274                                 &ndr_table_wkssvc,
1275                                 NDR_WKSSVC_NETRWKSTATRANSPORTDEL,
1276                                 &r);
1277
1278         if (!NT_STATUS_IS_OK(status)) {
1279                 return status;
1280         }
1281
1282         if (NT_STATUS_IS_ERR(status)) {
1283                 return status;
1284         }
1285
1286         /* Return variables */
1287
1288         /* Return result */
1289         if (werror) {
1290                 *werror = r.out.result;
1291         }
1292
1293         return werror_to_ntstatus(r.out.result);
1294 }
1295
1296 struct rpccli_wkssvc_NetrUseAdd_state {
1297         struct wkssvc_NetrUseAdd orig;
1298         struct wkssvc_NetrUseAdd tmp;
1299         TALLOC_CTX *out_mem_ctx;
1300         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1301 };
1302
1303 static void rpccli_wkssvc_NetrUseAdd_done(struct tevent_req *subreq);
1304
1305 struct tevent_req *rpccli_wkssvc_NetrUseAdd_send(TALLOC_CTX *mem_ctx,
1306                                                  struct tevent_context *ev,
1307                                                  struct rpc_pipe_client *cli,
1308                                                  const char *_server_name /* [in] [unique,charset(UTF16)] */,
1309                                                  uint32_t _level /* [in]  */,
1310                                                  union wkssvc_NetrUseGetInfoCtr *_ctr /* [in] [ref,switch_is(level)] */,
1311                                                  uint32_t *_parm_err /* [in,out] [unique] */)
1312 {
1313         struct tevent_req *req;
1314         struct rpccli_wkssvc_NetrUseAdd_state *state;
1315         struct tevent_req *subreq;
1316
1317         req = tevent_req_create(mem_ctx, &state,
1318                                 struct rpccli_wkssvc_NetrUseAdd_state);
1319         if (req == NULL) {
1320                 return NULL;
1321         }
1322         state->out_mem_ctx = NULL;
1323         state->dispatch_recv = cli->dispatch_recv;
1324
1325         /* In parameters */
1326         state->orig.in.server_name = _server_name;
1327         state->orig.in.level = _level;
1328         state->orig.in.ctr = _ctr;
1329         state->orig.in.parm_err = _parm_err;
1330
1331         /* Out parameters */
1332         state->orig.out.parm_err = _parm_err;
1333
1334         /* Result */
1335         ZERO_STRUCT(state->orig.out.result);
1336
1337         state->out_mem_ctx = talloc_named_const(state, 0,
1338                              "rpccli_wkssvc_NetrUseAdd_out_memory");
1339         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1340                 return tevent_req_post(req, ev);
1341         }
1342
1343         /* make a temporary copy, that we pass to the dispatch function */
1344         state->tmp = state->orig;
1345
1346         subreq = cli->dispatch_send(state, ev, cli,
1347                                     &ndr_table_wkssvc,
1348                                     NDR_WKSSVC_NETRUSEADD,
1349                                     &state->tmp);
1350         if (tevent_req_nomem(subreq, req)) {
1351                 return tevent_req_post(req, ev);
1352         }
1353         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrUseAdd_done, req);
1354         return req;
1355 }
1356
1357 static void rpccli_wkssvc_NetrUseAdd_done(struct tevent_req *subreq)
1358 {
1359         struct tevent_req *req = tevent_req_callback_data(
1360                 subreq, struct tevent_req);
1361         struct rpccli_wkssvc_NetrUseAdd_state *state = tevent_req_data(
1362                 req, struct rpccli_wkssvc_NetrUseAdd_state);
1363         NTSTATUS status;
1364         TALLOC_CTX *mem_ctx;
1365
1366         if (state->out_mem_ctx) {
1367                 mem_ctx = state->out_mem_ctx;
1368         } else {
1369                 mem_ctx = state;
1370         }
1371
1372         status = state->dispatch_recv(subreq, mem_ctx);
1373         TALLOC_FREE(subreq);
1374         if (!NT_STATUS_IS_OK(status)) {
1375                 tevent_req_nterror(req, status);
1376                 return;
1377         }
1378
1379         /* Copy out parameters */
1380         if (state->orig.out.parm_err && state->tmp.out.parm_err) {
1381                 *state->orig.out.parm_err = *state->tmp.out.parm_err;
1382         }
1383
1384         /* Copy result */
1385         state->orig.out.result = state->tmp.out.result;
1386
1387         /* Reset temporary structure */
1388         ZERO_STRUCT(state->tmp);
1389
1390         tevent_req_done(req);
1391 }
1392
1393 NTSTATUS rpccli_wkssvc_NetrUseAdd_recv(struct tevent_req *req,
1394                                        TALLOC_CTX *mem_ctx,
1395                                        WERROR *result)
1396 {
1397         struct rpccli_wkssvc_NetrUseAdd_state *state = tevent_req_data(
1398                 req, struct rpccli_wkssvc_NetrUseAdd_state);
1399         NTSTATUS status;
1400
1401         if (tevent_req_is_nterror(req, &status)) {
1402                 tevent_req_received(req);
1403                 return status;
1404         }
1405
1406         /* Steal possbile out parameters to the callers context */
1407         talloc_steal(mem_ctx, state->out_mem_ctx);
1408
1409         /* Return result */
1410         *result = state->orig.out.result;
1411
1412         tevent_req_received(req);
1413         return NT_STATUS_OK;
1414 }
1415
1416 NTSTATUS rpccli_wkssvc_NetrUseAdd(struct rpc_pipe_client *cli,
1417                                   TALLOC_CTX *mem_ctx,
1418                                   const char *server_name /* [in] [unique,charset(UTF16)] */,
1419                                   uint32_t level /* [in]  */,
1420                                   union wkssvc_NetrUseGetInfoCtr *ctr /* [in] [ref,switch_is(level)] */,
1421                                   uint32_t *parm_err /* [in,out] [unique] */,
1422                                   WERROR *werror)
1423 {
1424         struct wkssvc_NetrUseAdd r;
1425         NTSTATUS status;
1426
1427         /* In parameters */
1428         r.in.server_name = server_name;
1429         r.in.level = level;
1430         r.in.ctr = ctr;
1431         r.in.parm_err = parm_err;
1432
1433         status = cli->dispatch(cli,
1434                                 mem_ctx,
1435                                 &ndr_table_wkssvc,
1436                                 NDR_WKSSVC_NETRUSEADD,
1437                                 &r);
1438
1439         if (!NT_STATUS_IS_OK(status)) {
1440                 return status;
1441         }
1442
1443         if (NT_STATUS_IS_ERR(status)) {
1444                 return status;
1445         }
1446
1447         /* Return variables */
1448         if (parm_err && r.out.parm_err) {
1449                 *parm_err = *r.out.parm_err;
1450         }
1451
1452         /* Return result */
1453         if (werror) {
1454                 *werror = r.out.result;
1455         }
1456
1457         return werror_to_ntstatus(r.out.result);
1458 }
1459
1460 struct rpccli_wkssvc_NetrUseGetInfo_state {
1461         struct wkssvc_NetrUseGetInfo orig;
1462         struct wkssvc_NetrUseGetInfo tmp;
1463         TALLOC_CTX *out_mem_ctx;
1464         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1465 };
1466
1467 static void rpccli_wkssvc_NetrUseGetInfo_done(struct tevent_req *subreq);
1468
1469 struct tevent_req *rpccli_wkssvc_NetrUseGetInfo_send(TALLOC_CTX *mem_ctx,
1470                                                      struct tevent_context *ev,
1471                                                      struct rpc_pipe_client *cli,
1472                                                      const char *_server_name /* [in] [unique,charset(UTF16)] */,
1473                                                      const char *_use_name /* [in] [ref,charset(UTF16)] */,
1474                                                      uint32_t _level /* [in]  */,
1475                                                      union wkssvc_NetrUseGetInfoCtr *_ctr /* [out] [ref,switch_is(level)] */)
1476 {
1477         struct tevent_req *req;
1478         struct rpccli_wkssvc_NetrUseGetInfo_state *state;
1479         struct tevent_req *subreq;
1480
1481         req = tevent_req_create(mem_ctx, &state,
1482                                 struct rpccli_wkssvc_NetrUseGetInfo_state);
1483         if (req == NULL) {
1484                 return NULL;
1485         }
1486         state->out_mem_ctx = NULL;
1487         state->dispatch_recv = cli->dispatch_recv;
1488
1489         /* In parameters */
1490         state->orig.in.server_name = _server_name;
1491         state->orig.in.use_name = _use_name;
1492         state->orig.in.level = _level;
1493
1494         /* Out parameters */
1495         state->orig.out.ctr = _ctr;
1496
1497         /* Result */
1498         ZERO_STRUCT(state->orig.out.result);
1499
1500         state->out_mem_ctx = talloc_named_const(state, 0,
1501                              "rpccli_wkssvc_NetrUseGetInfo_out_memory");
1502         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1503                 return tevent_req_post(req, ev);
1504         }
1505
1506         /* make a temporary copy, that we pass to the dispatch function */
1507         state->tmp = state->orig;
1508
1509         subreq = cli->dispatch_send(state, ev, cli,
1510                                     &ndr_table_wkssvc,
1511                                     NDR_WKSSVC_NETRUSEGETINFO,
1512                                     &state->tmp);
1513         if (tevent_req_nomem(subreq, req)) {
1514                 return tevent_req_post(req, ev);
1515         }
1516         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrUseGetInfo_done, req);
1517         return req;
1518 }
1519
1520 static void rpccli_wkssvc_NetrUseGetInfo_done(struct tevent_req *subreq)
1521 {
1522         struct tevent_req *req = tevent_req_callback_data(
1523                 subreq, struct tevent_req);
1524         struct rpccli_wkssvc_NetrUseGetInfo_state *state = tevent_req_data(
1525                 req, struct rpccli_wkssvc_NetrUseGetInfo_state);
1526         NTSTATUS status;
1527         TALLOC_CTX *mem_ctx;
1528
1529         if (state->out_mem_ctx) {
1530                 mem_ctx = state->out_mem_ctx;
1531         } else {
1532                 mem_ctx = state;
1533         }
1534
1535         status = state->dispatch_recv(subreq, mem_ctx);
1536         TALLOC_FREE(subreq);
1537         if (!NT_STATUS_IS_OK(status)) {
1538                 tevent_req_nterror(req, status);
1539                 return;
1540         }
1541
1542         /* Copy out parameters */
1543         *state->orig.out.ctr = *state->tmp.out.ctr;
1544
1545         /* Copy result */
1546         state->orig.out.result = state->tmp.out.result;
1547
1548         /* Reset temporary structure */
1549         ZERO_STRUCT(state->tmp);
1550
1551         tevent_req_done(req);
1552 }
1553
1554 NTSTATUS rpccli_wkssvc_NetrUseGetInfo_recv(struct tevent_req *req,
1555                                            TALLOC_CTX *mem_ctx,
1556                                            WERROR *result)
1557 {
1558         struct rpccli_wkssvc_NetrUseGetInfo_state *state = tevent_req_data(
1559                 req, struct rpccli_wkssvc_NetrUseGetInfo_state);
1560         NTSTATUS status;
1561
1562         if (tevent_req_is_nterror(req, &status)) {
1563                 tevent_req_received(req);
1564                 return status;
1565         }
1566
1567         /* Steal possbile out parameters to the callers context */
1568         talloc_steal(mem_ctx, state->out_mem_ctx);
1569
1570         /* Return result */
1571         *result = state->orig.out.result;
1572
1573         tevent_req_received(req);
1574         return NT_STATUS_OK;
1575 }
1576
1577 NTSTATUS rpccli_wkssvc_NetrUseGetInfo(struct rpc_pipe_client *cli,
1578                                       TALLOC_CTX *mem_ctx,
1579                                       const char *server_name /* [in] [unique,charset(UTF16)] */,
1580                                       const char *use_name /* [in] [ref,charset(UTF16)] */,
1581                                       uint32_t level /* [in]  */,
1582                                       union wkssvc_NetrUseGetInfoCtr *ctr /* [out] [ref,switch_is(level)] */,
1583                                       WERROR *werror)
1584 {
1585         struct wkssvc_NetrUseGetInfo r;
1586         NTSTATUS status;
1587
1588         /* In parameters */
1589         r.in.server_name = server_name;
1590         r.in.use_name = use_name;
1591         r.in.level = level;
1592
1593         status = cli->dispatch(cli,
1594                                 mem_ctx,
1595                                 &ndr_table_wkssvc,
1596                                 NDR_WKSSVC_NETRUSEGETINFO,
1597                                 &r);
1598
1599         if (!NT_STATUS_IS_OK(status)) {
1600                 return status;
1601         }
1602
1603         if (NT_STATUS_IS_ERR(status)) {
1604                 return status;
1605         }
1606
1607         /* Return variables */
1608         *ctr = *r.out.ctr;
1609
1610         /* Return result */
1611         if (werror) {
1612                 *werror = r.out.result;
1613         }
1614
1615         return werror_to_ntstatus(r.out.result);
1616 }
1617
1618 struct rpccli_wkssvc_NetrUseDel_state {
1619         struct wkssvc_NetrUseDel orig;
1620         struct wkssvc_NetrUseDel tmp;
1621         TALLOC_CTX *out_mem_ctx;
1622         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1623 };
1624
1625 static void rpccli_wkssvc_NetrUseDel_done(struct tevent_req *subreq);
1626
1627 struct tevent_req *rpccli_wkssvc_NetrUseDel_send(TALLOC_CTX *mem_ctx,
1628                                                  struct tevent_context *ev,
1629                                                  struct rpc_pipe_client *cli,
1630                                                  const char *_server_name /* [in] [unique,charset(UTF16)] */,
1631                                                  const char *_use_name /* [in] [ref,charset(UTF16)] */,
1632                                                  uint32_t _force_cond /* [in]  */)
1633 {
1634         struct tevent_req *req;
1635         struct rpccli_wkssvc_NetrUseDel_state *state;
1636         struct tevent_req *subreq;
1637
1638         req = tevent_req_create(mem_ctx, &state,
1639                                 struct rpccli_wkssvc_NetrUseDel_state);
1640         if (req == NULL) {
1641                 return NULL;
1642         }
1643         state->out_mem_ctx = NULL;
1644         state->dispatch_recv = cli->dispatch_recv;
1645
1646         /* In parameters */
1647         state->orig.in.server_name = _server_name;
1648         state->orig.in.use_name = _use_name;
1649         state->orig.in.force_cond = _force_cond;
1650
1651         /* Out parameters */
1652
1653         /* Result */
1654         ZERO_STRUCT(state->orig.out.result);
1655
1656         /* make a temporary copy, that we pass to the dispatch function */
1657         state->tmp = state->orig;
1658
1659         subreq = cli->dispatch_send(state, ev, cli,
1660                                     &ndr_table_wkssvc,
1661                                     NDR_WKSSVC_NETRUSEDEL,
1662                                     &state->tmp);
1663         if (tevent_req_nomem(subreq, req)) {
1664                 return tevent_req_post(req, ev);
1665         }
1666         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrUseDel_done, req);
1667         return req;
1668 }
1669
1670 static void rpccli_wkssvc_NetrUseDel_done(struct tevent_req *subreq)
1671 {
1672         struct tevent_req *req = tevent_req_callback_data(
1673                 subreq, struct tevent_req);
1674         struct rpccli_wkssvc_NetrUseDel_state *state = tevent_req_data(
1675                 req, struct rpccli_wkssvc_NetrUseDel_state);
1676         NTSTATUS status;
1677         TALLOC_CTX *mem_ctx;
1678
1679         if (state->out_mem_ctx) {
1680                 mem_ctx = state->out_mem_ctx;
1681         } else {
1682                 mem_ctx = state;
1683         }
1684
1685         status = state->dispatch_recv(subreq, mem_ctx);
1686         TALLOC_FREE(subreq);
1687         if (!NT_STATUS_IS_OK(status)) {
1688                 tevent_req_nterror(req, status);
1689                 return;
1690         }
1691
1692         /* Copy out parameters */
1693
1694         /* Copy result */
1695         state->orig.out.result = state->tmp.out.result;
1696
1697         /* Reset temporary structure */
1698         ZERO_STRUCT(state->tmp);
1699
1700         tevent_req_done(req);
1701 }
1702
1703 NTSTATUS rpccli_wkssvc_NetrUseDel_recv(struct tevent_req *req,
1704                                        TALLOC_CTX *mem_ctx,
1705                                        WERROR *result)
1706 {
1707         struct rpccli_wkssvc_NetrUseDel_state *state = tevent_req_data(
1708                 req, struct rpccli_wkssvc_NetrUseDel_state);
1709         NTSTATUS status;
1710
1711         if (tevent_req_is_nterror(req, &status)) {
1712                 tevent_req_received(req);
1713                 return status;
1714         }
1715
1716         /* Steal possbile out parameters to the callers context */
1717         talloc_steal(mem_ctx, state->out_mem_ctx);
1718
1719         /* Return result */
1720         *result = state->orig.out.result;
1721
1722         tevent_req_received(req);
1723         return NT_STATUS_OK;
1724 }
1725
1726 NTSTATUS rpccli_wkssvc_NetrUseDel(struct rpc_pipe_client *cli,
1727                                   TALLOC_CTX *mem_ctx,
1728                                   const char *server_name /* [in] [unique,charset(UTF16)] */,
1729                                   const char *use_name /* [in] [ref,charset(UTF16)] */,
1730                                   uint32_t force_cond /* [in]  */,
1731                                   WERROR *werror)
1732 {
1733         struct wkssvc_NetrUseDel r;
1734         NTSTATUS status;
1735
1736         /* In parameters */
1737         r.in.server_name = server_name;
1738         r.in.use_name = use_name;
1739         r.in.force_cond = force_cond;
1740
1741         status = cli->dispatch(cli,
1742                                 mem_ctx,
1743                                 &ndr_table_wkssvc,
1744                                 NDR_WKSSVC_NETRUSEDEL,
1745                                 &r);
1746
1747         if (!NT_STATUS_IS_OK(status)) {
1748                 return status;
1749         }
1750
1751         if (NT_STATUS_IS_ERR(status)) {
1752                 return status;
1753         }
1754
1755         /* Return variables */
1756
1757         /* Return result */
1758         if (werror) {
1759                 *werror = r.out.result;
1760         }
1761
1762         return werror_to_ntstatus(r.out.result);
1763 }
1764
1765 struct rpccli_wkssvc_NetrUseEnum_state {
1766         struct wkssvc_NetrUseEnum orig;
1767         struct wkssvc_NetrUseEnum tmp;
1768         TALLOC_CTX *out_mem_ctx;
1769         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1770 };
1771
1772 static void rpccli_wkssvc_NetrUseEnum_done(struct tevent_req *subreq);
1773
1774 struct tevent_req *rpccli_wkssvc_NetrUseEnum_send(TALLOC_CTX *mem_ctx,
1775                                                   struct tevent_context *ev,
1776                                                   struct rpc_pipe_client *cli,
1777                                                   const char *_server_name /* [in] [unique,charset(UTF16)] */,
1778                                                   struct wkssvc_NetrUseEnumInfo *_info /* [in,out] [ref] */,
1779                                                   uint32_t _prefmaxlen /* [in]  */,
1780                                                   uint32_t *_entries_read /* [out] [ref] */,
1781                                                   uint32_t *_resume_handle /* [in,out] [unique] */)
1782 {
1783         struct tevent_req *req;
1784         struct rpccli_wkssvc_NetrUseEnum_state *state;
1785         struct tevent_req *subreq;
1786
1787         req = tevent_req_create(mem_ctx, &state,
1788                                 struct rpccli_wkssvc_NetrUseEnum_state);
1789         if (req == NULL) {
1790                 return NULL;
1791         }
1792         state->out_mem_ctx = NULL;
1793         state->dispatch_recv = cli->dispatch_recv;
1794
1795         /* In parameters */
1796         state->orig.in.server_name = _server_name;
1797         state->orig.in.info = _info;
1798         state->orig.in.prefmaxlen = _prefmaxlen;
1799         state->orig.in.resume_handle = _resume_handle;
1800
1801         /* Out parameters */
1802         state->orig.out.info = _info;
1803         state->orig.out.entries_read = _entries_read;
1804         state->orig.out.resume_handle = _resume_handle;
1805
1806         /* Result */
1807         ZERO_STRUCT(state->orig.out.result);
1808
1809         state->out_mem_ctx = talloc_named_const(state, 0,
1810                              "rpccli_wkssvc_NetrUseEnum_out_memory");
1811         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1812                 return tevent_req_post(req, ev);
1813         }
1814
1815         /* make a temporary copy, that we pass to the dispatch function */
1816         state->tmp = state->orig;
1817
1818         subreq = cli->dispatch_send(state, ev, cli,
1819                                     &ndr_table_wkssvc,
1820                                     NDR_WKSSVC_NETRUSEENUM,
1821                                     &state->tmp);
1822         if (tevent_req_nomem(subreq, req)) {
1823                 return tevent_req_post(req, ev);
1824         }
1825         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrUseEnum_done, req);
1826         return req;
1827 }
1828
1829 static void rpccli_wkssvc_NetrUseEnum_done(struct tevent_req *subreq)
1830 {
1831         struct tevent_req *req = tevent_req_callback_data(
1832                 subreq, struct tevent_req);
1833         struct rpccli_wkssvc_NetrUseEnum_state *state = tevent_req_data(
1834                 req, struct rpccli_wkssvc_NetrUseEnum_state);
1835         NTSTATUS status;
1836         TALLOC_CTX *mem_ctx;
1837
1838         if (state->out_mem_ctx) {
1839                 mem_ctx = state->out_mem_ctx;
1840         } else {
1841                 mem_ctx = state;
1842         }
1843
1844         status = state->dispatch_recv(subreq, mem_ctx);
1845         TALLOC_FREE(subreq);
1846         if (!NT_STATUS_IS_OK(status)) {
1847                 tevent_req_nterror(req, status);
1848                 return;
1849         }
1850
1851         /* Copy out parameters */
1852         *state->orig.out.info = *state->tmp.out.info;
1853         *state->orig.out.entries_read = *state->tmp.out.entries_read;
1854         if (state->orig.out.resume_handle && state->tmp.out.resume_handle) {
1855                 *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
1856         }
1857
1858         /* Copy result */
1859         state->orig.out.result = state->tmp.out.result;
1860
1861         /* Reset temporary structure */
1862         ZERO_STRUCT(state->tmp);
1863
1864         tevent_req_done(req);
1865 }
1866
1867 NTSTATUS rpccli_wkssvc_NetrUseEnum_recv(struct tevent_req *req,
1868                                         TALLOC_CTX *mem_ctx,
1869                                         WERROR *result)
1870 {
1871         struct rpccli_wkssvc_NetrUseEnum_state *state = tevent_req_data(
1872                 req, struct rpccli_wkssvc_NetrUseEnum_state);
1873         NTSTATUS status;
1874
1875         if (tevent_req_is_nterror(req, &status)) {
1876                 tevent_req_received(req);
1877                 return status;
1878         }
1879
1880         /* Steal possbile out parameters to the callers context */
1881         talloc_steal(mem_ctx, state->out_mem_ctx);
1882
1883         /* Return result */
1884         *result = state->orig.out.result;
1885
1886         tevent_req_received(req);
1887         return NT_STATUS_OK;
1888 }
1889
1890 NTSTATUS rpccli_wkssvc_NetrUseEnum(struct rpc_pipe_client *cli,
1891                                    TALLOC_CTX *mem_ctx,
1892                                    const char *server_name /* [in] [unique,charset(UTF16)] */,
1893                                    struct wkssvc_NetrUseEnumInfo *info /* [in,out] [ref] */,
1894                                    uint32_t prefmaxlen /* [in]  */,
1895                                    uint32_t *entries_read /* [out] [ref] */,
1896                                    uint32_t *resume_handle /* [in,out] [unique] */,
1897                                    WERROR *werror)
1898 {
1899         struct wkssvc_NetrUseEnum r;
1900         NTSTATUS status;
1901
1902         /* In parameters */
1903         r.in.server_name = server_name;
1904         r.in.info = info;
1905         r.in.prefmaxlen = prefmaxlen;
1906         r.in.resume_handle = resume_handle;
1907
1908         status = cli->dispatch(cli,
1909                                 mem_ctx,
1910                                 &ndr_table_wkssvc,
1911                                 NDR_WKSSVC_NETRUSEENUM,
1912                                 &r);
1913
1914         if (!NT_STATUS_IS_OK(status)) {
1915                 return status;
1916         }
1917
1918         if (NT_STATUS_IS_ERR(status)) {
1919                 return status;
1920         }
1921
1922         /* Return variables */
1923         *info = *r.out.info;
1924         *entries_read = *r.out.entries_read;
1925         if (resume_handle && r.out.resume_handle) {
1926                 *resume_handle = *r.out.resume_handle;
1927         }
1928
1929         /* Return result */
1930         if (werror) {
1931                 *werror = r.out.result;
1932         }
1933
1934         return werror_to_ntstatus(r.out.result);
1935 }
1936
1937 struct rpccli_wkssvc_NetrMessageBufferSend_state {
1938         struct wkssvc_NetrMessageBufferSend orig;
1939         struct wkssvc_NetrMessageBufferSend tmp;
1940         TALLOC_CTX *out_mem_ctx;
1941         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1942 };
1943
1944 static void rpccli_wkssvc_NetrMessageBufferSend_done(struct tevent_req *subreq);
1945
1946 struct tevent_req *rpccli_wkssvc_NetrMessageBufferSend_send(TALLOC_CTX *mem_ctx,
1947                                                             struct tevent_context *ev,
1948                                                             struct rpc_pipe_client *cli,
1949                                                             const char *_server_name /* [in] [unique,charset(UTF16)] */,
1950                                                             const char *_message_name /* [in] [ref,charset(UTF16)] */,
1951                                                             const char *_message_sender_name /* [in] [unique,charset(UTF16)] */,
1952                                                             uint8_t *_message_buffer /* [in] [ref,size_is(message_size)] */,
1953                                                             uint32_t _message_size /* [in]  */)
1954 {
1955         struct tevent_req *req;
1956         struct rpccli_wkssvc_NetrMessageBufferSend_state *state;
1957         struct tevent_req *subreq;
1958
1959         req = tevent_req_create(mem_ctx, &state,
1960                                 struct rpccli_wkssvc_NetrMessageBufferSend_state);
1961         if (req == NULL) {
1962                 return NULL;
1963         }
1964         state->out_mem_ctx = NULL;
1965         state->dispatch_recv = cli->dispatch_recv;
1966
1967         /* In parameters */
1968         state->orig.in.server_name = _server_name;
1969         state->orig.in.message_name = _message_name;
1970         state->orig.in.message_sender_name = _message_sender_name;
1971         state->orig.in.message_buffer = _message_buffer;
1972         state->orig.in.message_size = _message_size;
1973
1974         /* Out parameters */
1975
1976         /* Result */
1977         ZERO_STRUCT(state->orig.out.result);
1978
1979         /* make a temporary copy, that we pass to the dispatch function */
1980         state->tmp = state->orig;
1981
1982         subreq = cli->dispatch_send(state, ev, cli,
1983                                     &ndr_table_wkssvc,
1984                                     NDR_WKSSVC_NETRMESSAGEBUFFERSEND,
1985                                     &state->tmp);
1986         if (tevent_req_nomem(subreq, req)) {
1987                 return tevent_req_post(req, ev);
1988         }
1989         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrMessageBufferSend_done, req);
1990         return req;
1991 }
1992
1993 static void rpccli_wkssvc_NetrMessageBufferSend_done(struct tevent_req *subreq)
1994 {
1995         struct tevent_req *req = tevent_req_callback_data(
1996                 subreq, struct tevent_req);
1997         struct rpccli_wkssvc_NetrMessageBufferSend_state *state = tevent_req_data(
1998                 req, struct rpccli_wkssvc_NetrMessageBufferSend_state);
1999         NTSTATUS status;
2000         TALLOC_CTX *mem_ctx;
2001
2002         if (state->out_mem_ctx) {
2003                 mem_ctx = state->out_mem_ctx;
2004         } else {
2005                 mem_ctx = state;
2006         }
2007
2008         status = state->dispatch_recv(subreq, mem_ctx);
2009         TALLOC_FREE(subreq);
2010         if (!NT_STATUS_IS_OK(status)) {
2011                 tevent_req_nterror(req, status);
2012                 return;
2013         }
2014
2015         /* Copy out parameters */
2016
2017         /* Copy result */
2018         state->orig.out.result = state->tmp.out.result;
2019
2020         /* Reset temporary structure */
2021         ZERO_STRUCT(state->tmp);
2022
2023         tevent_req_done(req);
2024 }
2025
2026 NTSTATUS rpccli_wkssvc_NetrMessageBufferSend_recv(struct tevent_req *req,
2027                                                   TALLOC_CTX *mem_ctx,
2028                                                   WERROR *result)
2029 {
2030         struct rpccli_wkssvc_NetrMessageBufferSend_state *state = tevent_req_data(
2031                 req, struct rpccli_wkssvc_NetrMessageBufferSend_state);
2032         NTSTATUS status;
2033
2034         if (tevent_req_is_nterror(req, &status)) {
2035                 tevent_req_received(req);
2036                 return status;
2037         }
2038
2039         /* Steal possbile out parameters to the callers context */
2040         talloc_steal(mem_ctx, state->out_mem_ctx);
2041
2042         /* Return result */
2043         *result = state->orig.out.result;
2044
2045         tevent_req_received(req);
2046         return NT_STATUS_OK;
2047 }
2048
2049 NTSTATUS rpccli_wkssvc_NetrMessageBufferSend(struct rpc_pipe_client *cli,
2050                                              TALLOC_CTX *mem_ctx,
2051                                              const char *server_name /* [in] [unique,charset(UTF16)] */,
2052                                              const char *message_name /* [in] [ref,charset(UTF16)] */,
2053                                              const char *message_sender_name /* [in] [unique,charset(UTF16)] */,
2054                                              uint8_t *message_buffer /* [in] [ref,size_is(message_size)] */,
2055                                              uint32_t message_size /* [in]  */,
2056                                              WERROR *werror)
2057 {
2058         struct wkssvc_NetrMessageBufferSend r;
2059         NTSTATUS status;
2060
2061         /* In parameters */
2062         r.in.server_name = server_name;
2063         r.in.message_name = message_name;
2064         r.in.message_sender_name = message_sender_name;
2065         r.in.message_buffer = message_buffer;
2066         r.in.message_size = message_size;
2067
2068         status = cli->dispatch(cli,
2069                                 mem_ctx,
2070                                 &ndr_table_wkssvc,
2071                                 NDR_WKSSVC_NETRMESSAGEBUFFERSEND,
2072                                 &r);
2073
2074         if (!NT_STATUS_IS_OK(status)) {
2075                 return status;
2076         }
2077
2078         if (NT_STATUS_IS_ERR(status)) {
2079                 return status;
2080         }
2081
2082         /* Return variables */
2083
2084         /* Return result */
2085         if (werror) {
2086                 *werror = r.out.result;
2087         }
2088
2089         return werror_to_ntstatus(r.out.result);
2090 }
2091
2092 struct rpccli_wkssvc_NetrWorkstationStatisticsGet_state {
2093         struct wkssvc_NetrWorkstationStatisticsGet orig;
2094         struct wkssvc_NetrWorkstationStatisticsGet tmp;
2095         TALLOC_CTX *out_mem_ctx;
2096         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2097 };
2098
2099 static void rpccli_wkssvc_NetrWorkstationStatisticsGet_done(struct tevent_req *subreq);
2100
2101 struct tevent_req *rpccli_wkssvc_NetrWorkstationStatisticsGet_send(TALLOC_CTX *mem_ctx,
2102                                                                    struct tevent_context *ev,
2103                                                                    struct rpc_pipe_client *cli,
2104                                                                    const char *_server_name /* [in] [unique,charset(UTF16)] */,
2105                                                                    const char *_unknown2 /* [in] [unique,charset(UTF16)] */,
2106                                                                    uint32_t _unknown3 /* [in]  */,
2107                                                                    uint32_t _unknown4 /* [in]  */,
2108                                                                    struct wkssvc_NetrWorkstationStatistics **_info /* [out] [ref] */)
2109 {
2110         struct tevent_req *req;
2111         struct rpccli_wkssvc_NetrWorkstationStatisticsGet_state *state;
2112         struct tevent_req *subreq;
2113
2114         req = tevent_req_create(mem_ctx, &state,
2115                                 struct rpccli_wkssvc_NetrWorkstationStatisticsGet_state);
2116         if (req == NULL) {
2117                 return NULL;
2118         }
2119         state->out_mem_ctx = NULL;
2120         state->dispatch_recv = cli->dispatch_recv;
2121
2122         /* In parameters */
2123         state->orig.in.server_name = _server_name;
2124         state->orig.in.unknown2 = _unknown2;
2125         state->orig.in.unknown3 = _unknown3;
2126         state->orig.in.unknown4 = _unknown4;
2127
2128         /* Out parameters */
2129         state->orig.out.info = _info;
2130
2131         /* Result */
2132         ZERO_STRUCT(state->orig.out.result);
2133
2134         state->out_mem_ctx = talloc_named_const(state, 0,
2135                              "rpccli_wkssvc_NetrWorkstationStatisticsGet_out_memory");
2136         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2137                 return tevent_req_post(req, ev);
2138         }
2139
2140         /* make a temporary copy, that we pass to the dispatch function */
2141         state->tmp = state->orig;
2142
2143         subreq = cli->dispatch_send(state, ev, cli,
2144                                     &ndr_table_wkssvc,
2145                                     NDR_WKSSVC_NETRWORKSTATIONSTATISTICSGET,
2146                                     &state->tmp);
2147         if (tevent_req_nomem(subreq, req)) {
2148                 return tevent_req_post(req, ev);
2149         }
2150         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrWorkstationStatisticsGet_done, req);
2151         return req;
2152 }
2153
2154 static void rpccli_wkssvc_NetrWorkstationStatisticsGet_done(struct tevent_req *subreq)
2155 {
2156         struct tevent_req *req = tevent_req_callback_data(
2157                 subreq, struct tevent_req);
2158         struct rpccli_wkssvc_NetrWorkstationStatisticsGet_state *state = tevent_req_data(
2159                 req, struct rpccli_wkssvc_NetrWorkstationStatisticsGet_state);
2160         NTSTATUS status;
2161         TALLOC_CTX *mem_ctx;
2162
2163         if (state->out_mem_ctx) {
2164                 mem_ctx = state->out_mem_ctx;
2165         } else {
2166                 mem_ctx = state;
2167         }
2168
2169         status = state->dispatch_recv(subreq, mem_ctx);
2170         TALLOC_FREE(subreq);
2171         if (!NT_STATUS_IS_OK(status)) {
2172                 tevent_req_nterror(req, status);
2173                 return;
2174         }
2175
2176         /* Copy out parameters */
2177         *state->orig.out.info = *state->tmp.out.info;
2178
2179         /* Copy result */
2180         state->orig.out.result = state->tmp.out.result;
2181
2182         /* Reset temporary structure */
2183         ZERO_STRUCT(state->tmp);
2184
2185         tevent_req_done(req);
2186 }
2187
2188 NTSTATUS rpccli_wkssvc_NetrWorkstationStatisticsGet_recv(struct tevent_req *req,
2189                                                          TALLOC_CTX *mem_ctx,
2190                                                          WERROR *result)
2191 {
2192         struct rpccli_wkssvc_NetrWorkstationStatisticsGet_state *state = tevent_req_data(
2193                 req, struct rpccli_wkssvc_NetrWorkstationStatisticsGet_state);
2194         NTSTATUS status;
2195
2196         if (tevent_req_is_nterror(req, &status)) {
2197                 tevent_req_received(req);
2198                 return status;
2199         }
2200
2201         /* Steal possbile out parameters to the callers context */
2202         talloc_steal(mem_ctx, state->out_mem_ctx);
2203
2204         /* Return result */
2205         *result = state->orig.out.result;
2206
2207         tevent_req_received(req);
2208         return NT_STATUS_OK;
2209 }
2210
2211 NTSTATUS rpccli_wkssvc_NetrWorkstationStatisticsGet(struct rpc_pipe_client *cli,
2212                                                     TALLOC_CTX *mem_ctx,
2213                                                     const char *server_name /* [in] [unique,charset(UTF16)] */,
2214                                                     const char *unknown2 /* [in] [unique,charset(UTF16)] */,
2215                                                     uint32_t unknown3 /* [in]  */,
2216                                                     uint32_t unknown4 /* [in]  */,
2217                                                     struct wkssvc_NetrWorkstationStatistics **info /* [out] [ref] */,
2218                                                     WERROR *werror)
2219 {
2220         struct wkssvc_NetrWorkstationStatisticsGet r;
2221         NTSTATUS status;
2222
2223         /* In parameters */
2224         r.in.server_name = server_name;
2225         r.in.unknown2 = unknown2;
2226         r.in.unknown3 = unknown3;
2227         r.in.unknown4 = unknown4;
2228
2229         status = cli->dispatch(cli,
2230                                 mem_ctx,
2231                                 &ndr_table_wkssvc,
2232                                 NDR_WKSSVC_NETRWORKSTATIONSTATISTICSGET,
2233                                 &r);
2234
2235         if (!NT_STATUS_IS_OK(status)) {
2236                 return status;
2237         }
2238
2239         if (NT_STATUS_IS_ERR(status)) {
2240                 return status;
2241         }
2242
2243         /* Return variables */
2244         *info = *r.out.info;
2245
2246         /* Return result */
2247         if (werror) {
2248                 *werror = r.out.result;
2249         }
2250
2251         return werror_to_ntstatus(r.out.result);
2252 }
2253
2254 struct rpccli_wkssvc_NetrLogonDomainNameAdd_state {
2255         struct wkssvc_NetrLogonDomainNameAdd orig;
2256         struct wkssvc_NetrLogonDomainNameAdd tmp;
2257         TALLOC_CTX *out_mem_ctx;
2258         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2259 };
2260
2261 static void rpccli_wkssvc_NetrLogonDomainNameAdd_done(struct tevent_req *subreq);
2262
2263 struct tevent_req *rpccli_wkssvc_NetrLogonDomainNameAdd_send(TALLOC_CTX *mem_ctx,
2264                                                              struct tevent_context *ev,
2265                                                              struct rpc_pipe_client *cli,
2266                                                              const char *_domain_name /* [in] [ref,charset(UTF16)] */)
2267 {
2268         struct tevent_req *req;
2269         struct rpccli_wkssvc_NetrLogonDomainNameAdd_state *state;
2270         struct tevent_req *subreq;
2271
2272         req = tevent_req_create(mem_ctx, &state,
2273                                 struct rpccli_wkssvc_NetrLogonDomainNameAdd_state);
2274         if (req == NULL) {
2275                 return NULL;
2276         }
2277         state->out_mem_ctx = NULL;
2278         state->dispatch_recv = cli->dispatch_recv;
2279
2280         /* In parameters */
2281         state->orig.in.domain_name = _domain_name;
2282
2283         /* Out parameters */
2284
2285         /* Result */
2286         ZERO_STRUCT(state->orig.out.result);
2287
2288         /* make a temporary copy, that we pass to the dispatch function */
2289         state->tmp = state->orig;
2290
2291         subreq = cli->dispatch_send(state, ev, cli,
2292                                     &ndr_table_wkssvc,
2293                                     NDR_WKSSVC_NETRLOGONDOMAINNAMEADD,
2294                                     &state->tmp);
2295         if (tevent_req_nomem(subreq, req)) {
2296                 return tevent_req_post(req, ev);
2297         }
2298         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrLogonDomainNameAdd_done, req);
2299         return req;
2300 }
2301
2302 static void rpccli_wkssvc_NetrLogonDomainNameAdd_done(struct tevent_req *subreq)
2303 {
2304         struct tevent_req *req = tevent_req_callback_data(
2305                 subreq, struct tevent_req);
2306         struct rpccli_wkssvc_NetrLogonDomainNameAdd_state *state = tevent_req_data(
2307                 req, struct rpccli_wkssvc_NetrLogonDomainNameAdd_state);
2308         NTSTATUS status;
2309         TALLOC_CTX *mem_ctx;
2310
2311         if (state->out_mem_ctx) {
2312                 mem_ctx = state->out_mem_ctx;
2313         } else {
2314                 mem_ctx = state;
2315         }
2316
2317         status = state->dispatch_recv(subreq, mem_ctx);
2318         TALLOC_FREE(subreq);
2319         if (!NT_STATUS_IS_OK(status)) {
2320                 tevent_req_nterror(req, status);
2321                 return;
2322         }
2323
2324         /* Copy out parameters */
2325
2326         /* Copy result */
2327         state->orig.out.result = state->tmp.out.result;
2328
2329         /* Reset temporary structure */
2330         ZERO_STRUCT(state->tmp);
2331
2332         tevent_req_done(req);
2333 }
2334
2335 NTSTATUS rpccli_wkssvc_NetrLogonDomainNameAdd_recv(struct tevent_req *req,
2336                                                    TALLOC_CTX *mem_ctx,
2337                                                    WERROR *result)
2338 {
2339         struct rpccli_wkssvc_NetrLogonDomainNameAdd_state *state = tevent_req_data(
2340                 req, struct rpccli_wkssvc_NetrLogonDomainNameAdd_state);
2341         NTSTATUS status;
2342
2343         if (tevent_req_is_nterror(req, &status)) {
2344                 tevent_req_received(req);
2345                 return status;
2346         }
2347
2348         /* Steal possbile out parameters to the callers context */
2349         talloc_steal(mem_ctx, state->out_mem_ctx);
2350
2351         /* Return result */
2352         *result = state->orig.out.result;
2353
2354         tevent_req_received(req);
2355         return NT_STATUS_OK;
2356 }
2357
2358 NTSTATUS rpccli_wkssvc_NetrLogonDomainNameAdd(struct rpc_pipe_client *cli,
2359                                               TALLOC_CTX *mem_ctx,
2360                                               const char *domain_name /* [in] [ref,charset(UTF16)] */,
2361                                               WERROR *werror)
2362 {
2363         struct wkssvc_NetrLogonDomainNameAdd r;
2364         NTSTATUS status;
2365
2366         /* In parameters */
2367         r.in.domain_name = domain_name;
2368
2369         status = cli->dispatch(cli,
2370                                 mem_ctx,
2371                                 &ndr_table_wkssvc,
2372                                 NDR_WKSSVC_NETRLOGONDOMAINNAMEADD,
2373                                 &r);
2374
2375         if (!NT_STATUS_IS_OK(status)) {
2376                 return status;
2377         }
2378
2379         if (NT_STATUS_IS_ERR(status)) {
2380                 return status;
2381         }
2382
2383         /* Return variables */
2384
2385         /* Return result */
2386         if (werror) {
2387                 *werror = r.out.result;
2388         }
2389
2390         return werror_to_ntstatus(r.out.result);
2391 }
2392
2393 struct rpccli_wkssvc_NetrLogonDomainNameDel_state {
2394         struct wkssvc_NetrLogonDomainNameDel orig;
2395         struct wkssvc_NetrLogonDomainNameDel tmp;
2396         TALLOC_CTX *out_mem_ctx;
2397         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2398 };
2399
2400 static void rpccli_wkssvc_NetrLogonDomainNameDel_done(struct tevent_req *subreq);
2401
2402 struct tevent_req *rpccli_wkssvc_NetrLogonDomainNameDel_send(TALLOC_CTX *mem_ctx,
2403                                                              struct tevent_context *ev,
2404                                                              struct rpc_pipe_client *cli,
2405                                                              const char *_domain_name /* [in] [ref,charset(UTF16)] */)
2406 {
2407         struct tevent_req *req;
2408         struct rpccli_wkssvc_NetrLogonDomainNameDel_state *state;
2409         struct tevent_req *subreq;
2410
2411         req = tevent_req_create(mem_ctx, &state,
2412                                 struct rpccli_wkssvc_NetrLogonDomainNameDel_state);
2413         if (req == NULL) {
2414                 return NULL;
2415         }
2416         state->out_mem_ctx = NULL;
2417         state->dispatch_recv = cli->dispatch_recv;
2418
2419         /* In parameters */
2420         state->orig.in.domain_name = _domain_name;
2421
2422         /* Out parameters */
2423
2424         /* Result */
2425         ZERO_STRUCT(state->orig.out.result);
2426
2427         /* make a temporary copy, that we pass to the dispatch function */
2428         state->tmp = state->orig;
2429
2430         subreq = cli->dispatch_send(state, ev, cli,
2431                                     &ndr_table_wkssvc,
2432                                     NDR_WKSSVC_NETRLOGONDOMAINNAMEDEL,
2433                                     &state->tmp);
2434         if (tevent_req_nomem(subreq, req)) {
2435                 return tevent_req_post(req, ev);
2436         }
2437         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrLogonDomainNameDel_done, req);
2438         return req;
2439 }
2440
2441 static void rpccli_wkssvc_NetrLogonDomainNameDel_done(struct tevent_req *subreq)
2442 {
2443         struct tevent_req *req = tevent_req_callback_data(
2444                 subreq, struct tevent_req);
2445         struct rpccli_wkssvc_NetrLogonDomainNameDel_state *state = tevent_req_data(
2446                 req, struct rpccli_wkssvc_NetrLogonDomainNameDel_state);
2447         NTSTATUS status;
2448         TALLOC_CTX *mem_ctx;
2449
2450         if (state->out_mem_ctx) {
2451                 mem_ctx = state->out_mem_ctx;
2452         } else {
2453                 mem_ctx = state;
2454         }
2455
2456         status = state->dispatch_recv(subreq, mem_ctx);
2457         TALLOC_FREE(subreq);
2458         if (!NT_STATUS_IS_OK(status)) {
2459                 tevent_req_nterror(req, status);
2460                 return;
2461         }
2462
2463         /* Copy out parameters */
2464
2465         /* Copy result */
2466         state->orig.out.result = state->tmp.out.result;
2467
2468         /* Reset temporary structure */
2469         ZERO_STRUCT(state->tmp);
2470
2471         tevent_req_done(req);
2472 }
2473
2474 NTSTATUS rpccli_wkssvc_NetrLogonDomainNameDel_recv(struct tevent_req *req,
2475                                                    TALLOC_CTX *mem_ctx,
2476                                                    WERROR *result)
2477 {
2478         struct rpccli_wkssvc_NetrLogonDomainNameDel_state *state = tevent_req_data(
2479                 req, struct rpccli_wkssvc_NetrLogonDomainNameDel_state);
2480         NTSTATUS status;
2481
2482         if (tevent_req_is_nterror(req, &status)) {
2483                 tevent_req_received(req);
2484                 return status;
2485         }
2486
2487         /* Steal possbile out parameters to the callers context */
2488         talloc_steal(mem_ctx, state->out_mem_ctx);
2489
2490         /* Return result */
2491         *result = state->orig.out.result;
2492
2493         tevent_req_received(req);
2494         return NT_STATUS_OK;
2495 }
2496
2497 NTSTATUS rpccli_wkssvc_NetrLogonDomainNameDel(struct rpc_pipe_client *cli,
2498                                               TALLOC_CTX *mem_ctx,
2499                                               const char *domain_name /* [in] [ref,charset(UTF16)] */,
2500                                               WERROR *werror)
2501 {
2502         struct wkssvc_NetrLogonDomainNameDel r;
2503         NTSTATUS status;
2504
2505         /* In parameters */
2506         r.in.domain_name = domain_name;
2507
2508         status = cli->dispatch(cli,
2509                                 mem_ctx,
2510                                 &ndr_table_wkssvc,
2511                                 NDR_WKSSVC_NETRLOGONDOMAINNAMEDEL,
2512                                 &r);
2513
2514         if (!NT_STATUS_IS_OK(status)) {
2515                 return status;
2516         }
2517
2518         if (NT_STATUS_IS_ERR(status)) {
2519                 return status;
2520         }
2521
2522         /* Return variables */
2523
2524         /* Return result */
2525         if (werror) {
2526                 *werror = r.out.result;
2527         }
2528
2529         return werror_to_ntstatus(r.out.result);
2530 }
2531
2532 struct rpccli_wkssvc_NetrJoinDomain_state {
2533         struct wkssvc_NetrJoinDomain orig;
2534         struct wkssvc_NetrJoinDomain tmp;
2535         TALLOC_CTX *out_mem_ctx;
2536         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2537 };
2538
2539 static void rpccli_wkssvc_NetrJoinDomain_done(struct tevent_req *subreq);
2540
2541 struct tevent_req *rpccli_wkssvc_NetrJoinDomain_send(TALLOC_CTX *mem_ctx,
2542                                                      struct tevent_context *ev,
2543                                                      struct rpc_pipe_client *cli,
2544                                                      const char *_server_name /* [in] [unique,charset(UTF16)] */,
2545                                                      const char *_domain_name /* [in] [ref,charset(UTF16)] */,
2546                                                      const char *_account_ou /* [in] [unique,charset(UTF16)] */,
2547                                                      const char *_Account /* [in] [unique,charset(UTF16)] */,
2548                                                      const char *_password /* [in] [unique,charset(UTF16)] */,
2549                                                      uint32_t _join_flags /* [in]  */)
2550 {
2551         struct tevent_req *req;
2552         struct rpccli_wkssvc_NetrJoinDomain_state *state;
2553         struct tevent_req *subreq;
2554
2555         req = tevent_req_create(mem_ctx, &state,
2556                                 struct rpccli_wkssvc_NetrJoinDomain_state);
2557         if (req == NULL) {
2558                 return NULL;
2559         }
2560         state->out_mem_ctx = NULL;
2561         state->dispatch_recv = cli->dispatch_recv;
2562
2563         /* In parameters */
2564         state->orig.in.server_name = _server_name;
2565         state->orig.in.domain_name = _domain_name;
2566         state->orig.in.account_ou = _account_ou;
2567         state->orig.in.Account = _Account;
2568         state->orig.in.password = _password;
2569         state->orig.in.join_flags = _join_flags;
2570
2571         /* Out parameters */
2572
2573         /* Result */
2574         ZERO_STRUCT(state->orig.out.result);
2575
2576         /* make a temporary copy, that we pass to the dispatch function */
2577         state->tmp = state->orig;
2578
2579         subreq = cli->dispatch_send(state, ev, cli,
2580                                     &ndr_table_wkssvc,
2581                                     NDR_WKSSVC_NETRJOINDOMAIN,
2582                                     &state->tmp);
2583         if (tevent_req_nomem(subreq, req)) {
2584                 return tevent_req_post(req, ev);
2585         }
2586         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrJoinDomain_done, req);
2587         return req;
2588 }
2589
2590 static void rpccli_wkssvc_NetrJoinDomain_done(struct tevent_req *subreq)
2591 {
2592         struct tevent_req *req = tevent_req_callback_data(
2593                 subreq, struct tevent_req);
2594         struct rpccli_wkssvc_NetrJoinDomain_state *state = tevent_req_data(
2595                 req, struct rpccli_wkssvc_NetrJoinDomain_state);
2596         NTSTATUS status;
2597         TALLOC_CTX *mem_ctx;
2598
2599         if (state->out_mem_ctx) {
2600                 mem_ctx = state->out_mem_ctx;
2601         } else {
2602                 mem_ctx = state;
2603         }
2604
2605         status = state->dispatch_recv(subreq, mem_ctx);
2606         TALLOC_FREE(subreq);
2607         if (!NT_STATUS_IS_OK(status)) {
2608                 tevent_req_nterror(req, status);
2609                 return;
2610         }
2611
2612         /* Copy out parameters */
2613
2614         /* Copy result */
2615         state->orig.out.result = state->tmp.out.result;
2616
2617         /* Reset temporary structure */
2618         ZERO_STRUCT(state->tmp);
2619
2620         tevent_req_done(req);
2621 }
2622
2623 NTSTATUS rpccli_wkssvc_NetrJoinDomain_recv(struct tevent_req *req,
2624                                            TALLOC_CTX *mem_ctx,
2625                                            WERROR *result)
2626 {
2627         struct rpccli_wkssvc_NetrJoinDomain_state *state = tevent_req_data(
2628                 req, struct rpccli_wkssvc_NetrJoinDomain_state);
2629         NTSTATUS status;
2630
2631         if (tevent_req_is_nterror(req, &status)) {
2632                 tevent_req_received(req);
2633                 return status;
2634         }
2635
2636         /* Steal possbile out parameters to the callers context */
2637         talloc_steal(mem_ctx, state->out_mem_ctx);
2638
2639         /* Return result */
2640         *result = state->orig.out.result;
2641
2642         tevent_req_received(req);
2643         return NT_STATUS_OK;
2644 }
2645
2646 NTSTATUS rpccli_wkssvc_NetrJoinDomain(struct rpc_pipe_client *cli,
2647                                       TALLOC_CTX *mem_ctx,
2648                                       const char *server_name /* [in] [unique,charset(UTF16)] */,
2649                                       const char *domain_name /* [in] [ref,charset(UTF16)] */,
2650                                       const char *account_ou /* [in] [unique,charset(UTF16)] */,
2651                                       const char *Account /* [in] [unique,charset(UTF16)] */,
2652                                       const char *password /* [in] [unique,charset(UTF16)] */,
2653                                       uint32_t join_flags /* [in]  */,
2654                                       WERROR *werror)
2655 {
2656         struct wkssvc_NetrJoinDomain r;
2657         NTSTATUS status;
2658
2659         /* In parameters */
2660         r.in.server_name = server_name;
2661         r.in.domain_name = domain_name;
2662         r.in.account_ou = account_ou;
2663         r.in.Account = Account;
2664         r.in.password = password;
2665         r.in.join_flags = join_flags;
2666
2667         status = cli->dispatch(cli,
2668                                 mem_ctx,
2669                                 &ndr_table_wkssvc,
2670                                 NDR_WKSSVC_NETRJOINDOMAIN,
2671                                 &r);
2672
2673         if (!NT_STATUS_IS_OK(status)) {
2674                 return status;
2675         }
2676
2677         if (NT_STATUS_IS_ERR(status)) {
2678                 return status;
2679         }
2680
2681         /* Return variables */
2682
2683         /* Return result */
2684         if (werror) {
2685                 *werror = r.out.result;
2686         }
2687
2688         return werror_to_ntstatus(r.out.result);
2689 }
2690
2691 struct rpccli_wkssvc_NetrUnjoinDomain_state {
2692         struct wkssvc_NetrUnjoinDomain orig;
2693         struct wkssvc_NetrUnjoinDomain tmp;
2694         TALLOC_CTX *out_mem_ctx;
2695         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2696 };
2697
2698 static void rpccli_wkssvc_NetrUnjoinDomain_done(struct tevent_req *subreq);
2699
2700 struct tevent_req *rpccli_wkssvc_NetrUnjoinDomain_send(TALLOC_CTX *mem_ctx,
2701                                                        struct tevent_context *ev,
2702                                                        struct rpc_pipe_client *cli,
2703                                                        const char *_server_name /* [in] [unique,charset(UTF16)] */,
2704                                                        const char *_Account /* [in] [unique,charset(UTF16)] */,
2705                                                        const char *_password /* [in] [unique,charset(UTF16)] */,
2706                                                        uint32_t _unjoin_flags /* [in]  */)
2707 {
2708         struct tevent_req *req;
2709         struct rpccli_wkssvc_NetrUnjoinDomain_state *state;
2710         struct tevent_req *subreq;
2711
2712         req = tevent_req_create(mem_ctx, &state,
2713                                 struct rpccli_wkssvc_NetrUnjoinDomain_state);
2714         if (req == NULL) {
2715                 return NULL;
2716         }
2717         state->out_mem_ctx = NULL;
2718         state->dispatch_recv = cli->dispatch_recv;
2719
2720         /* In parameters */
2721         state->orig.in.server_name = _server_name;
2722         state->orig.in.Account = _Account;
2723         state->orig.in.password = _password;
2724         state->orig.in.unjoin_flags = _unjoin_flags;
2725
2726         /* Out parameters */
2727
2728         /* Result */
2729         ZERO_STRUCT(state->orig.out.result);
2730
2731         /* make a temporary copy, that we pass to the dispatch function */
2732         state->tmp = state->orig;
2733
2734         subreq = cli->dispatch_send(state, ev, cli,
2735                                     &ndr_table_wkssvc,
2736                                     NDR_WKSSVC_NETRUNJOINDOMAIN,
2737                                     &state->tmp);
2738         if (tevent_req_nomem(subreq, req)) {
2739                 return tevent_req_post(req, ev);
2740         }
2741         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrUnjoinDomain_done, req);
2742         return req;
2743 }
2744
2745 static void rpccli_wkssvc_NetrUnjoinDomain_done(struct tevent_req *subreq)
2746 {
2747         struct tevent_req *req = tevent_req_callback_data(
2748                 subreq, struct tevent_req);
2749         struct rpccli_wkssvc_NetrUnjoinDomain_state *state = tevent_req_data(
2750                 req, struct rpccli_wkssvc_NetrUnjoinDomain_state);
2751         NTSTATUS status;
2752         TALLOC_CTX *mem_ctx;
2753
2754         if (state->out_mem_ctx) {
2755                 mem_ctx = state->out_mem_ctx;
2756         } else {
2757                 mem_ctx = state;
2758         }
2759
2760         status = state->dispatch_recv(subreq, mem_ctx);
2761         TALLOC_FREE(subreq);
2762         if (!NT_STATUS_IS_OK(status)) {
2763                 tevent_req_nterror(req, status);
2764                 return;
2765         }
2766
2767         /* Copy out parameters */
2768
2769         /* Copy result */
2770         state->orig.out.result = state->tmp.out.result;
2771
2772         /* Reset temporary structure */
2773         ZERO_STRUCT(state->tmp);
2774
2775         tevent_req_done(req);
2776 }
2777
2778 NTSTATUS rpccli_wkssvc_NetrUnjoinDomain_recv(struct tevent_req *req,
2779                                              TALLOC_CTX *mem_ctx,
2780                                              WERROR *result)
2781 {
2782         struct rpccli_wkssvc_NetrUnjoinDomain_state *state = tevent_req_data(
2783                 req, struct rpccli_wkssvc_NetrUnjoinDomain_state);
2784         NTSTATUS status;
2785
2786         if (tevent_req_is_nterror(req, &status)) {
2787                 tevent_req_received(req);
2788                 return status;
2789         }
2790
2791         /* Steal possbile out parameters to the callers context */
2792         talloc_steal(mem_ctx, state->out_mem_ctx);
2793
2794         /* Return result */
2795         *result = state->orig.out.result;
2796
2797         tevent_req_received(req);
2798         return NT_STATUS_OK;
2799 }
2800
2801 NTSTATUS rpccli_wkssvc_NetrUnjoinDomain(struct rpc_pipe_client *cli,
2802                                         TALLOC_CTX *mem_ctx,
2803                                         const char *server_name /* [in] [unique,charset(UTF16)] */,
2804                                         const char *Account /* [in] [unique,charset(UTF16)] */,
2805                                         const char *password /* [in] [unique,charset(UTF16)] */,
2806                                         uint32_t unjoin_flags /* [in]  */,
2807                                         WERROR *werror)
2808 {
2809         struct wkssvc_NetrUnjoinDomain r;
2810         NTSTATUS status;
2811
2812         /* In parameters */
2813         r.in.server_name = server_name;
2814         r.in.Account = Account;
2815         r.in.password = password;
2816         r.in.unjoin_flags = unjoin_flags;
2817
2818         status = cli->dispatch(cli,
2819                                 mem_ctx,
2820                                 &ndr_table_wkssvc,
2821                                 NDR_WKSSVC_NETRUNJOINDOMAIN,
2822                                 &r);
2823
2824         if (!NT_STATUS_IS_OK(status)) {
2825                 return status;
2826         }
2827
2828         if (NT_STATUS_IS_ERR(status)) {
2829                 return status;
2830         }
2831
2832         /* Return variables */
2833
2834         /* Return result */
2835         if (werror) {
2836                 *werror = r.out.result;
2837         }
2838
2839         return werror_to_ntstatus(r.out.result);
2840 }
2841
2842 struct rpccli_wkssvc_NetrRenameMachineInDomain_state {
2843         struct wkssvc_NetrRenameMachineInDomain orig;
2844         struct wkssvc_NetrRenameMachineInDomain tmp;
2845         TALLOC_CTX *out_mem_ctx;
2846         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2847 };
2848
2849 static void rpccli_wkssvc_NetrRenameMachineInDomain_done(struct tevent_req *subreq);
2850
2851 struct tevent_req *rpccli_wkssvc_NetrRenameMachineInDomain_send(TALLOC_CTX *mem_ctx,
2852                                                                 struct tevent_context *ev,
2853                                                                 struct rpc_pipe_client *cli,
2854                                                                 const char *_server_name /* [in] [unique,charset(UTF16)] */,
2855                                                                 const char *_NewMachineName /* [in] [unique,charset(UTF16)] */,
2856                                                                 const char *_Account /* [in] [unique,charset(UTF16)] */,
2857                                                                 const char *_password /* [in] [unique,charset(UTF16)] */,
2858                                                                 uint32_t _RenameOptions /* [in]  */)
2859 {
2860         struct tevent_req *req;
2861         struct rpccli_wkssvc_NetrRenameMachineInDomain_state *state;
2862         struct tevent_req *subreq;
2863
2864         req = tevent_req_create(mem_ctx, &state,
2865                                 struct rpccli_wkssvc_NetrRenameMachineInDomain_state);
2866         if (req == NULL) {
2867                 return NULL;
2868         }
2869         state->out_mem_ctx = NULL;
2870         state->dispatch_recv = cli->dispatch_recv;
2871
2872         /* In parameters */
2873         state->orig.in.server_name = _server_name;
2874         state->orig.in.NewMachineName = _NewMachineName;
2875         state->orig.in.Account = _Account;
2876         state->orig.in.password = _password;
2877         state->orig.in.RenameOptions = _RenameOptions;
2878
2879         /* Out parameters */
2880
2881         /* Result */
2882         ZERO_STRUCT(state->orig.out.result);
2883
2884         /* make a temporary copy, that we pass to the dispatch function */
2885         state->tmp = state->orig;
2886
2887         subreq = cli->dispatch_send(state, ev, cli,
2888                                     &ndr_table_wkssvc,
2889                                     NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN,
2890                                     &state->tmp);
2891         if (tevent_req_nomem(subreq, req)) {
2892                 return tevent_req_post(req, ev);
2893         }
2894         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrRenameMachineInDomain_done, req);
2895         return req;
2896 }
2897
2898 static void rpccli_wkssvc_NetrRenameMachineInDomain_done(struct tevent_req *subreq)
2899 {
2900         struct tevent_req *req = tevent_req_callback_data(
2901                 subreq, struct tevent_req);
2902         struct rpccli_wkssvc_NetrRenameMachineInDomain_state *state = tevent_req_data(
2903                 req, struct rpccli_wkssvc_NetrRenameMachineInDomain_state);
2904         NTSTATUS status;
2905         TALLOC_CTX *mem_ctx;
2906
2907         if (state->out_mem_ctx) {
2908                 mem_ctx = state->out_mem_ctx;
2909         } else {
2910                 mem_ctx = state;
2911         }
2912
2913         status = state->dispatch_recv(subreq, mem_ctx);
2914         TALLOC_FREE(subreq);
2915         if (!NT_STATUS_IS_OK(status)) {
2916                 tevent_req_nterror(req, status);
2917                 return;
2918         }
2919
2920         /* Copy out parameters */
2921
2922         /* Copy result */
2923         state->orig.out.result = state->tmp.out.result;
2924
2925         /* Reset temporary structure */
2926         ZERO_STRUCT(state->tmp);
2927
2928         tevent_req_done(req);
2929 }
2930
2931 NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain_recv(struct tevent_req *req,
2932                                                       TALLOC_CTX *mem_ctx,
2933                                                       WERROR *result)
2934 {
2935         struct rpccli_wkssvc_NetrRenameMachineInDomain_state *state = tevent_req_data(
2936                 req, struct rpccli_wkssvc_NetrRenameMachineInDomain_state);
2937         NTSTATUS status;
2938
2939         if (tevent_req_is_nterror(req, &status)) {
2940                 tevent_req_received(req);
2941                 return status;
2942         }
2943
2944         /* Steal possbile out parameters to the callers context */
2945         talloc_steal(mem_ctx, state->out_mem_ctx);
2946
2947         /* Return result */
2948         *result = state->orig.out.result;
2949
2950         tevent_req_received(req);
2951         return NT_STATUS_OK;
2952 }
2953
2954 NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain(struct rpc_pipe_client *cli,
2955                                                  TALLOC_CTX *mem_ctx,
2956                                                  const char *server_name /* [in] [unique,charset(UTF16)] */,
2957                                                  const char *NewMachineName /* [in] [unique,charset(UTF16)] */,
2958                                                  const char *Account /* [in] [unique,charset(UTF16)] */,
2959                                                  const char *password /* [in] [unique,charset(UTF16)] */,
2960                                                  uint32_t RenameOptions /* [in]  */,
2961                                                  WERROR *werror)
2962 {
2963         struct wkssvc_NetrRenameMachineInDomain r;
2964         NTSTATUS status;
2965
2966         /* In parameters */
2967         r.in.server_name = server_name;
2968         r.in.NewMachineName = NewMachineName;
2969         r.in.Account = Account;
2970         r.in.password = password;
2971         r.in.RenameOptions = RenameOptions;
2972
2973         status = cli->dispatch(cli,
2974                                 mem_ctx,
2975                                 &ndr_table_wkssvc,
2976                                 NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN,
2977                                 &r);
2978
2979         if (!NT_STATUS_IS_OK(status)) {
2980                 return status;
2981         }
2982
2983         if (NT_STATUS_IS_ERR(status)) {
2984                 return status;
2985         }
2986
2987         /* Return variables */
2988
2989         /* Return result */
2990         if (werror) {
2991                 *werror = r.out.result;
2992         }
2993
2994         return werror_to_ntstatus(r.out.result);
2995 }
2996
2997 struct rpccli_wkssvc_NetrValidateName_state {
2998         struct wkssvc_NetrValidateName orig;
2999         struct wkssvc_NetrValidateName tmp;
3000         TALLOC_CTX *out_mem_ctx;
3001         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3002 };
3003
3004 static void rpccli_wkssvc_NetrValidateName_done(struct tevent_req *subreq);
3005
3006 struct tevent_req *rpccli_wkssvc_NetrValidateName_send(TALLOC_CTX *mem_ctx,
3007                                                        struct tevent_context *ev,
3008                                                        struct rpc_pipe_client *cli,
3009                                                        const char *_server_name /* [in] [unique,charset(UTF16)] */,
3010                                                        const char *_name /* [in] [ref,charset(UTF16)] */,
3011                                                        const char *_Account /* [in] [unique,charset(UTF16)] */,
3012                                                        const char *_Password /* [in] [unique,charset(UTF16)] */,
3013                                                        enum wkssvc_NetValidateNameType _name_type /* [in]  */)
3014 {
3015         struct tevent_req *req;
3016         struct rpccli_wkssvc_NetrValidateName_state *state;
3017         struct tevent_req *subreq;
3018
3019         req = tevent_req_create(mem_ctx, &state,
3020                                 struct rpccli_wkssvc_NetrValidateName_state);
3021         if (req == NULL) {
3022                 return NULL;
3023         }
3024         state->out_mem_ctx = NULL;
3025         state->dispatch_recv = cli->dispatch_recv;
3026
3027         /* In parameters */
3028         state->orig.in.server_name = _server_name;
3029         state->orig.in.name = _name;
3030         state->orig.in.Account = _Account;
3031         state->orig.in.Password = _Password;
3032         state->orig.in.name_type = _name_type;
3033
3034         /* Out parameters */
3035
3036         /* Result */
3037         ZERO_STRUCT(state->orig.out.result);
3038
3039         /* make a temporary copy, that we pass to the dispatch function */
3040         state->tmp = state->orig;
3041
3042         subreq = cli->dispatch_send(state, ev, cli,
3043                                     &ndr_table_wkssvc,
3044                                     NDR_WKSSVC_NETRVALIDATENAME,
3045                                     &state->tmp);
3046         if (tevent_req_nomem(subreq, req)) {
3047                 return tevent_req_post(req, ev);
3048         }
3049         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrValidateName_done, req);
3050         return req;
3051 }
3052
3053 static void rpccli_wkssvc_NetrValidateName_done(struct tevent_req *subreq)
3054 {
3055         struct tevent_req *req = tevent_req_callback_data(
3056                 subreq, struct tevent_req);
3057         struct rpccli_wkssvc_NetrValidateName_state *state = tevent_req_data(
3058                 req, struct rpccli_wkssvc_NetrValidateName_state);
3059         NTSTATUS status;
3060         TALLOC_CTX *mem_ctx;
3061
3062         if (state->out_mem_ctx) {
3063                 mem_ctx = state->out_mem_ctx;
3064         } else {
3065                 mem_ctx = state;
3066         }
3067
3068         status = state->dispatch_recv(subreq, mem_ctx);
3069         TALLOC_FREE(subreq);
3070         if (!NT_STATUS_IS_OK(status)) {
3071                 tevent_req_nterror(req, status);
3072                 return;
3073         }
3074
3075         /* Copy out parameters */
3076
3077         /* Copy result */
3078         state->orig.out.result = state->tmp.out.result;
3079
3080         /* Reset temporary structure */
3081         ZERO_STRUCT(state->tmp);
3082
3083         tevent_req_done(req);
3084 }
3085
3086 NTSTATUS rpccli_wkssvc_NetrValidateName_recv(struct tevent_req *req,
3087                                              TALLOC_CTX *mem_ctx,
3088                                              WERROR *result)
3089 {
3090         struct rpccli_wkssvc_NetrValidateName_state *state = tevent_req_data(
3091                 req, struct rpccli_wkssvc_NetrValidateName_state);
3092         NTSTATUS status;
3093
3094         if (tevent_req_is_nterror(req, &status)) {
3095                 tevent_req_received(req);
3096                 return status;
3097         }
3098
3099         /* Steal possbile out parameters to the callers context */
3100         talloc_steal(mem_ctx, state->out_mem_ctx);
3101
3102         /* Return result */
3103         *result = state->orig.out.result;
3104
3105         tevent_req_received(req);
3106         return NT_STATUS_OK;
3107 }
3108
3109 NTSTATUS rpccli_wkssvc_NetrValidateName(struct rpc_pipe_client *cli,
3110                                         TALLOC_CTX *mem_ctx,
3111                                         const char *server_name /* [in] [unique,charset(UTF16)] */,
3112                                         const char *name /* [in] [ref,charset(UTF16)] */,
3113                                         const char *Account /* [in] [unique,charset(UTF16)] */,
3114                                         const char *Password /* [in] [unique,charset(UTF16)] */,
3115                                         enum wkssvc_NetValidateNameType name_type /* [in]  */,
3116                                         WERROR *werror)
3117 {
3118         struct wkssvc_NetrValidateName r;
3119         NTSTATUS status;
3120
3121         /* In parameters */
3122         r.in.server_name = server_name;
3123         r.in.name = name;
3124         r.in.Account = Account;
3125         r.in.Password = Password;
3126         r.in.name_type = name_type;
3127
3128         status = cli->dispatch(cli,
3129                                 mem_ctx,
3130                                 &ndr_table_wkssvc,
3131                                 NDR_WKSSVC_NETRVALIDATENAME,
3132                                 &r);
3133
3134         if (!NT_STATUS_IS_OK(status)) {
3135                 return status;
3136         }
3137
3138         if (NT_STATUS_IS_ERR(status)) {
3139                 return status;
3140         }
3141
3142         /* Return variables */
3143
3144         /* Return result */
3145         if (werror) {
3146                 *werror = r.out.result;
3147         }
3148
3149         return werror_to_ntstatus(r.out.result);
3150 }
3151
3152 struct rpccli_wkssvc_NetrGetJoinInformation_state {
3153         struct wkssvc_NetrGetJoinInformation orig;
3154         struct wkssvc_NetrGetJoinInformation tmp;
3155         TALLOC_CTX *out_mem_ctx;
3156         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3157 };
3158
3159 static void rpccli_wkssvc_NetrGetJoinInformation_done(struct tevent_req *subreq);
3160
3161 struct tevent_req *rpccli_wkssvc_NetrGetJoinInformation_send(TALLOC_CTX *mem_ctx,
3162                                                              struct tevent_context *ev,
3163                                                              struct rpc_pipe_client *cli,
3164                                                              const char *_server_name /* [in] [unique,charset(UTF16)] */,
3165                                                              const char **_name_buffer /* [in,out] [ref,charset(UTF16)] */,
3166                                                              enum wkssvc_NetJoinStatus *_name_type /* [out] [ref] */)
3167 {
3168         struct tevent_req *req;
3169         struct rpccli_wkssvc_NetrGetJoinInformation_state *state;
3170         struct tevent_req *subreq;
3171
3172         req = tevent_req_create(mem_ctx, &state,
3173                                 struct rpccli_wkssvc_NetrGetJoinInformation_state);
3174         if (req == NULL) {
3175                 return NULL;
3176         }
3177         state->out_mem_ctx = NULL;
3178         state->dispatch_recv = cli->dispatch_recv;
3179
3180         /* In parameters */
3181         state->orig.in.server_name = _server_name;
3182         state->orig.in.name_buffer = _name_buffer;
3183
3184         /* Out parameters */
3185         state->orig.out.name_buffer = _name_buffer;
3186         state->orig.out.name_type = _name_type;
3187
3188         /* Result */
3189         ZERO_STRUCT(state->orig.out.result);
3190
3191         state->out_mem_ctx = talloc_named_const(state, 0,
3192                              "rpccli_wkssvc_NetrGetJoinInformation_out_memory");
3193         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3194                 return tevent_req_post(req, ev);
3195         }
3196
3197         /* make a temporary copy, that we pass to the dispatch function */
3198         state->tmp = state->orig;
3199
3200         subreq = cli->dispatch_send(state, ev, cli,
3201                                     &ndr_table_wkssvc,
3202                                     NDR_WKSSVC_NETRGETJOININFORMATION,
3203                                     &state->tmp);
3204         if (tevent_req_nomem(subreq, req)) {
3205                 return tevent_req_post(req, ev);
3206         }
3207         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrGetJoinInformation_done, req);
3208         return req;
3209 }
3210
3211 static void rpccli_wkssvc_NetrGetJoinInformation_done(struct tevent_req *subreq)
3212 {
3213         struct tevent_req *req = tevent_req_callback_data(
3214                 subreq, struct tevent_req);
3215         struct rpccli_wkssvc_NetrGetJoinInformation_state *state = tevent_req_data(
3216                 req, struct rpccli_wkssvc_NetrGetJoinInformation_state);
3217         NTSTATUS status;
3218         TALLOC_CTX *mem_ctx;
3219
3220         if (state->out_mem_ctx) {
3221                 mem_ctx = state->out_mem_ctx;
3222         } else {
3223                 mem_ctx = state;
3224         }
3225
3226         status = state->dispatch_recv(subreq, mem_ctx);
3227         TALLOC_FREE(subreq);
3228         if (!NT_STATUS_IS_OK(status)) {
3229                 tevent_req_nterror(req, status);
3230                 return;
3231         }
3232
3233         /* Copy out parameters */
3234         *state->orig.out.name_buffer = *state->tmp.out.name_buffer;
3235         *state->orig.out.name_type = *state->tmp.out.name_type;
3236
3237         /* Copy result */
3238         state->orig.out.result = state->tmp.out.result;
3239
3240         /* Reset temporary structure */
3241         ZERO_STRUCT(state->tmp);
3242
3243         tevent_req_done(req);
3244 }
3245
3246 NTSTATUS rpccli_wkssvc_NetrGetJoinInformation_recv(struct tevent_req *req,
3247                                                    TALLOC_CTX *mem_ctx,
3248                                                    WERROR *result)
3249 {
3250         struct rpccli_wkssvc_NetrGetJoinInformation_state *state = tevent_req_data(
3251                 req, struct rpccli_wkssvc_NetrGetJoinInformation_state);
3252         NTSTATUS status;
3253
3254         if (tevent_req_is_nterror(req, &status)) {
3255                 tevent_req_received(req);
3256                 return status;
3257         }
3258
3259         /* Steal possbile out parameters to the callers context */
3260         talloc_steal(mem_ctx, state->out_mem_ctx);
3261
3262         /* Return result */
3263         *result = state->orig.out.result;
3264
3265         tevent_req_received(req);
3266         return NT_STATUS_OK;
3267 }
3268
3269 NTSTATUS rpccli_wkssvc_NetrGetJoinInformation(struct rpc_pipe_client *cli,
3270                                               TALLOC_CTX *mem_ctx,
3271                                               const char *server_name /* [in] [unique,charset(UTF16)] */,
3272                                               const char **name_buffer /* [in,out] [ref,charset(UTF16)] */,
3273                                               enum wkssvc_NetJoinStatus *name_type /* [out] [ref] */,
3274                                               WERROR *werror)
3275 {
3276         struct wkssvc_NetrGetJoinInformation r;
3277         NTSTATUS status;
3278
3279         /* In parameters */
3280         r.in.server_name = server_name;
3281         r.in.name_buffer = name_buffer;
3282
3283         status = cli->dispatch(cli,
3284                                 mem_ctx,
3285                                 &ndr_table_wkssvc,
3286                                 NDR_WKSSVC_NETRGETJOININFORMATION,
3287                                 &r);
3288
3289         if (!NT_STATUS_IS_OK(status)) {
3290                 return status;
3291         }
3292
3293         if (NT_STATUS_IS_ERR(status)) {
3294                 return status;
3295         }
3296
3297         /* Return variables */
3298         *name_buffer = *r.out.name_buffer;
3299         *name_type = *r.out.name_type;
3300
3301         /* Return result */
3302         if (werror) {
3303                 *werror = r.out.result;
3304         }
3305
3306         return werror_to_ntstatus(r.out.result);
3307 }
3308
3309 struct rpccli_wkssvc_NetrGetJoinableOus_state {
3310         struct wkssvc_NetrGetJoinableOus orig;
3311         struct wkssvc_NetrGetJoinableOus tmp;
3312         TALLOC_CTX *out_mem_ctx;
3313         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3314 };
3315
3316 static void rpccli_wkssvc_NetrGetJoinableOus_done(struct tevent_req *subreq);
3317
3318 struct tevent_req *rpccli_wkssvc_NetrGetJoinableOus_send(TALLOC_CTX *mem_ctx,
3319                                                          struct tevent_context *ev,
3320                                                          struct rpc_pipe_client *cli,
3321                                                          const char *_server_name /* [in] [unique,charset(UTF16)] */,
3322                                                          const char *_domain_name /* [in] [ref,charset(UTF16)] */,
3323                                                          const char *_Account /* [in] [unique,charset(UTF16)] */,
3324                                                          const char *_unknown /* [in] [unique,charset(UTF16)] */,
3325                                                          uint32_t *_num_ous /* [in,out] [ref] */,
3326                                                          const char ***_ous /* [out] [ref,charset(UTF16),size_is(,*num_ous)] */)
3327 {
3328         struct tevent_req *req;
3329         struct rpccli_wkssvc_NetrGetJoinableOus_state *state;
3330         struct tevent_req *subreq;
3331
3332         req = tevent_req_create(mem_ctx, &state,
3333                                 struct rpccli_wkssvc_NetrGetJoinableOus_state);
3334         if (req == NULL) {
3335                 return NULL;
3336         }
3337         state->out_mem_ctx = NULL;
3338         state->dispatch_recv = cli->dispatch_recv;
3339
3340         /* In parameters */
3341         state->orig.in.server_name = _server_name;
3342         state->orig.in.domain_name = _domain_name;
3343         state->orig.in.Account = _Account;
3344         state->orig.in.unknown = _unknown;
3345         state->orig.in.num_ous = _num_ous;
3346
3347         /* Out parameters */
3348         state->orig.out.num_ous = _num_ous;
3349         state->orig.out.ous = _ous;
3350
3351         /* Result */
3352         ZERO_STRUCT(state->orig.out.result);
3353
3354         state->out_mem_ctx = talloc_named_const(state, 0,
3355                              "rpccli_wkssvc_NetrGetJoinableOus_out_memory");
3356         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3357                 return tevent_req_post(req, ev);
3358         }
3359
3360         /* make a temporary copy, that we pass to the dispatch function */
3361         state->tmp = state->orig;
3362
3363         subreq = cli->dispatch_send(state, ev, cli,
3364                                     &ndr_table_wkssvc,
3365                                     NDR_WKSSVC_NETRGETJOINABLEOUS,
3366                                     &state->tmp);
3367         if (tevent_req_nomem(subreq, req)) {
3368                 return tevent_req_post(req, ev);
3369         }
3370         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrGetJoinableOus_done, req);
3371         return req;
3372 }
3373
3374 static void rpccli_wkssvc_NetrGetJoinableOus_done(struct tevent_req *subreq)
3375 {
3376         struct tevent_req *req = tevent_req_callback_data(
3377                 subreq, struct tevent_req);
3378         struct rpccli_wkssvc_NetrGetJoinableOus_state *state = tevent_req_data(
3379                 req, struct rpccli_wkssvc_NetrGetJoinableOus_state);
3380         NTSTATUS status;
3381         TALLOC_CTX *mem_ctx;
3382
3383         if (state->out_mem_ctx) {
3384                 mem_ctx = state->out_mem_ctx;
3385         } else {
3386                 mem_ctx = state;
3387         }
3388
3389         status = state->dispatch_recv(subreq, mem_ctx);
3390         TALLOC_FREE(subreq);
3391         if (!NT_STATUS_IS_OK(status)) {
3392                 tevent_req_nterror(req, status);
3393                 return;
3394         }
3395
3396         /* Copy out parameters */
3397         *state->orig.out.num_ous = *state->tmp.out.num_ous;
3398         *state->orig.out.ous = *state->tmp.out.ous;
3399
3400         /* Copy result */
3401         state->orig.out.result = state->tmp.out.result;
3402
3403         /* Reset temporary structure */
3404         ZERO_STRUCT(state->tmp);
3405
3406         tevent_req_done(req);
3407 }
3408
3409 NTSTATUS rpccli_wkssvc_NetrGetJoinableOus_recv(struct tevent_req *req,
3410                                                TALLOC_CTX *mem_ctx,
3411                                                WERROR *result)
3412 {
3413         struct rpccli_wkssvc_NetrGetJoinableOus_state *state = tevent_req_data(
3414                 req, struct rpccli_wkssvc_NetrGetJoinableOus_state);
3415         NTSTATUS status;
3416
3417         if (tevent_req_is_nterror(req, &status)) {
3418                 tevent_req_received(req);
3419                 return status;
3420         }
3421
3422         /* Steal possbile out parameters to the callers context */
3423         talloc_steal(mem_ctx, state->out_mem_ctx);
3424
3425         /* Return result */
3426         *result = state->orig.out.result;
3427
3428         tevent_req_received(req);
3429         return NT_STATUS_OK;
3430 }
3431
3432 NTSTATUS rpccli_wkssvc_NetrGetJoinableOus(struct rpc_pipe_client *cli,
3433                                           TALLOC_CTX *mem_ctx,
3434                                           const char *server_name /* [in] [unique,charset(UTF16)] */,
3435                                           const char *domain_name /* [in] [ref,charset(UTF16)] */,
3436                                           const char *Account /* [in] [unique,charset(UTF16)] */,
3437                                           const char *unknown /* [in] [unique,charset(UTF16)] */,
3438                                           uint32_t *num_ous /* [in,out] [ref] */,
3439                                           const char ***ous /* [out] [ref,charset(UTF16),size_is(,*num_ous)] */,
3440                                           WERROR *werror)
3441 {
3442         struct wkssvc_NetrGetJoinableOus r;
3443         NTSTATUS status;
3444
3445         /* In parameters */
3446         r.in.server_name = server_name;
3447         r.in.domain_name = domain_name;
3448         r.in.Account = Account;
3449         r.in.unknown = unknown;
3450         r.in.num_ous = num_ous;
3451
3452         status = cli->dispatch(cli,
3453                                 mem_ctx,
3454                                 &ndr_table_wkssvc,
3455                                 NDR_WKSSVC_NETRGETJOINABLEOUS,
3456                                 &r);
3457
3458         if (!NT_STATUS_IS_OK(status)) {
3459                 return status;
3460         }
3461
3462         if (NT_STATUS_IS_ERR(status)) {
3463                 return status;
3464         }
3465
3466         /* Return variables */
3467         *num_ous = *r.out.num_ous;
3468         *ous = *r.out.ous;
3469
3470         /* Return result */
3471         if (werror) {
3472                 *werror = r.out.result;
3473         }
3474
3475         return werror_to_ntstatus(r.out.result);
3476 }
3477
3478 struct rpccli_wkssvc_NetrJoinDomain2_state {
3479         struct wkssvc_NetrJoinDomain2 orig;
3480         struct wkssvc_NetrJoinDomain2 tmp;
3481         TALLOC_CTX *out_mem_ctx;
3482         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3483 };
3484
3485 static void rpccli_wkssvc_NetrJoinDomain2_done(struct tevent_req *subreq);
3486
3487 struct tevent_req *rpccli_wkssvc_NetrJoinDomain2_send(TALLOC_CTX *mem_ctx,
3488                                                       struct tevent_context *ev,
3489                                                       struct rpc_pipe_client *cli,
3490                                                       const char *_server_name /* [in] [unique,charset(UTF16)] */,
3491                                                       const char *_domain_name /* [in] [ref,charset(UTF16)] */,
3492                                                       const char *_account_ou /* [in] [unique,charset(UTF16)] */,
3493                                                       const char *_admin_account /* [in] [unique,charset(UTF16)] */,
3494                                                       struct wkssvc_PasswordBuffer *_encrypted_password /* [in] [unique] */,
3495                                                       uint32_t _join_flags /* [in]  */)
3496 {
3497         struct tevent_req *req;
3498         struct rpccli_wkssvc_NetrJoinDomain2_state *state;
3499         struct tevent_req *subreq;
3500
3501         req = tevent_req_create(mem_ctx, &state,
3502                                 struct rpccli_wkssvc_NetrJoinDomain2_state);
3503         if (req == NULL) {
3504                 return NULL;
3505         }
3506         state->out_mem_ctx = NULL;
3507         state->dispatch_recv = cli->dispatch_recv;
3508
3509         /* In parameters */
3510         state->orig.in.server_name = _server_name;
3511         state->orig.in.domain_name = _domain_name;
3512         state->orig.in.account_ou = _account_ou;
3513         state->orig.in.admin_account = _admin_account;
3514         state->orig.in.encrypted_password = _encrypted_password;
3515         state->orig.in.join_flags = _join_flags;
3516
3517         /* Out parameters */
3518
3519         /* Result */
3520         ZERO_STRUCT(state->orig.out.result);
3521
3522         /* make a temporary copy, that we pass to the dispatch function */
3523         state->tmp = state->orig;
3524
3525         subreq = cli->dispatch_send(state, ev, cli,
3526                                     &ndr_table_wkssvc,
3527                                     NDR_WKSSVC_NETRJOINDOMAIN2,
3528                                     &state->tmp);
3529         if (tevent_req_nomem(subreq, req)) {
3530                 return tevent_req_post(req, ev);
3531         }
3532         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrJoinDomain2_done, req);
3533         return req;
3534 }
3535
3536 static void rpccli_wkssvc_NetrJoinDomain2_done(struct tevent_req *subreq)
3537 {
3538         struct tevent_req *req = tevent_req_callback_data(
3539                 subreq, struct tevent_req);
3540         struct rpccli_wkssvc_NetrJoinDomain2_state *state = tevent_req_data(
3541                 req, struct rpccli_wkssvc_NetrJoinDomain2_state);
3542         NTSTATUS status;
3543         TALLOC_CTX *mem_ctx;
3544
3545         if (state->out_mem_ctx) {
3546                 mem_ctx = state->out_mem_ctx;
3547         } else {
3548                 mem_ctx = state;
3549         }
3550
3551         status = state->dispatch_recv(subreq, mem_ctx);
3552         TALLOC_FREE(subreq);
3553         if (!NT_STATUS_IS_OK(status)) {
3554                 tevent_req_nterror(req, status);
3555                 return;
3556         }
3557
3558         /* Copy out parameters */
3559
3560         /* Copy result */
3561         state->orig.out.result = state->tmp.out.result;
3562
3563         /* Reset temporary structure */
3564         ZERO_STRUCT(state->tmp);
3565
3566         tevent_req_done(req);
3567 }
3568
3569 NTSTATUS rpccli_wkssvc_NetrJoinDomain2_recv(struct tevent_req *req,
3570                                             TALLOC_CTX *mem_ctx,
3571                                             WERROR *result)
3572 {
3573         struct rpccli_wkssvc_NetrJoinDomain2_state *state = tevent_req_data(
3574                 req, struct rpccli_wkssvc_NetrJoinDomain2_state);
3575         NTSTATUS status;
3576
3577         if (tevent_req_is_nterror(req, &status)) {
3578                 tevent_req_received(req);
3579                 return status;
3580         }
3581
3582         /* Steal possbile out parameters to the callers context */
3583         talloc_steal(mem_ctx, state->out_mem_ctx);
3584
3585         /* Return result */
3586         *result = state->orig.out.result;
3587
3588         tevent_req_received(req);
3589         return NT_STATUS_OK;
3590 }
3591
3592 NTSTATUS rpccli_wkssvc_NetrJoinDomain2(struct rpc_pipe_client *cli,
3593                                        TALLOC_CTX *mem_ctx,
3594                                        const char *server_name /* [in] [unique,charset(UTF16)] */,
3595                                        const char *domain_name /* [in] [ref,charset(UTF16)] */,
3596                                        const char *account_ou /* [in] [unique,charset(UTF16)] */,
3597                                        const char *admin_account /* [in] [unique,charset(UTF16)] */,
3598                                        struct wkssvc_PasswordBuffer *encrypted_password /* [in] [unique] */,
3599                                        uint32_t join_flags /* [in]  */,
3600                                        WERROR *werror)
3601 {
3602         struct wkssvc_NetrJoinDomain2 r;
3603         NTSTATUS status;
3604
3605         /* In parameters */
3606         r.in.server_name = server_name;
3607         r.in.domain_name = domain_name;
3608         r.in.account_ou = account_ou;
3609         r.in.admin_account = admin_account;
3610         r.in.encrypted_password = encrypted_password;
3611         r.in.join_flags = join_flags;
3612
3613         status = cli->dispatch(cli,
3614                                 mem_ctx,
3615                                 &ndr_table_wkssvc,
3616                                 NDR_WKSSVC_NETRJOINDOMAIN2,
3617                                 &r);
3618
3619         if (!NT_STATUS_IS_OK(status)) {
3620                 return status;
3621         }
3622
3623         if (NT_STATUS_IS_ERR(status)) {
3624                 return status;
3625         }
3626
3627         /* Return variables */
3628
3629         /* Return result */
3630         if (werror) {
3631                 *werror = r.out.result;
3632         }
3633
3634         return werror_to_ntstatus(r.out.result);
3635 }
3636
3637 struct rpccli_wkssvc_NetrUnjoinDomain2_state {
3638         struct wkssvc_NetrUnjoinDomain2 orig;
3639         struct wkssvc_NetrUnjoinDomain2 tmp;
3640         TALLOC_CTX *out_mem_ctx;
3641         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3642 };
3643
3644 static void rpccli_wkssvc_NetrUnjoinDomain2_done(struct tevent_req *subreq);
3645
3646 struct tevent_req *rpccli_wkssvc_NetrUnjoinDomain2_send(TALLOC_CTX *mem_ctx,
3647                                                         struct tevent_context *ev,
3648                                                         struct rpc_pipe_client *cli,
3649                                                         const char *_server_name /* [in] [unique,charset(UTF16)] */,
3650                                                         const char *_account /* [in] [unique,charset(UTF16)] */,
3651                                                         struct wkssvc_PasswordBuffer *_encrypted_password /* [in] [unique] */,
3652                                                         uint32_t _unjoin_flags /* [in]  */)
3653 {
3654         struct tevent_req *req;
3655         struct rpccli_wkssvc_NetrUnjoinDomain2_state *state;
3656         struct tevent_req *subreq;
3657
3658         req = tevent_req_create(mem_ctx, &state,
3659                                 struct rpccli_wkssvc_NetrUnjoinDomain2_state);
3660         if (req == NULL) {
3661                 return NULL;
3662         }
3663         state->out_mem_ctx = NULL;
3664         state->dispatch_recv = cli->dispatch_recv;
3665
3666         /* In parameters */
3667         state->orig.in.server_name = _server_name;
3668         state->orig.in.account = _account;
3669         state->orig.in.encrypted_password = _encrypted_password;
3670         state->orig.in.unjoin_flags = _unjoin_flags;
3671
3672         /* Out parameters */
3673
3674         /* Result */
3675         ZERO_STRUCT(state->orig.out.result);
3676
3677         /* make a temporary copy, that we pass to the dispatch function */
3678         state->tmp = state->orig;
3679
3680         subreq = cli->dispatch_send(state, ev, cli,
3681                                     &ndr_table_wkssvc,
3682                                     NDR_WKSSVC_NETRUNJOINDOMAIN2,
3683                                     &state->tmp);
3684         if (tevent_req_nomem(subreq, req)) {
3685                 return tevent_req_post(req, ev);
3686         }
3687         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrUnjoinDomain2_done, req);
3688         return req;
3689 }
3690
3691 static void rpccli_wkssvc_NetrUnjoinDomain2_done(struct tevent_req *subreq)
3692 {
3693         struct tevent_req *req = tevent_req_callback_data(
3694                 subreq, struct tevent_req);
3695         struct rpccli_wkssvc_NetrUnjoinDomain2_state *state = tevent_req_data(
3696                 req, struct rpccli_wkssvc_NetrUnjoinDomain2_state);
3697         NTSTATUS status;
3698         TALLOC_CTX *mem_ctx;
3699
3700         if (state->out_mem_ctx) {
3701                 mem_ctx = state->out_mem_ctx;
3702         } else {
3703                 mem_ctx = state;
3704         }
3705
3706         status = state->dispatch_recv(subreq, mem_ctx);
3707         TALLOC_FREE(subreq);
3708         if (!NT_STATUS_IS_OK(status)) {
3709                 tevent_req_nterror(req, status);
3710                 return;
3711         }
3712
3713         /* Copy out parameters */
3714
3715         /* Copy result */
3716         state->orig.out.result = state->tmp.out.result;
3717
3718         /* Reset temporary structure */
3719         ZERO_STRUCT(state->tmp);
3720
3721         tevent_req_done(req);
3722 }
3723
3724 NTSTATUS rpccli_wkssvc_NetrUnjoinDomain2_recv(struct tevent_req *req,
3725                                               TALLOC_CTX *mem_ctx,
3726                                               WERROR *result)
3727 {
3728         struct rpccli_wkssvc_NetrUnjoinDomain2_state *state = tevent_req_data(
3729                 req, struct rpccli_wkssvc_NetrUnjoinDomain2_state);
3730         NTSTATUS status;
3731
3732         if (tevent_req_is_nterror(req, &status)) {
3733                 tevent_req_received(req);
3734                 return status;
3735         }
3736
3737         /* Steal possbile out parameters to the callers context */
3738         talloc_steal(mem_ctx, state->out_mem_ctx);
3739
3740         /* Return result */
3741         *result = state->orig.out.result;
3742
3743         tevent_req_received(req);
3744         return NT_STATUS_OK;
3745 }
3746
3747 NTSTATUS rpccli_wkssvc_NetrUnjoinDomain2(struct rpc_pipe_client *cli,
3748                                          TALLOC_CTX *mem_ctx,
3749                                          const char *server_name /* [in] [unique,charset(UTF16)] */,
3750                                          const char *account /* [in] [unique,charset(UTF16)] */,
3751                                          struct wkssvc_PasswordBuffer *encrypted_password /* [in] [unique] */,
3752                                          uint32_t unjoin_flags /* [in]  */,
3753                                          WERROR *werror)
3754 {
3755         struct wkssvc_NetrUnjoinDomain2 r;
3756         NTSTATUS status;
3757
3758         /* In parameters */
3759         r.in.server_name = server_name;
3760         r.in.account = account;
3761         r.in.encrypted_password = encrypted_password;
3762         r.in.unjoin_flags = unjoin_flags;
3763
3764         status = cli->dispatch(cli,
3765                                 mem_ctx,
3766                                 &ndr_table_wkssvc,
3767                                 NDR_WKSSVC_NETRUNJOINDOMAIN2,
3768                                 &r);
3769
3770         if (!NT_STATUS_IS_OK(status)) {
3771                 return status;
3772         }
3773
3774         if (NT_STATUS_IS_ERR(status)) {
3775                 return status;
3776         }
3777
3778         /* Return variables */
3779
3780         /* Return result */
3781         if (werror) {
3782                 *werror = r.out.result;
3783         }
3784
3785         return werror_to_ntstatus(r.out.result);
3786 }
3787
3788 struct rpccli_wkssvc_NetrRenameMachineInDomain2_state {
3789         struct wkssvc_NetrRenameMachineInDomain2 orig;
3790         struct wkssvc_NetrRenameMachineInDomain2 tmp;
3791         TALLOC_CTX *out_mem_ctx;
3792         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3793 };
3794
3795 static void rpccli_wkssvc_NetrRenameMachineInDomain2_done(struct tevent_req *subreq);
3796
3797 struct tevent_req *rpccli_wkssvc_NetrRenameMachineInDomain2_send(TALLOC_CTX *mem_ctx,
3798                                                                  struct tevent_context *ev,
3799                                                                  struct rpc_pipe_client *cli,
3800                                                                  const char *_server_name /* [in] [unique,charset(UTF16)] */,
3801                                                                  const char *_NewMachineName /* [in] [unique,charset(UTF16)] */,
3802                                                                  const char *_Account /* [in] [unique,charset(UTF16)] */,
3803                                                                  struct wkssvc_PasswordBuffer *_EncryptedPassword /* [in] [unique] */,
3804                                                                  uint32_t _RenameOptions /* [in]  */)
3805 {
3806         struct tevent_req *req;
3807         struct rpccli_wkssvc_NetrRenameMachineInDomain2_state *state;
3808         struct tevent_req *subreq;
3809
3810         req = tevent_req_create(mem_ctx, &state,
3811                                 struct rpccli_wkssvc_NetrRenameMachineInDomain2_state);
3812         if (req == NULL) {
3813                 return NULL;
3814         }
3815         state->out_mem_ctx = NULL;
3816         state->dispatch_recv = cli->dispatch_recv;
3817
3818         /* In parameters */
3819         state->orig.in.server_name = _server_name;
3820         state->orig.in.NewMachineName = _NewMachineName;
3821         state->orig.in.Account = _Account;
3822         state->orig.in.EncryptedPassword = _EncryptedPassword;
3823         state->orig.in.RenameOptions = _RenameOptions;
3824
3825         /* Out parameters */
3826
3827         /* Result */
3828         ZERO_STRUCT(state->orig.out.result);
3829
3830         /* make a temporary copy, that we pass to the dispatch function */
3831         state->tmp = state->orig;
3832
3833         subreq = cli->dispatch_send(state, ev, cli,
3834                                     &ndr_table_wkssvc,
3835                                     NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN2,
3836                                     &state->tmp);
3837         if (tevent_req_nomem(subreq, req)) {
3838                 return tevent_req_post(req, ev);
3839         }
3840         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrRenameMachineInDomain2_done, req);
3841         return req;
3842 }
3843
3844 static void rpccli_wkssvc_NetrRenameMachineInDomain2_done(struct tevent_req *subreq)
3845 {
3846         struct tevent_req *req = tevent_req_callback_data(
3847                 subreq, struct tevent_req);
3848         struct rpccli_wkssvc_NetrRenameMachineInDomain2_state *state = tevent_req_data(
3849                 req, struct rpccli_wkssvc_NetrRenameMachineInDomain2_state);
3850         NTSTATUS status;
3851         TALLOC_CTX *mem_ctx;
3852
3853         if (state->out_mem_ctx) {
3854                 mem_ctx = state->out_mem_ctx;
3855         } else {
3856                 mem_ctx = state;
3857         }
3858
3859         status = state->dispatch_recv(subreq, mem_ctx);
3860         TALLOC_FREE(subreq);
3861         if (!NT_STATUS_IS_OK(status)) {
3862                 tevent_req_nterror(req, status);
3863                 return;
3864         }
3865
3866         /* Copy out parameters */
3867
3868         /* Copy result */
3869         state->orig.out.result = state->tmp.out.result;
3870
3871         /* Reset temporary structure */
3872         ZERO_STRUCT(state->tmp);
3873
3874         tevent_req_done(req);
3875 }
3876
3877 NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain2_recv(struct tevent_req *req,
3878                                                        TALLOC_CTX *mem_ctx,
3879                                                        WERROR *result)
3880 {
3881         struct rpccli_wkssvc_NetrRenameMachineInDomain2_state *state = tevent_req_data(
3882                 req, struct rpccli_wkssvc_NetrRenameMachineInDomain2_state);
3883         NTSTATUS status;
3884
3885         if (tevent_req_is_nterror(req, &status)) {
3886                 tevent_req_received(req);
3887                 return status;
3888         }
3889
3890         /* Steal possbile out parameters to the callers context */
3891         talloc_steal(mem_ctx, state->out_mem_ctx);
3892
3893         /* Return result */
3894         *result = state->orig.out.result;
3895
3896         tevent_req_received(req);
3897         return NT_STATUS_OK;
3898 }
3899
3900 NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain2(struct rpc_pipe_client *cli,
3901                                                   TALLOC_CTX *mem_ctx,
3902                                                   const char *server_name /* [in] [unique,charset(UTF16)] */,
3903                                                   const char *NewMachineName /* [in] [unique,charset(UTF16)] */,
3904                                                   const char *Account /* [in] [unique,charset(UTF16)] */,
3905                                                   struct wkssvc_PasswordBuffer *EncryptedPassword /* [in] [unique] */,
3906                                                   uint32_t RenameOptions /* [in]  */,
3907                                                   WERROR *werror)
3908 {
3909         struct wkssvc_NetrRenameMachineInDomain2 r;
3910         NTSTATUS status;
3911
3912         /* In parameters */
3913         r.in.server_name = server_name;
3914         r.in.NewMachineName = NewMachineName;
3915         r.in.Account = Account;
3916         r.in.EncryptedPassword = EncryptedPassword;
3917         r.in.RenameOptions = RenameOptions;
3918
3919         status = cli->dispatch(cli,
3920                                 mem_ctx,
3921                                 &ndr_table_wkssvc,
3922                                 NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN2,
3923                                 &r);
3924
3925         if (!NT_STATUS_IS_OK(status)) {
3926                 return status;
3927         }
3928
3929         if (NT_STATUS_IS_ERR(status)) {
3930                 return status;
3931         }
3932
3933         /* Return variables */
3934
3935         /* Return result */
3936         if (werror) {
3937                 *werror = r.out.result;
3938         }
3939
3940         return werror_to_ntstatus(r.out.result);
3941 }
3942
3943 struct rpccli_wkssvc_NetrValidateName2_state {
3944         struct wkssvc_NetrValidateName2 orig;
3945         struct wkssvc_NetrValidateName2 tmp;
3946         TALLOC_CTX *out_mem_ctx;
3947         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3948 };
3949
3950 static void rpccli_wkssvc_NetrValidateName2_done(struct tevent_req *subreq);
3951
3952 struct tevent_req *rpccli_wkssvc_NetrValidateName2_send(TALLOC_CTX *mem_ctx,
3953                                                         struct tevent_context *ev,
3954                                                         struct rpc_pipe_client *cli,
3955                                                         const char *_server_name /* [in] [unique,charset(UTF16)] */,
3956                                                         const char *_name /* [in] [ref,charset(UTF16)] */,
3957                                                         const char *_Account /* [in] [unique,charset(UTF16)] */,
3958                                                         struct wkssvc_PasswordBuffer *_EncryptedPassword /* [in] [unique] */,
3959                                                         enum wkssvc_NetValidateNameType _name_type /* [in]  */)
3960 {
3961         struct tevent_req *req;
3962         struct rpccli_wkssvc_NetrValidateName2_state *state;
3963         struct tevent_req *subreq;
3964
3965         req = tevent_req_create(mem_ctx, &state,
3966                                 struct rpccli_wkssvc_NetrValidateName2_state);
3967         if (req == NULL) {
3968                 return NULL;
3969         }
3970         state->out_mem_ctx = NULL;
3971         state->dispatch_recv = cli->dispatch_recv;
3972
3973         /* In parameters */
3974         state->orig.in.server_name = _server_name;
3975         state->orig.in.name = _name;
3976         state->orig.in.Account = _Account;
3977         state->orig.in.EncryptedPassword = _EncryptedPassword;
3978         state->orig.in.name_type = _name_type;
3979
3980         /* Out parameters */
3981
3982         /* Result */
3983         ZERO_STRUCT(state->orig.out.result);
3984
3985         /* make a temporary copy, that we pass to the dispatch function */
3986         state->tmp = state->orig;
3987
3988         subreq = cli->dispatch_send(state, ev, cli,
3989                                     &ndr_table_wkssvc,
3990                                     NDR_WKSSVC_NETRVALIDATENAME2,
3991                                     &state->tmp);
3992         if (tevent_req_nomem(subreq, req)) {
3993                 return tevent_req_post(req, ev);
3994         }
3995         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrValidateName2_done, req);
3996         return req;
3997 }
3998
3999 static void rpccli_wkssvc_NetrValidateName2_done(struct tevent_req *subreq)
4000 {
4001         struct tevent_req *req = tevent_req_callback_data(
4002                 subreq, struct tevent_req);
4003         struct rpccli_wkssvc_NetrValidateName2_state *state = tevent_req_data(
4004                 req, struct rpccli_wkssvc_NetrValidateName2_state);
4005         NTSTATUS status;
4006         TALLOC_CTX *mem_ctx;
4007
4008         if (state->out_mem_ctx) {
4009                 mem_ctx = state->out_mem_ctx;
4010         } else {
4011                 mem_ctx = state;
4012         }
4013
4014         status = state->dispatch_recv(subreq, mem_ctx);
4015         TALLOC_FREE(subreq);
4016         if (!NT_STATUS_IS_OK(status)) {
4017                 tevent_req_nterror(req, status);
4018                 return;
4019         }
4020
4021         /* Copy out parameters */
4022
4023         /* Copy result */
4024         state->orig.out.result = state->tmp.out.result;
4025
4026         /* Reset temporary structure */
4027         ZERO_STRUCT(state->tmp);
4028
4029         tevent_req_done(req);
4030 }
4031
4032 NTSTATUS rpccli_wkssvc_NetrValidateName2_recv(struct tevent_req *req,
4033                                               TALLOC_CTX *mem_ctx,
4034                                               WERROR *result)
4035 {
4036         struct rpccli_wkssvc_NetrValidateName2_state *state = tevent_req_data(
4037                 req, struct rpccli_wkssvc_NetrValidateName2_state);
4038         NTSTATUS status;
4039
4040         if (tevent_req_is_nterror(req, &status)) {
4041                 tevent_req_received(req);
4042                 return status;
4043         }
4044
4045         /* Steal possbile out parameters to the callers context */
4046         talloc_steal(mem_ctx, state->out_mem_ctx);
4047
4048         /* Return result */
4049         *result = state->orig.out.result;
4050
4051         tevent_req_received(req);
4052         return NT_STATUS_OK;
4053 }
4054
4055 NTSTATUS rpccli_wkssvc_NetrValidateName2(struct rpc_pipe_client *cli,
4056                                          TALLOC_CTX *mem_ctx,
4057                                          const char *server_name /* [in] [unique,charset(UTF16)] */,
4058                                          const char *name /* [in] [ref,charset(UTF16)] */,
4059                                          const char *Account /* [in] [unique,charset(UTF16)] */,
4060                                          struct wkssvc_PasswordBuffer *EncryptedPassword /* [in] [unique] */,
4061                                          enum wkssvc_NetValidateNameType name_type /* [in]  */,
4062                                          WERROR *werror)
4063 {
4064         struct wkssvc_NetrValidateName2 r;
4065         NTSTATUS status;
4066
4067         /* In parameters */
4068         r.in.server_name = server_name;
4069         r.in.name = name;
4070         r.in.Account = Account;
4071         r.in.EncryptedPassword = EncryptedPassword;
4072         r.in.name_type = name_type;
4073
4074         status = cli->dispatch(cli,
4075                                 mem_ctx,
4076                                 &ndr_table_wkssvc,
4077                                 NDR_WKSSVC_NETRVALIDATENAME2,
4078                                 &r);
4079
4080         if (!NT_STATUS_IS_OK(status)) {
4081                 return status;
4082         }
4083
4084         if (NT_STATUS_IS_ERR(status)) {
4085                 return status;
4086         }
4087
4088         /* Return variables */
4089
4090         /* Return result */
4091         if (werror) {
4092                 *werror = r.out.result;
4093         }
4094
4095         return werror_to_ntstatus(r.out.result);
4096 }
4097
4098 struct rpccli_wkssvc_NetrGetJoinableOus2_state {
4099         struct wkssvc_NetrGetJoinableOus2 orig;
4100         struct wkssvc_NetrGetJoinableOus2 tmp;
4101         TALLOC_CTX *out_mem_ctx;
4102         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4103 };
4104
4105 static void rpccli_wkssvc_NetrGetJoinableOus2_done(struct tevent_req *subreq);
4106
4107 struct tevent_req *rpccli_wkssvc_NetrGetJoinableOus2_send(TALLOC_CTX *mem_ctx,
4108                                                           struct tevent_context *ev,
4109                                                           struct rpc_pipe_client *cli,
4110                                                           const char *_server_name /* [in] [unique,charset(UTF16)] */,
4111                                                           const char *_domain_name /* [in] [ref,charset(UTF16)] */,
4112                                                           const char *_Account /* [in] [unique,charset(UTF16)] */,
4113                                                           struct wkssvc_PasswordBuffer *_EncryptedPassword /* [in] [unique] */,
4114                                                           uint32_t *_num_ous /* [in,out] [ref] */,
4115                                                           const char ***_ous /* [out] [ref,charset(UTF16),size_is(,*num_ous)] */)
4116 {
4117         struct tevent_req *req;
4118         struct rpccli_wkssvc_NetrGetJoinableOus2_state *state;
4119         struct tevent_req *subreq;
4120
4121         req = tevent_req_create(mem_ctx, &state,
4122                                 struct rpccli_wkssvc_NetrGetJoinableOus2_state);
4123         if (req == NULL) {
4124                 return NULL;
4125         }
4126         state->out_mem_ctx = NULL;
4127         state->dispatch_recv = cli->dispatch_recv;
4128
4129         /* In parameters */
4130         state->orig.in.server_name = _server_name;
4131         state->orig.in.domain_name = _domain_name;
4132         state->orig.in.Account = _Account;
4133         state->orig.in.EncryptedPassword = _EncryptedPassword;
4134         state->orig.in.num_ous = _num_ous;
4135
4136         /* Out parameters */
4137         state->orig.out.num_ous = _num_ous;
4138         state->orig.out.ous = _ous;
4139
4140         /* Result */
4141         ZERO_STRUCT(state->orig.out.result);
4142
4143         state->out_mem_ctx = talloc_named_const(state, 0,
4144                              "rpccli_wkssvc_NetrGetJoinableOus2_out_memory");
4145         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4146                 return tevent_req_post(req, ev);
4147         }
4148
4149         /* make a temporary copy, that we pass to the dispatch function */
4150         state->tmp = state->orig;
4151
4152         subreq = cli->dispatch_send(state, ev, cli,
4153                                     &ndr_table_wkssvc,
4154                                     NDR_WKSSVC_NETRGETJOINABLEOUS2,
4155                                     &state->tmp);
4156         if (tevent_req_nomem(subreq, req)) {
4157                 return tevent_req_post(req, ev);
4158         }
4159         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrGetJoinableOus2_done, req);
4160         return req;
4161 }
4162
4163 static void rpccli_wkssvc_NetrGetJoinableOus2_done(struct tevent_req *subreq)
4164 {
4165         struct tevent_req *req = tevent_req_callback_data(
4166                 subreq, struct tevent_req);
4167         struct rpccli_wkssvc_NetrGetJoinableOus2_state *state = tevent_req_data(
4168                 req, struct rpccli_wkssvc_NetrGetJoinableOus2_state);
4169         NTSTATUS status;
4170         TALLOC_CTX *mem_ctx;
4171
4172         if (state->out_mem_ctx) {
4173                 mem_ctx = state->out_mem_ctx;
4174         } else {
4175                 mem_ctx = state;
4176         }
4177
4178         status = state->dispatch_recv(subreq, mem_ctx);
4179         TALLOC_FREE(subreq);
4180         if (!NT_STATUS_IS_OK(status)) {
4181                 tevent_req_nterror(req, status);
4182                 return;
4183         }
4184
4185         /* Copy out parameters */
4186         *state->orig.out.num_ous = *state->tmp.out.num_ous;
4187         *state->orig.out.ous = *state->tmp.out.ous;
4188
4189         /* Copy result */
4190         state->orig.out.result = state->tmp.out.result;
4191
4192         /* Reset temporary structure */
4193         ZERO_STRUCT(state->tmp);
4194
4195         tevent_req_done(req);
4196 }
4197
4198 NTSTATUS rpccli_wkssvc_NetrGetJoinableOus2_recv(struct tevent_req *req,
4199                                                 TALLOC_CTX *mem_ctx,
4200                                                 WERROR *result)
4201 {
4202         struct rpccli_wkssvc_NetrGetJoinableOus2_state *state = tevent_req_data(
4203                 req, struct rpccli_wkssvc_NetrGetJoinableOus2_state);
4204         NTSTATUS status;
4205
4206         if (tevent_req_is_nterror(req, &status)) {
4207                 tevent_req_received(req);
4208                 return status;
4209         }
4210
4211         /* Steal possbile out parameters to the callers context */
4212         talloc_steal(mem_ctx, state->out_mem_ctx);
4213
4214         /* Return result */
4215         *result = state->orig.out.result;
4216
4217         tevent_req_received(req);
4218         return NT_STATUS_OK;
4219 }
4220
4221 NTSTATUS rpccli_wkssvc_NetrGetJoinableOus2(struct rpc_pipe_client *cli,
4222                                            TALLOC_CTX *mem_ctx,
4223                                            const char *server_name /* [in] [unique,charset(UTF16)] */,
4224                                            const char *domain_name /* [in] [ref,charset(UTF16)] */,
4225                                            const char *Account /* [in] [unique,charset(UTF16)] */,
4226                                            struct wkssvc_PasswordBuffer *EncryptedPassword /* [in] [unique] */,
4227                                            uint32_t *num_ous /* [in,out] [ref] */,
4228                                            const char ***ous /* [out] [ref,charset(UTF16),size_is(,*num_ous)] */,
4229                                            WERROR *werror)
4230 {
4231         struct wkssvc_NetrGetJoinableOus2 r;
4232         NTSTATUS status;
4233
4234         /* In parameters */
4235         r.in.server_name = server_name;
4236         r.in.domain_name = domain_name;
4237         r.in.Account = Account;
4238         r.in.EncryptedPassword = EncryptedPassword;
4239         r.in.num_ous = num_ous;
4240
4241         status = cli->dispatch(cli,
4242                                 mem_ctx,
4243                                 &ndr_table_wkssvc,
4244                                 NDR_WKSSVC_NETRGETJOINABLEOUS2,
4245                                 &r);
4246
4247         if (!NT_STATUS_IS_OK(status)) {
4248                 return status;
4249         }
4250
4251         if (NT_STATUS_IS_ERR(status)) {
4252                 return status;
4253         }
4254
4255         /* Return variables */
4256         *num_ous = *r.out.num_ous;
4257         *ous = *r.out.ous;
4258
4259         /* Return result */
4260         if (werror) {
4261                 *werror = r.out.result;
4262         }
4263
4264         return werror_to_ntstatus(r.out.result);
4265 }
4266
4267 struct rpccli_wkssvc_NetrAddAlternateComputerName_state {
4268         struct wkssvc_NetrAddAlternateComputerName orig;
4269         struct wkssvc_NetrAddAlternateComputerName tmp;
4270         TALLOC_CTX *out_mem_ctx;
4271         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4272 };
4273
4274 static void rpccli_wkssvc_NetrAddAlternateComputerName_done(struct tevent_req *subreq);
4275
4276 struct tevent_req *rpccli_wkssvc_NetrAddAlternateComputerName_send(TALLOC_CTX *mem_ctx,
4277                                                                    struct tevent_context *ev,
4278                                                                    struct rpc_pipe_client *cli,
4279                                                                    const char *_server_name /* [in] [unique,charset(UTF16)] */,
4280                                                                    const char *_NewAlternateMachineName /* [in] [unique,charset(UTF16)] */,
4281                                                                    const char *_Account /* [in] [unique,charset(UTF16)] */,
4282                                                                    struct wkssvc_PasswordBuffer *_EncryptedPassword /* [in] [unique] */,
4283                                                                    uint32_t _Reserved /* [in]  */)
4284 {
4285         struct tevent_req *req;
4286         struct rpccli_wkssvc_NetrAddAlternateComputerName_state *state;
4287         struct tevent_req *subreq;
4288
4289         req = tevent_req_create(mem_ctx, &state,
4290                                 struct rpccli_wkssvc_NetrAddAlternateComputerName_state);
4291         if (req == NULL) {
4292                 return NULL;
4293         }
4294         state->out_mem_ctx = NULL;
4295         state->dispatch_recv = cli->dispatch_recv;
4296
4297         /* In parameters */
4298         state->orig.in.server_name = _server_name;
4299         state->orig.in.NewAlternateMachineName = _NewAlternateMachineName;
4300         state->orig.in.Account = _Account;
4301         state->orig.in.EncryptedPassword = _EncryptedPassword;
4302         state->orig.in.Reserved = _Reserved;
4303
4304         /* Out parameters */
4305
4306         /* Result */
4307         ZERO_STRUCT(state->orig.out.result);
4308
4309         /* make a temporary copy, that we pass to the dispatch function */
4310         state->tmp = state->orig;
4311
4312         subreq = cli->dispatch_send(state, ev, cli,
4313                                     &ndr_table_wkssvc,
4314                                     NDR_WKSSVC_NETRADDALTERNATECOMPUTERNAME,
4315                                     &state->tmp);
4316         if (tevent_req_nomem(subreq, req)) {
4317                 return tevent_req_post(req, ev);
4318         }
4319         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrAddAlternateComputerName_done, req);
4320         return req;
4321 }
4322
4323 static void rpccli_wkssvc_NetrAddAlternateComputerName_done(struct tevent_req *subreq)
4324 {
4325         struct tevent_req *req = tevent_req_callback_data(
4326                 subreq, struct tevent_req);
4327         struct rpccli_wkssvc_NetrAddAlternateComputerName_state *state = tevent_req_data(
4328                 req, struct rpccli_wkssvc_NetrAddAlternateComputerName_state);
4329         NTSTATUS status;
4330         TALLOC_CTX *mem_ctx;
4331
4332         if (state->out_mem_ctx) {
4333                 mem_ctx = state->out_mem_ctx;
4334         } else {
4335                 mem_ctx = state;
4336         }
4337
4338         status = state->dispatch_recv(subreq, mem_ctx);
4339         TALLOC_FREE(subreq);
4340         if (!NT_STATUS_IS_OK(status)) {
4341                 tevent_req_nterror(req, status);
4342                 return;
4343         }
4344
4345         /* Copy out parameters */
4346
4347         /* Copy result */
4348         state->orig.out.result = state->tmp.out.result;
4349
4350         /* Reset temporary structure */
4351         ZERO_STRUCT(state->tmp);
4352
4353         tevent_req_done(req);
4354 }
4355
4356 NTSTATUS rpccli_wkssvc_NetrAddAlternateComputerName_recv(struct tevent_req *req,
4357                                                          TALLOC_CTX *mem_ctx,
4358                                                          WERROR *result)
4359 {
4360         struct rpccli_wkssvc_NetrAddAlternateComputerName_state *state = tevent_req_data(
4361                 req, struct rpccli_wkssvc_NetrAddAlternateComputerName_state);
4362         NTSTATUS status;
4363
4364         if (tevent_req_is_nterror(req, &status)) {
4365                 tevent_req_received(req);
4366                 return status;
4367         }
4368
4369         /* Steal possbile out parameters to the callers context */
4370         talloc_steal(mem_ctx, state->out_mem_ctx);
4371
4372         /* Return result */
4373         *result = state->orig.out.result;
4374
4375         tevent_req_received(req);
4376         return NT_STATUS_OK;
4377 }
4378
4379 NTSTATUS rpccli_wkssvc_NetrAddAlternateComputerName(struct rpc_pipe_client *cli,
4380                                                     TALLOC_CTX *mem_ctx,
4381                                                     const char *server_name /* [in] [unique,charset(UTF16)] */,
4382                                                     const char *NewAlternateMachineName /* [in] [unique,charset(UTF16)] */,
4383                                                     const char *Account /* [in] [unique,charset(UTF16)] */,
4384                                                     struct wkssvc_PasswordBuffer *EncryptedPassword /* [in] [unique] */,
4385                                                     uint32_t Reserved /* [in]  */,
4386                                                     WERROR *werror)
4387 {
4388         struct wkssvc_NetrAddAlternateComputerName r;
4389         NTSTATUS status;
4390
4391         /* In parameters */
4392         r.in.server_name = server_name;
4393         r.in.NewAlternateMachineName = NewAlternateMachineName;
4394         r.in.Account = Account;
4395         r.in.EncryptedPassword = EncryptedPassword;
4396         r.in.Reserved = Reserved;
4397
4398         status = cli->dispatch(cli,
4399                                 mem_ctx,
4400                                 &ndr_table_wkssvc,
4401                                 NDR_WKSSVC_NETRADDALTERNATECOMPUTERNAME,
4402                                 &r);
4403
4404         if (!NT_STATUS_IS_OK(status)) {
4405                 return status;
4406         }
4407
4408         if (NT_STATUS_IS_ERR(status)) {
4409                 return status;
4410         }
4411
4412         /* Return variables */
4413
4414         /* Return result */
4415         if (werror) {
4416                 *werror = r.out.result;
4417         }
4418
4419         return werror_to_ntstatus(r.out.result);
4420 }
4421
4422 struct rpccli_wkssvc_NetrRemoveAlternateComputerName_state {
4423         struct wkssvc_NetrRemoveAlternateComputerName orig;
4424         struct wkssvc_NetrRemoveAlternateComputerName tmp;
4425         TALLOC_CTX *out_mem_ctx;
4426         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4427 };
4428
4429 static void rpccli_wkssvc_NetrRemoveAlternateComputerName_done(struct tevent_req *subreq);
4430
4431 struct tevent_req *rpccli_wkssvc_NetrRemoveAlternateComputerName_send(TALLOC_CTX *mem_ctx,
4432                                                                       struct tevent_context *ev,
4433                                                                       struct rpc_pipe_client *cli,
4434                                                                       const char *_server_name /* [in] [unique,charset(UTF16)] */,
4435                                                                       const char *_AlternateMachineNameToRemove /* [in] [unique,charset(UTF16)] */,
4436                                                                       const char *_Account /* [in] [unique,charset(UTF16)] */,
4437                                                                       struct wkssvc_PasswordBuffer *_EncryptedPassword /* [in] [unique] */,
4438                                                                       uint32_t _Reserved /* [in]  */)
4439 {
4440         struct tevent_req *req;
4441         struct rpccli_wkssvc_NetrRemoveAlternateComputerName_state *state;
4442         struct tevent_req *subreq;
4443
4444         req = tevent_req_create(mem_ctx, &state,
4445                                 struct rpccli_wkssvc_NetrRemoveAlternateComputerName_state);
4446         if (req == NULL) {
4447                 return NULL;
4448         }
4449         state->out_mem_ctx = NULL;
4450         state->dispatch_recv = cli->dispatch_recv;
4451
4452         /* In parameters */
4453         state->orig.in.server_name = _server_name;
4454         state->orig.in.AlternateMachineNameToRemove = _AlternateMachineNameToRemove;
4455         state->orig.in.Account = _Account;
4456         state->orig.in.EncryptedPassword = _EncryptedPassword;
4457         state->orig.in.Reserved = _Reserved;
4458
4459         /* Out parameters */
4460
4461         /* Result */
4462         ZERO_STRUCT(state->orig.out.result);
4463
4464         /* make a temporary copy, that we pass to the dispatch function */
4465         state->tmp = state->orig;
4466
4467         subreq = cli->dispatch_send(state, ev, cli,
4468                                     &ndr_table_wkssvc,
4469                                     NDR_WKSSVC_NETRREMOVEALTERNATECOMPUTERNAME,
4470                                     &state->tmp);
4471         if (tevent_req_nomem(subreq, req)) {
4472                 return tevent_req_post(req, ev);
4473         }
4474         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrRemoveAlternateComputerName_done, req);
4475         return req;
4476 }
4477
4478 static void rpccli_wkssvc_NetrRemoveAlternateComputerName_done(struct tevent_req *subreq)
4479 {
4480         struct tevent_req *req = tevent_req_callback_data(
4481                 subreq, struct tevent_req);
4482         struct rpccli_wkssvc_NetrRemoveAlternateComputerName_state *state = tevent_req_data(
4483                 req, struct rpccli_wkssvc_NetrRemoveAlternateComputerName_state);
4484         NTSTATUS status;
4485         TALLOC_CTX *mem_ctx;
4486
4487         if (state->out_mem_ctx) {
4488                 mem_ctx = state->out_mem_ctx;
4489         } else {
4490                 mem_ctx = state;
4491         }
4492
4493         status = state->dispatch_recv(subreq, mem_ctx);
4494         TALLOC_FREE(subreq);
4495         if (!NT_STATUS_IS_OK(status)) {
4496                 tevent_req_nterror(req, status);
4497                 return;
4498         }
4499
4500         /* Copy out parameters */
4501
4502         /* Copy result */
4503         state->orig.out.result = state->tmp.out.result;
4504
4505         /* Reset temporary structure */
4506         ZERO_STRUCT(state->tmp);
4507
4508         tevent_req_done(req);
4509 }
4510
4511 NTSTATUS rpccli_wkssvc_NetrRemoveAlternateComputerName_recv(struct tevent_req *req,
4512                                                             TALLOC_CTX *mem_ctx,
4513                                                             WERROR *result)
4514 {
4515         struct rpccli_wkssvc_NetrRemoveAlternateComputerName_state *state = tevent_req_data(
4516                 req, struct rpccli_wkssvc_NetrRemoveAlternateComputerName_state);
4517         NTSTATUS status;
4518
4519         if (tevent_req_is_nterror(req, &status)) {
4520                 tevent_req_received(req);
4521                 return status;
4522         }
4523
4524         /* Steal possbile out parameters to the callers context */
4525         talloc_steal(mem_ctx, state->out_mem_ctx);
4526
4527         /* Return result */
4528         *result = state->orig.out.result;
4529
4530         tevent_req_received(req);
4531         return NT_STATUS_OK;
4532 }
4533
4534 NTSTATUS rpccli_wkssvc_NetrRemoveAlternateComputerName(struct rpc_pipe_client *cli,
4535                                                        TALLOC_CTX *mem_ctx,
4536                                                        const char *server_name /* [in] [unique,charset(UTF16)] */,
4537                                                        const char *AlternateMachineNameToRemove /* [in] [unique,charset(UTF16)] */,
4538                                                        const char *Account /* [in] [unique,charset(UTF16)] */,
4539                                                        struct wkssvc_PasswordBuffer *EncryptedPassword /* [in] [unique] */,
4540                                                        uint32_t Reserved /* [in]  */,
4541                                                        WERROR *werror)
4542 {
4543         struct wkssvc_NetrRemoveAlternateComputerName r;
4544         NTSTATUS status;
4545
4546         /* In parameters */
4547         r.in.server_name = server_name;
4548         r.in.AlternateMachineNameToRemove = AlternateMachineNameToRemove;
4549         r.in.Account = Account;
4550         r.in.EncryptedPassword = EncryptedPassword;
4551         r.in.Reserved = Reserved;
4552
4553         status = cli->dispatch(cli,
4554                                 mem_ctx,
4555                                 &ndr_table_wkssvc,
4556                                 NDR_WKSSVC_NETRREMOVEALTERNATECOMPUTERNAME,
4557                                 &r);
4558
4559         if (!NT_STATUS_IS_OK(status)) {
4560                 return status;
4561         }
4562
4563         if (NT_STATUS_IS_ERR(status)) {
4564                 return status;
4565         }
4566
4567         /* Return variables */
4568
4569         /* Return result */
4570         if (werror) {
4571                 *werror = r.out.result;
4572         }
4573
4574         return werror_to_ntstatus(r.out.result);
4575 }
4576
4577 struct rpccli_wkssvc_NetrSetPrimaryComputername_state {
4578         struct wkssvc_NetrSetPrimaryComputername orig;
4579         struct wkssvc_NetrSetPrimaryComputername tmp;
4580         TALLOC_CTX *out_mem_ctx;
4581         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4582 };
4583
4584 static void rpccli_wkssvc_NetrSetPrimaryComputername_done(struct tevent_req *subreq);
4585
4586 struct tevent_req *rpccli_wkssvc_NetrSetPrimaryComputername_send(TALLOC_CTX *mem_ctx,
4587                                                                  struct tevent_context *ev,
4588                                                                  struct rpc_pipe_client *cli,
4589                                                                  const char *_server_name /* [in] [unique,charset(UTF16)] */,
4590                                                                  const char *_primary_name /* [in] [unique,charset(UTF16)] */,
4591                                                                  const char *_Account /* [in] [unique,charset(UTF16)] */,
4592                                                                  struct wkssvc_PasswordBuffer *_EncryptedPassword /* [in] [unique] */,
4593                                                                  uint32_t _Reserved /* [in]  */)
4594 {
4595         struct tevent_req *req;
4596         struct rpccli_wkssvc_NetrSetPrimaryComputername_state *state;
4597         struct tevent_req *subreq;
4598
4599         req = tevent_req_create(mem_ctx, &state,
4600                                 struct rpccli_wkssvc_NetrSetPrimaryComputername_state);
4601         if (req == NULL) {
4602                 return NULL;
4603         }
4604         state->out_mem_ctx = NULL;
4605         state->dispatch_recv = cli->dispatch_recv;
4606
4607         /* In parameters */
4608         state->orig.in.server_name = _server_name;
4609         state->orig.in.primary_name = _primary_name;
4610         state->orig.in.Account = _Account;
4611         state->orig.in.EncryptedPassword = _EncryptedPassword;
4612         state->orig.in.Reserved = _Reserved;
4613
4614         /* Out parameters */
4615
4616         /* Result */
4617         ZERO_STRUCT(state->orig.out.result);
4618
4619         /* make a temporary copy, that we pass to the dispatch function */
4620         state->tmp = state->orig;
4621
4622         subreq = cli->dispatch_send(state, ev, cli,
4623                                     &ndr_table_wkssvc,
4624                                     NDR_WKSSVC_NETRSETPRIMARYCOMPUTERNAME,
4625                                     &state->tmp);
4626         if (tevent_req_nomem(subreq, req)) {
4627                 return tevent_req_post(req, ev);
4628         }
4629         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrSetPrimaryComputername_done, req);
4630         return req;
4631 }
4632
4633 static void rpccli_wkssvc_NetrSetPrimaryComputername_done(struct tevent_req *subreq)
4634 {
4635         struct tevent_req *req = tevent_req_callback_data(
4636                 subreq, struct tevent_req);
4637         struct rpccli_wkssvc_NetrSetPrimaryComputername_state *state = tevent_req_data(
4638                 req, struct rpccli_wkssvc_NetrSetPrimaryComputername_state);
4639         NTSTATUS status;
4640         TALLOC_CTX *mem_ctx;
4641
4642         if (state->out_mem_ctx) {
4643                 mem_ctx = state->out_mem_ctx;
4644         } else {
4645                 mem_ctx = state;
4646         }
4647
4648         status = state->dispatch_recv(subreq, mem_ctx);
4649         TALLOC_FREE(subreq);
4650         if (!NT_STATUS_IS_OK(status)) {
4651                 tevent_req_nterror(req, status);
4652                 return;
4653         }
4654
4655         /* Copy out parameters */
4656
4657         /* Copy result */
4658         state->orig.out.result = state->tmp.out.result;
4659
4660         /* Reset temporary structure */
4661         ZERO_STRUCT(state->tmp);
4662
4663         tevent_req_done(req);
4664 }
4665
4666 NTSTATUS rpccli_wkssvc_NetrSetPrimaryComputername_recv(struct tevent_req *req,
4667                                                        TALLOC_CTX *mem_ctx,
4668                                                        WERROR *result)
4669 {
4670         struct rpccli_wkssvc_NetrSetPrimaryComputername_state *state = tevent_req_data(
4671                 req, struct rpccli_wkssvc_NetrSetPrimaryComputername_state);
4672         NTSTATUS status;
4673
4674         if (tevent_req_is_nterror(req, &status)) {
4675                 tevent_req_received(req);
4676                 return status;
4677         }
4678
4679         /* Steal possbile out parameters to the callers context */
4680         talloc_steal(mem_ctx, state->out_mem_ctx);
4681
4682         /* Return result */
4683         *result = state->orig.out.result;
4684
4685         tevent_req_received(req);
4686         return NT_STATUS_OK;
4687 }
4688
4689 NTSTATUS rpccli_wkssvc_NetrSetPrimaryComputername(struct rpc_pipe_client *cli,
4690                                                   TALLOC_CTX *mem_ctx,
4691                                                   const char *server_name /* [in] [unique,charset(UTF16)] */,
4692                                                   const char *primary_name /* [in] [unique,charset(UTF16)] */,
4693                                                   const char *Account /* [in] [unique,charset(UTF16)] */,
4694                                                   struct wkssvc_PasswordBuffer *EncryptedPassword /* [in] [unique] */,
4695                                                   uint32_t Reserved /* [in]  */,
4696                                                   WERROR *werror)
4697 {
4698         struct wkssvc_NetrSetPrimaryComputername r;
4699         NTSTATUS status;
4700
4701         /* In parameters */
4702         r.in.server_name = server_name;
4703         r.in.primary_name = primary_name;
4704         r.in.Account = Account;
4705         r.in.EncryptedPassword = EncryptedPassword;
4706         r.in.Reserved = Reserved;
4707
4708         status = cli->dispatch(cli,
4709                                 mem_ctx,
4710                                 &ndr_table_wkssvc,
4711                                 NDR_WKSSVC_NETRSETPRIMARYCOMPUTERNAME,
4712                                 &r);
4713
4714         if (!NT_STATUS_IS_OK(status)) {
4715                 return status;
4716         }
4717
4718         if (NT_STATUS_IS_ERR(status)) {
4719                 return status;
4720         }
4721
4722         /* Return variables */
4723
4724         /* Return result */
4725         if (werror) {
4726                 *werror = r.out.result;
4727         }
4728
4729         return werror_to_ntstatus(r.out.result);
4730 }
4731
4732 struct rpccli_wkssvc_NetrEnumerateComputerNames_state {
4733         struct wkssvc_NetrEnumerateComputerNames orig;
4734         struct wkssvc_NetrEnumerateComputerNames tmp;
4735         TALLOC_CTX *out_mem_ctx;
4736         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4737 };
4738
4739 static void rpccli_wkssvc_NetrEnumerateComputerNames_done(struct tevent_req *subreq);
4740
4741 struct tevent_req *rpccli_wkssvc_NetrEnumerateComputerNames_send(TALLOC_CTX *mem_ctx,
4742                                                                  struct tevent_context *ev,
4743                                                                  struct rpc_pipe_client *cli,
4744                                                                  const char *_server_name /* [in] [unique,charset(UTF16)] */,
4745                                                                  enum wkssvc_ComputerNameType _name_type /* [in]  */,
4746                                                                  uint32_t _Reserved /* [in]  */,
4747                                                                  struct wkssvc_ComputerNamesCtr **_ctr /* [out] [ref] */)
4748 {
4749         struct tevent_req *req;
4750         struct rpccli_wkssvc_NetrEnumerateComputerNames_state *state;
4751         struct tevent_req *subreq;
4752
4753         req = tevent_req_create(mem_ctx, &state,
4754                                 struct rpccli_wkssvc_NetrEnumerateComputerNames_state);
4755         if (req == NULL) {
4756                 return NULL;
4757         }
4758         state->out_mem_ctx = NULL;
4759         state->dispatch_recv = cli->dispatch_recv;
4760
4761         /* In parameters */
4762         state->orig.in.server_name = _server_name;
4763         state->orig.in.name_type = _name_type;
4764         state->orig.in.Reserved = _Reserved;
4765
4766         /* Out parameters */
4767         state->orig.out.ctr = _ctr;
4768
4769         /* Result */
4770         ZERO_STRUCT(state->orig.out.result);
4771
4772         state->out_mem_ctx = talloc_named_const(state, 0,
4773                              "rpccli_wkssvc_NetrEnumerateComputerNames_out_memory");
4774         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4775                 return tevent_req_post(req, ev);
4776         }
4777
4778         /* make a temporary copy, that we pass to the dispatch function */
4779         state->tmp = state->orig;
4780
4781         subreq = cli->dispatch_send(state, ev, cli,
4782                                     &ndr_table_wkssvc,
4783                                     NDR_WKSSVC_NETRENUMERATECOMPUTERNAMES,
4784                                     &state->tmp);
4785         if (tevent_req_nomem(subreq, req)) {
4786                 return tevent_req_post(req, ev);
4787         }
4788         tevent_req_set_callback(subreq, rpccli_wkssvc_NetrEnumerateComputerNames_done, req);
4789         return req;
4790 }
4791
4792 static void rpccli_wkssvc_NetrEnumerateComputerNames_done(struct tevent_req *subreq)
4793 {
4794         struct tevent_req *req = tevent_req_callback_data(
4795                 subreq, struct tevent_req);
4796         struct rpccli_wkssvc_NetrEnumerateComputerNames_state *state = tevent_req_data(
4797                 req, struct rpccli_wkssvc_NetrEnumerateComputerNames_state);
4798         NTSTATUS status;
4799         TALLOC_CTX *mem_ctx;
4800
4801         if (state->out_mem_ctx) {
4802                 mem_ctx = state->out_mem_ctx;
4803         } else {
4804                 mem_ctx = state;
4805         }
4806
4807         status = state->dispatch_recv(subreq, mem_ctx);
4808         TALLOC_FREE(subreq);
4809         if (!NT_STATUS_IS_OK(status)) {
4810                 tevent_req_nterror(req, status);
4811                 return;
4812         }
4813
4814         /* Copy out parameters */
4815         *state->orig.out.ctr = *state->tmp.out.ctr;
4816
4817         /* Copy result */
4818         state->orig.out.result = state->tmp.out.result;
4819
4820         /* Reset temporary structure */
4821         ZERO_STRUCT(state->tmp);
4822
4823         tevent_req_done(req);
4824 }
4825
4826 NTSTATUS rpccli_wkssvc_NetrEnumerateComputerNames_recv(struct tevent_req *req,
4827                                                        TALLOC_CTX *mem_ctx,
4828                                                        WERROR *result)
4829 {
4830         struct rpccli_wkssvc_NetrEnumerateComputerNames_state *state = tevent_req_data(
4831                 req, struct rpccli_wkssvc_NetrEnumerateComputerNames_state);
4832         NTSTATUS status;
4833
4834         if (tevent_req_is_nterror(req, &status)) {
4835                 tevent_req_received(req);
4836                 return status;
4837         }
4838
4839         /* Steal possbile out parameters to the callers context */
4840         talloc_steal(mem_ctx, state->out_mem_ctx);
4841
4842         /* Return result */
4843         *result = state->orig.out.result;
4844
4845         tevent_req_received(req);
4846         return NT_STATUS_OK;
4847 }
4848
4849 NTSTATUS rpccli_wkssvc_NetrEnumerateComputerNames(struct rpc_pipe_client *cli,
4850                                                   TALLOC_CTX *mem_ctx,
4851                                                   const char *server_name /* [in] [unique,charset(UTF16)] */,
4852                                                   enum wkssvc_ComputerNameType name_type /* [in]  */,
4853                                                   uint32_t Reserved /* [in]  */,
4854                                                   struct wkssvc_ComputerNamesCtr **ctr /* [out] [ref] */,
4855                                                   WERROR *werror)
4856 {
4857         struct wkssvc_NetrEnumerateComputerNames r;
4858         NTSTATUS status;
4859
4860         /* In parameters */
4861         r.in.server_name = server_name;
4862         r.in.name_type = name_type;
4863         r.in.Reserved = Reserved;
4864
4865         status = cli->dispatch(cli,
4866                                 mem_ctx,
4867                                 &ndr_table_wkssvc,
4868                                 NDR_WKSSVC_NETRENUMERATECOMPUTERNAMES,
4869                                 &r);
4870
4871         if (!NT_STATUS_IS_OK(status)) {
4872                 return status;
4873         }
4874
4875         if (NT_STATUS_IS_ERR(status)) {
4876                 return status;
4877         }
4878
4879         /* Return variables */
4880         *ctr = *r.out.ctr;
4881
4882         /* Return result */
4883         if (werror) {
4884                 *werror = r.out.result;
4885         }
4886
4887         return werror_to_ntstatus(r.out.result);
4888 }
4889