netapi: add skeleton for NetLocalGroup*Member calls.
[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  NetServerGetInfo
219 ****************************************************************/
220
221 NET_API_STATUS NetServerGetInfo(const char * server_name /* [in] [unique] */,
222                                 uint32_t level /* [in] */,
223                                 uint8_t **buffer /* [out] [ref] */)
224 {
225         struct NetServerGetInfo r;
226         struct libnetapi_ctx *ctx = NULL;
227         NET_API_STATUS status;
228         WERROR werr;
229
230         status = libnetapi_getctx(&ctx);
231         if (status != 0) {
232                 return status;
233         }
234
235         /* In parameters */
236         r.in.server_name = server_name;
237         r.in.level = level;
238
239         /* Out parameters */
240         r.out.buffer = buffer;
241
242         if (DEBUGLEVEL >= 10) {
243                 NDR_PRINT_IN_DEBUG(NetServerGetInfo, &r);
244         }
245
246         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
247                 werr = NetServerGetInfo_l(ctx, &r);
248         } else {
249                 werr = NetServerGetInfo_r(ctx, &r);
250         }
251
252         r.out.result = W_ERROR_V(werr);
253
254         if (DEBUGLEVEL >= 10) {
255                 NDR_PRINT_OUT_DEBUG(NetServerGetInfo, &r);
256         }
257
258         return r.out.result;
259 }
260
261 /****************************************************************
262  NetServerSetInfo
263 ****************************************************************/
264
265 NET_API_STATUS NetServerSetInfo(const char * server_name /* [in] [unique] */,
266                                 uint32_t level /* [in] */,
267                                 uint8_t *buffer /* [in] [ref] */,
268                                 uint32_t *parm_error /* [out] [ref] */)
269 {
270         struct NetServerSetInfo r;
271         struct libnetapi_ctx *ctx = NULL;
272         NET_API_STATUS status;
273         WERROR werr;
274
275         status = libnetapi_getctx(&ctx);
276         if (status != 0) {
277                 return status;
278         }
279
280         /* In parameters */
281         r.in.server_name = server_name;
282         r.in.level = level;
283         r.in.buffer = buffer;
284
285         /* Out parameters */
286         r.out.parm_error = parm_error;
287
288         if (DEBUGLEVEL >= 10) {
289                 NDR_PRINT_IN_DEBUG(NetServerSetInfo, &r);
290         }
291
292         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
293                 werr = NetServerSetInfo_l(ctx, &r);
294         } else {
295                 werr = NetServerSetInfo_r(ctx, &r);
296         }
297
298         r.out.result = W_ERROR_V(werr);
299
300         if (DEBUGLEVEL >= 10) {
301                 NDR_PRINT_OUT_DEBUG(NetServerSetInfo, &r);
302         }
303
304         return r.out.result;
305 }
306
307 /****************************************************************
308  NetGetDCName
309 ****************************************************************/
310
311 NET_API_STATUS NetGetDCName(const char * server_name /* [in] [unique] */,
312                             const char * domain_name /* [in] [unique] */,
313                             uint8_t **buffer /* [out] [ref] */)
314 {
315         struct NetGetDCName r;
316         struct libnetapi_ctx *ctx = NULL;
317         NET_API_STATUS status;
318         WERROR werr;
319
320         status = libnetapi_getctx(&ctx);
321         if (status != 0) {
322                 return status;
323         }
324
325         /* In parameters */
326         r.in.server_name = server_name;
327         r.in.domain_name = domain_name;
328
329         /* Out parameters */
330         r.out.buffer = buffer;
331
332         if (DEBUGLEVEL >= 10) {
333                 NDR_PRINT_IN_DEBUG(NetGetDCName, &r);
334         }
335
336         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
337                 werr = NetGetDCName_l(ctx, &r);
338         } else {
339                 werr = NetGetDCName_r(ctx, &r);
340         }
341
342         r.out.result = W_ERROR_V(werr);
343
344         if (DEBUGLEVEL >= 10) {
345                 NDR_PRINT_OUT_DEBUG(NetGetDCName, &r);
346         }
347
348         return r.out.result;
349 }
350
351 /****************************************************************
352  NetGetAnyDCName
353 ****************************************************************/
354
355 NET_API_STATUS NetGetAnyDCName(const char * server_name /* [in] [unique] */,
356                                const char * domain_name /* [in] [unique] */,
357                                uint8_t **buffer /* [out] [ref] */)
358 {
359         struct NetGetAnyDCName r;
360         struct libnetapi_ctx *ctx = NULL;
361         NET_API_STATUS status;
362         WERROR werr;
363
364         status = libnetapi_getctx(&ctx);
365         if (status != 0) {
366                 return status;
367         }
368
369         /* In parameters */
370         r.in.server_name = server_name;
371         r.in.domain_name = domain_name;
372
373         /* Out parameters */
374         r.out.buffer = buffer;
375
376         if (DEBUGLEVEL >= 10) {
377                 NDR_PRINT_IN_DEBUG(NetGetAnyDCName, &r);
378         }
379
380         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
381                 werr = NetGetAnyDCName_l(ctx, &r);
382         } else {
383                 werr = NetGetAnyDCName_r(ctx, &r);
384         }
385
386         r.out.result = W_ERROR_V(werr);
387
388         if (DEBUGLEVEL >= 10) {
389                 NDR_PRINT_OUT_DEBUG(NetGetAnyDCName, &r);
390         }
391
392         return r.out.result;
393 }
394
395 /****************************************************************
396  DsGetDcName
397 ****************************************************************/
398
399 NET_API_STATUS DsGetDcName(const char * server_name /* [in] [unique] */,
400                            const char * domain_name /* [in] [ref] */,
401                            struct GUID *domain_guid /* [in] [unique] */,
402                            const char * site_name /* [in] [unique] */,
403                            uint32_t flags /* [in] */,
404                            struct DOMAIN_CONTROLLER_INFO **dc_info /* [out] [ref] */)
405 {
406         struct DsGetDcName r;
407         struct libnetapi_ctx *ctx = NULL;
408         NET_API_STATUS status;
409         WERROR werr;
410
411         status = libnetapi_getctx(&ctx);
412         if (status != 0) {
413                 return status;
414         }
415
416         /* In parameters */
417         r.in.server_name = server_name;
418         r.in.domain_name = domain_name;
419         r.in.domain_guid = domain_guid;
420         r.in.site_name = site_name;
421         r.in.flags = flags;
422
423         /* Out parameters */
424         r.out.dc_info = dc_info;
425
426         if (DEBUGLEVEL >= 10) {
427                 NDR_PRINT_IN_DEBUG(DsGetDcName, &r);
428         }
429
430         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
431                 werr = DsGetDcName_l(ctx, &r);
432         } else {
433                 werr = DsGetDcName_r(ctx, &r);
434         }
435
436         r.out.result = W_ERROR_V(werr);
437
438         if (DEBUGLEVEL >= 10) {
439                 NDR_PRINT_OUT_DEBUG(DsGetDcName, &r);
440         }
441
442         return r.out.result;
443 }
444
445 /****************************************************************
446  NetUserAdd
447 ****************************************************************/
448
449 NET_API_STATUS NetUserAdd(const char * server_name /* [in] [unique] */,
450                           uint32_t level /* [in] */,
451                           uint8_t *buffer /* [in] [ref] */,
452                           uint32_t *parm_error /* [out] [ref] */)
453 {
454         struct NetUserAdd 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.level = level;
467         r.in.buffer = buffer;
468
469         /* Out parameters */
470         r.out.parm_error = parm_error;
471
472         if (DEBUGLEVEL >= 10) {
473                 NDR_PRINT_IN_DEBUG(NetUserAdd, &r);
474         }
475
476         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
477                 werr = NetUserAdd_l(ctx, &r);
478         } else {
479                 werr = NetUserAdd_r(ctx, &r);
480         }
481
482         r.out.result = W_ERROR_V(werr);
483
484         if (DEBUGLEVEL >= 10) {
485                 NDR_PRINT_OUT_DEBUG(NetUserAdd, &r);
486         }
487
488         return r.out.result;
489 }
490
491 /****************************************************************
492  NetUserDel
493 ****************************************************************/
494
495 NET_API_STATUS NetUserDel(const char * server_name /* [in] [unique] */,
496                           const char * user_name /* [in] [ref] */)
497 {
498         struct NetUserDel r;
499         struct libnetapi_ctx *ctx = NULL;
500         NET_API_STATUS status;
501         WERROR werr;
502
503         status = libnetapi_getctx(&ctx);
504         if (status != 0) {
505                 return status;
506         }
507
508         /* In parameters */
509         r.in.server_name = server_name;
510         r.in.user_name = user_name;
511
512         /* Out parameters */
513
514         if (DEBUGLEVEL >= 10) {
515                 NDR_PRINT_IN_DEBUG(NetUserDel, &r);
516         }
517
518         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
519                 werr = NetUserDel_l(ctx, &r);
520         } else {
521                 werr = NetUserDel_r(ctx, &r);
522         }
523
524         r.out.result = W_ERROR_V(werr);
525
526         if (DEBUGLEVEL >= 10) {
527                 NDR_PRINT_OUT_DEBUG(NetUserDel, &r);
528         }
529
530         return r.out.result;
531 }
532
533 /****************************************************************
534  NetUserEnum
535 ****************************************************************/
536
537 NET_API_STATUS NetUserEnum(const char * server_name /* [in] [unique] */,
538                            uint32_t level /* [in] */,
539                            uint32_t filter /* [in] */,
540                            uint8_t **buffer /* [out] [ref] */,
541                            uint32_t prefmaxlen /* [in] */,
542                            uint32_t *entries_read /* [out] [ref] */,
543                            uint32_t *total_entries /* [out] [ref] */,
544                            uint32_t *resume_handle /* [in,out] [ref] */)
545 {
546         struct NetUserEnum 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.level = level;
559         r.in.filter = filter;
560         r.in.prefmaxlen = prefmaxlen;
561         r.in.resume_handle = resume_handle;
562
563         /* Out parameters */
564         r.out.buffer = buffer;
565         r.out.entries_read = entries_read;
566         r.out.total_entries = total_entries;
567         r.out.resume_handle = resume_handle;
568
569         if (DEBUGLEVEL >= 10) {
570                 NDR_PRINT_IN_DEBUG(NetUserEnum, &r);
571         }
572
573         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
574                 werr = NetUserEnum_l(ctx, &r);
575         } else {
576                 werr = NetUserEnum_r(ctx, &r);
577         }
578
579         r.out.result = W_ERROR_V(werr);
580
581         if (DEBUGLEVEL >= 10) {
582                 NDR_PRINT_OUT_DEBUG(NetUserEnum, &r);
583         }
584
585         return r.out.result;
586 }
587
588 /****************************************************************
589  NetUserChangePassword
590 ****************************************************************/
591
592 NET_API_STATUS NetUserChangePassword(const char * domain_name /* [in] */,
593                                      const char * user_name /* [in] */,
594                                      const char * old_password /* [in] */,
595                                      const char * new_password /* [in] */)
596 {
597         struct NetUserChangePassword r;
598         struct libnetapi_ctx *ctx = NULL;
599         NET_API_STATUS status;
600         WERROR werr;
601
602         status = libnetapi_getctx(&ctx);
603         if (status != 0) {
604                 return status;
605         }
606
607         /* In parameters */
608         r.in.domain_name = domain_name;
609         r.in.user_name = user_name;
610         r.in.old_password = old_password;
611         r.in.new_password = new_password;
612
613         /* Out parameters */
614
615         if (DEBUGLEVEL >= 10) {
616                 NDR_PRINT_IN_DEBUG(NetUserChangePassword, &r);
617         }
618
619         if (LIBNETAPI_LOCAL_SERVER(domain_name)) {
620                 werr = NetUserChangePassword_l(ctx, &r);
621         } else {
622                 werr = NetUserChangePassword_r(ctx, &r);
623         }
624
625         r.out.result = W_ERROR_V(werr);
626
627         if (DEBUGLEVEL >= 10) {
628                 NDR_PRINT_OUT_DEBUG(NetUserChangePassword, &r);
629         }
630
631         return r.out.result;
632 }
633
634 /****************************************************************
635  NetUserGetInfo
636 ****************************************************************/
637
638 NET_API_STATUS NetUserGetInfo(const char * server_name /* [in] */,
639                               const char * user_name /* [in] */,
640                               uint32_t level /* [in] */,
641                               uint8_t **buffer /* [out] [ref] */)
642 {
643         struct NetUserGetInfo r;
644         struct libnetapi_ctx *ctx = NULL;
645         NET_API_STATUS status;
646         WERROR werr;
647
648         status = libnetapi_getctx(&ctx);
649         if (status != 0) {
650                 return status;
651         }
652
653         /* In parameters */
654         r.in.server_name = server_name;
655         r.in.user_name = user_name;
656         r.in.level = level;
657
658         /* Out parameters */
659         r.out.buffer = buffer;
660
661         if (DEBUGLEVEL >= 10) {
662                 NDR_PRINT_IN_DEBUG(NetUserGetInfo, &r);
663         }
664
665         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
666                 werr = NetUserGetInfo_l(ctx, &r);
667         } else {
668                 werr = NetUserGetInfo_r(ctx, &r);
669         }
670
671         r.out.result = W_ERROR_V(werr);
672
673         if (DEBUGLEVEL >= 10) {
674                 NDR_PRINT_OUT_DEBUG(NetUserGetInfo, &r);
675         }
676
677         return r.out.result;
678 }
679
680 /****************************************************************
681  NetUserSetInfo
682 ****************************************************************/
683
684 NET_API_STATUS NetUserSetInfo(const char * server_name /* [in] */,
685                               const char * user_name /* [in] */,
686                               uint32_t level /* [in] */,
687                               uint8_t *buffer /* [in] [ref] */,
688                               uint32_t *parm_err /* [out] [ref] */)
689 {
690         struct NetUserSetInfo r;
691         struct libnetapi_ctx *ctx = NULL;
692         NET_API_STATUS status;
693         WERROR werr;
694
695         status = libnetapi_getctx(&ctx);
696         if (status != 0) {
697                 return status;
698         }
699
700         /* In parameters */
701         r.in.server_name = server_name;
702         r.in.user_name = user_name;
703         r.in.level = level;
704         r.in.buffer = buffer;
705
706         /* Out parameters */
707         r.out.parm_err = parm_err;
708
709         if (DEBUGLEVEL >= 10) {
710                 NDR_PRINT_IN_DEBUG(NetUserSetInfo, &r);
711         }
712
713         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
714                 werr = NetUserSetInfo_l(ctx, &r);
715         } else {
716                 werr = NetUserSetInfo_r(ctx, &r);
717         }
718
719         r.out.result = W_ERROR_V(werr);
720
721         if (DEBUGLEVEL >= 10) {
722                 NDR_PRINT_OUT_DEBUG(NetUserSetInfo, &r);
723         }
724
725         return r.out.result;
726 }
727
728 /****************************************************************
729  NetUserModalsGet
730 ****************************************************************/
731
732 NET_API_STATUS NetUserModalsGet(const char * server_name /* [in] */,
733                                 uint32_t level /* [in] */,
734                                 uint8_t **buffer /* [out] [ref] */)
735 {
736         struct NetUserModalsGet r;
737         struct libnetapi_ctx *ctx = NULL;
738         NET_API_STATUS status;
739         WERROR werr;
740
741         status = libnetapi_getctx(&ctx);
742         if (status != 0) {
743                 return status;
744         }
745
746         /* In parameters */
747         r.in.server_name = server_name;
748         r.in.level = level;
749
750         /* Out parameters */
751         r.out.buffer = buffer;
752
753         if (DEBUGLEVEL >= 10) {
754                 NDR_PRINT_IN_DEBUG(NetUserModalsGet, &r);
755         }
756
757         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
758                 werr = NetUserModalsGet_l(ctx, &r);
759         } else {
760                 werr = NetUserModalsGet_r(ctx, &r);
761         }
762
763         r.out.result = W_ERROR_V(werr);
764
765         if (DEBUGLEVEL >= 10) {
766                 NDR_PRINT_OUT_DEBUG(NetUserModalsGet, &r);
767         }
768
769         return r.out.result;
770 }
771
772 /****************************************************************
773  NetUserModalsSet
774 ****************************************************************/
775
776 NET_API_STATUS NetUserModalsSet(const char * server_name /* [in] */,
777                                 uint32_t level /* [in] */,
778                                 uint8_t *buffer /* [in] [ref] */,
779                                 uint32_t *parm_err /* [out] [ref] */)
780 {
781         struct NetUserModalsSet r;
782         struct libnetapi_ctx *ctx = NULL;
783         NET_API_STATUS status;
784         WERROR werr;
785
786         status = libnetapi_getctx(&ctx);
787         if (status != 0) {
788                 return status;
789         }
790
791         /* In parameters */
792         r.in.server_name = server_name;
793         r.in.level = level;
794         r.in.buffer = buffer;
795
796         /* Out parameters */
797         r.out.parm_err = parm_err;
798
799         if (DEBUGLEVEL >= 10) {
800                 NDR_PRINT_IN_DEBUG(NetUserModalsSet, &r);
801         }
802
803         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
804                 werr = NetUserModalsSet_l(ctx, &r);
805         } else {
806                 werr = NetUserModalsSet_r(ctx, &r);
807         }
808
809         r.out.result = W_ERROR_V(werr);
810
811         if (DEBUGLEVEL >= 10) {
812                 NDR_PRINT_OUT_DEBUG(NetUserModalsSet, &r);
813         }
814
815         return r.out.result;
816 }
817
818 /****************************************************************
819  NetQueryDisplayInformation
820 ****************************************************************/
821
822 NET_API_STATUS NetQueryDisplayInformation(const char * server_name /* [in] [unique] */,
823                                           uint32_t level /* [in] */,
824                                           uint32_t idx /* [in] */,
825                                           uint32_t entries_requested /* [in] */,
826                                           uint32_t prefmaxlen /* [in] */,
827                                           uint32_t *entries_read /* [out] [ref] */,
828                                           void **buffer /* [out] [noprint,ref] */)
829 {
830         struct NetQueryDisplayInformation r;
831         struct libnetapi_ctx *ctx = NULL;
832         NET_API_STATUS status;
833         WERROR werr;
834
835         status = libnetapi_getctx(&ctx);
836         if (status != 0) {
837                 return status;
838         }
839
840         /* In parameters */
841         r.in.server_name = server_name;
842         r.in.level = level;
843         r.in.idx = idx;
844         r.in.entries_requested = entries_requested;
845         r.in.prefmaxlen = prefmaxlen;
846
847         /* Out parameters */
848         r.out.entries_read = entries_read;
849         r.out.buffer = buffer;
850
851         if (DEBUGLEVEL >= 10) {
852                 NDR_PRINT_IN_DEBUG(NetQueryDisplayInformation, &r);
853         }
854
855         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
856                 werr = NetQueryDisplayInformation_l(ctx, &r);
857         } else {
858                 werr = NetQueryDisplayInformation_r(ctx, &r);
859         }
860
861         r.out.result = W_ERROR_V(werr);
862
863         if (DEBUGLEVEL >= 10) {
864                 NDR_PRINT_OUT_DEBUG(NetQueryDisplayInformation, &r);
865         }
866
867         return r.out.result;
868 }
869
870 /****************************************************************
871  NetGroupAdd
872 ****************************************************************/
873
874 NET_API_STATUS NetGroupAdd(const char * server_name /* [in] */,
875                            uint32_t level /* [in] */,
876                            uint8_t *buffer /* [in] [ref] */,
877                            uint32_t *parm_err /* [out] [ref] */)
878 {
879         struct NetGroupAdd r;
880         struct libnetapi_ctx *ctx = NULL;
881         NET_API_STATUS status;
882         WERROR werr;
883
884         status = libnetapi_getctx(&ctx);
885         if (status != 0) {
886                 return status;
887         }
888
889         /* In parameters */
890         r.in.server_name = server_name;
891         r.in.level = level;
892         r.in.buffer = buffer;
893
894         /* Out parameters */
895         r.out.parm_err = parm_err;
896
897         if (DEBUGLEVEL >= 10) {
898                 NDR_PRINT_IN_DEBUG(NetGroupAdd, &r);
899         }
900
901         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
902                 werr = NetGroupAdd_l(ctx, &r);
903         } else {
904                 werr = NetGroupAdd_r(ctx, &r);
905         }
906
907         r.out.result = W_ERROR_V(werr);
908
909         if (DEBUGLEVEL >= 10) {
910                 NDR_PRINT_OUT_DEBUG(NetGroupAdd, &r);
911         }
912
913         return r.out.result;
914 }
915
916 /****************************************************************
917  NetGroupDel
918 ****************************************************************/
919
920 NET_API_STATUS NetGroupDel(const char * server_name /* [in] */,
921                            const char * group_name /* [in] */)
922 {
923         struct NetGroupDel r;
924         struct libnetapi_ctx *ctx = NULL;
925         NET_API_STATUS status;
926         WERROR werr;
927
928         status = libnetapi_getctx(&ctx);
929         if (status != 0) {
930                 return status;
931         }
932
933         /* In parameters */
934         r.in.server_name = server_name;
935         r.in.group_name = group_name;
936
937         /* Out parameters */
938
939         if (DEBUGLEVEL >= 10) {
940                 NDR_PRINT_IN_DEBUG(NetGroupDel, &r);
941         }
942
943         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
944                 werr = NetGroupDel_l(ctx, &r);
945         } else {
946                 werr = NetGroupDel_r(ctx, &r);
947         }
948
949         r.out.result = W_ERROR_V(werr);
950
951         if (DEBUGLEVEL >= 10) {
952                 NDR_PRINT_OUT_DEBUG(NetGroupDel, &r);
953         }
954
955         return r.out.result;
956 }
957
958 /****************************************************************
959  NetGroupEnum
960 ****************************************************************/
961
962 NET_API_STATUS NetGroupEnum(const char * server_name /* [in] */,
963                             uint32_t level /* [in] */,
964                             uint8_t **buffer /* [out] [ref] */,
965                             uint32_t prefmaxlen /* [in] */,
966                             uint32_t *entries_read /* [out] [ref] */,
967                             uint32_t *total_entries /* [out] [ref] */,
968                             uint32_t *resume_handle /* [in,out] [ref] */)
969 {
970         struct NetGroupEnum r;
971         struct libnetapi_ctx *ctx = NULL;
972         NET_API_STATUS status;
973         WERROR werr;
974
975         status = libnetapi_getctx(&ctx);
976         if (status != 0) {
977                 return status;
978         }
979
980         /* In parameters */
981         r.in.server_name = server_name;
982         r.in.level = level;
983         r.in.prefmaxlen = prefmaxlen;
984         r.in.resume_handle = resume_handle;
985
986         /* Out parameters */
987         r.out.buffer = buffer;
988         r.out.entries_read = entries_read;
989         r.out.total_entries = total_entries;
990         r.out.resume_handle = resume_handle;
991
992         if (DEBUGLEVEL >= 10) {
993                 NDR_PRINT_IN_DEBUG(NetGroupEnum, &r);
994         }
995
996         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
997                 werr = NetGroupEnum_l(ctx, &r);
998         } else {
999                 werr = NetGroupEnum_r(ctx, &r);
1000         }
1001
1002         r.out.result = W_ERROR_V(werr);
1003
1004         if (DEBUGLEVEL >= 10) {
1005                 NDR_PRINT_OUT_DEBUG(NetGroupEnum, &r);
1006         }
1007
1008         return r.out.result;
1009 }
1010
1011 /****************************************************************
1012  NetGroupSetInfo
1013 ****************************************************************/
1014
1015 NET_API_STATUS NetGroupSetInfo(const char * server_name /* [in] */,
1016                                const char * group_name /* [in] */,
1017                                uint32_t level /* [in] */,
1018                                uint8_t *buffer /* [in] [ref] */,
1019                                uint32_t *parm_err /* [out] [ref] */)
1020 {
1021         struct NetGroupSetInfo r;
1022         struct libnetapi_ctx *ctx = NULL;
1023         NET_API_STATUS status;
1024         WERROR werr;
1025
1026         status = libnetapi_getctx(&ctx);
1027         if (status != 0) {
1028                 return status;
1029         }
1030
1031         /* In parameters */
1032         r.in.server_name = server_name;
1033         r.in.group_name = group_name;
1034         r.in.level = level;
1035         r.in.buffer = buffer;
1036
1037         /* Out parameters */
1038         r.out.parm_err = parm_err;
1039
1040         if (DEBUGLEVEL >= 10) {
1041                 NDR_PRINT_IN_DEBUG(NetGroupSetInfo, &r);
1042         }
1043
1044         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1045                 werr = NetGroupSetInfo_l(ctx, &r);
1046         } else {
1047                 werr = NetGroupSetInfo_r(ctx, &r);
1048         }
1049
1050         r.out.result = W_ERROR_V(werr);
1051
1052         if (DEBUGLEVEL >= 10) {
1053                 NDR_PRINT_OUT_DEBUG(NetGroupSetInfo, &r);
1054         }
1055
1056         return r.out.result;
1057 }
1058
1059 /****************************************************************
1060  NetGroupGetInfo
1061 ****************************************************************/
1062
1063 NET_API_STATUS NetGroupGetInfo(const char * server_name /* [in] */,
1064                                const char * group_name /* [in] */,
1065                                uint32_t level /* [in] */,
1066                                uint8_t **buffer /* [out] [ref] */)
1067 {
1068         struct NetGroupGetInfo r;
1069         struct libnetapi_ctx *ctx = NULL;
1070         NET_API_STATUS status;
1071         WERROR werr;
1072
1073         status = libnetapi_getctx(&ctx);
1074         if (status != 0) {
1075                 return status;
1076         }
1077
1078         /* In parameters */
1079         r.in.server_name = server_name;
1080         r.in.group_name = group_name;
1081         r.in.level = level;
1082
1083         /* Out parameters */
1084         r.out.buffer = buffer;
1085
1086         if (DEBUGLEVEL >= 10) {
1087                 NDR_PRINT_IN_DEBUG(NetGroupGetInfo, &r);
1088         }
1089
1090         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1091                 werr = NetGroupGetInfo_l(ctx, &r);
1092         } else {
1093                 werr = NetGroupGetInfo_r(ctx, &r);
1094         }
1095
1096         r.out.result = W_ERROR_V(werr);
1097
1098         if (DEBUGLEVEL >= 10) {
1099                 NDR_PRINT_OUT_DEBUG(NetGroupGetInfo, &r);
1100         }
1101
1102         return r.out.result;
1103 }
1104
1105 /****************************************************************
1106  NetGroupAddUser
1107 ****************************************************************/
1108
1109 NET_API_STATUS NetGroupAddUser(const char * server_name /* [in] */,
1110                                const char * group_name /* [in] */,
1111                                const char * user_name /* [in] */)
1112 {
1113         struct NetGroupAddUser r;
1114         struct libnetapi_ctx *ctx = NULL;
1115         NET_API_STATUS status;
1116         WERROR werr;
1117
1118         status = libnetapi_getctx(&ctx);
1119         if (status != 0) {
1120                 return status;
1121         }
1122
1123         /* In parameters */
1124         r.in.server_name = server_name;
1125         r.in.group_name = group_name;
1126         r.in.user_name = user_name;
1127
1128         /* Out parameters */
1129
1130         if (DEBUGLEVEL >= 10) {
1131                 NDR_PRINT_IN_DEBUG(NetGroupAddUser, &r);
1132         }
1133
1134         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1135                 werr = NetGroupAddUser_l(ctx, &r);
1136         } else {
1137                 werr = NetGroupAddUser_r(ctx, &r);
1138         }
1139
1140         r.out.result = W_ERROR_V(werr);
1141
1142         if (DEBUGLEVEL >= 10) {
1143                 NDR_PRINT_OUT_DEBUG(NetGroupAddUser, &r);
1144         }
1145
1146         return r.out.result;
1147 }
1148
1149 /****************************************************************
1150  NetGroupDelUser
1151 ****************************************************************/
1152
1153 NET_API_STATUS NetGroupDelUser(const char * server_name /* [in] */,
1154                                const char * group_name /* [in] */,
1155                                const char * user_name /* [in] */)
1156 {
1157         struct NetGroupDelUser r;
1158         struct libnetapi_ctx *ctx = NULL;
1159         NET_API_STATUS status;
1160         WERROR werr;
1161
1162         status = libnetapi_getctx(&ctx);
1163         if (status != 0) {
1164                 return status;
1165         }
1166
1167         /* In parameters */
1168         r.in.server_name = server_name;
1169         r.in.group_name = group_name;
1170         r.in.user_name = user_name;
1171
1172         /* Out parameters */
1173
1174         if (DEBUGLEVEL >= 10) {
1175                 NDR_PRINT_IN_DEBUG(NetGroupDelUser, &r);
1176         }
1177
1178         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1179                 werr = NetGroupDelUser_l(ctx, &r);
1180         } else {
1181                 werr = NetGroupDelUser_r(ctx, &r);
1182         }
1183
1184         r.out.result = W_ERROR_V(werr);
1185
1186         if (DEBUGLEVEL >= 10) {
1187                 NDR_PRINT_OUT_DEBUG(NetGroupDelUser, &r);
1188         }
1189
1190         return r.out.result;
1191 }
1192
1193 /****************************************************************
1194  NetGroupGetUsers
1195 ****************************************************************/
1196
1197 NET_API_STATUS NetGroupGetUsers(const char * server_name /* [in] */,
1198                                 const char * group_name /* [in] */,
1199                                 uint32_t level /* [in] */,
1200                                 uint8_t **buffer /* [out] [ref] */,
1201                                 uint32_t prefmaxlen /* [in] */,
1202                                 uint32_t *entries_read /* [out] [ref] */,
1203                                 uint32_t *total_entries /* [out] [ref] */,
1204                                 uint32_t *resume_handle /* [in,out] [ref] */)
1205 {
1206         struct NetGroupGetUsers r;
1207         struct libnetapi_ctx *ctx = NULL;
1208         NET_API_STATUS status;
1209         WERROR werr;
1210
1211         status = libnetapi_getctx(&ctx);
1212         if (status != 0) {
1213                 return status;
1214         }
1215
1216         /* In parameters */
1217         r.in.server_name = server_name;
1218         r.in.group_name = group_name;
1219         r.in.level = level;
1220         r.in.prefmaxlen = prefmaxlen;
1221         r.in.resume_handle = resume_handle;
1222
1223         /* Out parameters */
1224         r.out.buffer = buffer;
1225         r.out.entries_read = entries_read;
1226         r.out.total_entries = total_entries;
1227         r.out.resume_handle = resume_handle;
1228
1229         if (DEBUGLEVEL >= 10) {
1230                 NDR_PRINT_IN_DEBUG(NetGroupGetUsers, &r);
1231         }
1232
1233         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1234                 werr = NetGroupGetUsers_l(ctx, &r);
1235         } else {
1236                 werr = NetGroupGetUsers_r(ctx, &r);
1237         }
1238
1239         r.out.result = W_ERROR_V(werr);
1240
1241         if (DEBUGLEVEL >= 10) {
1242                 NDR_PRINT_OUT_DEBUG(NetGroupGetUsers, &r);
1243         }
1244
1245         return r.out.result;
1246 }
1247
1248 /****************************************************************
1249  NetLocalGroupAdd
1250 ****************************************************************/
1251
1252 NET_API_STATUS NetLocalGroupAdd(const char * server_name /* [in] */,
1253                                 uint32_t level /* [in] */,
1254                                 uint8_t *buffer /* [in] [ref] */,
1255                                 uint32_t *parm_err /* [out] [ref] */)
1256 {
1257         struct NetLocalGroupAdd r;
1258         struct libnetapi_ctx *ctx = NULL;
1259         NET_API_STATUS status;
1260         WERROR werr;
1261
1262         status = libnetapi_getctx(&ctx);
1263         if (status != 0) {
1264                 return status;
1265         }
1266
1267         /* In parameters */
1268         r.in.server_name = server_name;
1269         r.in.level = level;
1270         r.in.buffer = buffer;
1271
1272         /* Out parameters */
1273         r.out.parm_err = parm_err;
1274
1275         if (DEBUGLEVEL >= 10) {
1276                 NDR_PRINT_IN_DEBUG(NetLocalGroupAdd, &r);
1277         }
1278
1279         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1280                 werr = NetLocalGroupAdd_l(ctx, &r);
1281         } else {
1282                 werr = NetLocalGroupAdd_r(ctx, &r);
1283         }
1284
1285         r.out.result = W_ERROR_V(werr);
1286
1287         if (DEBUGLEVEL >= 10) {
1288                 NDR_PRINT_OUT_DEBUG(NetLocalGroupAdd, &r);
1289         }
1290
1291         return r.out.result;
1292 }
1293
1294 /****************************************************************
1295  NetLocalGroupDel
1296 ****************************************************************/
1297
1298 NET_API_STATUS NetLocalGroupDel(const char * server_name /* [in] */,
1299                                 const char * group_name /* [in] */)
1300 {
1301         struct NetLocalGroupDel r;
1302         struct libnetapi_ctx *ctx = NULL;
1303         NET_API_STATUS status;
1304         WERROR werr;
1305
1306         status = libnetapi_getctx(&ctx);
1307         if (status != 0) {
1308                 return status;
1309         }
1310
1311         /* In parameters */
1312         r.in.server_name = server_name;
1313         r.in.group_name = group_name;
1314
1315         /* Out parameters */
1316
1317         if (DEBUGLEVEL >= 10) {
1318                 NDR_PRINT_IN_DEBUG(NetLocalGroupDel, &r);
1319         }
1320
1321         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1322                 werr = NetLocalGroupDel_l(ctx, &r);
1323         } else {
1324                 werr = NetLocalGroupDel_r(ctx, &r);
1325         }
1326
1327         r.out.result = W_ERROR_V(werr);
1328
1329         if (DEBUGLEVEL >= 10) {
1330                 NDR_PRINT_OUT_DEBUG(NetLocalGroupDel, &r);
1331         }
1332
1333         return r.out.result;
1334 }
1335
1336 /****************************************************************
1337  NetLocalGroupGetInfo
1338 ****************************************************************/
1339
1340 NET_API_STATUS NetLocalGroupGetInfo(const char * server_name /* [in] */,
1341                                     const char * group_name /* [in] */,
1342                                     uint32_t level /* [in] */,
1343                                     uint8_t **buffer /* [out] [ref] */)
1344 {
1345         struct NetLocalGroupGetInfo r;
1346         struct libnetapi_ctx *ctx = NULL;
1347         NET_API_STATUS status;
1348         WERROR werr;
1349
1350         status = libnetapi_getctx(&ctx);
1351         if (status != 0) {
1352                 return status;
1353         }
1354
1355         /* In parameters */
1356         r.in.server_name = server_name;
1357         r.in.group_name = group_name;
1358         r.in.level = level;
1359
1360         /* Out parameters */
1361         r.out.buffer = buffer;
1362
1363         if (DEBUGLEVEL >= 10) {
1364                 NDR_PRINT_IN_DEBUG(NetLocalGroupGetInfo, &r);
1365         }
1366
1367         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1368                 werr = NetLocalGroupGetInfo_l(ctx, &r);
1369         } else {
1370                 werr = NetLocalGroupGetInfo_r(ctx, &r);
1371         }
1372
1373         r.out.result = W_ERROR_V(werr);
1374
1375         if (DEBUGLEVEL >= 10) {
1376                 NDR_PRINT_OUT_DEBUG(NetLocalGroupGetInfo, &r);
1377         }
1378
1379         return r.out.result;
1380 }
1381
1382 /****************************************************************
1383  NetLocalGroupSetInfo
1384 ****************************************************************/
1385
1386 NET_API_STATUS NetLocalGroupSetInfo(const char * server_name /* [in] */,
1387                                     const char * group_name /* [in] */,
1388                                     uint32_t level /* [in] */,
1389                                     uint8_t *buffer /* [in] [ref] */,
1390                                     uint32_t *parm_err /* [out] [ref] */)
1391 {
1392         struct NetLocalGroupSetInfo r;
1393         struct libnetapi_ctx *ctx = NULL;
1394         NET_API_STATUS status;
1395         WERROR werr;
1396
1397         status = libnetapi_getctx(&ctx);
1398         if (status != 0) {
1399                 return status;
1400         }
1401
1402         /* In parameters */
1403         r.in.server_name = server_name;
1404         r.in.group_name = group_name;
1405         r.in.level = level;
1406         r.in.buffer = buffer;
1407
1408         /* Out parameters */
1409         r.out.parm_err = parm_err;
1410
1411         if (DEBUGLEVEL >= 10) {
1412                 NDR_PRINT_IN_DEBUG(NetLocalGroupSetInfo, &r);
1413         }
1414
1415         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1416                 werr = NetLocalGroupSetInfo_l(ctx, &r);
1417         } else {
1418                 werr = NetLocalGroupSetInfo_r(ctx, &r);
1419         }
1420
1421         r.out.result = W_ERROR_V(werr);
1422
1423         if (DEBUGLEVEL >= 10) {
1424                 NDR_PRINT_OUT_DEBUG(NetLocalGroupSetInfo, &r);
1425         }
1426
1427         return r.out.result;
1428 }
1429
1430 /****************************************************************
1431  NetLocalGroupEnum
1432 ****************************************************************/
1433
1434 NET_API_STATUS NetLocalGroupEnum(const char * server_name /* [in] */,
1435                                  uint32_t level /* [in] */,
1436                                  uint8_t **buffer /* [out] [ref] */,
1437                                  uint32_t prefmaxlen /* [in] */,
1438                                  uint32_t *entries_read /* [out] [ref] */,
1439                                  uint32_t *total_entries /* [out] [ref] */,
1440                                  uint32_t *resume_handle /* [in,out] [ref] */)
1441 {
1442         struct NetLocalGroupEnum r;
1443         struct libnetapi_ctx *ctx = NULL;
1444         NET_API_STATUS status;
1445         WERROR werr;
1446
1447         status = libnetapi_getctx(&ctx);
1448         if (status != 0) {
1449                 return status;
1450         }
1451
1452         /* In parameters */
1453         r.in.server_name = server_name;
1454         r.in.level = level;
1455         r.in.prefmaxlen = prefmaxlen;
1456         r.in.resume_handle = resume_handle;
1457
1458         /* Out parameters */
1459         r.out.buffer = buffer;
1460         r.out.entries_read = entries_read;
1461         r.out.total_entries = total_entries;
1462         r.out.resume_handle = resume_handle;
1463
1464         if (DEBUGLEVEL >= 10) {
1465                 NDR_PRINT_IN_DEBUG(NetLocalGroupEnum, &r);
1466         }
1467
1468         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1469                 werr = NetLocalGroupEnum_l(ctx, &r);
1470         } else {
1471                 werr = NetLocalGroupEnum_r(ctx, &r);
1472         }
1473
1474         r.out.result = W_ERROR_V(werr);
1475
1476         if (DEBUGLEVEL >= 10) {
1477                 NDR_PRINT_OUT_DEBUG(NetLocalGroupEnum, &r);
1478         }
1479
1480         return r.out.result;
1481 }
1482
1483 /****************************************************************
1484  NetLocalGroupAddMembers
1485 ****************************************************************/
1486
1487 NET_API_STATUS NetLocalGroupAddMembers(const char * server_name /* [in] */,
1488                                        const char * group_name /* [in] */,
1489                                        uint32_t level /* [in] */,
1490                                        uint8_t *buffer /* [in] [ref] */,
1491                                        uint32_t total_entries /* [in] */)
1492 {
1493         struct NetLocalGroupAddMembers r;
1494         struct libnetapi_ctx *ctx = NULL;
1495         NET_API_STATUS status;
1496         WERROR werr;
1497
1498         status = libnetapi_getctx(&ctx);
1499         if (status != 0) {
1500                 return status;
1501         }
1502
1503         /* In parameters */
1504         r.in.server_name = server_name;
1505         r.in.group_name = group_name;
1506         r.in.level = level;
1507         r.in.buffer = buffer;
1508         r.in.total_entries = total_entries;
1509
1510         /* Out parameters */
1511
1512         if (DEBUGLEVEL >= 10) {
1513                 NDR_PRINT_IN_DEBUG(NetLocalGroupAddMembers, &r);
1514         }
1515
1516         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1517                 werr = NetLocalGroupAddMembers_l(ctx, &r);
1518         } else {
1519                 werr = NetLocalGroupAddMembers_r(ctx, &r);
1520         }
1521
1522         r.out.result = W_ERROR_V(werr);
1523
1524         if (DEBUGLEVEL >= 10) {
1525                 NDR_PRINT_OUT_DEBUG(NetLocalGroupAddMembers, &r);
1526         }
1527
1528         return r.out.result;
1529 }
1530
1531 /****************************************************************
1532  NetLocalGroupDelMembers
1533 ****************************************************************/
1534
1535 NET_API_STATUS NetLocalGroupDelMembers(const char * server_name /* [in] */,
1536                                        const char * group_name /* [in] */,
1537                                        uint32_t level /* [in] */,
1538                                        uint8_t *buffer /* [in] [ref] */,
1539                                        uint32_t total_entries /* [in] */)
1540 {
1541         struct NetLocalGroupDelMembers r;
1542         struct libnetapi_ctx *ctx = NULL;
1543         NET_API_STATUS status;
1544         WERROR werr;
1545
1546         status = libnetapi_getctx(&ctx);
1547         if (status != 0) {
1548                 return status;
1549         }
1550
1551         /* In parameters */
1552         r.in.server_name = server_name;
1553         r.in.group_name = group_name;
1554         r.in.level = level;
1555         r.in.buffer = buffer;
1556         r.in.total_entries = total_entries;
1557
1558         /* Out parameters */
1559
1560         if (DEBUGLEVEL >= 10) {
1561                 NDR_PRINT_IN_DEBUG(NetLocalGroupDelMembers, &r);
1562         }
1563
1564         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1565                 werr = NetLocalGroupDelMembers_l(ctx, &r);
1566         } else {
1567                 werr = NetLocalGroupDelMembers_r(ctx, &r);
1568         }
1569
1570         r.out.result = W_ERROR_V(werr);
1571
1572         if (DEBUGLEVEL >= 10) {
1573                 NDR_PRINT_OUT_DEBUG(NetLocalGroupDelMembers, &r);
1574         }
1575
1576         return r.out.result;
1577 }
1578
1579 /****************************************************************
1580  NetLocalGroupGetMembers
1581 ****************************************************************/
1582
1583 NET_API_STATUS NetLocalGroupGetMembers(const char * server_name /* [in] */,
1584                                        const char * local_group_name /* [in] */,
1585                                        uint32_t level /* [in] */,
1586                                        uint8_t **buffer /* [out] [ref] */,
1587                                        uint32_t prefmaxlen /* [in] */,
1588                                        uint32_t *entries_read /* [out] [ref] */,
1589                                        uint32_t *total_entries /* [out] [ref] */,
1590                                        uint32_t *resume_handle /* [in,out] [ref] */)
1591 {
1592         struct NetLocalGroupGetMembers r;
1593         struct libnetapi_ctx *ctx = NULL;
1594         NET_API_STATUS status;
1595         WERROR werr;
1596
1597         status = libnetapi_getctx(&ctx);
1598         if (status != 0) {
1599                 return status;
1600         }
1601
1602         /* In parameters */
1603         r.in.server_name = server_name;
1604         r.in.local_group_name = local_group_name;
1605         r.in.level = level;
1606         r.in.prefmaxlen = prefmaxlen;
1607         r.in.resume_handle = resume_handle;
1608
1609         /* Out parameters */
1610         r.out.buffer = buffer;
1611         r.out.entries_read = entries_read;
1612         r.out.total_entries = total_entries;
1613         r.out.resume_handle = resume_handle;
1614
1615         if (DEBUGLEVEL >= 10) {
1616                 NDR_PRINT_IN_DEBUG(NetLocalGroupGetMembers, &r);
1617         }
1618
1619         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1620                 werr = NetLocalGroupGetMembers_l(ctx, &r);
1621         } else {
1622                 werr = NetLocalGroupGetMembers_r(ctx, &r);
1623         }
1624
1625         r.out.result = W_ERROR_V(werr);
1626
1627         if (DEBUGLEVEL >= 10) {
1628                 NDR_PRINT_OUT_DEBUG(NetLocalGroupGetMembers, &r);
1629         }
1630
1631         return r.out.result;
1632 }
1633
1634 /****************************************************************
1635  NetLocalGroupSetMembers
1636 ****************************************************************/
1637
1638 NET_API_STATUS NetLocalGroupSetMembers(const char * server_name /* [in] */,
1639                                        const char * group_name /* [in] */,
1640                                        uint32_t level /* [in] */,
1641                                        uint8_t *buffer /* [in] [ref] */,
1642                                        uint32_t total_entries /* [in] */)
1643 {
1644         struct NetLocalGroupSetMembers r;
1645         struct libnetapi_ctx *ctx = NULL;
1646         NET_API_STATUS status;
1647         WERROR werr;
1648
1649         status = libnetapi_getctx(&ctx);
1650         if (status != 0) {
1651                 return status;
1652         }
1653
1654         /* In parameters */
1655         r.in.server_name = server_name;
1656         r.in.group_name = group_name;
1657         r.in.level = level;
1658         r.in.buffer = buffer;
1659         r.in.total_entries = total_entries;
1660
1661         /* Out parameters */
1662
1663         if (DEBUGLEVEL >= 10) {
1664                 NDR_PRINT_IN_DEBUG(NetLocalGroupSetMembers, &r);
1665         }
1666
1667         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1668                 werr = NetLocalGroupSetMembers_l(ctx, &r);
1669         } else {
1670                 werr = NetLocalGroupSetMembers_r(ctx, &r);
1671         }
1672
1673         r.out.result = W_ERROR_V(werr);
1674
1675         if (DEBUGLEVEL >= 10) {
1676                 NDR_PRINT_OUT_DEBUG(NetLocalGroupSetMembers, &r);
1677         }
1678
1679         return r.out.result;
1680 }
1681
1682 /****************************************************************
1683  NetRemoteTOD
1684 ****************************************************************/
1685
1686 NET_API_STATUS NetRemoteTOD(const char * server_name /* [in] */,
1687                             uint8_t **buffer /* [out] [ref] */)
1688 {
1689         struct NetRemoteTOD r;
1690         struct libnetapi_ctx *ctx = NULL;
1691         NET_API_STATUS status;
1692         WERROR werr;
1693
1694         status = libnetapi_getctx(&ctx);
1695         if (status != 0) {
1696                 return status;
1697         }
1698
1699         /* In parameters */
1700         r.in.server_name = server_name;
1701
1702         /* Out parameters */
1703         r.out.buffer = buffer;
1704
1705         if (DEBUGLEVEL >= 10) {
1706                 NDR_PRINT_IN_DEBUG(NetRemoteTOD, &r);
1707         }
1708
1709         if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1710                 werr = NetRemoteTOD_l(ctx, &r);
1711         } else {
1712                 werr = NetRemoteTOD_r(ctx, &r);
1713         }
1714
1715         r.out.result = W_ERROR_V(werr);
1716
1717         if (DEBUGLEVEL >= 10) {
1718                 NDR_PRINT_OUT_DEBUG(NetRemoteTOD, &r);
1719         }
1720
1721         return r.out.result;
1722 }
1723