s3-libnetapi: add I_NetLogonControl{2} skeleton.
[ira/wip.git] / source3 / lib / netapi / libnetapi.c
1 /*
2  *  Unix SMB/CIFS implementation.
3  *  NetApi Support
4  *  Copyright (C) Guenther Deschner 2007-2008
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #include "includes.h"
21 #include "librpc/gen_ndr/libnetapi.h"
22 #include "lib/netapi/netapi.h"
23 #include "lib/netapi/netapi_private.h"
24 #include "lib/netapi/libnetapi.h"
25 #include "librpc/gen_ndr/ndr_libnetapi.h"
26
27 /****************************************************************
28  NetJoinDomain
29 ****************************************************************/
30
31 NET_API_STATUS NetJoinDomain(const char * server /* [in] [unique] */,
32                              const char * domain /* [in] [ref] */,
33                              const char * account_ou /* [in] [unique] */,
34                              const char * account /* [in] [unique] */,
35                              const char * password /* [in] [unique] */,
36                              uint32_t join_flags /* [in] */)
37 {
38         struct NetJoinDomain r;
39         struct libnetapi_ctx *ctx = NULL;
40         NET_API_STATUS status;
41         WERROR werr;
42
43         status = libnetapi_getctx(&ctx);
44         if (status != 0) {
45                 return status;
46         }
47
48         /* In parameters */
49         r.in.server = server;
50         r.in.domain = domain;
51         r.in.account_ou = account_ou;
52         r.in.account = account;
53         r.in.password = password;
54         r.in.join_flags = join_flags;
55
56         /* Out parameters */
57
58         if (DEBUGLEVEL >= 10) {
59                 NDR_PRINT_IN_DEBUG(NetJoinDomain, &r);
60         }
61
62         if (LIBNETAPI_LOCAL_SERVER(server)) {
63                 werr = NetJoinDomain_l(ctx, &r);
64         } else {
65                 werr = NetJoinDomain_r(ctx, &r);
66         }
67
68         r.out.result = W_ERROR_V(werr);
69
70         if (DEBUGLEVEL >= 10) {
71                 NDR_PRINT_OUT_DEBUG(NetJoinDomain, &r);
72         }
73
74         return r.out.result;
75 }
76
77 /****************************************************************
78  NetUnjoinDomain
79 ****************************************************************/
80
81 NET_API_STATUS NetUnjoinDomain(const char * server_name /* [in] [unique] */,
82                                const char * account /* [in] [unique] */,
83                                const char * password /* [in] [unique] */,
84                                uint32_t unjoin_flags /* [in] */)
85 {
86         struct NetUnjoinDomain r;
87         struct libnetapi_ctx *ctx = NULL;
88         NET_API_STATUS status;
89         WERROR werr;
90
91         status = libnetapi_getctx(&ctx);
92         if (status != 0) {
93                 return status;
94         }
95
96         /* In parameters */
97         r.in.server_name = server_name;
98         r.in.account = account;
99         r.in.password = password;
100         r.in.unjoin_flags = unjoin_flags;
101
102         /* Out parameters */
103
104         if (DEBUGLEVEL >= 10) {
105                 NDR_PRINT_IN_DEBUG(NetUnjoinDomain, &r);
106         }
107
108         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
109                 werr = NetUnjoinDomain_l(ctx, &r);
110         } else {
111                 werr = NetUnjoinDomain_r(ctx, &r);
112         }
113
114         r.out.result = W_ERROR_V(werr);
115
116         if (DEBUGLEVEL >= 10) {
117                 NDR_PRINT_OUT_DEBUG(NetUnjoinDomain, &r);
118         }
119
120         return r.out.result;
121 }
122
123 /****************************************************************
124  NetGetJoinInformation
125 ****************************************************************/
126
127 NET_API_STATUS NetGetJoinInformation(const char * server_name /* [in] [unique] */,
128                                      const char * *name_buffer /* [out] [ref] */,
129                                      uint16_t *name_type /* [out] [ref] */)
130 {
131         struct NetGetJoinInformation r;
132         struct libnetapi_ctx *ctx = NULL;
133         NET_API_STATUS status;
134         WERROR werr;
135
136         status = libnetapi_getctx(&ctx);
137         if (status != 0) {
138                 return status;
139         }
140
141         /* In parameters */
142         r.in.server_name = server_name;
143
144         /* Out parameters */
145         r.out.name_buffer = name_buffer;
146         r.out.name_type = name_type;
147
148         if (DEBUGLEVEL >= 10) {
149                 NDR_PRINT_IN_DEBUG(NetGetJoinInformation, &r);
150         }
151
152         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
153                 werr = NetGetJoinInformation_l(ctx, &r);
154         } else {
155                 werr = NetGetJoinInformation_r(ctx, &r);
156         }
157
158         r.out.result = W_ERROR_V(werr);
159
160         if (DEBUGLEVEL >= 10) {
161                 NDR_PRINT_OUT_DEBUG(NetGetJoinInformation, &r);
162         }
163
164         return r.out.result;
165 }
166
167 /****************************************************************
168  NetGetJoinableOUs
169 ****************************************************************/
170
171 NET_API_STATUS NetGetJoinableOUs(const char * server_name /* [in] [unique] */,
172                                  const char * domain /* [in] [ref] */,
173                                  const char * account /* [in] [unique] */,
174                                  const char * password /* [in] [unique] */,
175                                  uint32_t *ou_count /* [out] [ref] */,
176                                  const char * **ous /* [out] [ref] */)
177 {
178         struct NetGetJoinableOUs r;
179         struct libnetapi_ctx *ctx = NULL;
180         NET_API_STATUS status;
181         WERROR werr;
182
183         status = libnetapi_getctx(&ctx);
184         if (status != 0) {
185                 return status;
186         }
187
188         /* In parameters */
189         r.in.server_name = server_name;
190         r.in.domain = domain;
191         r.in.account = account;
192         r.in.password = password;
193
194         /* Out parameters */
195         r.out.ou_count = ou_count;
196         r.out.ous = ous;
197
198         if (DEBUGLEVEL >= 10) {
199                 NDR_PRINT_IN_DEBUG(NetGetJoinableOUs, &r);
200         }
201
202         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
203                 werr = NetGetJoinableOUs_l(ctx, &r);
204         } else {
205                 werr = NetGetJoinableOUs_r(ctx, &r);
206         }
207
208         r.out.result = W_ERROR_V(werr);
209
210         if (DEBUGLEVEL >= 10) {
211                 NDR_PRINT_OUT_DEBUG(NetGetJoinableOUs, &r);
212         }
213
214         return r.out.result;
215 }
216
217 /****************************************************************
218  NetRenameMachineInDomain
219 ****************************************************************/
220
221 NET_API_STATUS NetRenameMachineInDomain(const char * server_name /* [in] */,
222                                         const char * new_machine_name /* [in] */,
223                                         const char * account /* [in] */,
224                                         const char * password /* [in] */,
225                                         uint32_t rename_options /* [in] */)
226 {
227         struct NetRenameMachineInDomain r;
228         struct libnetapi_ctx *ctx = NULL;
229         NET_API_STATUS status;
230         WERROR werr;
231
232         status = libnetapi_getctx(&ctx);
233         if (status != 0) {
234                 return status;
235         }
236
237         /* In parameters */
238         r.in.server_name = server_name;
239         r.in.new_machine_name = new_machine_name;
240         r.in.account = account;
241         r.in.password = password;
242         r.in.rename_options = rename_options;
243
244         /* Out parameters */
245
246         if (DEBUGLEVEL >= 10) {
247                 NDR_PRINT_IN_DEBUG(NetRenameMachineInDomain, &r);
248         }
249
250         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
251                 werr = NetRenameMachineInDomain_l(ctx, &r);
252         } else {
253                 werr = NetRenameMachineInDomain_r(ctx, &r);
254         }
255
256         r.out.result = W_ERROR_V(werr);
257
258         if (DEBUGLEVEL >= 10) {
259                 NDR_PRINT_OUT_DEBUG(NetRenameMachineInDomain, &r);
260         }
261
262         return r.out.result;
263 }
264
265 /****************************************************************
266  NetServerGetInfo
267 ****************************************************************/
268
269 NET_API_STATUS NetServerGetInfo(const char * server_name /* [in] [unique] */,
270                                 uint32_t level /* [in] */,
271                                 uint8_t **buffer /* [out] [ref] */)
272 {
273         struct NetServerGetInfo r;
274         struct libnetapi_ctx *ctx = NULL;
275         NET_API_STATUS status;
276         WERROR werr;
277
278         status = libnetapi_getctx(&ctx);
279         if (status != 0) {
280                 return status;
281         }
282
283         /* In parameters */
284         r.in.server_name = server_name;
285         r.in.level = level;
286
287         /* Out parameters */
288         r.out.buffer = buffer;
289
290         if (DEBUGLEVEL >= 10) {
291                 NDR_PRINT_IN_DEBUG(NetServerGetInfo, &r);
292         }
293
294         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
295                 werr = NetServerGetInfo_l(ctx, &r);
296         } else {
297                 werr = NetServerGetInfo_r(ctx, &r);
298         }
299
300         r.out.result = W_ERROR_V(werr);
301
302         if (DEBUGLEVEL >= 10) {
303                 NDR_PRINT_OUT_DEBUG(NetServerGetInfo, &r);
304         }
305
306         return r.out.result;
307 }
308
309 /****************************************************************
310  NetServerSetInfo
311 ****************************************************************/
312
313 NET_API_STATUS NetServerSetInfo(const char * server_name /* [in] [unique] */,
314                                 uint32_t level /* [in] */,
315                                 uint8_t *buffer /* [in] [ref] */,
316                                 uint32_t *parm_error /* [out] [ref] */)
317 {
318         struct NetServerSetInfo r;
319         struct libnetapi_ctx *ctx = NULL;
320         NET_API_STATUS status;
321         WERROR werr;
322
323         status = libnetapi_getctx(&ctx);
324         if (status != 0) {
325                 return status;
326         }
327
328         /* In parameters */
329         r.in.server_name = server_name;
330         r.in.level = level;
331         r.in.buffer = buffer;
332
333         /* Out parameters */
334         r.out.parm_error = parm_error;
335
336         if (DEBUGLEVEL >= 10) {
337                 NDR_PRINT_IN_DEBUG(NetServerSetInfo, &r);
338         }
339
340         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
341                 werr = NetServerSetInfo_l(ctx, &r);
342         } else {
343                 werr = NetServerSetInfo_r(ctx, &r);
344         }
345
346         r.out.result = W_ERROR_V(werr);
347
348         if (DEBUGLEVEL >= 10) {
349                 NDR_PRINT_OUT_DEBUG(NetServerSetInfo, &r);
350         }
351
352         return r.out.result;
353 }
354
355 /****************************************************************
356  NetGetDCName
357 ****************************************************************/
358
359 NET_API_STATUS NetGetDCName(const char * server_name /* [in] [unique] */,
360                             const char * domain_name /* [in] [unique] */,
361                             uint8_t **buffer /* [out] [ref] */)
362 {
363         struct NetGetDCName r;
364         struct libnetapi_ctx *ctx = NULL;
365         NET_API_STATUS status;
366         WERROR werr;
367
368         status = libnetapi_getctx(&ctx);
369         if (status != 0) {
370                 return status;
371         }
372
373         /* In parameters */
374         r.in.server_name = server_name;
375         r.in.domain_name = domain_name;
376
377         /* Out parameters */
378         r.out.buffer = buffer;
379
380         if (DEBUGLEVEL >= 10) {
381                 NDR_PRINT_IN_DEBUG(NetGetDCName, &r);
382         }
383
384         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
385                 werr = NetGetDCName_l(ctx, &r);
386         } else {
387                 werr = NetGetDCName_r(ctx, &r);
388         }
389
390         r.out.result = W_ERROR_V(werr);
391
392         if (DEBUGLEVEL >= 10) {
393                 NDR_PRINT_OUT_DEBUG(NetGetDCName, &r);
394         }
395
396         return r.out.result;
397 }
398
399 /****************************************************************
400  NetGetAnyDCName
401 ****************************************************************/
402
403 NET_API_STATUS NetGetAnyDCName(const char * server_name /* [in] [unique] */,
404                                const char * domain_name /* [in] [unique] */,
405                                uint8_t **buffer /* [out] [ref] */)
406 {
407         struct NetGetAnyDCName r;
408         struct libnetapi_ctx *ctx = NULL;
409         NET_API_STATUS status;
410         WERROR werr;
411
412         status = libnetapi_getctx(&ctx);
413         if (status != 0) {
414                 return status;
415         }
416
417         /* In parameters */
418         r.in.server_name = server_name;
419         r.in.domain_name = domain_name;
420
421         /* Out parameters */
422         r.out.buffer = buffer;
423
424         if (DEBUGLEVEL >= 10) {
425                 NDR_PRINT_IN_DEBUG(NetGetAnyDCName, &r);
426         }
427
428         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
429                 werr = NetGetAnyDCName_l(ctx, &r);
430         } else {
431                 werr = NetGetAnyDCName_r(ctx, &r);
432         }
433
434         r.out.result = W_ERROR_V(werr);
435
436         if (DEBUGLEVEL >= 10) {
437                 NDR_PRINT_OUT_DEBUG(NetGetAnyDCName, &r);
438         }
439
440         return r.out.result;
441 }
442
443 /****************************************************************
444  DsGetDcName
445 ****************************************************************/
446
447 NET_API_STATUS DsGetDcName(const char * server_name /* [in] [unique] */,
448                            const char * domain_name /* [in] [ref] */,
449                            struct GUID *domain_guid /* [in] [unique] */,
450                            const char * site_name /* [in] [unique] */,
451                            uint32_t flags /* [in] */,
452                            struct DOMAIN_CONTROLLER_INFO **dc_info /* [out] [ref] */)
453 {
454         struct DsGetDcName r;
455         struct libnetapi_ctx *ctx = NULL;
456         NET_API_STATUS status;
457         WERROR werr;
458
459         status = libnetapi_getctx(&ctx);
460         if (status != 0) {
461                 return status;
462         }
463
464         /* In parameters */
465         r.in.server_name = server_name;
466         r.in.domain_name = domain_name;
467         r.in.domain_guid = domain_guid;
468         r.in.site_name = site_name;
469         r.in.flags = flags;
470
471         /* Out parameters */
472         r.out.dc_info = dc_info;
473
474         if (DEBUGLEVEL >= 10) {
475                 NDR_PRINT_IN_DEBUG(DsGetDcName, &r);
476         }
477
478         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
479                 werr = DsGetDcName_l(ctx, &r);
480         } else {
481                 werr = DsGetDcName_r(ctx, &r);
482         }
483
484         r.out.result = W_ERROR_V(werr);
485
486         if (DEBUGLEVEL >= 10) {
487                 NDR_PRINT_OUT_DEBUG(DsGetDcName, &r);
488         }
489
490         return r.out.result;
491 }
492
493 /****************************************************************
494  NetUserAdd
495 ****************************************************************/
496
497 NET_API_STATUS NetUserAdd(const char * server_name /* [in] [unique] */,
498                           uint32_t level /* [in] */,
499                           uint8_t *buffer /* [in] [ref] */,
500                           uint32_t *parm_error /* [out] [ref] */)
501 {
502         struct NetUserAdd r;
503         struct libnetapi_ctx *ctx = NULL;
504         NET_API_STATUS status;
505         WERROR werr;
506
507         status = libnetapi_getctx(&ctx);
508         if (status != 0) {
509                 return status;
510         }
511
512         /* In parameters */
513         r.in.server_name = server_name;
514         r.in.level = level;
515         r.in.buffer = buffer;
516
517         /* Out parameters */
518         r.out.parm_error = parm_error;
519
520         if (DEBUGLEVEL >= 10) {
521                 NDR_PRINT_IN_DEBUG(NetUserAdd, &r);
522         }
523
524         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
525                 werr = NetUserAdd_l(ctx, &r);
526         } else {
527                 werr = NetUserAdd_r(ctx, &r);
528         }
529
530         r.out.result = W_ERROR_V(werr);
531
532         if (DEBUGLEVEL >= 10) {
533                 NDR_PRINT_OUT_DEBUG(NetUserAdd, &r);
534         }
535
536         return r.out.result;
537 }
538
539 /****************************************************************
540  NetUserDel
541 ****************************************************************/
542
543 NET_API_STATUS NetUserDel(const char * server_name /* [in] [unique] */,
544                           const char * user_name /* [in] [ref] */)
545 {
546         struct NetUserDel r;
547         struct libnetapi_ctx *ctx = NULL;
548         NET_API_STATUS status;
549         WERROR werr;
550
551         status = libnetapi_getctx(&ctx);
552         if (status != 0) {
553                 return status;
554         }
555
556         /* In parameters */
557         r.in.server_name = server_name;
558         r.in.user_name = user_name;
559
560         /* Out parameters */
561
562         if (DEBUGLEVEL >= 10) {
563                 NDR_PRINT_IN_DEBUG(NetUserDel, &r);
564         }
565
566         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
567                 werr = NetUserDel_l(ctx, &r);
568         } else {
569                 werr = NetUserDel_r(ctx, &r);
570         }
571
572         r.out.result = W_ERROR_V(werr);
573
574         if (DEBUGLEVEL >= 10) {
575                 NDR_PRINT_OUT_DEBUG(NetUserDel, &r);
576         }
577
578         return r.out.result;
579 }
580
581 /****************************************************************
582  NetUserEnum
583 ****************************************************************/
584
585 NET_API_STATUS NetUserEnum(const char * server_name /* [in] [unique] */,
586                            uint32_t level /* [in] */,
587                            uint32_t filter /* [in] */,
588                            uint8_t **buffer /* [out] [ref] */,
589                            uint32_t prefmaxlen /* [in] */,
590                            uint32_t *entries_read /* [out] [ref] */,
591                            uint32_t *total_entries /* [out] [ref] */,
592                            uint32_t *resume_handle /* [in,out] [ref] */)
593 {
594         struct NetUserEnum r;
595         struct libnetapi_ctx *ctx = NULL;
596         NET_API_STATUS status;
597         WERROR werr;
598
599         status = libnetapi_getctx(&ctx);
600         if (status != 0) {
601                 return status;
602         }
603
604         /* In parameters */
605         r.in.server_name = server_name;
606         r.in.level = level;
607         r.in.filter = filter;
608         r.in.prefmaxlen = prefmaxlen;
609         r.in.resume_handle = resume_handle;
610
611         /* Out parameters */
612         r.out.buffer = buffer;
613         r.out.entries_read = entries_read;
614         r.out.total_entries = total_entries;
615         r.out.resume_handle = resume_handle;
616
617         if (DEBUGLEVEL >= 10) {
618                 NDR_PRINT_IN_DEBUG(NetUserEnum, &r);
619         }
620
621         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
622                 werr = NetUserEnum_l(ctx, &r);
623         } else {
624                 werr = NetUserEnum_r(ctx, &r);
625         }
626
627         r.out.result = W_ERROR_V(werr);
628
629         if (DEBUGLEVEL >= 10) {
630                 NDR_PRINT_OUT_DEBUG(NetUserEnum, &r);
631         }
632
633         return r.out.result;
634 }
635
636 /****************************************************************
637  NetUserChangePassword
638 ****************************************************************/
639
640 NET_API_STATUS NetUserChangePassword(const char * domain_name /* [in] */,
641                                      const char * user_name /* [in] */,
642                                      const char * old_password /* [in] */,
643                                      const char * new_password /* [in] */)
644 {
645         struct NetUserChangePassword r;
646         struct libnetapi_ctx *ctx = NULL;
647         NET_API_STATUS status;
648         WERROR werr;
649
650         status = libnetapi_getctx(&ctx);
651         if (status != 0) {
652                 return status;
653         }
654
655         /* In parameters */
656         r.in.domain_name = domain_name;
657         r.in.user_name = user_name;
658         r.in.old_password = old_password;
659         r.in.new_password = new_password;
660
661         /* Out parameters */
662
663         if (DEBUGLEVEL >= 10) {
664                 NDR_PRINT_IN_DEBUG(NetUserChangePassword, &r);
665         }
666
667         if (LIBNETAPI_LOCAL_SERVER(domain_name)) {
668                 werr = NetUserChangePassword_l(ctx, &r);
669         } else {
670                 werr = NetUserChangePassword_r(ctx, &r);
671         }
672
673         r.out.result = W_ERROR_V(werr);
674
675         if (DEBUGLEVEL >= 10) {
676                 NDR_PRINT_OUT_DEBUG(NetUserChangePassword, &r);
677         }
678
679         return r.out.result;
680 }
681
682 /****************************************************************
683  NetUserGetInfo
684 ****************************************************************/
685
686 NET_API_STATUS NetUserGetInfo(const char * server_name /* [in] */,
687                               const char * user_name /* [in] */,
688                               uint32_t level /* [in] */,
689                               uint8_t **buffer /* [out] [ref] */)
690 {
691         struct NetUserGetInfo r;
692         struct libnetapi_ctx *ctx = NULL;
693         NET_API_STATUS status;
694         WERROR werr;
695
696         status = libnetapi_getctx(&ctx);
697         if (status != 0) {
698                 return status;
699         }
700
701         /* In parameters */
702         r.in.server_name = server_name;
703         r.in.user_name = user_name;
704         r.in.level = level;
705
706         /* Out parameters */
707         r.out.buffer = buffer;
708
709         if (DEBUGLEVEL >= 10) {
710                 NDR_PRINT_IN_DEBUG(NetUserGetInfo, &r);
711         }
712
713         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
714                 werr = NetUserGetInfo_l(ctx, &r);
715         } else {
716                 werr = NetUserGetInfo_r(ctx, &r);
717         }
718
719         r.out.result = W_ERROR_V(werr);
720
721         if (DEBUGLEVEL >= 10) {
722                 NDR_PRINT_OUT_DEBUG(NetUserGetInfo, &r);
723         }
724
725         return r.out.result;
726 }
727
728 /****************************************************************
729  NetUserSetInfo
730 ****************************************************************/
731
732 NET_API_STATUS NetUserSetInfo(const char * server_name /* [in] */,
733                               const char * user_name /* [in] */,
734                               uint32_t level /* [in] */,
735                               uint8_t *buffer /* [in] [ref] */,
736                               uint32_t *parm_err /* [out] [ref] */)
737 {
738         struct NetUserSetInfo r;
739         struct libnetapi_ctx *ctx = NULL;
740         NET_API_STATUS status;
741         WERROR werr;
742
743         status = libnetapi_getctx(&ctx);
744         if (status != 0) {
745                 return status;
746         }
747
748         /* In parameters */
749         r.in.server_name = server_name;
750         r.in.user_name = user_name;
751         r.in.level = level;
752         r.in.buffer = buffer;
753
754         /* Out parameters */
755         r.out.parm_err = parm_err;
756
757         if (DEBUGLEVEL >= 10) {
758                 NDR_PRINT_IN_DEBUG(NetUserSetInfo, &r);
759         }
760
761         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
762                 werr = NetUserSetInfo_l(ctx, &r);
763         } else {
764                 werr = NetUserSetInfo_r(ctx, &r);
765         }
766
767         r.out.result = W_ERROR_V(werr);
768
769         if (DEBUGLEVEL >= 10) {
770                 NDR_PRINT_OUT_DEBUG(NetUserSetInfo, &r);
771         }
772
773         return r.out.result;
774 }
775
776 /****************************************************************
777  NetUserGetGroups
778 ****************************************************************/
779
780 NET_API_STATUS NetUserGetGroups(const char * server_name /* [in] */,
781                                 const char * user_name /* [in] */,
782                                 uint32_t level /* [in] */,
783                                 uint8_t **buffer /* [out] [ref] */,
784                                 uint32_t prefmaxlen /* [in] */,
785                                 uint32_t *entries_read /* [out] [ref] */,
786                                 uint32_t *total_entries /* [out] [ref] */)
787 {
788         struct NetUserGetGroups r;
789         struct libnetapi_ctx *ctx = NULL;
790         NET_API_STATUS status;
791         WERROR werr;
792
793         status = libnetapi_getctx(&ctx);
794         if (status != 0) {
795                 return status;
796         }
797
798         /* In parameters */
799         r.in.server_name = server_name;
800         r.in.user_name = user_name;
801         r.in.level = level;
802         r.in.prefmaxlen = prefmaxlen;
803
804         /* Out parameters */
805         r.out.buffer = buffer;
806         r.out.entries_read = entries_read;
807         r.out.total_entries = total_entries;
808
809         if (DEBUGLEVEL >= 10) {
810                 NDR_PRINT_IN_DEBUG(NetUserGetGroups, &r);
811         }
812
813         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
814                 werr = NetUserGetGroups_l(ctx, &r);
815         } else {
816                 werr = NetUserGetGroups_r(ctx, &r);
817         }
818
819         r.out.result = W_ERROR_V(werr);
820
821         if (DEBUGLEVEL >= 10) {
822                 NDR_PRINT_OUT_DEBUG(NetUserGetGroups, &r);
823         }
824
825         return r.out.result;
826 }
827
828 /****************************************************************
829  NetUserSetGroups
830 ****************************************************************/
831
832 NET_API_STATUS NetUserSetGroups(const char * server_name /* [in] */,
833                                 const char * user_name /* [in] */,
834                                 uint32_t level /* [in] */,
835                                 uint8_t *buffer /* [in] [ref] */,
836                                 uint32_t num_entries /* [in] */)
837 {
838         struct NetUserSetGroups r;
839         struct libnetapi_ctx *ctx = NULL;
840         NET_API_STATUS status;
841         WERROR werr;
842
843         status = libnetapi_getctx(&ctx);
844         if (status != 0) {
845                 return status;
846         }
847
848         /* In parameters */
849         r.in.server_name = server_name;
850         r.in.user_name = user_name;
851         r.in.level = level;
852         r.in.buffer = buffer;
853         r.in.num_entries = num_entries;
854
855         /* Out parameters */
856
857         if (DEBUGLEVEL >= 10) {
858                 NDR_PRINT_IN_DEBUG(NetUserSetGroups, &r);
859         }
860
861         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
862                 werr = NetUserSetGroups_l(ctx, &r);
863         } else {
864                 werr = NetUserSetGroups_r(ctx, &r);
865         }
866
867         r.out.result = W_ERROR_V(werr);
868
869         if (DEBUGLEVEL >= 10) {
870                 NDR_PRINT_OUT_DEBUG(NetUserSetGroups, &r);
871         }
872
873         return r.out.result;
874 }
875
876 /****************************************************************
877  NetUserGetLocalGroups
878 ****************************************************************/
879
880 NET_API_STATUS NetUserGetLocalGroups(const char * server_name /* [in] */,
881                                      const char * user_name /* [in] */,
882                                      uint32_t level /* [in] */,
883                                      uint32_t flags /* [in] */,
884                                      uint8_t **buffer /* [out] [ref] */,
885                                      uint32_t prefmaxlen /* [in] */,
886                                      uint32_t *entries_read /* [out] [ref] */,
887                                      uint32_t *total_entries /* [out] [ref] */)
888 {
889         struct NetUserGetLocalGroups r;
890         struct libnetapi_ctx *ctx = NULL;
891         NET_API_STATUS status;
892         WERROR werr;
893
894         status = libnetapi_getctx(&ctx);
895         if (status != 0) {
896                 return status;
897         }
898
899         /* In parameters */
900         r.in.server_name = server_name;
901         r.in.user_name = user_name;
902         r.in.level = level;
903         r.in.flags = flags;
904         r.in.prefmaxlen = prefmaxlen;
905
906         /* Out parameters */
907         r.out.buffer = buffer;
908         r.out.entries_read = entries_read;
909         r.out.total_entries = total_entries;
910
911         if (DEBUGLEVEL >= 10) {
912                 NDR_PRINT_IN_DEBUG(NetUserGetLocalGroups, &r);
913         }
914
915         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
916                 werr = NetUserGetLocalGroups_l(ctx, &r);
917         } else {
918                 werr = NetUserGetLocalGroups_r(ctx, &r);
919         }
920
921         r.out.result = W_ERROR_V(werr);
922
923         if (DEBUGLEVEL >= 10) {
924                 NDR_PRINT_OUT_DEBUG(NetUserGetLocalGroups, &r);
925         }
926
927         return r.out.result;
928 }
929
930 /****************************************************************
931  NetUserModalsGet
932 ****************************************************************/
933
934 NET_API_STATUS NetUserModalsGet(const char * server_name /* [in] */,
935                                 uint32_t level /* [in] */,
936                                 uint8_t **buffer /* [out] [ref] */)
937 {
938         struct NetUserModalsGet r;
939         struct libnetapi_ctx *ctx = NULL;
940         NET_API_STATUS status;
941         WERROR werr;
942
943         status = libnetapi_getctx(&ctx);
944         if (status != 0) {
945                 return status;
946         }
947
948         /* In parameters */
949         r.in.server_name = server_name;
950         r.in.level = level;
951
952         /* Out parameters */
953         r.out.buffer = buffer;
954
955         if (DEBUGLEVEL >= 10) {
956                 NDR_PRINT_IN_DEBUG(NetUserModalsGet, &r);
957         }
958
959         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
960                 werr = NetUserModalsGet_l(ctx, &r);
961         } else {
962                 werr = NetUserModalsGet_r(ctx, &r);
963         }
964
965         r.out.result = W_ERROR_V(werr);
966
967         if (DEBUGLEVEL >= 10) {
968                 NDR_PRINT_OUT_DEBUG(NetUserModalsGet, &r);
969         }
970
971         return r.out.result;
972 }
973
974 /****************************************************************
975  NetUserModalsSet
976 ****************************************************************/
977
978 NET_API_STATUS NetUserModalsSet(const char * server_name /* [in] */,
979                                 uint32_t level /* [in] */,
980                                 uint8_t *buffer /* [in] [ref] */,
981                                 uint32_t *parm_err /* [out] [ref] */)
982 {
983         struct NetUserModalsSet r;
984         struct libnetapi_ctx *ctx = NULL;
985         NET_API_STATUS status;
986         WERROR werr;
987
988         status = libnetapi_getctx(&ctx);
989         if (status != 0) {
990                 return status;
991         }
992
993         /* In parameters */
994         r.in.server_name = server_name;
995         r.in.level = level;
996         r.in.buffer = buffer;
997
998         /* Out parameters */
999         r.out.parm_err = parm_err;
1000
1001         if (DEBUGLEVEL >= 10) {
1002                 NDR_PRINT_IN_DEBUG(NetUserModalsSet, &r);
1003         }
1004
1005         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1006                 werr = NetUserModalsSet_l(ctx, &r);
1007         } else {
1008                 werr = NetUserModalsSet_r(ctx, &r);
1009         }
1010
1011         r.out.result = W_ERROR_V(werr);
1012
1013         if (DEBUGLEVEL >= 10) {
1014                 NDR_PRINT_OUT_DEBUG(NetUserModalsSet, &r);
1015         }
1016
1017         return r.out.result;
1018 }
1019
1020 /****************************************************************
1021  NetQueryDisplayInformation
1022 ****************************************************************/
1023
1024 NET_API_STATUS NetQueryDisplayInformation(const char * server_name /* [in] [unique] */,
1025                                           uint32_t level /* [in] */,
1026                                           uint32_t idx /* [in] */,
1027                                           uint32_t entries_requested /* [in] */,
1028                                           uint32_t prefmaxlen /* [in] */,
1029                                           uint32_t *entries_read /* [out] [ref] */,
1030                                           void **buffer /* [out] [noprint,ref] */)
1031 {
1032         struct NetQueryDisplayInformation r;
1033         struct libnetapi_ctx *ctx = NULL;
1034         NET_API_STATUS status;
1035         WERROR werr;
1036
1037         status = libnetapi_getctx(&ctx);
1038         if (status != 0) {
1039                 return status;
1040         }
1041
1042         /* In parameters */
1043         r.in.server_name = server_name;
1044         r.in.level = level;
1045         r.in.idx = idx;
1046         r.in.entries_requested = entries_requested;
1047         r.in.prefmaxlen = prefmaxlen;
1048
1049         /* Out parameters */
1050         r.out.entries_read = entries_read;
1051         r.out.buffer = buffer;
1052
1053         if (DEBUGLEVEL >= 10) {
1054                 NDR_PRINT_IN_DEBUG(NetQueryDisplayInformation, &r);
1055         }
1056
1057         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1058                 werr = NetQueryDisplayInformation_l(ctx, &r);
1059         } else {
1060                 werr = NetQueryDisplayInformation_r(ctx, &r);
1061         }
1062
1063         r.out.result = W_ERROR_V(werr);
1064
1065         if (DEBUGLEVEL >= 10) {
1066                 NDR_PRINT_OUT_DEBUG(NetQueryDisplayInformation, &r);
1067         }
1068
1069         return r.out.result;
1070 }
1071
1072 /****************************************************************
1073  NetGroupAdd
1074 ****************************************************************/
1075
1076 NET_API_STATUS NetGroupAdd(const char * server_name /* [in] */,
1077                            uint32_t level /* [in] */,
1078                            uint8_t *buffer /* [in] [ref] */,
1079                            uint32_t *parm_err /* [out] [ref] */)
1080 {
1081         struct NetGroupAdd r;
1082         struct libnetapi_ctx *ctx = NULL;
1083         NET_API_STATUS status;
1084         WERROR werr;
1085
1086         status = libnetapi_getctx(&ctx);
1087         if (status != 0) {
1088                 return status;
1089         }
1090
1091         /* In parameters */
1092         r.in.server_name = server_name;
1093         r.in.level = level;
1094         r.in.buffer = buffer;
1095
1096         /* Out parameters */
1097         r.out.parm_err = parm_err;
1098
1099         if (DEBUGLEVEL >= 10) {
1100                 NDR_PRINT_IN_DEBUG(NetGroupAdd, &r);
1101         }
1102
1103         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1104                 werr = NetGroupAdd_l(ctx, &r);
1105         } else {
1106                 werr = NetGroupAdd_r(ctx, &r);
1107         }
1108
1109         r.out.result = W_ERROR_V(werr);
1110
1111         if (DEBUGLEVEL >= 10) {
1112                 NDR_PRINT_OUT_DEBUG(NetGroupAdd, &r);
1113         }
1114
1115         return r.out.result;
1116 }
1117
1118 /****************************************************************
1119  NetGroupDel
1120 ****************************************************************/
1121
1122 NET_API_STATUS NetGroupDel(const char * server_name /* [in] */,
1123                            const char * group_name /* [in] */)
1124 {
1125         struct NetGroupDel r;
1126         struct libnetapi_ctx *ctx = NULL;
1127         NET_API_STATUS status;
1128         WERROR werr;
1129
1130         status = libnetapi_getctx(&ctx);
1131         if (status != 0) {
1132                 return status;
1133         }
1134
1135         /* In parameters */
1136         r.in.server_name = server_name;
1137         r.in.group_name = group_name;
1138
1139         /* Out parameters */
1140
1141         if (DEBUGLEVEL >= 10) {
1142                 NDR_PRINT_IN_DEBUG(NetGroupDel, &r);
1143         }
1144
1145         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1146                 werr = NetGroupDel_l(ctx, &r);
1147         } else {
1148                 werr = NetGroupDel_r(ctx, &r);
1149         }
1150
1151         r.out.result = W_ERROR_V(werr);
1152
1153         if (DEBUGLEVEL >= 10) {
1154                 NDR_PRINT_OUT_DEBUG(NetGroupDel, &r);
1155         }
1156
1157         return r.out.result;
1158 }
1159
1160 /****************************************************************
1161  NetGroupEnum
1162 ****************************************************************/
1163
1164 NET_API_STATUS NetGroupEnum(const char * server_name /* [in] */,
1165                             uint32_t level /* [in] */,
1166                             uint8_t **buffer /* [out] [ref] */,
1167                             uint32_t prefmaxlen /* [in] */,
1168                             uint32_t *entries_read /* [out] [ref] */,
1169                             uint32_t *total_entries /* [out] [ref] */,
1170                             uint32_t *resume_handle /* [in,out] [ref] */)
1171 {
1172         struct NetGroupEnum r;
1173         struct libnetapi_ctx *ctx = NULL;
1174         NET_API_STATUS status;
1175         WERROR werr;
1176
1177         status = libnetapi_getctx(&ctx);
1178         if (status != 0) {
1179                 return status;
1180         }
1181
1182         /* In parameters */
1183         r.in.server_name = server_name;
1184         r.in.level = level;
1185         r.in.prefmaxlen = prefmaxlen;
1186         r.in.resume_handle = resume_handle;
1187
1188         /* Out parameters */
1189         r.out.buffer = buffer;
1190         r.out.entries_read = entries_read;
1191         r.out.total_entries = total_entries;
1192         r.out.resume_handle = resume_handle;
1193
1194         if (DEBUGLEVEL >= 10) {
1195                 NDR_PRINT_IN_DEBUG(NetGroupEnum, &r);
1196         }
1197
1198         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1199                 werr = NetGroupEnum_l(ctx, &r);
1200         } else {
1201                 werr = NetGroupEnum_r(ctx, &r);
1202         }
1203
1204         r.out.result = W_ERROR_V(werr);
1205
1206         if (DEBUGLEVEL >= 10) {
1207                 NDR_PRINT_OUT_DEBUG(NetGroupEnum, &r);
1208         }
1209
1210         return r.out.result;
1211 }
1212
1213 /****************************************************************
1214  NetGroupSetInfo
1215 ****************************************************************/
1216
1217 NET_API_STATUS NetGroupSetInfo(const char * server_name /* [in] */,
1218                                const char * group_name /* [in] */,
1219                                uint32_t level /* [in] */,
1220                                uint8_t *buffer /* [in] [ref] */,
1221                                uint32_t *parm_err /* [out] [ref] */)
1222 {
1223         struct NetGroupSetInfo r;
1224         struct libnetapi_ctx *ctx = NULL;
1225         NET_API_STATUS status;
1226         WERROR werr;
1227
1228         status = libnetapi_getctx(&ctx);
1229         if (status != 0) {
1230                 return status;
1231         }
1232
1233         /* In parameters */
1234         r.in.server_name = server_name;
1235         r.in.group_name = group_name;
1236         r.in.level = level;
1237         r.in.buffer = buffer;
1238
1239         /* Out parameters */
1240         r.out.parm_err = parm_err;
1241
1242         if (DEBUGLEVEL >= 10) {
1243                 NDR_PRINT_IN_DEBUG(NetGroupSetInfo, &r);
1244         }
1245
1246         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1247                 werr = NetGroupSetInfo_l(ctx, &r);
1248         } else {
1249                 werr = NetGroupSetInfo_r(ctx, &r);
1250         }
1251
1252         r.out.result = W_ERROR_V(werr);
1253
1254         if (DEBUGLEVEL >= 10) {
1255                 NDR_PRINT_OUT_DEBUG(NetGroupSetInfo, &r);
1256         }
1257
1258         return r.out.result;
1259 }
1260
1261 /****************************************************************
1262  NetGroupGetInfo
1263 ****************************************************************/
1264
1265 NET_API_STATUS NetGroupGetInfo(const char * server_name /* [in] */,
1266                                const char * group_name /* [in] */,
1267                                uint32_t level /* [in] */,
1268                                uint8_t **buffer /* [out] [ref] */)
1269 {
1270         struct NetGroupGetInfo r;
1271         struct libnetapi_ctx *ctx = NULL;
1272         NET_API_STATUS status;
1273         WERROR werr;
1274
1275         status = libnetapi_getctx(&ctx);
1276         if (status != 0) {
1277                 return status;
1278         }
1279
1280         /* In parameters */
1281         r.in.server_name = server_name;
1282         r.in.group_name = group_name;
1283         r.in.level = level;
1284
1285         /* Out parameters */
1286         r.out.buffer = buffer;
1287
1288         if (DEBUGLEVEL >= 10) {
1289                 NDR_PRINT_IN_DEBUG(NetGroupGetInfo, &r);
1290         }
1291
1292         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1293                 werr = NetGroupGetInfo_l(ctx, &r);
1294         } else {
1295                 werr = NetGroupGetInfo_r(ctx, &r);
1296         }
1297
1298         r.out.result = W_ERROR_V(werr);
1299
1300         if (DEBUGLEVEL >= 10) {
1301                 NDR_PRINT_OUT_DEBUG(NetGroupGetInfo, &r);
1302         }
1303
1304         return r.out.result;
1305 }
1306
1307 /****************************************************************
1308  NetGroupAddUser
1309 ****************************************************************/
1310
1311 NET_API_STATUS NetGroupAddUser(const char * server_name /* [in] */,
1312                                const char * group_name /* [in] */,
1313                                const char * user_name /* [in] */)
1314 {
1315         struct NetGroupAddUser r;
1316         struct libnetapi_ctx *ctx = NULL;
1317         NET_API_STATUS status;
1318         WERROR werr;
1319
1320         status = libnetapi_getctx(&ctx);
1321         if (status != 0) {
1322                 return status;
1323         }
1324
1325         /* In parameters */
1326         r.in.server_name = server_name;
1327         r.in.group_name = group_name;
1328         r.in.user_name = user_name;
1329
1330         /* Out parameters */
1331
1332         if (DEBUGLEVEL >= 10) {
1333                 NDR_PRINT_IN_DEBUG(NetGroupAddUser, &r);
1334         }
1335
1336         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1337                 werr = NetGroupAddUser_l(ctx, &r);
1338         } else {
1339                 werr = NetGroupAddUser_r(ctx, &r);
1340         }
1341
1342         r.out.result = W_ERROR_V(werr);
1343
1344         if (DEBUGLEVEL >= 10) {
1345                 NDR_PRINT_OUT_DEBUG(NetGroupAddUser, &r);
1346         }
1347
1348         return r.out.result;
1349 }
1350
1351 /****************************************************************
1352  NetGroupDelUser
1353 ****************************************************************/
1354
1355 NET_API_STATUS NetGroupDelUser(const char * server_name /* [in] */,
1356                                const char * group_name /* [in] */,
1357                                const char * user_name /* [in] */)
1358 {
1359         struct NetGroupDelUser r;
1360         struct libnetapi_ctx *ctx = NULL;
1361         NET_API_STATUS status;
1362         WERROR werr;
1363
1364         status = libnetapi_getctx(&ctx);
1365         if (status != 0) {
1366                 return status;
1367         }
1368
1369         /* In parameters */
1370         r.in.server_name = server_name;
1371         r.in.group_name = group_name;
1372         r.in.user_name = user_name;
1373
1374         /* Out parameters */
1375
1376         if (DEBUGLEVEL >= 10) {
1377                 NDR_PRINT_IN_DEBUG(NetGroupDelUser, &r);
1378         }
1379
1380         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1381                 werr = NetGroupDelUser_l(ctx, &r);
1382         } else {
1383                 werr = NetGroupDelUser_r(ctx, &r);
1384         }
1385
1386         r.out.result = W_ERROR_V(werr);
1387
1388         if (DEBUGLEVEL >= 10) {
1389                 NDR_PRINT_OUT_DEBUG(NetGroupDelUser, &r);
1390         }
1391
1392         return r.out.result;
1393 }
1394
1395 /****************************************************************
1396  NetGroupGetUsers
1397 ****************************************************************/
1398
1399 NET_API_STATUS NetGroupGetUsers(const char * server_name /* [in] */,
1400                                 const char * group_name /* [in] */,
1401                                 uint32_t level /* [in] */,
1402                                 uint8_t **buffer /* [out] [ref] */,
1403                                 uint32_t prefmaxlen /* [in] */,
1404                                 uint32_t *entries_read /* [out] [ref] */,
1405                                 uint32_t *total_entries /* [out] [ref] */,
1406                                 uint32_t *resume_handle /* [in,out] [ref] */)
1407 {
1408         struct NetGroupGetUsers r;
1409         struct libnetapi_ctx *ctx = NULL;
1410         NET_API_STATUS status;
1411         WERROR werr;
1412
1413         status = libnetapi_getctx(&ctx);
1414         if (status != 0) {
1415                 return status;
1416         }
1417
1418         /* In parameters */
1419         r.in.server_name = server_name;
1420         r.in.group_name = group_name;
1421         r.in.level = level;
1422         r.in.prefmaxlen = prefmaxlen;
1423         r.in.resume_handle = resume_handle;
1424
1425         /* Out parameters */
1426         r.out.buffer = buffer;
1427         r.out.entries_read = entries_read;
1428         r.out.total_entries = total_entries;
1429         r.out.resume_handle = resume_handle;
1430
1431         if (DEBUGLEVEL >= 10) {
1432                 NDR_PRINT_IN_DEBUG(NetGroupGetUsers, &r);
1433         }
1434
1435         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1436                 werr = NetGroupGetUsers_l(ctx, &r);
1437         } else {
1438                 werr = NetGroupGetUsers_r(ctx, &r);
1439         }
1440
1441         r.out.result = W_ERROR_V(werr);
1442
1443         if (DEBUGLEVEL >= 10) {
1444                 NDR_PRINT_OUT_DEBUG(NetGroupGetUsers, &r);
1445         }
1446
1447         return r.out.result;
1448 }
1449
1450 /****************************************************************
1451  NetGroupSetUsers
1452 ****************************************************************/
1453
1454 NET_API_STATUS NetGroupSetUsers(const char * server_name /* [in] */,
1455                                 const char * group_name /* [in] */,
1456                                 uint32_t level /* [in] */,
1457                                 uint8_t *buffer /* [in] [ref] */,
1458                                 uint32_t num_entries /* [in] */)
1459 {
1460         struct NetGroupSetUsers r;
1461         struct libnetapi_ctx *ctx = NULL;
1462         NET_API_STATUS status;
1463         WERROR werr;
1464
1465         status = libnetapi_getctx(&ctx);
1466         if (status != 0) {
1467                 return status;
1468         }
1469
1470         /* In parameters */
1471         r.in.server_name = server_name;
1472         r.in.group_name = group_name;
1473         r.in.level = level;
1474         r.in.buffer = buffer;
1475         r.in.num_entries = num_entries;
1476
1477         /* Out parameters */
1478
1479         if (DEBUGLEVEL >= 10) {
1480                 NDR_PRINT_IN_DEBUG(NetGroupSetUsers, &r);
1481         }
1482
1483         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1484                 werr = NetGroupSetUsers_l(ctx, &r);
1485         } else {
1486                 werr = NetGroupSetUsers_r(ctx, &r);
1487         }
1488
1489         r.out.result = W_ERROR_V(werr);
1490
1491         if (DEBUGLEVEL >= 10) {
1492                 NDR_PRINT_OUT_DEBUG(NetGroupSetUsers, &r);
1493         }
1494
1495         return r.out.result;
1496 }
1497
1498 /****************************************************************
1499  NetLocalGroupAdd
1500 ****************************************************************/
1501
1502 NET_API_STATUS NetLocalGroupAdd(const char * server_name /* [in] */,
1503                                 uint32_t level /* [in] */,
1504                                 uint8_t *buffer /* [in] [ref] */,
1505                                 uint32_t *parm_err /* [out] [ref] */)
1506 {
1507         struct NetLocalGroupAdd r;
1508         struct libnetapi_ctx *ctx = NULL;
1509         NET_API_STATUS status;
1510         WERROR werr;
1511
1512         status = libnetapi_getctx(&ctx);
1513         if (status != 0) {
1514                 return status;
1515         }
1516
1517         /* In parameters */
1518         r.in.server_name = server_name;
1519         r.in.level = level;
1520         r.in.buffer = buffer;
1521
1522         /* Out parameters */
1523         r.out.parm_err = parm_err;
1524
1525         if (DEBUGLEVEL >= 10) {
1526                 NDR_PRINT_IN_DEBUG(NetLocalGroupAdd, &r);
1527         }
1528
1529         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1530                 werr = NetLocalGroupAdd_l(ctx, &r);
1531         } else {
1532                 werr = NetLocalGroupAdd_r(ctx, &r);
1533         }
1534
1535         r.out.result = W_ERROR_V(werr);
1536
1537         if (DEBUGLEVEL >= 10) {
1538                 NDR_PRINT_OUT_DEBUG(NetLocalGroupAdd, &r);
1539         }
1540
1541         return r.out.result;
1542 }
1543
1544 /****************************************************************
1545  NetLocalGroupDel
1546 ****************************************************************/
1547
1548 NET_API_STATUS NetLocalGroupDel(const char * server_name /* [in] */,
1549                                 const char * group_name /* [in] */)
1550 {
1551         struct NetLocalGroupDel r;
1552         struct libnetapi_ctx *ctx = NULL;
1553         NET_API_STATUS status;
1554         WERROR werr;
1555
1556         status = libnetapi_getctx(&ctx);
1557         if (status != 0) {
1558                 return status;
1559         }
1560
1561         /* In parameters */
1562         r.in.server_name = server_name;
1563         r.in.group_name = group_name;
1564
1565         /* Out parameters */
1566
1567         if (DEBUGLEVEL >= 10) {
1568                 NDR_PRINT_IN_DEBUG(NetLocalGroupDel, &r);
1569         }
1570
1571         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1572                 werr = NetLocalGroupDel_l(ctx, &r);
1573         } else {
1574                 werr = NetLocalGroupDel_r(ctx, &r);
1575         }
1576
1577         r.out.result = W_ERROR_V(werr);
1578
1579         if (DEBUGLEVEL >= 10) {
1580                 NDR_PRINT_OUT_DEBUG(NetLocalGroupDel, &r);
1581         }
1582
1583         return r.out.result;
1584 }
1585
1586 /****************************************************************
1587  NetLocalGroupGetInfo
1588 ****************************************************************/
1589
1590 NET_API_STATUS NetLocalGroupGetInfo(const char * server_name /* [in] */,
1591                                     const char * group_name /* [in] */,
1592                                     uint32_t level /* [in] */,
1593                                     uint8_t **buffer /* [out] [ref] */)
1594 {
1595         struct NetLocalGroupGetInfo r;
1596         struct libnetapi_ctx *ctx = NULL;
1597         NET_API_STATUS status;
1598         WERROR werr;
1599
1600         status = libnetapi_getctx(&ctx);
1601         if (status != 0) {
1602                 return status;
1603         }
1604
1605         /* In parameters */
1606         r.in.server_name = server_name;
1607         r.in.group_name = group_name;
1608         r.in.level = level;
1609
1610         /* Out parameters */
1611         r.out.buffer = buffer;
1612
1613         if (DEBUGLEVEL >= 10) {
1614                 NDR_PRINT_IN_DEBUG(NetLocalGroupGetInfo, &r);
1615         }
1616
1617         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1618                 werr = NetLocalGroupGetInfo_l(ctx, &r);
1619         } else {
1620                 werr = NetLocalGroupGetInfo_r(ctx, &r);
1621         }
1622
1623         r.out.result = W_ERROR_V(werr);
1624
1625         if (DEBUGLEVEL >= 10) {
1626                 NDR_PRINT_OUT_DEBUG(NetLocalGroupGetInfo, &r);
1627         }
1628
1629         return r.out.result;
1630 }
1631
1632 /****************************************************************
1633  NetLocalGroupSetInfo
1634 ****************************************************************/
1635
1636 NET_API_STATUS NetLocalGroupSetInfo(const char * server_name /* [in] */,
1637                                     const char * group_name /* [in] */,
1638                                     uint32_t level /* [in] */,
1639                                     uint8_t *buffer /* [in] [ref] */,
1640                                     uint32_t *parm_err /* [out] [ref] */)
1641 {
1642         struct NetLocalGroupSetInfo r;
1643         struct libnetapi_ctx *ctx = NULL;
1644         NET_API_STATUS status;
1645         WERROR werr;
1646
1647         status = libnetapi_getctx(&ctx);
1648         if (status != 0) {
1649                 return status;
1650         }
1651
1652         /* In parameters */
1653         r.in.server_name = server_name;
1654         r.in.group_name = group_name;
1655         r.in.level = level;
1656         r.in.buffer = buffer;
1657
1658         /* Out parameters */
1659         r.out.parm_err = parm_err;
1660
1661         if (DEBUGLEVEL >= 10) {
1662                 NDR_PRINT_IN_DEBUG(NetLocalGroupSetInfo, &r);
1663         }
1664
1665         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1666                 werr = NetLocalGroupSetInfo_l(ctx, &r);
1667         } else {
1668                 werr = NetLocalGroupSetInfo_r(ctx, &r);
1669         }
1670
1671         r.out.result = W_ERROR_V(werr);
1672
1673         if (DEBUGLEVEL >= 10) {
1674                 NDR_PRINT_OUT_DEBUG(NetLocalGroupSetInfo, &r);
1675         }
1676
1677         return r.out.result;
1678 }
1679
1680 /****************************************************************
1681  NetLocalGroupEnum
1682 ****************************************************************/
1683
1684 NET_API_STATUS NetLocalGroupEnum(const char * server_name /* [in] */,
1685                                  uint32_t level /* [in] */,
1686                                  uint8_t **buffer /* [out] [ref] */,
1687                                  uint32_t prefmaxlen /* [in] */,
1688                                  uint32_t *entries_read /* [out] [ref] */,
1689                                  uint32_t *total_entries /* [out] [ref] */,
1690                                  uint32_t *resume_handle /* [in,out] [ref] */)
1691 {
1692         struct NetLocalGroupEnum r;
1693         struct libnetapi_ctx *ctx = NULL;
1694         NET_API_STATUS status;
1695         WERROR werr;
1696
1697         status = libnetapi_getctx(&ctx);
1698         if (status != 0) {
1699                 return status;
1700         }
1701
1702         /* In parameters */
1703         r.in.server_name = server_name;
1704         r.in.level = level;
1705         r.in.prefmaxlen = prefmaxlen;
1706         r.in.resume_handle = resume_handle;
1707
1708         /* Out parameters */
1709         r.out.buffer = buffer;
1710         r.out.entries_read = entries_read;
1711         r.out.total_entries = total_entries;
1712         r.out.resume_handle = resume_handle;
1713
1714         if (DEBUGLEVEL >= 10) {
1715                 NDR_PRINT_IN_DEBUG(NetLocalGroupEnum, &r);
1716         }
1717
1718         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1719                 werr = NetLocalGroupEnum_l(ctx, &r);
1720         } else {
1721                 werr = NetLocalGroupEnum_r(ctx, &r);
1722         }
1723
1724         r.out.result = W_ERROR_V(werr);
1725
1726         if (DEBUGLEVEL >= 10) {
1727                 NDR_PRINT_OUT_DEBUG(NetLocalGroupEnum, &r);
1728         }
1729
1730         return r.out.result;
1731 }
1732
1733 /****************************************************************
1734  NetLocalGroupAddMembers
1735 ****************************************************************/
1736
1737 NET_API_STATUS NetLocalGroupAddMembers(const char * server_name /* [in] */,
1738                                        const char * group_name /* [in] */,
1739                                        uint32_t level /* [in] */,
1740                                        uint8_t *buffer /* [in] [ref] */,
1741                                        uint32_t total_entries /* [in] */)
1742 {
1743         struct NetLocalGroupAddMembers r;
1744         struct libnetapi_ctx *ctx = NULL;
1745         NET_API_STATUS status;
1746         WERROR werr;
1747
1748         status = libnetapi_getctx(&ctx);
1749         if (status != 0) {
1750                 return status;
1751         }
1752
1753         /* In parameters */
1754         r.in.server_name = server_name;
1755         r.in.group_name = group_name;
1756         r.in.level = level;
1757         r.in.buffer = buffer;
1758         r.in.total_entries = total_entries;
1759
1760         /* Out parameters */
1761
1762         if (DEBUGLEVEL >= 10) {
1763                 NDR_PRINT_IN_DEBUG(NetLocalGroupAddMembers, &r);
1764         }
1765
1766         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1767                 werr = NetLocalGroupAddMembers_l(ctx, &r);
1768         } else {
1769                 werr = NetLocalGroupAddMembers_r(ctx, &r);
1770         }
1771
1772         r.out.result = W_ERROR_V(werr);
1773
1774         if (DEBUGLEVEL >= 10) {
1775                 NDR_PRINT_OUT_DEBUG(NetLocalGroupAddMembers, &r);
1776         }
1777
1778         return r.out.result;
1779 }
1780
1781 /****************************************************************
1782  NetLocalGroupDelMembers
1783 ****************************************************************/
1784
1785 NET_API_STATUS NetLocalGroupDelMembers(const char * server_name /* [in] */,
1786                                        const char * group_name /* [in] */,
1787                                        uint32_t level /* [in] */,
1788                                        uint8_t *buffer /* [in] [ref] */,
1789                                        uint32_t total_entries /* [in] */)
1790 {
1791         struct NetLocalGroupDelMembers r;
1792         struct libnetapi_ctx *ctx = NULL;
1793         NET_API_STATUS status;
1794         WERROR werr;
1795
1796         status = libnetapi_getctx(&ctx);
1797         if (status != 0) {
1798                 return status;
1799         }
1800
1801         /* In parameters */
1802         r.in.server_name = server_name;
1803         r.in.group_name = group_name;
1804         r.in.level = level;
1805         r.in.buffer = buffer;
1806         r.in.total_entries = total_entries;
1807
1808         /* Out parameters */
1809
1810         if (DEBUGLEVEL >= 10) {
1811                 NDR_PRINT_IN_DEBUG(NetLocalGroupDelMembers, &r);
1812         }
1813
1814         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1815                 werr = NetLocalGroupDelMembers_l(ctx, &r);
1816         } else {
1817                 werr = NetLocalGroupDelMembers_r(ctx, &r);
1818         }
1819
1820         r.out.result = W_ERROR_V(werr);
1821
1822         if (DEBUGLEVEL >= 10) {
1823                 NDR_PRINT_OUT_DEBUG(NetLocalGroupDelMembers, &r);
1824         }
1825
1826         return r.out.result;
1827 }
1828
1829 /****************************************************************
1830  NetLocalGroupGetMembers
1831 ****************************************************************/
1832
1833 NET_API_STATUS NetLocalGroupGetMembers(const char * server_name /* [in] */,
1834                                        const char * local_group_name /* [in] */,
1835                                        uint32_t level /* [in] */,
1836                                        uint8_t **buffer /* [out] [ref] */,
1837                                        uint32_t prefmaxlen /* [in] */,
1838                                        uint32_t *entries_read /* [out] [ref] */,
1839                                        uint32_t *total_entries /* [out] [ref] */,
1840                                        uint32_t *resume_handle /* [in,out] [ref] */)
1841 {
1842         struct NetLocalGroupGetMembers r;
1843         struct libnetapi_ctx *ctx = NULL;
1844         NET_API_STATUS status;
1845         WERROR werr;
1846
1847         status = libnetapi_getctx(&ctx);
1848         if (status != 0) {
1849                 return status;
1850         }
1851
1852         /* In parameters */
1853         r.in.server_name = server_name;
1854         r.in.local_group_name = local_group_name;
1855         r.in.level = level;
1856         r.in.prefmaxlen = prefmaxlen;
1857         r.in.resume_handle = resume_handle;
1858
1859         /* Out parameters */
1860         r.out.buffer = buffer;
1861         r.out.entries_read = entries_read;
1862         r.out.total_entries = total_entries;
1863         r.out.resume_handle = resume_handle;
1864
1865         if (DEBUGLEVEL >= 10) {
1866                 NDR_PRINT_IN_DEBUG(NetLocalGroupGetMembers, &r);
1867         }
1868
1869         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1870                 werr = NetLocalGroupGetMembers_l(ctx, &r);
1871         } else {
1872                 werr = NetLocalGroupGetMembers_r(ctx, &r);
1873         }
1874
1875         r.out.result = W_ERROR_V(werr);
1876
1877         if (DEBUGLEVEL >= 10) {
1878                 NDR_PRINT_OUT_DEBUG(NetLocalGroupGetMembers, &r);
1879         }
1880
1881         return r.out.result;
1882 }
1883
1884 /****************************************************************
1885  NetLocalGroupSetMembers
1886 ****************************************************************/
1887
1888 NET_API_STATUS NetLocalGroupSetMembers(const char * server_name /* [in] */,
1889                                        const char * group_name /* [in] */,
1890                                        uint32_t level /* [in] */,
1891                                        uint8_t *buffer /* [in] [ref] */,
1892                                        uint32_t total_entries /* [in] */)
1893 {
1894         struct NetLocalGroupSetMembers r;
1895         struct libnetapi_ctx *ctx = NULL;
1896         NET_API_STATUS status;
1897         WERROR werr;
1898
1899         status = libnetapi_getctx(&ctx);
1900         if (status != 0) {
1901                 return status;
1902         }
1903
1904         /* In parameters */
1905         r.in.server_name = server_name;
1906         r.in.group_name = group_name;
1907         r.in.level = level;
1908         r.in.buffer = buffer;
1909         r.in.total_entries = total_entries;
1910
1911         /* Out parameters */
1912
1913         if (DEBUGLEVEL >= 10) {
1914                 NDR_PRINT_IN_DEBUG(NetLocalGroupSetMembers, &r);
1915         }
1916
1917         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1918                 werr = NetLocalGroupSetMembers_l(ctx, &r);
1919         } else {
1920                 werr = NetLocalGroupSetMembers_r(ctx, &r);
1921         }
1922
1923         r.out.result = W_ERROR_V(werr);
1924
1925         if (DEBUGLEVEL >= 10) {
1926                 NDR_PRINT_OUT_DEBUG(NetLocalGroupSetMembers, &r);
1927         }
1928
1929         return r.out.result;
1930 }
1931
1932 /****************************************************************
1933  NetRemoteTOD
1934 ****************************************************************/
1935
1936 NET_API_STATUS NetRemoteTOD(const char * server_name /* [in] */,
1937                             uint8_t **buffer /* [out] [ref] */)
1938 {
1939         struct NetRemoteTOD r;
1940         struct libnetapi_ctx *ctx = NULL;
1941         NET_API_STATUS status;
1942         WERROR werr;
1943
1944         status = libnetapi_getctx(&ctx);
1945         if (status != 0) {
1946                 return status;
1947         }
1948
1949         /* In parameters */
1950         r.in.server_name = server_name;
1951
1952         /* Out parameters */
1953         r.out.buffer = buffer;
1954
1955         if (DEBUGLEVEL >= 10) {
1956                 NDR_PRINT_IN_DEBUG(NetRemoteTOD, &r);
1957         }
1958
1959         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1960                 werr = NetRemoteTOD_l(ctx, &r);
1961         } else {
1962                 werr = NetRemoteTOD_r(ctx, &r);
1963         }
1964
1965         r.out.result = W_ERROR_V(werr);
1966
1967         if (DEBUGLEVEL >= 10) {
1968                 NDR_PRINT_OUT_DEBUG(NetRemoteTOD, &r);
1969         }
1970
1971         return r.out.result;
1972 }
1973
1974 /****************************************************************
1975  NetShareAdd
1976 ****************************************************************/
1977
1978 NET_API_STATUS NetShareAdd(const char * server_name /* [in] */,
1979                            uint32_t level /* [in] */,
1980                            uint8_t *buffer /* [in] [ref] */,
1981                            uint32_t *parm_err /* [out] [ref] */)
1982 {
1983         struct NetShareAdd r;
1984         struct libnetapi_ctx *ctx = NULL;
1985         NET_API_STATUS status;
1986         WERROR werr;
1987
1988         status = libnetapi_getctx(&ctx);
1989         if (status != 0) {
1990                 return status;
1991         }
1992
1993         /* In parameters */
1994         r.in.server_name = server_name;
1995         r.in.level = level;
1996         r.in.buffer = buffer;
1997
1998         /* Out parameters */
1999         r.out.parm_err = parm_err;
2000
2001         if (DEBUGLEVEL >= 10) {
2002                 NDR_PRINT_IN_DEBUG(NetShareAdd, &r);
2003         }
2004
2005         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2006                 werr = NetShareAdd_l(ctx, &r);
2007         } else {
2008                 werr = NetShareAdd_r(ctx, &r);
2009         }
2010
2011         r.out.result = W_ERROR_V(werr);
2012
2013         if (DEBUGLEVEL >= 10) {
2014                 NDR_PRINT_OUT_DEBUG(NetShareAdd, &r);
2015         }
2016
2017         return r.out.result;
2018 }
2019
2020 /****************************************************************
2021  NetShareDel
2022 ****************************************************************/
2023
2024 NET_API_STATUS NetShareDel(const char * server_name /* [in] */,
2025                            const char * net_name /* [in] */,
2026                            uint32_t reserved /* [in] */)
2027 {
2028         struct NetShareDel r;
2029         struct libnetapi_ctx *ctx = NULL;
2030         NET_API_STATUS status;
2031         WERROR werr;
2032
2033         status = libnetapi_getctx(&ctx);
2034         if (status != 0) {
2035                 return status;
2036         }
2037
2038         /* In parameters */
2039         r.in.server_name = server_name;
2040         r.in.net_name = net_name;
2041         r.in.reserved = reserved;
2042
2043         /* Out parameters */
2044
2045         if (DEBUGLEVEL >= 10) {
2046                 NDR_PRINT_IN_DEBUG(NetShareDel, &r);
2047         }
2048
2049         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2050                 werr = NetShareDel_l(ctx, &r);
2051         } else {
2052                 werr = NetShareDel_r(ctx, &r);
2053         }
2054
2055         r.out.result = W_ERROR_V(werr);
2056
2057         if (DEBUGLEVEL >= 10) {
2058                 NDR_PRINT_OUT_DEBUG(NetShareDel, &r);
2059         }
2060
2061         return r.out.result;
2062 }
2063
2064 /****************************************************************
2065  NetShareEnum
2066 ****************************************************************/
2067
2068 NET_API_STATUS NetShareEnum(const char * server_name /* [in] */,
2069                             uint32_t level /* [in] */,
2070                             uint8_t **buffer /* [out] [ref] */,
2071                             uint32_t prefmaxlen /* [in] */,
2072                             uint32_t *entries_read /* [out] [ref] */,
2073                             uint32_t *total_entries /* [out] [ref] */,
2074                             uint32_t *resume_handle /* [in,out] [ref] */)
2075 {
2076         struct NetShareEnum r;
2077         struct libnetapi_ctx *ctx = NULL;
2078         NET_API_STATUS status;
2079         WERROR werr;
2080
2081         status = libnetapi_getctx(&ctx);
2082         if (status != 0) {
2083                 return status;
2084         }
2085
2086         /* In parameters */
2087         r.in.server_name = server_name;
2088         r.in.level = level;
2089         r.in.prefmaxlen = prefmaxlen;
2090         r.in.resume_handle = resume_handle;
2091
2092         /* Out parameters */
2093         r.out.buffer = buffer;
2094         r.out.entries_read = entries_read;
2095         r.out.total_entries = total_entries;
2096         r.out.resume_handle = resume_handle;
2097
2098         if (DEBUGLEVEL >= 10) {
2099                 NDR_PRINT_IN_DEBUG(NetShareEnum, &r);
2100         }
2101
2102         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2103                 werr = NetShareEnum_l(ctx, &r);
2104         } else {
2105                 werr = NetShareEnum_r(ctx, &r);
2106         }
2107
2108         r.out.result = W_ERROR_V(werr);
2109
2110         if (DEBUGLEVEL >= 10) {
2111                 NDR_PRINT_OUT_DEBUG(NetShareEnum, &r);
2112         }
2113
2114         return r.out.result;
2115 }
2116
2117 /****************************************************************
2118  NetShareGetInfo
2119 ****************************************************************/
2120
2121 NET_API_STATUS NetShareGetInfo(const char * server_name /* [in] */,
2122                                const char * net_name /* [in] */,
2123                                uint32_t level /* [in] */,
2124                                uint8_t **buffer /* [out] [ref] */)
2125 {
2126         struct NetShareGetInfo r;
2127         struct libnetapi_ctx *ctx = NULL;
2128         NET_API_STATUS status;
2129         WERROR werr;
2130
2131         status = libnetapi_getctx(&ctx);
2132         if (status != 0) {
2133                 return status;
2134         }
2135
2136         /* In parameters */
2137         r.in.server_name = server_name;
2138         r.in.net_name = net_name;
2139         r.in.level = level;
2140
2141         /* Out parameters */
2142         r.out.buffer = buffer;
2143
2144         if (DEBUGLEVEL >= 10) {
2145                 NDR_PRINT_IN_DEBUG(NetShareGetInfo, &r);
2146         }
2147
2148         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2149                 werr = NetShareGetInfo_l(ctx, &r);
2150         } else {
2151                 werr = NetShareGetInfo_r(ctx, &r);
2152         }
2153
2154         r.out.result = W_ERROR_V(werr);
2155
2156         if (DEBUGLEVEL >= 10) {
2157                 NDR_PRINT_OUT_DEBUG(NetShareGetInfo, &r);
2158         }
2159
2160         return r.out.result;
2161 }
2162
2163 /****************************************************************
2164  NetShareSetInfo
2165 ****************************************************************/
2166
2167 NET_API_STATUS NetShareSetInfo(const char * server_name /* [in] */,
2168                                const char * net_name /* [in] */,
2169                                uint32_t level /* [in] */,
2170                                uint8_t *buffer /* [in] [ref] */,
2171                                uint32_t *parm_err /* [out] [ref] */)
2172 {
2173         struct NetShareSetInfo r;
2174         struct libnetapi_ctx *ctx = NULL;
2175         NET_API_STATUS status;
2176         WERROR werr;
2177
2178         status = libnetapi_getctx(&ctx);
2179         if (status != 0) {
2180                 return status;
2181         }
2182
2183         /* In parameters */
2184         r.in.server_name = server_name;
2185         r.in.net_name = net_name;
2186         r.in.level = level;
2187         r.in.buffer = buffer;
2188
2189         /* Out parameters */
2190         r.out.parm_err = parm_err;
2191
2192         if (DEBUGLEVEL >= 10) {
2193                 NDR_PRINT_IN_DEBUG(NetShareSetInfo, &r);
2194         }
2195
2196         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2197                 werr = NetShareSetInfo_l(ctx, &r);
2198         } else {
2199                 werr = NetShareSetInfo_r(ctx, &r);
2200         }
2201
2202         r.out.result = W_ERROR_V(werr);
2203
2204         if (DEBUGLEVEL >= 10) {
2205                 NDR_PRINT_OUT_DEBUG(NetShareSetInfo, &r);
2206         }
2207
2208         return r.out.result;
2209 }
2210
2211 /****************************************************************
2212  NetFileClose
2213 ****************************************************************/
2214
2215 NET_API_STATUS NetFileClose(const char * server_name /* [in] */,
2216                             uint32_t fileid /* [in] */)
2217 {
2218         struct NetFileClose r;
2219         struct libnetapi_ctx *ctx = NULL;
2220         NET_API_STATUS status;
2221         WERROR werr;
2222
2223         status = libnetapi_getctx(&ctx);
2224         if (status != 0) {
2225                 return status;
2226         }
2227
2228         /* In parameters */
2229         r.in.server_name = server_name;
2230         r.in.fileid = fileid;
2231
2232         /* Out parameters */
2233
2234         if (DEBUGLEVEL >= 10) {
2235                 NDR_PRINT_IN_DEBUG(NetFileClose, &r);
2236         }
2237
2238         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2239                 werr = NetFileClose_l(ctx, &r);
2240         } else {
2241                 werr = NetFileClose_r(ctx, &r);
2242         }
2243
2244         r.out.result = W_ERROR_V(werr);
2245
2246         if (DEBUGLEVEL >= 10) {
2247                 NDR_PRINT_OUT_DEBUG(NetFileClose, &r);
2248         }
2249
2250         return r.out.result;
2251 }
2252
2253 /****************************************************************
2254  NetFileGetInfo
2255 ****************************************************************/
2256
2257 NET_API_STATUS NetFileGetInfo(const char * server_name /* [in] */,
2258                               uint32_t fileid /* [in] */,
2259                               uint32_t level /* [in] */,
2260                               uint8_t **buffer /* [out] [ref] */)
2261 {
2262         struct NetFileGetInfo r;
2263         struct libnetapi_ctx *ctx = NULL;
2264         NET_API_STATUS status;
2265         WERROR werr;
2266
2267         status = libnetapi_getctx(&ctx);
2268         if (status != 0) {
2269                 return status;
2270         }
2271
2272         /* In parameters */
2273         r.in.server_name = server_name;
2274         r.in.fileid = fileid;
2275         r.in.level = level;
2276
2277         /* Out parameters */
2278         r.out.buffer = buffer;
2279
2280         if (DEBUGLEVEL >= 10) {
2281                 NDR_PRINT_IN_DEBUG(NetFileGetInfo, &r);
2282         }
2283
2284         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2285                 werr = NetFileGetInfo_l(ctx, &r);
2286         } else {
2287                 werr = NetFileGetInfo_r(ctx, &r);
2288         }
2289
2290         r.out.result = W_ERROR_V(werr);
2291
2292         if (DEBUGLEVEL >= 10) {
2293                 NDR_PRINT_OUT_DEBUG(NetFileGetInfo, &r);
2294         }
2295
2296         return r.out.result;
2297 }
2298
2299 /****************************************************************
2300  NetFileEnum
2301 ****************************************************************/
2302
2303 NET_API_STATUS NetFileEnum(const char * server_name /* [in] */,
2304                            const char * base_path /* [in] */,
2305                            const char * user_name /* [in] */,
2306                            uint32_t level /* [in] */,
2307                            uint8_t **buffer /* [out] [ref] */,
2308                            uint32_t prefmaxlen /* [in] */,
2309                            uint32_t *entries_read /* [out] [ref] */,
2310                            uint32_t *total_entries /* [out] [ref] */,
2311                            uint32_t *resume_handle /* [in,out] [ref] */)
2312 {
2313         struct NetFileEnum r;
2314         struct libnetapi_ctx *ctx = NULL;
2315         NET_API_STATUS status;
2316         WERROR werr;
2317
2318         status = libnetapi_getctx(&ctx);
2319         if (status != 0) {
2320                 return status;
2321         }
2322
2323         /* In parameters */
2324         r.in.server_name = server_name;
2325         r.in.base_path = base_path;
2326         r.in.user_name = user_name;
2327         r.in.level = level;
2328         r.in.prefmaxlen = prefmaxlen;
2329         r.in.resume_handle = resume_handle;
2330
2331         /* Out parameters */
2332         r.out.buffer = buffer;
2333         r.out.entries_read = entries_read;
2334         r.out.total_entries = total_entries;
2335         r.out.resume_handle = resume_handle;
2336
2337         if (DEBUGLEVEL >= 10) {
2338                 NDR_PRINT_IN_DEBUG(NetFileEnum, &r);
2339         }
2340
2341         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2342                 werr = NetFileEnum_l(ctx, &r);
2343         } else {
2344                 werr = NetFileEnum_r(ctx, &r);
2345         }
2346
2347         r.out.result = W_ERROR_V(werr);
2348
2349         if (DEBUGLEVEL >= 10) {
2350                 NDR_PRINT_OUT_DEBUG(NetFileEnum, &r);
2351         }
2352
2353         return r.out.result;
2354 }
2355
2356 /****************************************************************
2357  NetShutdownInit
2358 ****************************************************************/
2359
2360 NET_API_STATUS NetShutdownInit(const char * server_name /* [in] */,
2361                                const char * message /* [in] */,
2362                                uint32_t timeout /* [in] */,
2363                                uint8_t force_apps /* [in] */,
2364                                uint8_t do_reboot /* [in] */)
2365 {
2366         struct NetShutdownInit r;
2367         struct libnetapi_ctx *ctx = NULL;
2368         NET_API_STATUS status;
2369         WERROR werr;
2370
2371         status = libnetapi_getctx(&ctx);
2372         if (status != 0) {
2373                 return status;
2374         }
2375
2376         /* In parameters */
2377         r.in.server_name = server_name;
2378         r.in.message = message;
2379         r.in.timeout = timeout;
2380         r.in.force_apps = force_apps;
2381         r.in.do_reboot = do_reboot;
2382
2383         /* Out parameters */
2384
2385         if (DEBUGLEVEL >= 10) {
2386                 NDR_PRINT_IN_DEBUG(NetShutdownInit, &r);
2387         }
2388
2389         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2390                 werr = NetShutdownInit_l(ctx, &r);
2391         } else {
2392                 werr = NetShutdownInit_r(ctx, &r);
2393         }
2394
2395         r.out.result = W_ERROR_V(werr);
2396
2397         if (DEBUGLEVEL >= 10) {
2398                 NDR_PRINT_OUT_DEBUG(NetShutdownInit, &r);
2399         }
2400
2401         return r.out.result;
2402 }
2403
2404 /****************************************************************
2405  NetShutdownAbort
2406 ****************************************************************/
2407
2408 NET_API_STATUS NetShutdownAbort(const char * server_name /* [in] */)
2409 {
2410         struct NetShutdownAbort r;
2411         struct libnetapi_ctx *ctx = NULL;
2412         NET_API_STATUS status;
2413         WERROR werr;
2414
2415         status = libnetapi_getctx(&ctx);
2416         if (status != 0) {
2417                 return status;
2418         }
2419
2420         /* In parameters */
2421         r.in.server_name = server_name;
2422
2423         /* Out parameters */
2424
2425         if (DEBUGLEVEL >= 10) {
2426                 NDR_PRINT_IN_DEBUG(NetShutdownAbort, &r);
2427         }
2428
2429         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2430                 werr = NetShutdownAbort_l(ctx, &r);
2431         } else {
2432                 werr = NetShutdownAbort_r(ctx, &r);
2433         }
2434
2435         r.out.result = W_ERROR_V(werr);
2436
2437         if (DEBUGLEVEL >= 10) {
2438                 NDR_PRINT_OUT_DEBUG(NetShutdownAbort, &r);
2439         }
2440
2441         return r.out.result;
2442 }
2443
2444 /****************************************************************
2445  I_NetLogonControl
2446 ****************************************************************/
2447
2448 NET_API_STATUS I_NetLogonControl(const char * server_name /* [in] */,
2449                                  uint32_t function_code /* [in] */,
2450                                  uint32_t query_level /* [in] */,
2451                                  uint8_t **buffer /* [out] [ref] */)
2452 {
2453         struct I_NetLogonControl r;
2454         struct libnetapi_ctx *ctx = NULL;
2455         NET_API_STATUS status;
2456         WERROR werr;
2457
2458         status = libnetapi_getctx(&ctx);
2459         if (status != 0) {
2460                 return status;
2461         }
2462
2463         /* In parameters */
2464         r.in.server_name = server_name;
2465         r.in.function_code = function_code;
2466         r.in.query_level = query_level;
2467
2468         /* Out parameters */
2469         r.out.buffer = buffer;
2470
2471         if (DEBUGLEVEL >= 10) {
2472                 NDR_PRINT_IN_DEBUG(I_NetLogonControl, &r);
2473         }
2474
2475         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2476                 werr = I_NetLogonControl_l(ctx, &r);
2477         } else {
2478                 werr = I_NetLogonControl_r(ctx, &r);
2479         }
2480
2481         r.out.result = W_ERROR_V(werr);
2482
2483         if (DEBUGLEVEL >= 10) {
2484                 NDR_PRINT_OUT_DEBUG(I_NetLogonControl, &r);
2485         }
2486
2487         return r.out.result;
2488 }
2489
2490 /****************************************************************
2491  I_NetLogonControl2
2492 ****************************************************************/
2493
2494 NET_API_STATUS I_NetLogonControl2(const char * server_name /* [in] */,
2495                                   uint32_t function_code /* [in] */,
2496                                   uint32_t query_level /* [in] */,
2497                                   uint8_t *data /* [in] [ref] */,
2498                                   uint8_t **buffer /* [out] [ref] */)
2499 {
2500         struct I_NetLogonControl2 r;
2501         struct libnetapi_ctx *ctx = NULL;
2502         NET_API_STATUS status;
2503         WERROR werr;
2504
2505         status = libnetapi_getctx(&ctx);
2506         if (status != 0) {
2507                 return status;
2508         }
2509
2510         /* In parameters */
2511         r.in.server_name = server_name;
2512         r.in.function_code = function_code;
2513         r.in.query_level = query_level;
2514         r.in.data = data;
2515
2516         /* Out parameters */
2517         r.out.buffer = buffer;
2518
2519         if (DEBUGLEVEL >= 10) {
2520                 NDR_PRINT_IN_DEBUG(I_NetLogonControl2, &r);
2521         }
2522
2523         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2524                 werr = I_NetLogonControl2_l(ctx, &r);
2525         } else {
2526                 werr = I_NetLogonControl2_r(ctx, &r);
2527         }
2528
2529         r.out.result = W_ERROR_V(werr);
2530
2531         if (DEBUGLEVEL >= 10) {
2532                 NDR_PRINT_OUT_DEBUG(I_NetLogonControl2, &r);
2533         }
2534
2535         return r.out.result;
2536 }
2537