dbwrap: Use tdb_null in db_ctdb_delete
[Samba/gbeck.git] / source3 / lib / netapi / libnetapi.c
blob45bb1d5d821a359c209ddd5d8905e7b7bb7edbfb
1 /*
2 * Unix SMB/CIFS implementation.
3 * NetApi Support
4 * Copyright (C) Guenther Deschner 2007-2008
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.
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.
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/>.
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"
27 /****************************************************************
28 NetJoinDomain
29 ****************************************************************/
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] */)
38 struct NetJoinDomain r;
39 struct libnetapi_ctx *ctx = NULL;
40 NET_API_STATUS status;
41 WERROR werr;
42 TALLOC_CTX *frame = talloc_stackframe();
44 status = libnetapi_getctx(&ctx);
45 if (status != 0) {
46 TALLOC_FREE(frame);
47 return status;
50 /* In parameters */
51 r.in.server = server;
52 r.in.domain = domain;
53 r.in.account_ou = account_ou;
54 r.in.account = account;
55 r.in.password = password;
56 r.in.join_flags = join_flags;
58 /* Out parameters */
60 if (DEBUGLEVEL >= 10) {
61 NDR_PRINT_IN_DEBUG(NetJoinDomain, &r);
64 if (LIBNETAPI_LOCAL_SERVER(server)) {
65 werr = NetJoinDomain_l(ctx, &r);
66 } else {
67 werr = NetJoinDomain_r(ctx, &r);
70 r.out.result = W_ERROR_V(werr);
72 if (DEBUGLEVEL >= 10) {
73 NDR_PRINT_OUT_DEBUG(NetJoinDomain, &r);
76 TALLOC_FREE(frame);
77 return (NET_API_STATUS)r.out.result;
80 /****************************************************************
81 NetUnjoinDomain
82 ****************************************************************/
84 NET_API_STATUS NetUnjoinDomain(const char * server_name /* [in] [unique] */,
85 const char * account /* [in] [unique] */,
86 const char * password /* [in] [unique] */,
87 uint32_t unjoin_flags /* [in] */)
89 struct NetUnjoinDomain r;
90 struct libnetapi_ctx *ctx = NULL;
91 NET_API_STATUS status;
92 WERROR werr;
93 TALLOC_CTX *frame = talloc_stackframe();
95 status = libnetapi_getctx(&ctx);
96 if (status != 0) {
97 TALLOC_FREE(frame);
98 return status;
101 /* In parameters */
102 r.in.server_name = server_name;
103 r.in.account = account;
104 r.in.password = password;
105 r.in.unjoin_flags = unjoin_flags;
107 /* Out parameters */
109 if (DEBUGLEVEL >= 10) {
110 NDR_PRINT_IN_DEBUG(NetUnjoinDomain, &r);
113 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
114 werr = NetUnjoinDomain_l(ctx, &r);
115 } else {
116 werr = NetUnjoinDomain_r(ctx, &r);
119 r.out.result = W_ERROR_V(werr);
121 if (DEBUGLEVEL >= 10) {
122 NDR_PRINT_OUT_DEBUG(NetUnjoinDomain, &r);
125 TALLOC_FREE(frame);
126 return (NET_API_STATUS)r.out.result;
129 /****************************************************************
130 NetGetJoinInformation
131 ****************************************************************/
133 NET_API_STATUS NetGetJoinInformation(const char * server_name /* [in] [unique] */,
134 const char * *name_buffer /* [out] [ref] */,
135 uint16_t *name_type /* [out] [ref] */)
137 struct NetGetJoinInformation r;
138 struct libnetapi_ctx *ctx = NULL;
139 NET_API_STATUS status;
140 WERROR werr;
141 TALLOC_CTX *frame = talloc_stackframe();
143 status = libnetapi_getctx(&ctx);
144 if (status != 0) {
145 TALLOC_FREE(frame);
146 return status;
149 /* In parameters */
150 r.in.server_name = server_name;
152 /* Out parameters */
153 r.out.name_buffer = name_buffer;
154 r.out.name_type = name_type;
156 if (DEBUGLEVEL >= 10) {
157 NDR_PRINT_IN_DEBUG(NetGetJoinInformation, &r);
160 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
161 werr = NetGetJoinInformation_l(ctx, &r);
162 } else {
163 werr = NetGetJoinInformation_r(ctx, &r);
166 r.out.result = W_ERROR_V(werr);
168 if (DEBUGLEVEL >= 10) {
169 NDR_PRINT_OUT_DEBUG(NetGetJoinInformation, &r);
172 TALLOC_FREE(frame);
173 return (NET_API_STATUS)r.out.result;
176 /****************************************************************
177 NetGetJoinableOUs
178 ****************************************************************/
180 NET_API_STATUS NetGetJoinableOUs(const char * server_name /* [in] [unique] */,
181 const char * domain /* [in] [ref] */,
182 const char * account /* [in] [unique] */,
183 const char * password /* [in] [unique] */,
184 uint32_t *ou_count /* [out] [ref] */,
185 const char * **ous /* [out] [ref] */)
187 struct NetGetJoinableOUs r;
188 struct libnetapi_ctx *ctx = NULL;
189 NET_API_STATUS status;
190 WERROR werr;
191 TALLOC_CTX *frame = talloc_stackframe();
193 status = libnetapi_getctx(&ctx);
194 if (status != 0) {
195 TALLOC_FREE(frame);
196 return status;
199 /* In parameters */
200 r.in.server_name = server_name;
201 r.in.domain = domain;
202 r.in.account = account;
203 r.in.password = password;
205 /* Out parameters */
206 r.out.ou_count = ou_count;
207 r.out.ous = ous;
209 if (DEBUGLEVEL >= 10) {
210 NDR_PRINT_IN_DEBUG(NetGetJoinableOUs, &r);
213 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
214 werr = NetGetJoinableOUs_l(ctx, &r);
215 } else {
216 werr = NetGetJoinableOUs_r(ctx, &r);
219 r.out.result = W_ERROR_V(werr);
221 if (DEBUGLEVEL >= 10) {
222 NDR_PRINT_OUT_DEBUG(NetGetJoinableOUs, &r);
225 TALLOC_FREE(frame);
226 return (NET_API_STATUS)r.out.result;
229 /****************************************************************
230 NetRenameMachineInDomain
231 ****************************************************************/
233 NET_API_STATUS NetRenameMachineInDomain(const char * server_name /* [in] */,
234 const char * new_machine_name /* [in] */,
235 const char * account /* [in] */,
236 const char * password /* [in] */,
237 uint32_t rename_options /* [in] */)
239 struct NetRenameMachineInDomain r;
240 struct libnetapi_ctx *ctx = NULL;
241 NET_API_STATUS status;
242 WERROR werr;
243 TALLOC_CTX *frame = talloc_stackframe();
245 status = libnetapi_getctx(&ctx);
246 if (status != 0) {
247 TALLOC_FREE(frame);
248 return status;
251 /* In parameters */
252 r.in.server_name = server_name;
253 r.in.new_machine_name = new_machine_name;
254 r.in.account = account;
255 r.in.password = password;
256 r.in.rename_options = rename_options;
258 /* Out parameters */
260 if (DEBUGLEVEL >= 10) {
261 NDR_PRINT_IN_DEBUG(NetRenameMachineInDomain, &r);
264 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
265 werr = NetRenameMachineInDomain_l(ctx, &r);
266 } else {
267 werr = NetRenameMachineInDomain_r(ctx, &r);
270 r.out.result = W_ERROR_V(werr);
272 if (DEBUGLEVEL >= 10) {
273 NDR_PRINT_OUT_DEBUG(NetRenameMachineInDomain, &r);
276 TALLOC_FREE(frame);
277 return (NET_API_STATUS)r.out.result;
280 /****************************************************************
281 NetServerGetInfo
282 ****************************************************************/
284 NET_API_STATUS NetServerGetInfo(const char * server_name /* [in] [unique] */,
285 uint32_t level /* [in] */,
286 uint8_t **buffer /* [out] [ref] */)
288 struct NetServerGetInfo r;
289 struct libnetapi_ctx *ctx = NULL;
290 NET_API_STATUS status;
291 WERROR werr;
292 TALLOC_CTX *frame = talloc_stackframe();
294 status = libnetapi_getctx(&ctx);
295 if (status != 0) {
296 TALLOC_FREE(frame);
297 return status;
300 /* In parameters */
301 r.in.server_name = server_name;
302 r.in.level = level;
304 /* Out parameters */
305 r.out.buffer = buffer;
307 if (DEBUGLEVEL >= 10) {
308 NDR_PRINT_IN_DEBUG(NetServerGetInfo, &r);
311 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
312 werr = NetServerGetInfo_l(ctx, &r);
313 } else {
314 werr = NetServerGetInfo_r(ctx, &r);
317 r.out.result = W_ERROR_V(werr);
319 if (DEBUGLEVEL >= 10) {
320 NDR_PRINT_OUT_DEBUG(NetServerGetInfo, &r);
323 TALLOC_FREE(frame);
324 return (NET_API_STATUS)r.out.result;
327 /****************************************************************
328 NetServerSetInfo
329 ****************************************************************/
331 NET_API_STATUS NetServerSetInfo(const char * server_name /* [in] [unique] */,
332 uint32_t level /* [in] */,
333 uint8_t *buffer /* [in] [ref] */,
334 uint32_t *parm_error /* [out] [ref] */)
336 struct NetServerSetInfo r;
337 struct libnetapi_ctx *ctx = NULL;
338 NET_API_STATUS status;
339 WERROR werr;
340 TALLOC_CTX *frame = talloc_stackframe();
342 status = libnetapi_getctx(&ctx);
343 if (status != 0) {
344 TALLOC_FREE(frame);
345 return status;
348 /* In parameters */
349 r.in.server_name = server_name;
350 r.in.level = level;
351 r.in.buffer = buffer;
353 /* Out parameters */
354 r.out.parm_error = parm_error;
356 if (DEBUGLEVEL >= 10) {
357 NDR_PRINT_IN_DEBUG(NetServerSetInfo, &r);
360 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
361 werr = NetServerSetInfo_l(ctx, &r);
362 } else {
363 werr = NetServerSetInfo_r(ctx, &r);
366 r.out.result = W_ERROR_V(werr);
368 if (DEBUGLEVEL >= 10) {
369 NDR_PRINT_OUT_DEBUG(NetServerSetInfo, &r);
372 TALLOC_FREE(frame);
373 return (NET_API_STATUS)r.out.result;
376 /****************************************************************
377 NetGetDCName
378 ****************************************************************/
380 NET_API_STATUS NetGetDCName(const char * server_name /* [in] [unique] */,
381 const char * domain_name /* [in] [unique] */,
382 uint8_t **buffer /* [out] [ref] */)
384 struct NetGetDCName r;
385 struct libnetapi_ctx *ctx = NULL;
386 NET_API_STATUS status;
387 WERROR werr;
388 TALLOC_CTX *frame = talloc_stackframe();
390 status = libnetapi_getctx(&ctx);
391 if (status != 0) {
392 TALLOC_FREE(frame);
393 return status;
396 /* In parameters */
397 r.in.server_name = server_name;
398 r.in.domain_name = domain_name;
400 /* Out parameters */
401 r.out.buffer = buffer;
403 if (DEBUGLEVEL >= 10) {
404 NDR_PRINT_IN_DEBUG(NetGetDCName, &r);
407 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
408 werr = NetGetDCName_l(ctx, &r);
409 } else {
410 werr = NetGetDCName_r(ctx, &r);
413 r.out.result = W_ERROR_V(werr);
415 if (DEBUGLEVEL >= 10) {
416 NDR_PRINT_OUT_DEBUG(NetGetDCName, &r);
419 TALLOC_FREE(frame);
420 return (NET_API_STATUS)r.out.result;
423 /****************************************************************
424 NetGetAnyDCName
425 ****************************************************************/
427 NET_API_STATUS NetGetAnyDCName(const char * server_name /* [in] [unique] */,
428 const char * domain_name /* [in] [unique] */,
429 uint8_t **buffer /* [out] [ref] */)
431 struct NetGetAnyDCName r;
432 struct libnetapi_ctx *ctx = NULL;
433 NET_API_STATUS status;
434 WERROR werr;
435 TALLOC_CTX *frame = talloc_stackframe();
437 status = libnetapi_getctx(&ctx);
438 if (status != 0) {
439 TALLOC_FREE(frame);
440 return status;
443 /* In parameters */
444 r.in.server_name = server_name;
445 r.in.domain_name = domain_name;
447 /* Out parameters */
448 r.out.buffer = buffer;
450 if (DEBUGLEVEL >= 10) {
451 NDR_PRINT_IN_DEBUG(NetGetAnyDCName, &r);
454 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
455 werr = NetGetAnyDCName_l(ctx, &r);
456 } else {
457 werr = NetGetAnyDCName_r(ctx, &r);
460 r.out.result = W_ERROR_V(werr);
462 if (DEBUGLEVEL >= 10) {
463 NDR_PRINT_OUT_DEBUG(NetGetAnyDCName, &r);
466 TALLOC_FREE(frame);
467 return (NET_API_STATUS)r.out.result;
470 /****************************************************************
471 DsGetDcName
472 ****************************************************************/
474 NET_API_STATUS DsGetDcName(const char * server_name /* [in] [unique] */,
475 const char * domain_name /* [in] [ref] */,
476 struct GUID *domain_guid /* [in] [unique] */,
477 const char * site_name /* [in] [unique] */,
478 uint32_t flags /* [in] */,
479 struct DOMAIN_CONTROLLER_INFO **dc_info /* [out] [ref] */)
481 struct DsGetDcName r;
482 struct libnetapi_ctx *ctx = NULL;
483 NET_API_STATUS status;
484 WERROR werr;
485 TALLOC_CTX *frame = talloc_stackframe();
487 status = libnetapi_getctx(&ctx);
488 if (status != 0) {
489 TALLOC_FREE(frame);
490 return status;
493 /* In parameters */
494 r.in.server_name = server_name;
495 r.in.domain_name = domain_name;
496 r.in.domain_guid = domain_guid;
497 r.in.site_name = site_name;
498 r.in.flags = flags;
500 /* Out parameters */
501 r.out.dc_info = dc_info;
503 if (DEBUGLEVEL >= 10) {
504 NDR_PRINT_IN_DEBUG(DsGetDcName, &r);
507 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
508 werr = DsGetDcName_l(ctx, &r);
509 } else {
510 werr = DsGetDcName_r(ctx, &r);
513 r.out.result = W_ERROR_V(werr);
515 if (DEBUGLEVEL >= 10) {
516 NDR_PRINT_OUT_DEBUG(DsGetDcName, &r);
519 TALLOC_FREE(frame);
520 return (NET_API_STATUS)r.out.result;
523 /****************************************************************
524 NetUserAdd
525 ****************************************************************/
527 NET_API_STATUS NetUserAdd(const char * server_name /* [in] [unique] */,
528 uint32_t level /* [in] */,
529 uint8_t *buffer /* [in] [ref] */,
530 uint32_t *parm_error /* [out] [ref] */)
532 struct NetUserAdd r;
533 struct libnetapi_ctx *ctx = NULL;
534 NET_API_STATUS status;
535 WERROR werr;
536 TALLOC_CTX *frame = talloc_stackframe();
538 status = libnetapi_getctx(&ctx);
539 if (status != 0) {
540 TALLOC_FREE(frame);
541 return status;
544 /* In parameters */
545 r.in.server_name = server_name;
546 r.in.level = level;
547 r.in.buffer = buffer;
549 /* Out parameters */
550 r.out.parm_error = parm_error;
552 if (DEBUGLEVEL >= 10) {
553 NDR_PRINT_IN_DEBUG(NetUserAdd, &r);
556 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
557 werr = NetUserAdd_l(ctx, &r);
558 } else {
559 werr = NetUserAdd_r(ctx, &r);
562 r.out.result = W_ERROR_V(werr);
564 if (DEBUGLEVEL >= 10) {
565 NDR_PRINT_OUT_DEBUG(NetUserAdd, &r);
568 TALLOC_FREE(frame);
569 return (NET_API_STATUS)r.out.result;
572 /****************************************************************
573 NetUserDel
574 ****************************************************************/
576 NET_API_STATUS NetUserDel(const char * server_name /* [in] [unique] */,
577 const char * user_name /* [in] [ref] */)
579 struct NetUserDel r;
580 struct libnetapi_ctx *ctx = NULL;
581 NET_API_STATUS status;
582 WERROR werr;
583 TALLOC_CTX *frame = talloc_stackframe();
585 status = libnetapi_getctx(&ctx);
586 if (status != 0) {
587 TALLOC_FREE(frame);
588 return status;
591 /* In parameters */
592 r.in.server_name = server_name;
593 r.in.user_name = user_name;
595 /* Out parameters */
597 if (DEBUGLEVEL >= 10) {
598 NDR_PRINT_IN_DEBUG(NetUserDel, &r);
601 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
602 werr = NetUserDel_l(ctx, &r);
603 } else {
604 werr = NetUserDel_r(ctx, &r);
607 r.out.result = W_ERROR_V(werr);
609 if (DEBUGLEVEL >= 10) {
610 NDR_PRINT_OUT_DEBUG(NetUserDel, &r);
613 TALLOC_FREE(frame);
614 return (NET_API_STATUS)r.out.result;
617 /****************************************************************
618 NetUserEnum
619 ****************************************************************/
621 NET_API_STATUS NetUserEnum(const char * server_name /* [in] [unique] */,
622 uint32_t level /* [in] */,
623 uint32_t filter /* [in] */,
624 uint8_t **buffer /* [out] [ref] */,
625 uint32_t prefmaxlen /* [in] */,
626 uint32_t *entries_read /* [out] [ref] */,
627 uint32_t *total_entries /* [out] [ref] */,
628 uint32_t *resume_handle /* [in,out] [ref] */)
630 struct NetUserEnum r;
631 struct libnetapi_ctx *ctx = NULL;
632 NET_API_STATUS status;
633 WERROR werr;
634 TALLOC_CTX *frame = talloc_stackframe();
636 status = libnetapi_getctx(&ctx);
637 if (status != 0) {
638 TALLOC_FREE(frame);
639 return status;
642 /* In parameters */
643 r.in.server_name = server_name;
644 r.in.level = level;
645 r.in.filter = filter;
646 r.in.prefmaxlen = prefmaxlen;
647 r.in.resume_handle = resume_handle;
649 /* Out parameters */
650 r.out.buffer = buffer;
651 r.out.entries_read = entries_read;
652 r.out.total_entries = total_entries;
653 r.out.resume_handle = resume_handle;
655 if (DEBUGLEVEL >= 10) {
656 NDR_PRINT_IN_DEBUG(NetUserEnum, &r);
659 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
660 werr = NetUserEnum_l(ctx, &r);
661 } else {
662 werr = NetUserEnum_r(ctx, &r);
665 r.out.result = W_ERROR_V(werr);
667 if (DEBUGLEVEL >= 10) {
668 NDR_PRINT_OUT_DEBUG(NetUserEnum, &r);
671 TALLOC_FREE(frame);
672 return (NET_API_STATUS)r.out.result;
675 /****************************************************************
676 NetUserChangePassword
677 ****************************************************************/
679 NET_API_STATUS NetUserChangePassword(const char * domain_name /* [in] */,
680 const char * user_name /* [in] */,
681 const char * old_password /* [in] */,
682 const char * new_password /* [in] */)
684 struct NetUserChangePassword r;
685 struct libnetapi_ctx *ctx = NULL;
686 NET_API_STATUS status;
687 WERROR werr;
688 TALLOC_CTX *frame = talloc_stackframe();
690 status = libnetapi_getctx(&ctx);
691 if (status != 0) {
692 TALLOC_FREE(frame);
693 return status;
696 /* In parameters */
697 r.in.domain_name = domain_name;
698 r.in.user_name = user_name;
699 r.in.old_password = old_password;
700 r.in.new_password = new_password;
702 /* Out parameters */
704 if (DEBUGLEVEL >= 10) {
705 NDR_PRINT_IN_DEBUG(NetUserChangePassword, &r);
708 if (LIBNETAPI_LOCAL_SERVER(domain_name)) {
709 werr = NetUserChangePassword_l(ctx, &r);
710 } else {
711 werr = NetUserChangePassword_r(ctx, &r);
714 r.out.result = W_ERROR_V(werr);
716 if (DEBUGLEVEL >= 10) {
717 NDR_PRINT_OUT_DEBUG(NetUserChangePassword, &r);
720 TALLOC_FREE(frame);
721 return (NET_API_STATUS)r.out.result;
724 /****************************************************************
725 NetUserGetInfo
726 ****************************************************************/
728 NET_API_STATUS NetUserGetInfo(const char * server_name /* [in] */,
729 const char * user_name /* [in] */,
730 uint32_t level /* [in] */,
731 uint8_t **buffer /* [out] [ref] */)
733 struct NetUserGetInfo r;
734 struct libnetapi_ctx *ctx = NULL;
735 NET_API_STATUS status;
736 WERROR werr;
737 TALLOC_CTX *frame = talloc_stackframe();
739 status = libnetapi_getctx(&ctx);
740 if (status != 0) {
741 TALLOC_FREE(frame);
742 return status;
745 /* In parameters */
746 r.in.server_name = server_name;
747 r.in.user_name = user_name;
748 r.in.level = level;
750 /* Out parameters */
751 r.out.buffer = buffer;
753 if (DEBUGLEVEL >= 10) {
754 NDR_PRINT_IN_DEBUG(NetUserGetInfo, &r);
757 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
758 werr = NetUserGetInfo_l(ctx, &r);
759 } else {
760 werr = NetUserGetInfo_r(ctx, &r);
763 r.out.result = W_ERROR_V(werr);
765 if (DEBUGLEVEL >= 10) {
766 NDR_PRINT_OUT_DEBUG(NetUserGetInfo, &r);
769 TALLOC_FREE(frame);
770 return (NET_API_STATUS)r.out.result;
773 /****************************************************************
774 NetUserSetInfo
775 ****************************************************************/
777 NET_API_STATUS NetUserSetInfo(const char * server_name /* [in] */,
778 const char * user_name /* [in] */,
779 uint32_t level /* [in] */,
780 uint8_t *buffer /* [in] [ref] */,
781 uint32_t *parm_err /* [out] [ref] */)
783 struct NetUserSetInfo r;
784 struct libnetapi_ctx *ctx = NULL;
785 NET_API_STATUS status;
786 WERROR werr;
787 TALLOC_CTX *frame = talloc_stackframe();
789 status = libnetapi_getctx(&ctx);
790 if (status != 0) {
791 TALLOC_FREE(frame);
792 return status;
795 /* In parameters */
796 r.in.server_name = server_name;
797 r.in.user_name = user_name;
798 r.in.level = level;
799 r.in.buffer = buffer;
801 /* Out parameters */
802 r.out.parm_err = parm_err;
804 if (DEBUGLEVEL >= 10) {
805 NDR_PRINT_IN_DEBUG(NetUserSetInfo, &r);
808 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
809 werr = NetUserSetInfo_l(ctx, &r);
810 } else {
811 werr = NetUserSetInfo_r(ctx, &r);
814 r.out.result = W_ERROR_V(werr);
816 if (DEBUGLEVEL >= 10) {
817 NDR_PRINT_OUT_DEBUG(NetUserSetInfo, &r);
820 TALLOC_FREE(frame);
821 return (NET_API_STATUS)r.out.result;
824 /****************************************************************
825 NetUserGetGroups
826 ****************************************************************/
828 NET_API_STATUS NetUserGetGroups(const char * server_name /* [in] */,
829 const char * user_name /* [in] */,
830 uint32_t level /* [in] */,
831 uint8_t **buffer /* [out] [ref] */,
832 uint32_t prefmaxlen /* [in] */,
833 uint32_t *entries_read /* [out] [ref] */,
834 uint32_t *total_entries /* [out] [ref] */)
836 struct NetUserGetGroups r;
837 struct libnetapi_ctx *ctx = NULL;
838 NET_API_STATUS status;
839 WERROR werr;
840 TALLOC_CTX *frame = talloc_stackframe();
842 status = libnetapi_getctx(&ctx);
843 if (status != 0) {
844 TALLOC_FREE(frame);
845 return status;
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.prefmaxlen = prefmaxlen;
854 /* Out parameters */
855 r.out.buffer = buffer;
856 r.out.entries_read = entries_read;
857 r.out.total_entries = total_entries;
859 if (DEBUGLEVEL >= 10) {
860 NDR_PRINT_IN_DEBUG(NetUserGetGroups, &r);
863 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
864 werr = NetUserGetGroups_l(ctx, &r);
865 } else {
866 werr = NetUserGetGroups_r(ctx, &r);
869 r.out.result = W_ERROR_V(werr);
871 if (DEBUGLEVEL >= 10) {
872 NDR_PRINT_OUT_DEBUG(NetUserGetGroups, &r);
875 TALLOC_FREE(frame);
876 return (NET_API_STATUS)r.out.result;
879 /****************************************************************
880 NetUserSetGroups
881 ****************************************************************/
883 NET_API_STATUS NetUserSetGroups(const char * server_name /* [in] */,
884 const char * user_name /* [in] */,
885 uint32_t level /* [in] */,
886 uint8_t *buffer /* [in] [ref] */,
887 uint32_t num_entries /* [in] */)
889 struct NetUserSetGroups r;
890 struct libnetapi_ctx *ctx = NULL;
891 NET_API_STATUS status;
892 WERROR werr;
893 TALLOC_CTX *frame = talloc_stackframe();
895 status = libnetapi_getctx(&ctx);
896 if (status != 0) {
897 TALLOC_FREE(frame);
898 return status;
901 /* In parameters */
902 r.in.server_name = server_name;
903 r.in.user_name = user_name;
904 r.in.level = level;
905 r.in.buffer = buffer;
906 r.in.num_entries = num_entries;
908 /* Out parameters */
910 if (DEBUGLEVEL >= 10) {
911 NDR_PRINT_IN_DEBUG(NetUserSetGroups, &r);
914 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
915 werr = NetUserSetGroups_l(ctx, &r);
916 } else {
917 werr = NetUserSetGroups_r(ctx, &r);
920 r.out.result = W_ERROR_V(werr);
922 if (DEBUGLEVEL >= 10) {
923 NDR_PRINT_OUT_DEBUG(NetUserSetGroups, &r);
926 TALLOC_FREE(frame);
927 return (NET_API_STATUS)r.out.result;
930 /****************************************************************
931 NetUserGetLocalGroups
932 ****************************************************************/
934 NET_API_STATUS NetUserGetLocalGroups(const char * server_name /* [in] */,
935 const char * user_name /* [in] */,
936 uint32_t level /* [in] */,
937 uint32_t flags /* [in] */,
938 uint8_t **buffer /* [out] [ref] */,
939 uint32_t prefmaxlen /* [in] */,
940 uint32_t *entries_read /* [out] [ref] */,
941 uint32_t *total_entries /* [out] [ref] */)
943 struct NetUserGetLocalGroups r;
944 struct libnetapi_ctx *ctx = NULL;
945 NET_API_STATUS status;
946 WERROR werr;
947 TALLOC_CTX *frame = talloc_stackframe();
949 status = libnetapi_getctx(&ctx);
950 if (status != 0) {
951 TALLOC_FREE(frame);
952 return status;
955 /* In parameters */
956 r.in.server_name = server_name;
957 r.in.user_name = user_name;
958 r.in.level = level;
959 r.in.flags = flags;
960 r.in.prefmaxlen = prefmaxlen;
962 /* Out parameters */
963 r.out.buffer = buffer;
964 r.out.entries_read = entries_read;
965 r.out.total_entries = total_entries;
967 if (DEBUGLEVEL >= 10) {
968 NDR_PRINT_IN_DEBUG(NetUserGetLocalGroups, &r);
971 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
972 werr = NetUserGetLocalGroups_l(ctx, &r);
973 } else {
974 werr = NetUserGetLocalGroups_r(ctx, &r);
977 r.out.result = W_ERROR_V(werr);
979 if (DEBUGLEVEL >= 10) {
980 NDR_PRINT_OUT_DEBUG(NetUserGetLocalGroups, &r);
983 TALLOC_FREE(frame);
984 return (NET_API_STATUS)r.out.result;
987 /****************************************************************
988 NetUserModalsGet
989 ****************************************************************/
991 NET_API_STATUS NetUserModalsGet(const char * server_name /* [in] */,
992 uint32_t level /* [in] */,
993 uint8_t **buffer /* [out] [ref] */)
995 struct NetUserModalsGet r;
996 struct libnetapi_ctx *ctx = NULL;
997 NET_API_STATUS status;
998 WERROR werr;
999 TALLOC_CTX *frame = talloc_stackframe();
1001 status = libnetapi_getctx(&ctx);
1002 if (status != 0) {
1003 TALLOC_FREE(frame);
1004 return status;
1007 /* In parameters */
1008 r.in.server_name = server_name;
1009 r.in.level = level;
1011 /* Out parameters */
1012 r.out.buffer = buffer;
1014 if (DEBUGLEVEL >= 10) {
1015 NDR_PRINT_IN_DEBUG(NetUserModalsGet, &r);
1018 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1019 werr = NetUserModalsGet_l(ctx, &r);
1020 } else {
1021 werr = NetUserModalsGet_r(ctx, &r);
1024 r.out.result = W_ERROR_V(werr);
1026 if (DEBUGLEVEL >= 10) {
1027 NDR_PRINT_OUT_DEBUG(NetUserModalsGet, &r);
1030 TALLOC_FREE(frame);
1031 return (NET_API_STATUS)r.out.result;
1034 /****************************************************************
1035 NetUserModalsSet
1036 ****************************************************************/
1038 NET_API_STATUS NetUserModalsSet(const char * server_name /* [in] */,
1039 uint32_t level /* [in] */,
1040 uint8_t *buffer /* [in] [ref] */,
1041 uint32_t *parm_err /* [out] [ref] */)
1043 struct NetUserModalsSet r;
1044 struct libnetapi_ctx *ctx = NULL;
1045 NET_API_STATUS status;
1046 WERROR werr;
1047 TALLOC_CTX *frame = talloc_stackframe();
1049 status = libnetapi_getctx(&ctx);
1050 if (status != 0) {
1051 TALLOC_FREE(frame);
1052 return status;
1055 /* In parameters */
1056 r.in.server_name = server_name;
1057 r.in.level = level;
1058 r.in.buffer = buffer;
1060 /* Out parameters */
1061 r.out.parm_err = parm_err;
1063 if (DEBUGLEVEL >= 10) {
1064 NDR_PRINT_IN_DEBUG(NetUserModalsSet, &r);
1067 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1068 werr = NetUserModalsSet_l(ctx, &r);
1069 } else {
1070 werr = NetUserModalsSet_r(ctx, &r);
1073 r.out.result = W_ERROR_V(werr);
1075 if (DEBUGLEVEL >= 10) {
1076 NDR_PRINT_OUT_DEBUG(NetUserModalsSet, &r);
1079 TALLOC_FREE(frame);
1080 return (NET_API_STATUS)r.out.result;
1083 /****************************************************************
1084 NetQueryDisplayInformation
1085 ****************************************************************/
1087 NET_API_STATUS NetQueryDisplayInformation(const char * server_name /* [in] [unique] */,
1088 uint32_t level /* [in] */,
1089 uint32_t idx /* [in] */,
1090 uint32_t entries_requested /* [in] */,
1091 uint32_t prefmaxlen /* [in] */,
1092 uint32_t *entries_read /* [out] [ref] */,
1093 void **buffer /* [out] [noprint,ref] */)
1095 struct NetQueryDisplayInformation r;
1096 struct libnetapi_ctx *ctx = NULL;
1097 NET_API_STATUS status;
1098 WERROR werr;
1099 TALLOC_CTX *frame = talloc_stackframe();
1101 status = libnetapi_getctx(&ctx);
1102 if (status != 0) {
1103 TALLOC_FREE(frame);
1104 return status;
1107 /* In parameters */
1108 r.in.server_name = server_name;
1109 r.in.level = level;
1110 r.in.idx = idx;
1111 r.in.entries_requested = entries_requested;
1112 r.in.prefmaxlen = prefmaxlen;
1114 /* Out parameters */
1115 r.out.entries_read = entries_read;
1116 r.out.buffer = buffer;
1118 if (DEBUGLEVEL >= 10) {
1119 NDR_PRINT_IN_DEBUG(NetQueryDisplayInformation, &r);
1122 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1123 werr = NetQueryDisplayInformation_l(ctx, &r);
1124 } else {
1125 werr = NetQueryDisplayInformation_r(ctx, &r);
1128 r.out.result = W_ERROR_V(werr);
1130 if (DEBUGLEVEL >= 10) {
1131 NDR_PRINT_OUT_DEBUG(NetQueryDisplayInformation, &r);
1134 TALLOC_FREE(frame);
1135 return (NET_API_STATUS)r.out.result;
1138 /****************************************************************
1139 NetGroupAdd
1140 ****************************************************************/
1142 NET_API_STATUS NetGroupAdd(const char * server_name /* [in] */,
1143 uint32_t level /* [in] */,
1144 uint8_t *buffer /* [in] [ref] */,
1145 uint32_t *parm_err /* [out] [ref] */)
1147 struct NetGroupAdd r;
1148 struct libnetapi_ctx *ctx = NULL;
1149 NET_API_STATUS status;
1150 WERROR werr;
1151 TALLOC_CTX *frame = talloc_stackframe();
1153 status = libnetapi_getctx(&ctx);
1154 if (status != 0) {
1155 TALLOC_FREE(frame);
1156 return status;
1159 /* In parameters */
1160 r.in.server_name = server_name;
1161 r.in.level = level;
1162 r.in.buffer = buffer;
1164 /* Out parameters */
1165 r.out.parm_err = parm_err;
1167 if (DEBUGLEVEL >= 10) {
1168 NDR_PRINT_IN_DEBUG(NetGroupAdd, &r);
1171 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1172 werr = NetGroupAdd_l(ctx, &r);
1173 } else {
1174 werr = NetGroupAdd_r(ctx, &r);
1177 r.out.result = W_ERROR_V(werr);
1179 if (DEBUGLEVEL >= 10) {
1180 NDR_PRINT_OUT_DEBUG(NetGroupAdd, &r);
1183 TALLOC_FREE(frame);
1184 return (NET_API_STATUS)r.out.result;
1187 /****************************************************************
1188 NetGroupDel
1189 ****************************************************************/
1191 NET_API_STATUS NetGroupDel(const char * server_name /* [in] */,
1192 const char * group_name /* [in] */)
1194 struct NetGroupDel r;
1195 struct libnetapi_ctx *ctx = NULL;
1196 NET_API_STATUS status;
1197 WERROR werr;
1198 TALLOC_CTX *frame = talloc_stackframe();
1200 status = libnetapi_getctx(&ctx);
1201 if (status != 0) {
1202 TALLOC_FREE(frame);
1203 return status;
1206 /* In parameters */
1207 r.in.server_name = server_name;
1208 r.in.group_name = group_name;
1210 /* Out parameters */
1212 if (DEBUGLEVEL >= 10) {
1213 NDR_PRINT_IN_DEBUG(NetGroupDel, &r);
1216 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1217 werr = NetGroupDel_l(ctx, &r);
1218 } else {
1219 werr = NetGroupDel_r(ctx, &r);
1222 r.out.result = W_ERROR_V(werr);
1224 if (DEBUGLEVEL >= 10) {
1225 NDR_PRINT_OUT_DEBUG(NetGroupDel, &r);
1228 TALLOC_FREE(frame);
1229 return (NET_API_STATUS)r.out.result;
1232 /****************************************************************
1233 NetGroupEnum
1234 ****************************************************************/
1236 NET_API_STATUS NetGroupEnum(const char * server_name /* [in] */,
1237 uint32_t level /* [in] */,
1238 uint8_t **buffer /* [out] [ref] */,
1239 uint32_t prefmaxlen /* [in] */,
1240 uint32_t *entries_read /* [out] [ref] */,
1241 uint32_t *total_entries /* [out] [ref] */,
1242 uint32_t *resume_handle /* [in,out] [ref] */)
1244 struct NetGroupEnum r;
1245 struct libnetapi_ctx *ctx = NULL;
1246 NET_API_STATUS status;
1247 WERROR werr;
1248 TALLOC_CTX *frame = talloc_stackframe();
1250 status = libnetapi_getctx(&ctx);
1251 if (status != 0) {
1252 TALLOC_FREE(frame);
1253 return status;
1256 /* In parameters */
1257 r.in.server_name = server_name;
1258 r.in.level = level;
1259 r.in.prefmaxlen = prefmaxlen;
1260 r.in.resume_handle = resume_handle;
1262 /* Out parameters */
1263 r.out.buffer = buffer;
1264 r.out.entries_read = entries_read;
1265 r.out.total_entries = total_entries;
1266 r.out.resume_handle = resume_handle;
1268 if (DEBUGLEVEL >= 10) {
1269 NDR_PRINT_IN_DEBUG(NetGroupEnum, &r);
1272 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1273 werr = NetGroupEnum_l(ctx, &r);
1274 } else {
1275 werr = NetGroupEnum_r(ctx, &r);
1278 r.out.result = W_ERROR_V(werr);
1280 if (DEBUGLEVEL >= 10) {
1281 NDR_PRINT_OUT_DEBUG(NetGroupEnum, &r);
1284 TALLOC_FREE(frame);
1285 return (NET_API_STATUS)r.out.result;
1288 /****************************************************************
1289 NetGroupSetInfo
1290 ****************************************************************/
1292 NET_API_STATUS NetGroupSetInfo(const char * server_name /* [in] */,
1293 const char * group_name /* [in] */,
1294 uint32_t level /* [in] */,
1295 uint8_t *buffer /* [in] [ref] */,
1296 uint32_t *parm_err /* [out] [ref] */)
1298 struct NetGroupSetInfo r;
1299 struct libnetapi_ctx *ctx = NULL;
1300 NET_API_STATUS status;
1301 WERROR werr;
1302 TALLOC_CTX *frame = talloc_stackframe();
1304 status = libnetapi_getctx(&ctx);
1305 if (status != 0) {
1306 TALLOC_FREE(frame);
1307 return status;
1310 /* In parameters */
1311 r.in.server_name = server_name;
1312 r.in.group_name = group_name;
1313 r.in.level = level;
1314 r.in.buffer = buffer;
1316 /* Out parameters */
1317 r.out.parm_err = parm_err;
1319 if (DEBUGLEVEL >= 10) {
1320 NDR_PRINT_IN_DEBUG(NetGroupSetInfo, &r);
1323 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1324 werr = NetGroupSetInfo_l(ctx, &r);
1325 } else {
1326 werr = NetGroupSetInfo_r(ctx, &r);
1329 r.out.result = W_ERROR_V(werr);
1331 if (DEBUGLEVEL >= 10) {
1332 NDR_PRINT_OUT_DEBUG(NetGroupSetInfo, &r);
1335 TALLOC_FREE(frame);
1336 return (NET_API_STATUS)r.out.result;
1339 /****************************************************************
1340 NetGroupGetInfo
1341 ****************************************************************/
1343 NET_API_STATUS NetGroupGetInfo(const char * server_name /* [in] */,
1344 const char * group_name /* [in] */,
1345 uint32_t level /* [in] */,
1346 uint8_t **buffer /* [out] [ref] */)
1348 struct NetGroupGetInfo r;
1349 struct libnetapi_ctx *ctx = NULL;
1350 NET_API_STATUS status;
1351 WERROR werr;
1352 TALLOC_CTX *frame = talloc_stackframe();
1354 status = libnetapi_getctx(&ctx);
1355 if (status != 0) {
1356 TALLOC_FREE(frame);
1357 return status;
1360 /* In parameters */
1361 r.in.server_name = server_name;
1362 r.in.group_name = group_name;
1363 r.in.level = level;
1365 /* Out parameters */
1366 r.out.buffer = buffer;
1368 if (DEBUGLEVEL >= 10) {
1369 NDR_PRINT_IN_DEBUG(NetGroupGetInfo, &r);
1372 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1373 werr = NetGroupGetInfo_l(ctx, &r);
1374 } else {
1375 werr = NetGroupGetInfo_r(ctx, &r);
1378 r.out.result = W_ERROR_V(werr);
1380 if (DEBUGLEVEL >= 10) {
1381 NDR_PRINT_OUT_DEBUG(NetGroupGetInfo, &r);
1384 TALLOC_FREE(frame);
1385 return (NET_API_STATUS)r.out.result;
1388 /****************************************************************
1389 NetGroupAddUser
1390 ****************************************************************/
1392 NET_API_STATUS NetGroupAddUser(const char * server_name /* [in] */,
1393 const char * group_name /* [in] */,
1394 const char * user_name /* [in] */)
1396 struct NetGroupAddUser r;
1397 struct libnetapi_ctx *ctx = NULL;
1398 NET_API_STATUS status;
1399 WERROR werr;
1400 TALLOC_CTX *frame = talloc_stackframe();
1402 status = libnetapi_getctx(&ctx);
1403 if (status != 0) {
1404 TALLOC_FREE(frame);
1405 return status;
1408 /* In parameters */
1409 r.in.server_name = server_name;
1410 r.in.group_name = group_name;
1411 r.in.user_name = user_name;
1413 /* Out parameters */
1415 if (DEBUGLEVEL >= 10) {
1416 NDR_PRINT_IN_DEBUG(NetGroupAddUser, &r);
1419 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1420 werr = NetGroupAddUser_l(ctx, &r);
1421 } else {
1422 werr = NetGroupAddUser_r(ctx, &r);
1425 r.out.result = W_ERROR_V(werr);
1427 if (DEBUGLEVEL >= 10) {
1428 NDR_PRINT_OUT_DEBUG(NetGroupAddUser, &r);
1431 TALLOC_FREE(frame);
1432 return (NET_API_STATUS)r.out.result;
1435 /****************************************************************
1436 NetGroupDelUser
1437 ****************************************************************/
1439 NET_API_STATUS NetGroupDelUser(const char * server_name /* [in] */,
1440 const char * group_name /* [in] */,
1441 const char * user_name /* [in] */)
1443 struct NetGroupDelUser r;
1444 struct libnetapi_ctx *ctx = NULL;
1445 NET_API_STATUS status;
1446 WERROR werr;
1447 TALLOC_CTX *frame = talloc_stackframe();
1449 status = libnetapi_getctx(&ctx);
1450 if (status != 0) {
1451 TALLOC_FREE(frame);
1452 return status;
1455 /* In parameters */
1456 r.in.server_name = server_name;
1457 r.in.group_name = group_name;
1458 r.in.user_name = user_name;
1460 /* Out parameters */
1462 if (DEBUGLEVEL >= 10) {
1463 NDR_PRINT_IN_DEBUG(NetGroupDelUser, &r);
1466 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1467 werr = NetGroupDelUser_l(ctx, &r);
1468 } else {
1469 werr = NetGroupDelUser_r(ctx, &r);
1472 r.out.result = W_ERROR_V(werr);
1474 if (DEBUGLEVEL >= 10) {
1475 NDR_PRINT_OUT_DEBUG(NetGroupDelUser, &r);
1478 TALLOC_FREE(frame);
1479 return (NET_API_STATUS)r.out.result;
1482 /****************************************************************
1483 NetGroupGetUsers
1484 ****************************************************************/
1486 NET_API_STATUS NetGroupGetUsers(const char * server_name /* [in] */,
1487 const char * group_name /* [in] */,
1488 uint32_t level /* [in] */,
1489 uint8_t **buffer /* [out] [ref] */,
1490 uint32_t prefmaxlen /* [in] */,
1491 uint32_t *entries_read /* [out] [ref] */,
1492 uint32_t *total_entries /* [out] [ref] */,
1493 uint32_t *resume_handle /* [in,out] [ref] */)
1495 struct NetGroupGetUsers r;
1496 struct libnetapi_ctx *ctx = NULL;
1497 NET_API_STATUS status;
1498 WERROR werr;
1499 TALLOC_CTX *frame = talloc_stackframe();
1501 status = libnetapi_getctx(&ctx);
1502 if (status != 0) {
1503 TALLOC_FREE(frame);
1504 return status;
1507 /* In parameters */
1508 r.in.server_name = server_name;
1509 r.in.group_name = group_name;
1510 r.in.level = level;
1511 r.in.prefmaxlen = prefmaxlen;
1512 r.in.resume_handle = resume_handle;
1514 /* Out parameters */
1515 r.out.buffer = buffer;
1516 r.out.entries_read = entries_read;
1517 r.out.total_entries = total_entries;
1518 r.out.resume_handle = resume_handle;
1520 if (DEBUGLEVEL >= 10) {
1521 NDR_PRINT_IN_DEBUG(NetGroupGetUsers, &r);
1524 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1525 werr = NetGroupGetUsers_l(ctx, &r);
1526 } else {
1527 werr = NetGroupGetUsers_r(ctx, &r);
1530 r.out.result = W_ERROR_V(werr);
1532 if (DEBUGLEVEL >= 10) {
1533 NDR_PRINT_OUT_DEBUG(NetGroupGetUsers, &r);
1536 TALLOC_FREE(frame);
1537 return (NET_API_STATUS)r.out.result;
1540 /****************************************************************
1541 NetGroupSetUsers
1542 ****************************************************************/
1544 NET_API_STATUS NetGroupSetUsers(const char * server_name /* [in] */,
1545 const char * group_name /* [in] */,
1546 uint32_t level /* [in] */,
1547 uint8_t *buffer /* [in] [ref] */,
1548 uint32_t num_entries /* [in] */)
1550 struct NetGroupSetUsers r;
1551 struct libnetapi_ctx *ctx = NULL;
1552 NET_API_STATUS status;
1553 WERROR werr;
1554 TALLOC_CTX *frame = talloc_stackframe();
1556 status = libnetapi_getctx(&ctx);
1557 if (status != 0) {
1558 TALLOC_FREE(frame);
1559 return status;
1562 /* In parameters */
1563 r.in.server_name = server_name;
1564 r.in.group_name = group_name;
1565 r.in.level = level;
1566 r.in.buffer = buffer;
1567 r.in.num_entries = num_entries;
1569 /* Out parameters */
1571 if (DEBUGLEVEL >= 10) {
1572 NDR_PRINT_IN_DEBUG(NetGroupSetUsers, &r);
1575 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1576 werr = NetGroupSetUsers_l(ctx, &r);
1577 } else {
1578 werr = NetGroupSetUsers_r(ctx, &r);
1581 r.out.result = W_ERROR_V(werr);
1583 if (DEBUGLEVEL >= 10) {
1584 NDR_PRINT_OUT_DEBUG(NetGroupSetUsers, &r);
1587 TALLOC_FREE(frame);
1588 return (NET_API_STATUS)r.out.result;
1591 /****************************************************************
1592 NetLocalGroupAdd
1593 ****************************************************************/
1595 NET_API_STATUS NetLocalGroupAdd(const char * server_name /* [in] */,
1596 uint32_t level /* [in] */,
1597 uint8_t *buffer /* [in] [ref] */,
1598 uint32_t *parm_err /* [out] [ref] */)
1600 struct NetLocalGroupAdd r;
1601 struct libnetapi_ctx *ctx = NULL;
1602 NET_API_STATUS status;
1603 WERROR werr;
1604 TALLOC_CTX *frame = talloc_stackframe();
1606 status = libnetapi_getctx(&ctx);
1607 if (status != 0) {
1608 TALLOC_FREE(frame);
1609 return status;
1612 /* In parameters */
1613 r.in.server_name = server_name;
1614 r.in.level = level;
1615 r.in.buffer = buffer;
1617 /* Out parameters */
1618 r.out.parm_err = parm_err;
1620 if (DEBUGLEVEL >= 10) {
1621 NDR_PRINT_IN_DEBUG(NetLocalGroupAdd, &r);
1624 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1625 werr = NetLocalGroupAdd_l(ctx, &r);
1626 } else {
1627 werr = NetLocalGroupAdd_r(ctx, &r);
1630 r.out.result = W_ERROR_V(werr);
1632 if (DEBUGLEVEL >= 10) {
1633 NDR_PRINT_OUT_DEBUG(NetLocalGroupAdd, &r);
1636 TALLOC_FREE(frame);
1637 return (NET_API_STATUS)r.out.result;
1640 /****************************************************************
1641 NetLocalGroupDel
1642 ****************************************************************/
1644 NET_API_STATUS NetLocalGroupDel(const char * server_name /* [in] */,
1645 const char * group_name /* [in] */)
1647 struct NetLocalGroupDel r;
1648 struct libnetapi_ctx *ctx = NULL;
1649 NET_API_STATUS status;
1650 WERROR werr;
1651 TALLOC_CTX *frame = talloc_stackframe();
1653 status = libnetapi_getctx(&ctx);
1654 if (status != 0) {
1655 TALLOC_FREE(frame);
1656 return status;
1659 /* In parameters */
1660 r.in.server_name = server_name;
1661 r.in.group_name = group_name;
1663 /* Out parameters */
1665 if (DEBUGLEVEL >= 10) {
1666 NDR_PRINT_IN_DEBUG(NetLocalGroupDel, &r);
1669 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1670 werr = NetLocalGroupDel_l(ctx, &r);
1671 } else {
1672 werr = NetLocalGroupDel_r(ctx, &r);
1675 r.out.result = W_ERROR_V(werr);
1677 if (DEBUGLEVEL >= 10) {
1678 NDR_PRINT_OUT_DEBUG(NetLocalGroupDel, &r);
1681 TALLOC_FREE(frame);
1682 return (NET_API_STATUS)r.out.result;
1685 /****************************************************************
1686 NetLocalGroupGetInfo
1687 ****************************************************************/
1689 NET_API_STATUS NetLocalGroupGetInfo(const char * server_name /* [in] */,
1690 const char * group_name /* [in] */,
1691 uint32_t level /* [in] */,
1692 uint8_t **buffer /* [out] [ref] */)
1694 struct NetLocalGroupGetInfo r;
1695 struct libnetapi_ctx *ctx = NULL;
1696 NET_API_STATUS status;
1697 WERROR werr;
1698 TALLOC_CTX *frame = talloc_stackframe();
1700 status = libnetapi_getctx(&ctx);
1701 if (status != 0) {
1702 TALLOC_FREE(frame);
1703 return status;
1706 /* In parameters */
1707 r.in.server_name = server_name;
1708 r.in.group_name = group_name;
1709 r.in.level = level;
1711 /* Out parameters */
1712 r.out.buffer = buffer;
1714 if (DEBUGLEVEL >= 10) {
1715 NDR_PRINT_IN_DEBUG(NetLocalGroupGetInfo, &r);
1718 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1719 werr = NetLocalGroupGetInfo_l(ctx, &r);
1720 } else {
1721 werr = NetLocalGroupGetInfo_r(ctx, &r);
1724 r.out.result = W_ERROR_V(werr);
1726 if (DEBUGLEVEL >= 10) {
1727 NDR_PRINT_OUT_DEBUG(NetLocalGroupGetInfo, &r);
1730 TALLOC_FREE(frame);
1731 return (NET_API_STATUS)r.out.result;
1734 /****************************************************************
1735 NetLocalGroupSetInfo
1736 ****************************************************************/
1738 NET_API_STATUS NetLocalGroupSetInfo(const char * server_name /* [in] */,
1739 const char * group_name /* [in] */,
1740 uint32_t level /* [in] */,
1741 uint8_t *buffer /* [in] [ref] */,
1742 uint32_t *parm_err /* [out] [ref] */)
1744 struct NetLocalGroupSetInfo r;
1745 struct libnetapi_ctx *ctx = NULL;
1746 NET_API_STATUS status;
1747 WERROR werr;
1748 TALLOC_CTX *frame = talloc_stackframe();
1750 status = libnetapi_getctx(&ctx);
1751 if (status != 0) {
1752 TALLOC_FREE(frame);
1753 return status;
1756 /* In parameters */
1757 r.in.server_name = server_name;
1758 r.in.group_name = group_name;
1759 r.in.level = level;
1760 r.in.buffer = buffer;
1762 /* Out parameters */
1763 r.out.parm_err = parm_err;
1765 if (DEBUGLEVEL >= 10) {
1766 NDR_PRINT_IN_DEBUG(NetLocalGroupSetInfo, &r);
1769 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1770 werr = NetLocalGroupSetInfo_l(ctx, &r);
1771 } else {
1772 werr = NetLocalGroupSetInfo_r(ctx, &r);
1775 r.out.result = W_ERROR_V(werr);
1777 if (DEBUGLEVEL >= 10) {
1778 NDR_PRINT_OUT_DEBUG(NetLocalGroupSetInfo, &r);
1781 TALLOC_FREE(frame);
1782 return (NET_API_STATUS)r.out.result;
1785 /****************************************************************
1786 NetLocalGroupEnum
1787 ****************************************************************/
1789 NET_API_STATUS NetLocalGroupEnum(const char * server_name /* [in] */,
1790 uint32_t level /* [in] */,
1791 uint8_t **buffer /* [out] [ref] */,
1792 uint32_t prefmaxlen /* [in] */,
1793 uint32_t *entries_read /* [out] [ref] */,
1794 uint32_t *total_entries /* [out] [ref] */,
1795 uint32_t *resume_handle /* [in,out] [ref] */)
1797 struct NetLocalGroupEnum r;
1798 struct libnetapi_ctx *ctx = NULL;
1799 NET_API_STATUS status;
1800 WERROR werr;
1801 TALLOC_CTX *frame = talloc_stackframe();
1803 status = libnetapi_getctx(&ctx);
1804 if (status != 0) {
1805 TALLOC_FREE(frame);
1806 return status;
1809 /* In parameters */
1810 r.in.server_name = server_name;
1811 r.in.level = level;
1812 r.in.prefmaxlen = prefmaxlen;
1813 r.in.resume_handle = resume_handle;
1815 /* Out parameters */
1816 r.out.buffer = buffer;
1817 r.out.entries_read = entries_read;
1818 r.out.total_entries = total_entries;
1819 r.out.resume_handle = resume_handle;
1821 if (DEBUGLEVEL >= 10) {
1822 NDR_PRINT_IN_DEBUG(NetLocalGroupEnum, &r);
1825 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1826 werr = NetLocalGroupEnum_l(ctx, &r);
1827 } else {
1828 werr = NetLocalGroupEnum_r(ctx, &r);
1831 r.out.result = W_ERROR_V(werr);
1833 if (DEBUGLEVEL >= 10) {
1834 NDR_PRINT_OUT_DEBUG(NetLocalGroupEnum, &r);
1837 TALLOC_FREE(frame);
1838 return (NET_API_STATUS)r.out.result;
1841 /****************************************************************
1842 NetLocalGroupAddMembers
1843 ****************************************************************/
1845 NET_API_STATUS NetLocalGroupAddMembers(const char * server_name /* [in] */,
1846 const char * group_name /* [in] */,
1847 uint32_t level /* [in] */,
1848 uint8_t *buffer /* [in] [ref] */,
1849 uint32_t total_entries /* [in] */)
1851 struct NetLocalGroupAddMembers r;
1852 struct libnetapi_ctx *ctx = NULL;
1853 NET_API_STATUS status;
1854 WERROR werr;
1855 TALLOC_CTX *frame = talloc_stackframe();
1857 status = libnetapi_getctx(&ctx);
1858 if (status != 0) {
1859 TALLOC_FREE(frame);
1860 return status;
1863 /* In parameters */
1864 r.in.server_name = server_name;
1865 r.in.group_name = group_name;
1866 r.in.level = level;
1867 r.in.buffer = buffer;
1868 r.in.total_entries = total_entries;
1870 /* Out parameters */
1872 if (DEBUGLEVEL >= 10) {
1873 NDR_PRINT_IN_DEBUG(NetLocalGroupAddMembers, &r);
1876 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1877 werr = NetLocalGroupAddMembers_l(ctx, &r);
1878 } else {
1879 werr = NetLocalGroupAddMembers_r(ctx, &r);
1882 r.out.result = W_ERROR_V(werr);
1884 if (DEBUGLEVEL >= 10) {
1885 NDR_PRINT_OUT_DEBUG(NetLocalGroupAddMembers, &r);
1888 TALLOC_FREE(frame);
1889 return (NET_API_STATUS)r.out.result;
1892 /****************************************************************
1893 NetLocalGroupDelMembers
1894 ****************************************************************/
1896 NET_API_STATUS NetLocalGroupDelMembers(const char * server_name /* [in] */,
1897 const char * group_name /* [in] */,
1898 uint32_t level /* [in] */,
1899 uint8_t *buffer /* [in] [ref] */,
1900 uint32_t total_entries /* [in] */)
1902 struct NetLocalGroupDelMembers r;
1903 struct libnetapi_ctx *ctx = NULL;
1904 NET_API_STATUS status;
1905 WERROR werr;
1906 TALLOC_CTX *frame = talloc_stackframe();
1908 status = libnetapi_getctx(&ctx);
1909 if (status != 0) {
1910 TALLOC_FREE(frame);
1911 return status;
1914 /* In parameters */
1915 r.in.server_name = server_name;
1916 r.in.group_name = group_name;
1917 r.in.level = level;
1918 r.in.buffer = buffer;
1919 r.in.total_entries = total_entries;
1921 /* Out parameters */
1923 if (DEBUGLEVEL >= 10) {
1924 NDR_PRINT_IN_DEBUG(NetLocalGroupDelMembers, &r);
1927 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1928 werr = NetLocalGroupDelMembers_l(ctx, &r);
1929 } else {
1930 werr = NetLocalGroupDelMembers_r(ctx, &r);
1933 r.out.result = W_ERROR_V(werr);
1935 if (DEBUGLEVEL >= 10) {
1936 NDR_PRINT_OUT_DEBUG(NetLocalGroupDelMembers, &r);
1939 TALLOC_FREE(frame);
1940 return (NET_API_STATUS)r.out.result;
1943 /****************************************************************
1944 NetLocalGroupGetMembers
1945 ****************************************************************/
1947 NET_API_STATUS NetLocalGroupGetMembers(const char * server_name /* [in] */,
1948 const char * local_group_name /* [in] */,
1949 uint32_t level /* [in] */,
1950 uint8_t **buffer /* [out] [ref] */,
1951 uint32_t prefmaxlen /* [in] */,
1952 uint32_t *entries_read /* [out] [ref] */,
1953 uint32_t *total_entries /* [out] [ref] */,
1954 uint32_t *resume_handle /* [in,out] [ref] */)
1956 struct NetLocalGroupGetMembers r;
1957 struct libnetapi_ctx *ctx = NULL;
1958 NET_API_STATUS status;
1959 WERROR werr;
1960 TALLOC_CTX *frame = talloc_stackframe();
1962 status = libnetapi_getctx(&ctx);
1963 if (status != 0) {
1964 TALLOC_FREE(frame);
1965 return status;
1968 /* In parameters */
1969 r.in.server_name = server_name;
1970 r.in.local_group_name = local_group_name;
1971 r.in.level = level;
1972 r.in.prefmaxlen = prefmaxlen;
1973 r.in.resume_handle = resume_handle;
1975 /* Out parameters */
1976 r.out.buffer = buffer;
1977 r.out.entries_read = entries_read;
1978 r.out.total_entries = total_entries;
1979 r.out.resume_handle = resume_handle;
1981 if (DEBUGLEVEL >= 10) {
1982 NDR_PRINT_IN_DEBUG(NetLocalGroupGetMembers, &r);
1985 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
1986 werr = NetLocalGroupGetMembers_l(ctx, &r);
1987 } else {
1988 werr = NetLocalGroupGetMembers_r(ctx, &r);
1991 r.out.result = W_ERROR_V(werr);
1993 if (DEBUGLEVEL >= 10) {
1994 NDR_PRINT_OUT_DEBUG(NetLocalGroupGetMembers, &r);
1997 TALLOC_FREE(frame);
1998 return (NET_API_STATUS)r.out.result;
2001 /****************************************************************
2002 NetLocalGroupSetMembers
2003 ****************************************************************/
2005 NET_API_STATUS NetLocalGroupSetMembers(const char * server_name /* [in] */,
2006 const char * group_name /* [in] */,
2007 uint32_t level /* [in] */,
2008 uint8_t *buffer /* [in] [ref] */,
2009 uint32_t total_entries /* [in] */)
2011 struct NetLocalGroupSetMembers r;
2012 struct libnetapi_ctx *ctx = NULL;
2013 NET_API_STATUS status;
2014 WERROR werr;
2015 TALLOC_CTX *frame = talloc_stackframe();
2017 status = libnetapi_getctx(&ctx);
2018 if (status != 0) {
2019 TALLOC_FREE(frame);
2020 return status;
2023 /* In parameters */
2024 r.in.server_name = server_name;
2025 r.in.group_name = group_name;
2026 r.in.level = level;
2027 r.in.buffer = buffer;
2028 r.in.total_entries = total_entries;
2030 /* Out parameters */
2032 if (DEBUGLEVEL >= 10) {
2033 NDR_PRINT_IN_DEBUG(NetLocalGroupSetMembers, &r);
2036 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2037 werr = NetLocalGroupSetMembers_l(ctx, &r);
2038 } else {
2039 werr = NetLocalGroupSetMembers_r(ctx, &r);
2042 r.out.result = W_ERROR_V(werr);
2044 if (DEBUGLEVEL >= 10) {
2045 NDR_PRINT_OUT_DEBUG(NetLocalGroupSetMembers, &r);
2048 TALLOC_FREE(frame);
2049 return (NET_API_STATUS)r.out.result;
2052 /****************************************************************
2053 NetRemoteTOD
2054 ****************************************************************/
2056 NET_API_STATUS NetRemoteTOD(const char * server_name /* [in] */,
2057 uint8_t **buffer /* [out] [ref] */)
2059 struct NetRemoteTOD r;
2060 struct libnetapi_ctx *ctx = NULL;
2061 NET_API_STATUS status;
2062 WERROR werr;
2063 TALLOC_CTX *frame = talloc_stackframe();
2065 status = libnetapi_getctx(&ctx);
2066 if (status != 0) {
2067 TALLOC_FREE(frame);
2068 return status;
2071 /* In parameters */
2072 r.in.server_name = server_name;
2074 /* Out parameters */
2075 r.out.buffer = buffer;
2077 if (DEBUGLEVEL >= 10) {
2078 NDR_PRINT_IN_DEBUG(NetRemoteTOD, &r);
2081 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2082 werr = NetRemoteTOD_l(ctx, &r);
2083 } else {
2084 werr = NetRemoteTOD_r(ctx, &r);
2087 r.out.result = W_ERROR_V(werr);
2089 if (DEBUGLEVEL >= 10) {
2090 NDR_PRINT_OUT_DEBUG(NetRemoteTOD, &r);
2093 TALLOC_FREE(frame);
2094 return (NET_API_STATUS)r.out.result;
2097 /****************************************************************
2098 NetShareAdd
2099 ****************************************************************/
2101 NET_API_STATUS NetShareAdd(const char * server_name /* [in] */,
2102 uint32_t level /* [in] */,
2103 uint8_t *buffer /* [in] [ref] */,
2104 uint32_t *parm_err /* [out] [ref] */)
2106 struct NetShareAdd r;
2107 struct libnetapi_ctx *ctx = NULL;
2108 NET_API_STATUS status;
2109 WERROR werr;
2110 TALLOC_CTX *frame = talloc_stackframe();
2112 status = libnetapi_getctx(&ctx);
2113 if (status != 0) {
2114 TALLOC_FREE(frame);
2115 return status;
2118 /* In parameters */
2119 r.in.server_name = server_name;
2120 r.in.level = level;
2121 r.in.buffer = buffer;
2123 /* Out parameters */
2124 r.out.parm_err = parm_err;
2126 if (DEBUGLEVEL >= 10) {
2127 NDR_PRINT_IN_DEBUG(NetShareAdd, &r);
2130 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2131 werr = NetShareAdd_l(ctx, &r);
2132 } else {
2133 werr = NetShareAdd_r(ctx, &r);
2136 r.out.result = W_ERROR_V(werr);
2138 if (DEBUGLEVEL >= 10) {
2139 NDR_PRINT_OUT_DEBUG(NetShareAdd, &r);
2142 TALLOC_FREE(frame);
2143 return (NET_API_STATUS)r.out.result;
2146 /****************************************************************
2147 NetShareDel
2148 ****************************************************************/
2150 NET_API_STATUS NetShareDel(const char * server_name /* [in] */,
2151 const char * net_name /* [in] */,
2152 uint32_t reserved /* [in] */)
2154 struct NetShareDel r;
2155 struct libnetapi_ctx *ctx = NULL;
2156 NET_API_STATUS status;
2157 WERROR werr;
2158 TALLOC_CTX *frame = talloc_stackframe();
2160 status = libnetapi_getctx(&ctx);
2161 if (status != 0) {
2162 TALLOC_FREE(frame);
2163 return status;
2166 /* In parameters */
2167 r.in.server_name = server_name;
2168 r.in.net_name = net_name;
2169 r.in.reserved = reserved;
2171 /* Out parameters */
2173 if (DEBUGLEVEL >= 10) {
2174 NDR_PRINT_IN_DEBUG(NetShareDel, &r);
2177 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2178 werr = NetShareDel_l(ctx, &r);
2179 } else {
2180 werr = NetShareDel_r(ctx, &r);
2183 r.out.result = W_ERROR_V(werr);
2185 if (DEBUGLEVEL >= 10) {
2186 NDR_PRINT_OUT_DEBUG(NetShareDel, &r);
2189 TALLOC_FREE(frame);
2190 return (NET_API_STATUS)r.out.result;
2193 /****************************************************************
2194 NetShareEnum
2195 ****************************************************************/
2197 NET_API_STATUS NetShareEnum(const char * server_name /* [in] */,
2198 uint32_t level /* [in] */,
2199 uint8_t **buffer /* [out] [ref] */,
2200 uint32_t prefmaxlen /* [in] */,
2201 uint32_t *entries_read /* [out] [ref] */,
2202 uint32_t *total_entries /* [out] [ref] */,
2203 uint32_t *resume_handle /* [in,out] [ref] */)
2205 struct NetShareEnum r;
2206 struct libnetapi_ctx *ctx = NULL;
2207 NET_API_STATUS status;
2208 WERROR werr;
2209 TALLOC_CTX *frame = talloc_stackframe();
2211 status = libnetapi_getctx(&ctx);
2212 if (status != 0) {
2213 TALLOC_FREE(frame);
2214 return status;
2217 /* In parameters */
2218 r.in.server_name = server_name;
2219 r.in.level = level;
2220 r.in.prefmaxlen = prefmaxlen;
2221 r.in.resume_handle = resume_handle;
2223 /* Out parameters */
2224 r.out.buffer = buffer;
2225 r.out.entries_read = entries_read;
2226 r.out.total_entries = total_entries;
2227 r.out.resume_handle = resume_handle;
2229 if (DEBUGLEVEL >= 10) {
2230 NDR_PRINT_IN_DEBUG(NetShareEnum, &r);
2233 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2234 werr = NetShareEnum_l(ctx, &r);
2235 } else {
2236 werr = NetShareEnum_r(ctx, &r);
2239 r.out.result = W_ERROR_V(werr);
2241 if (DEBUGLEVEL >= 10) {
2242 NDR_PRINT_OUT_DEBUG(NetShareEnum, &r);
2245 TALLOC_FREE(frame);
2246 return (NET_API_STATUS)r.out.result;
2249 /****************************************************************
2250 NetShareGetInfo
2251 ****************************************************************/
2253 NET_API_STATUS NetShareGetInfo(const char * server_name /* [in] */,
2254 const char * net_name /* [in] */,
2255 uint32_t level /* [in] */,
2256 uint8_t **buffer /* [out] [ref] */)
2258 struct NetShareGetInfo r;
2259 struct libnetapi_ctx *ctx = NULL;
2260 NET_API_STATUS status;
2261 WERROR werr;
2262 TALLOC_CTX *frame = talloc_stackframe();
2264 status = libnetapi_getctx(&ctx);
2265 if (status != 0) {
2266 TALLOC_FREE(frame);
2267 return status;
2270 /* In parameters */
2271 r.in.server_name = server_name;
2272 r.in.net_name = net_name;
2273 r.in.level = level;
2275 /* Out parameters */
2276 r.out.buffer = buffer;
2278 if (DEBUGLEVEL >= 10) {
2279 NDR_PRINT_IN_DEBUG(NetShareGetInfo, &r);
2282 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2283 werr = NetShareGetInfo_l(ctx, &r);
2284 } else {
2285 werr = NetShareGetInfo_r(ctx, &r);
2288 r.out.result = W_ERROR_V(werr);
2290 if (DEBUGLEVEL >= 10) {
2291 NDR_PRINT_OUT_DEBUG(NetShareGetInfo, &r);
2294 TALLOC_FREE(frame);
2295 return (NET_API_STATUS)r.out.result;
2298 /****************************************************************
2299 NetShareSetInfo
2300 ****************************************************************/
2302 NET_API_STATUS NetShareSetInfo(const char * server_name /* [in] */,
2303 const char * net_name /* [in] */,
2304 uint32_t level /* [in] */,
2305 uint8_t *buffer /* [in] [ref] */,
2306 uint32_t *parm_err /* [out] [ref] */)
2308 struct NetShareSetInfo r;
2309 struct libnetapi_ctx *ctx = NULL;
2310 NET_API_STATUS status;
2311 WERROR werr;
2312 TALLOC_CTX *frame = talloc_stackframe();
2314 status = libnetapi_getctx(&ctx);
2315 if (status != 0) {
2316 TALLOC_FREE(frame);
2317 return status;
2320 /* In parameters */
2321 r.in.server_name = server_name;
2322 r.in.net_name = net_name;
2323 r.in.level = level;
2324 r.in.buffer = buffer;
2326 /* Out parameters */
2327 r.out.parm_err = parm_err;
2329 if (DEBUGLEVEL >= 10) {
2330 NDR_PRINT_IN_DEBUG(NetShareSetInfo, &r);
2333 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2334 werr = NetShareSetInfo_l(ctx, &r);
2335 } else {
2336 werr = NetShareSetInfo_r(ctx, &r);
2339 r.out.result = W_ERROR_V(werr);
2341 if (DEBUGLEVEL >= 10) {
2342 NDR_PRINT_OUT_DEBUG(NetShareSetInfo, &r);
2345 TALLOC_FREE(frame);
2346 return (NET_API_STATUS)r.out.result;
2349 /****************************************************************
2350 NetFileClose
2351 ****************************************************************/
2353 NET_API_STATUS NetFileClose(const char * server_name /* [in] */,
2354 uint32_t fileid /* [in] */)
2356 struct NetFileClose r;
2357 struct libnetapi_ctx *ctx = NULL;
2358 NET_API_STATUS status;
2359 WERROR werr;
2360 TALLOC_CTX *frame = talloc_stackframe();
2362 status = libnetapi_getctx(&ctx);
2363 if (status != 0) {
2364 TALLOC_FREE(frame);
2365 return status;
2368 /* In parameters */
2369 r.in.server_name = server_name;
2370 r.in.fileid = fileid;
2372 /* Out parameters */
2374 if (DEBUGLEVEL >= 10) {
2375 NDR_PRINT_IN_DEBUG(NetFileClose, &r);
2378 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2379 werr = NetFileClose_l(ctx, &r);
2380 } else {
2381 werr = NetFileClose_r(ctx, &r);
2384 r.out.result = W_ERROR_V(werr);
2386 if (DEBUGLEVEL >= 10) {
2387 NDR_PRINT_OUT_DEBUG(NetFileClose, &r);
2390 TALLOC_FREE(frame);
2391 return (NET_API_STATUS)r.out.result;
2394 /****************************************************************
2395 NetFileGetInfo
2396 ****************************************************************/
2398 NET_API_STATUS NetFileGetInfo(const char * server_name /* [in] */,
2399 uint32_t fileid /* [in] */,
2400 uint32_t level /* [in] */,
2401 uint8_t **buffer /* [out] [ref] */)
2403 struct NetFileGetInfo r;
2404 struct libnetapi_ctx *ctx = NULL;
2405 NET_API_STATUS status;
2406 WERROR werr;
2407 TALLOC_CTX *frame = talloc_stackframe();
2409 status = libnetapi_getctx(&ctx);
2410 if (status != 0) {
2411 TALLOC_FREE(frame);
2412 return status;
2415 /* In parameters */
2416 r.in.server_name = server_name;
2417 r.in.fileid = fileid;
2418 r.in.level = level;
2420 /* Out parameters */
2421 r.out.buffer = buffer;
2423 if (DEBUGLEVEL >= 10) {
2424 NDR_PRINT_IN_DEBUG(NetFileGetInfo, &r);
2427 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2428 werr = NetFileGetInfo_l(ctx, &r);
2429 } else {
2430 werr = NetFileGetInfo_r(ctx, &r);
2433 r.out.result = W_ERROR_V(werr);
2435 if (DEBUGLEVEL >= 10) {
2436 NDR_PRINT_OUT_DEBUG(NetFileGetInfo, &r);
2439 TALLOC_FREE(frame);
2440 return (NET_API_STATUS)r.out.result;
2443 /****************************************************************
2444 NetFileEnum
2445 ****************************************************************/
2447 NET_API_STATUS NetFileEnum(const char * server_name /* [in] */,
2448 const char * base_path /* [in] */,
2449 const char * user_name /* [in] */,
2450 uint32_t level /* [in] */,
2451 uint8_t **buffer /* [out] [ref] */,
2452 uint32_t prefmaxlen /* [in] */,
2453 uint32_t *entries_read /* [out] [ref] */,
2454 uint32_t *total_entries /* [out] [ref] */,
2455 uint32_t *resume_handle /* [in,out] [ref] */)
2457 struct NetFileEnum r;
2458 struct libnetapi_ctx *ctx = NULL;
2459 NET_API_STATUS status;
2460 WERROR werr;
2461 TALLOC_CTX *frame = talloc_stackframe();
2463 status = libnetapi_getctx(&ctx);
2464 if (status != 0) {
2465 TALLOC_FREE(frame);
2466 return status;
2469 /* In parameters */
2470 r.in.server_name = server_name;
2471 r.in.base_path = base_path;
2472 r.in.user_name = user_name;
2473 r.in.level = level;
2474 r.in.prefmaxlen = prefmaxlen;
2475 r.in.resume_handle = resume_handle;
2477 /* Out parameters */
2478 r.out.buffer = buffer;
2479 r.out.entries_read = entries_read;
2480 r.out.total_entries = total_entries;
2481 r.out.resume_handle = resume_handle;
2483 if (DEBUGLEVEL >= 10) {
2484 NDR_PRINT_IN_DEBUG(NetFileEnum, &r);
2487 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2488 werr = NetFileEnum_l(ctx, &r);
2489 } else {
2490 werr = NetFileEnum_r(ctx, &r);
2493 r.out.result = W_ERROR_V(werr);
2495 if (DEBUGLEVEL >= 10) {
2496 NDR_PRINT_OUT_DEBUG(NetFileEnum, &r);
2499 TALLOC_FREE(frame);
2500 return (NET_API_STATUS)r.out.result;
2503 /****************************************************************
2504 NetShutdownInit
2505 ****************************************************************/
2507 NET_API_STATUS NetShutdownInit(const char * server_name /* [in] */,
2508 const char * message /* [in] */,
2509 uint32_t timeout /* [in] */,
2510 uint8_t force_apps /* [in] */,
2511 uint8_t do_reboot /* [in] */)
2513 struct NetShutdownInit r;
2514 struct libnetapi_ctx *ctx = NULL;
2515 NET_API_STATUS status;
2516 WERROR werr;
2517 TALLOC_CTX *frame = talloc_stackframe();
2519 status = libnetapi_getctx(&ctx);
2520 if (status != 0) {
2521 TALLOC_FREE(frame);
2522 return status;
2525 /* In parameters */
2526 r.in.server_name = server_name;
2527 r.in.message = message;
2528 r.in.timeout = timeout;
2529 r.in.force_apps = force_apps;
2530 r.in.do_reboot = do_reboot;
2532 /* Out parameters */
2534 if (DEBUGLEVEL >= 10) {
2535 NDR_PRINT_IN_DEBUG(NetShutdownInit, &r);
2538 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2539 werr = NetShutdownInit_l(ctx, &r);
2540 } else {
2541 werr = NetShutdownInit_r(ctx, &r);
2544 r.out.result = W_ERROR_V(werr);
2546 if (DEBUGLEVEL >= 10) {
2547 NDR_PRINT_OUT_DEBUG(NetShutdownInit, &r);
2550 TALLOC_FREE(frame);
2551 return (NET_API_STATUS)r.out.result;
2554 /****************************************************************
2555 NetShutdownAbort
2556 ****************************************************************/
2558 NET_API_STATUS NetShutdownAbort(const char * server_name /* [in] */)
2560 struct NetShutdownAbort r;
2561 struct libnetapi_ctx *ctx = NULL;
2562 NET_API_STATUS status;
2563 WERROR werr;
2564 TALLOC_CTX *frame = talloc_stackframe();
2566 status = libnetapi_getctx(&ctx);
2567 if (status != 0) {
2568 TALLOC_FREE(frame);
2569 return status;
2572 /* In parameters */
2573 r.in.server_name = server_name;
2575 /* Out parameters */
2577 if (DEBUGLEVEL >= 10) {
2578 NDR_PRINT_IN_DEBUG(NetShutdownAbort, &r);
2581 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2582 werr = NetShutdownAbort_l(ctx, &r);
2583 } else {
2584 werr = NetShutdownAbort_r(ctx, &r);
2587 r.out.result = W_ERROR_V(werr);
2589 if (DEBUGLEVEL >= 10) {
2590 NDR_PRINT_OUT_DEBUG(NetShutdownAbort, &r);
2593 TALLOC_FREE(frame);
2594 return (NET_API_STATUS)r.out.result;
2597 /****************************************************************
2598 I_NetLogonControl
2599 ****************************************************************/
2601 NET_API_STATUS I_NetLogonControl(const char * server_name /* [in] */,
2602 uint32_t function_code /* [in] */,
2603 uint32_t query_level /* [in] */,
2604 uint8_t **buffer /* [out] [ref] */)
2606 struct I_NetLogonControl r;
2607 struct libnetapi_ctx *ctx = NULL;
2608 NET_API_STATUS status;
2609 WERROR werr;
2610 TALLOC_CTX *frame = talloc_stackframe();
2612 status = libnetapi_getctx(&ctx);
2613 if (status != 0) {
2614 TALLOC_FREE(frame);
2615 return status;
2618 /* In parameters */
2619 r.in.server_name = server_name;
2620 r.in.function_code = function_code;
2621 r.in.query_level = query_level;
2623 /* Out parameters */
2624 r.out.buffer = buffer;
2626 if (DEBUGLEVEL >= 10) {
2627 NDR_PRINT_IN_DEBUG(I_NetLogonControl, &r);
2630 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2631 werr = I_NetLogonControl_l(ctx, &r);
2632 } else {
2633 werr = I_NetLogonControl_r(ctx, &r);
2636 r.out.result = W_ERROR_V(werr);
2638 if (DEBUGLEVEL >= 10) {
2639 NDR_PRINT_OUT_DEBUG(I_NetLogonControl, &r);
2642 TALLOC_FREE(frame);
2643 return (NET_API_STATUS)r.out.result;
2646 /****************************************************************
2647 I_NetLogonControl2
2648 ****************************************************************/
2650 NET_API_STATUS I_NetLogonControl2(const char * server_name /* [in] */,
2651 uint32_t function_code /* [in] */,
2652 uint32_t query_level /* [in] */,
2653 uint8_t *data /* [in] [ref] */,
2654 uint8_t **buffer /* [out] [ref] */)
2656 struct I_NetLogonControl2 r;
2657 struct libnetapi_ctx *ctx = NULL;
2658 NET_API_STATUS status;
2659 WERROR werr;
2660 TALLOC_CTX *frame = talloc_stackframe();
2662 status = libnetapi_getctx(&ctx);
2663 if (status != 0) {
2664 TALLOC_FREE(frame);
2665 return status;
2668 /* In parameters */
2669 r.in.server_name = server_name;
2670 r.in.function_code = function_code;
2671 r.in.query_level = query_level;
2672 r.in.data = data;
2674 /* Out parameters */
2675 r.out.buffer = buffer;
2677 if (DEBUGLEVEL >= 10) {
2678 NDR_PRINT_IN_DEBUG(I_NetLogonControl2, &r);
2681 if (LIBNETAPI_LOCAL_SERVER(server_name)) {
2682 werr = I_NetLogonControl2_l(ctx, &r);
2683 } else {
2684 werr = I_NetLogonControl2_r(ctx, &r);
2687 r.out.result = W_ERROR_V(werr);
2689 if (DEBUGLEVEL >= 10) {
2690 NDR_PRINT_OUT_DEBUG(I_NetLogonControl2, &r);
2693 TALLOC_FREE(frame);
2694 return (NET_API_STATUS)r.out.result;