2 * Unix SMB/CIFS implementation.
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/>.
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 /****************************************************************
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
;
43 status
= libnetapi_getctx(&ctx
);
51 r
.in
.account_ou
= account_ou
;
52 r
.in
.account
= account
;
53 r
.in
.password
= password
;
54 r
.in
.join_flags
= join_flags
;
58 if (DEBUGLEVEL
>= 10) {
59 NDR_PRINT_IN_DEBUG(NetJoinDomain
, &r
);
62 if (LIBNETAPI_LOCAL_SERVER(server
)) {
63 werr
= NetJoinDomain_l(ctx
, &r
);
65 werr
= NetJoinDomain_r(ctx
, &r
);
68 r
.out
.result
= W_ERROR_V(werr
);
70 if (DEBUGLEVEL
>= 10) {
71 NDR_PRINT_OUT_DEBUG(NetJoinDomain
, &r
);
77 /****************************************************************
79 ****************************************************************/
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] */)
86 struct NetUnjoinDomain r
;
87 struct libnetapi_ctx
*ctx
= NULL
;
88 NET_API_STATUS status
;
91 status
= libnetapi_getctx(&ctx
);
97 r
.in
.server_name
= server_name
;
98 r
.in
.account
= account
;
99 r
.in
.password
= password
;
100 r
.in
.unjoin_flags
= unjoin_flags
;
104 if (DEBUGLEVEL
>= 10) {
105 NDR_PRINT_IN_DEBUG(NetUnjoinDomain
, &r
);
108 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
109 werr
= NetUnjoinDomain_l(ctx
, &r
);
111 werr
= NetUnjoinDomain_r(ctx
, &r
);
114 r
.out
.result
= W_ERROR_V(werr
);
116 if (DEBUGLEVEL
>= 10) {
117 NDR_PRINT_OUT_DEBUG(NetUnjoinDomain
, &r
);
123 /****************************************************************
124 NetGetJoinInformation
125 ****************************************************************/
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] */)
131 struct NetGetJoinInformation r
;
132 struct libnetapi_ctx
*ctx
= NULL
;
133 NET_API_STATUS status
;
136 status
= libnetapi_getctx(&ctx
);
142 r
.in
.server_name
= server_name
;
145 r
.out
.name_buffer
= name_buffer
;
146 r
.out
.name_type
= name_type
;
148 if (DEBUGLEVEL
>= 10) {
149 NDR_PRINT_IN_DEBUG(NetGetJoinInformation
, &r
);
152 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
153 werr
= NetGetJoinInformation_l(ctx
, &r
);
155 werr
= NetGetJoinInformation_r(ctx
, &r
);
158 r
.out
.result
= W_ERROR_V(werr
);
160 if (DEBUGLEVEL
>= 10) {
161 NDR_PRINT_OUT_DEBUG(NetGetJoinInformation
, &r
);
167 /****************************************************************
169 ****************************************************************/
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] */)
178 struct NetGetJoinableOUs r
;
179 struct libnetapi_ctx
*ctx
= NULL
;
180 NET_API_STATUS status
;
183 status
= libnetapi_getctx(&ctx
);
189 r
.in
.server_name
= server_name
;
190 r
.in
.domain
= domain
;
191 r
.in
.account
= account
;
192 r
.in
.password
= password
;
195 r
.out
.ou_count
= ou_count
;
198 if (DEBUGLEVEL
>= 10) {
199 NDR_PRINT_IN_DEBUG(NetGetJoinableOUs
, &r
);
202 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
203 werr
= NetGetJoinableOUs_l(ctx
, &r
);
205 werr
= NetGetJoinableOUs_r(ctx
, &r
);
208 r
.out
.result
= W_ERROR_V(werr
);
210 if (DEBUGLEVEL
>= 10) {
211 NDR_PRINT_OUT_DEBUG(NetGetJoinableOUs
, &r
);
217 /****************************************************************
219 ****************************************************************/
221 NET_API_STATUS
NetServerGetInfo(const char * server_name
/* [in] [unique] */,
222 uint32_t level
/* [in] */,
223 uint8_t **buffer
/* [out] [ref] */)
225 struct NetServerGetInfo r
;
226 struct libnetapi_ctx
*ctx
= NULL
;
227 NET_API_STATUS status
;
230 status
= libnetapi_getctx(&ctx
);
236 r
.in
.server_name
= server_name
;
240 r
.out
.buffer
= buffer
;
242 if (DEBUGLEVEL
>= 10) {
243 NDR_PRINT_IN_DEBUG(NetServerGetInfo
, &r
);
246 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
247 werr
= NetServerGetInfo_l(ctx
, &r
);
249 werr
= NetServerGetInfo_r(ctx
, &r
);
252 r
.out
.result
= W_ERROR_V(werr
);
254 if (DEBUGLEVEL
>= 10) {
255 NDR_PRINT_OUT_DEBUG(NetServerGetInfo
, &r
);
261 /****************************************************************
263 ****************************************************************/
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] */)
270 struct NetServerSetInfo r
;
271 struct libnetapi_ctx
*ctx
= NULL
;
272 NET_API_STATUS status
;
275 status
= libnetapi_getctx(&ctx
);
281 r
.in
.server_name
= server_name
;
283 r
.in
.buffer
= buffer
;
286 r
.out
.parm_error
= parm_error
;
288 if (DEBUGLEVEL
>= 10) {
289 NDR_PRINT_IN_DEBUG(NetServerSetInfo
, &r
);
292 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
293 werr
= NetServerSetInfo_l(ctx
, &r
);
295 werr
= NetServerSetInfo_r(ctx
, &r
);
298 r
.out
.result
= W_ERROR_V(werr
);
300 if (DEBUGLEVEL
>= 10) {
301 NDR_PRINT_OUT_DEBUG(NetServerSetInfo
, &r
);
307 /****************************************************************
309 ****************************************************************/
311 NET_API_STATUS
NetGetDCName(const char * server_name
/* [in] [unique] */,
312 const char * domain_name
/* [in] [unique] */,
313 uint8_t **buffer
/* [out] [ref] */)
315 struct NetGetDCName r
;
316 struct libnetapi_ctx
*ctx
= NULL
;
317 NET_API_STATUS status
;
320 status
= libnetapi_getctx(&ctx
);
326 r
.in
.server_name
= server_name
;
327 r
.in
.domain_name
= domain_name
;
330 r
.out
.buffer
= buffer
;
332 if (DEBUGLEVEL
>= 10) {
333 NDR_PRINT_IN_DEBUG(NetGetDCName
, &r
);
336 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
337 werr
= NetGetDCName_l(ctx
, &r
);
339 werr
= NetGetDCName_r(ctx
, &r
);
342 r
.out
.result
= W_ERROR_V(werr
);
344 if (DEBUGLEVEL
>= 10) {
345 NDR_PRINT_OUT_DEBUG(NetGetDCName
, &r
);
351 /****************************************************************
353 ****************************************************************/
355 NET_API_STATUS
NetGetAnyDCName(const char * server_name
/* [in] [unique] */,
356 const char * domain_name
/* [in] [unique] */,
357 uint8_t **buffer
/* [out] [ref] */)
359 struct NetGetAnyDCName r
;
360 struct libnetapi_ctx
*ctx
= NULL
;
361 NET_API_STATUS status
;
364 status
= libnetapi_getctx(&ctx
);
370 r
.in
.server_name
= server_name
;
371 r
.in
.domain_name
= domain_name
;
374 r
.out
.buffer
= buffer
;
376 if (DEBUGLEVEL
>= 10) {
377 NDR_PRINT_IN_DEBUG(NetGetAnyDCName
, &r
);
380 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
381 werr
= NetGetAnyDCName_l(ctx
, &r
);
383 werr
= NetGetAnyDCName_r(ctx
, &r
);
386 r
.out
.result
= W_ERROR_V(werr
);
388 if (DEBUGLEVEL
>= 10) {
389 NDR_PRINT_OUT_DEBUG(NetGetAnyDCName
, &r
);
395 /****************************************************************
397 ****************************************************************/
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] */)
406 struct DsGetDcName r
;
407 struct libnetapi_ctx
*ctx
= NULL
;
408 NET_API_STATUS status
;
411 status
= libnetapi_getctx(&ctx
);
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
;
424 r
.out
.dc_info
= dc_info
;
426 if (DEBUGLEVEL
>= 10) {
427 NDR_PRINT_IN_DEBUG(DsGetDcName
, &r
);
430 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
431 werr
= DsGetDcName_l(ctx
, &r
);
433 werr
= DsGetDcName_r(ctx
, &r
);
436 r
.out
.result
= W_ERROR_V(werr
);
438 if (DEBUGLEVEL
>= 10) {
439 NDR_PRINT_OUT_DEBUG(DsGetDcName
, &r
);
445 /****************************************************************
447 ****************************************************************/
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] */)
455 struct libnetapi_ctx
*ctx
= NULL
;
456 NET_API_STATUS status
;
459 status
= libnetapi_getctx(&ctx
);
465 r
.in
.server_name
= server_name
;
467 r
.in
.buffer
= buffer
;
470 r
.out
.parm_error
= parm_error
;
472 if (DEBUGLEVEL
>= 10) {
473 NDR_PRINT_IN_DEBUG(NetUserAdd
, &r
);
476 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
477 werr
= NetUserAdd_l(ctx
, &r
);
479 werr
= NetUserAdd_r(ctx
, &r
);
482 r
.out
.result
= W_ERROR_V(werr
);
484 if (DEBUGLEVEL
>= 10) {
485 NDR_PRINT_OUT_DEBUG(NetUserAdd
, &r
);
491 /****************************************************************
493 ****************************************************************/
495 NET_API_STATUS
NetUserDel(const char * server_name
/* [in] [unique] */,
496 const char * user_name
/* [in] [ref] */)
499 struct libnetapi_ctx
*ctx
= NULL
;
500 NET_API_STATUS status
;
503 status
= libnetapi_getctx(&ctx
);
509 r
.in
.server_name
= server_name
;
510 r
.in
.user_name
= user_name
;
514 if (DEBUGLEVEL
>= 10) {
515 NDR_PRINT_IN_DEBUG(NetUserDel
, &r
);
518 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
519 werr
= NetUserDel_l(ctx
, &r
);
521 werr
= NetUserDel_r(ctx
, &r
);
524 r
.out
.result
= W_ERROR_V(werr
);
526 if (DEBUGLEVEL
>= 10) {
527 NDR_PRINT_OUT_DEBUG(NetUserDel
, &r
);
533 /****************************************************************
535 ****************************************************************/
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] */)
546 struct NetUserEnum r
;
547 struct libnetapi_ctx
*ctx
= NULL
;
548 NET_API_STATUS status
;
551 status
= libnetapi_getctx(&ctx
);
557 r
.in
.server_name
= server_name
;
559 r
.in
.filter
= filter
;
560 r
.in
.prefmaxlen
= prefmaxlen
;
561 r
.in
.resume_handle
= resume_handle
;
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
;
569 if (DEBUGLEVEL
>= 10) {
570 NDR_PRINT_IN_DEBUG(NetUserEnum
, &r
);
573 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
574 werr
= NetUserEnum_l(ctx
, &r
);
576 werr
= NetUserEnum_r(ctx
, &r
);
579 r
.out
.result
= W_ERROR_V(werr
);
581 if (DEBUGLEVEL
>= 10) {
582 NDR_PRINT_OUT_DEBUG(NetUserEnum
, &r
);
588 /****************************************************************
589 NetUserChangePassword
590 ****************************************************************/
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] */)
597 struct NetUserChangePassword r
;
598 struct libnetapi_ctx
*ctx
= NULL
;
599 NET_API_STATUS status
;
602 status
= libnetapi_getctx(&ctx
);
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
;
615 if (DEBUGLEVEL
>= 10) {
616 NDR_PRINT_IN_DEBUG(NetUserChangePassword
, &r
);
619 if (LIBNETAPI_LOCAL_SERVER(domain_name
)) {
620 werr
= NetUserChangePassword_l(ctx
, &r
);
622 werr
= NetUserChangePassword_r(ctx
, &r
);
625 r
.out
.result
= W_ERROR_V(werr
);
627 if (DEBUGLEVEL
>= 10) {
628 NDR_PRINT_OUT_DEBUG(NetUserChangePassword
, &r
);
634 /****************************************************************
636 ****************************************************************/
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] */)
643 struct NetUserGetInfo r
;
644 struct libnetapi_ctx
*ctx
= NULL
;
645 NET_API_STATUS status
;
648 status
= libnetapi_getctx(&ctx
);
654 r
.in
.server_name
= server_name
;
655 r
.in
.user_name
= user_name
;
659 r
.out
.buffer
= buffer
;
661 if (DEBUGLEVEL
>= 10) {
662 NDR_PRINT_IN_DEBUG(NetUserGetInfo
, &r
);
665 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
666 werr
= NetUserGetInfo_l(ctx
, &r
);
668 werr
= NetUserGetInfo_r(ctx
, &r
);
671 r
.out
.result
= W_ERROR_V(werr
);
673 if (DEBUGLEVEL
>= 10) {
674 NDR_PRINT_OUT_DEBUG(NetUserGetInfo
, &r
);
680 /****************************************************************
682 ****************************************************************/
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] */)
690 struct NetUserSetInfo r
;
691 struct libnetapi_ctx
*ctx
= NULL
;
692 NET_API_STATUS status
;
695 status
= libnetapi_getctx(&ctx
);
701 r
.in
.server_name
= server_name
;
702 r
.in
.user_name
= user_name
;
704 r
.in
.buffer
= buffer
;
707 r
.out
.parm_err
= parm_err
;
709 if (DEBUGLEVEL
>= 10) {
710 NDR_PRINT_IN_DEBUG(NetUserSetInfo
, &r
);
713 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
714 werr
= NetUserSetInfo_l(ctx
, &r
);
716 werr
= NetUserSetInfo_r(ctx
, &r
);
719 r
.out
.result
= W_ERROR_V(werr
);
721 if (DEBUGLEVEL
>= 10) {
722 NDR_PRINT_OUT_DEBUG(NetUserSetInfo
, &r
);
728 /****************************************************************
729 NetQueryDisplayInformation
730 ****************************************************************/
732 NET_API_STATUS
NetQueryDisplayInformation(const char * server_name
/* [in] [unique] */,
733 uint32_t level
/* [in] */,
734 uint32_t idx
/* [in] */,
735 uint32_t entries_requested
/* [in] */,
736 uint32_t prefmaxlen
/* [in] */,
737 uint32_t *entries_read
/* [out] [ref] */,
738 void **buffer
/* [out] [noprint,ref] */)
740 struct NetQueryDisplayInformation r
;
741 struct libnetapi_ctx
*ctx
= NULL
;
742 NET_API_STATUS status
;
745 status
= libnetapi_getctx(&ctx
);
751 r
.in
.server_name
= server_name
;
754 r
.in
.entries_requested
= entries_requested
;
755 r
.in
.prefmaxlen
= prefmaxlen
;
758 r
.out
.entries_read
= entries_read
;
759 r
.out
.buffer
= buffer
;
761 if (DEBUGLEVEL
>= 10) {
762 NDR_PRINT_IN_DEBUG(NetQueryDisplayInformation
, &r
);
765 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
766 werr
= NetQueryDisplayInformation_l(ctx
, &r
);
768 werr
= NetQueryDisplayInformation_r(ctx
, &r
);
771 r
.out
.result
= W_ERROR_V(werr
);
773 if (DEBUGLEVEL
>= 10) {
774 NDR_PRINT_OUT_DEBUG(NetQueryDisplayInformation
, &r
);
780 /****************************************************************
782 ****************************************************************/
784 NET_API_STATUS
NetGroupAdd(const char * server_name
/* [in] */,
785 uint32_t level
/* [in] */,
786 uint8_t *buffer
/* [in] [ref] */,
787 uint32_t *parm_err
/* [out] [ref] */)
789 struct NetGroupAdd r
;
790 struct libnetapi_ctx
*ctx
= NULL
;
791 NET_API_STATUS status
;
794 status
= libnetapi_getctx(&ctx
);
800 r
.in
.server_name
= server_name
;
802 r
.in
.buffer
= buffer
;
805 r
.out
.parm_err
= parm_err
;
807 if (DEBUGLEVEL
>= 10) {
808 NDR_PRINT_IN_DEBUG(NetGroupAdd
, &r
);
811 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
812 werr
= NetGroupAdd_l(ctx
, &r
);
814 werr
= NetGroupAdd_r(ctx
, &r
);
817 r
.out
.result
= W_ERROR_V(werr
);
819 if (DEBUGLEVEL
>= 10) {
820 NDR_PRINT_OUT_DEBUG(NetGroupAdd
, &r
);
826 /****************************************************************
828 ****************************************************************/
830 NET_API_STATUS
NetGroupDel(const char * server_name
/* [in] */,
831 const char * group_name
/* [in] */)
833 struct NetGroupDel r
;
834 struct libnetapi_ctx
*ctx
= NULL
;
835 NET_API_STATUS status
;
838 status
= libnetapi_getctx(&ctx
);
844 r
.in
.server_name
= server_name
;
845 r
.in
.group_name
= group_name
;
849 if (DEBUGLEVEL
>= 10) {
850 NDR_PRINT_IN_DEBUG(NetGroupDel
, &r
);
853 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
854 werr
= NetGroupDel_l(ctx
, &r
);
856 werr
= NetGroupDel_r(ctx
, &r
);
859 r
.out
.result
= W_ERROR_V(werr
);
861 if (DEBUGLEVEL
>= 10) {
862 NDR_PRINT_OUT_DEBUG(NetGroupDel
, &r
);
868 /****************************************************************
870 ****************************************************************/
872 NET_API_STATUS
NetGroupEnum(const char * server_name
/* [in] */,
873 uint32_t level
/* [in] */,
874 uint8_t **buffer
/* [out] [ref] */,
875 uint32_t prefmaxlen
/* [in] */,
876 uint32_t *entries_read
/* [out] [ref] */,
877 uint32_t *total_entries
/* [out] [ref] */,
878 uint32_t *resume_handle
/* [in,out] [ref] */)
880 struct NetGroupEnum r
;
881 struct libnetapi_ctx
*ctx
= NULL
;
882 NET_API_STATUS status
;
885 status
= libnetapi_getctx(&ctx
);
891 r
.in
.server_name
= server_name
;
893 r
.in
.prefmaxlen
= prefmaxlen
;
894 r
.in
.resume_handle
= resume_handle
;
897 r
.out
.buffer
= buffer
;
898 r
.out
.entries_read
= entries_read
;
899 r
.out
.total_entries
= total_entries
;
900 r
.out
.resume_handle
= resume_handle
;
902 if (DEBUGLEVEL
>= 10) {
903 NDR_PRINT_IN_DEBUG(NetGroupEnum
, &r
);
906 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
907 werr
= NetGroupEnum_l(ctx
, &r
);
909 werr
= NetGroupEnum_r(ctx
, &r
);
912 r
.out
.result
= W_ERROR_V(werr
);
914 if (DEBUGLEVEL
>= 10) {
915 NDR_PRINT_OUT_DEBUG(NetGroupEnum
, &r
);
921 /****************************************************************
923 ****************************************************************/
925 NET_API_STATUS
NetGroupSetInfo(const char * server_name
/* [in] */,
926 const char * group_name
/* [in] */,
927 uint32_t level
/* [in] */,
928 uint8_t *buffer
/* [in] [ref] */,
929 uint32_t *parm_err
/* [out] [ref] */)
931 struct NetGroupSetInfo r
;
932 struct libnetapi_ctx
*ctx
= NULL
;
933 NET_API_STATUS status
;
936 status
= libnetapi_getctx(&ctx
);
942 r
.in
.server_name
= server_name
;
943 r
.in
.group_name
= group_name
;
945 r
.in
.buffer
= buffer
;
948 r
.out
.parm_err
= parm_err
;
950 if (DEBUGLEVEL
>= 10) {
951 NDR_PRINT_IN_DEBUG(NetGroupSetInfo
, &r
);
954 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
955 werr
= NetGroupSetInfo_l(ctx
, &r
);
957 werr
= NetGroupSetInfo_r(ctx
, &r
);
960 r
.out
.result
= W_ERROR_V(werr
);
962 if (DEBUGLEVEL
>= 10) {
963 NDR_PRINT_OUT_DEBUG(NetGroupSetInfo
, &r
);
969 /****************************************************************
971 ****************************************************************/
973 NET_API_STATUS
NetGroupGetInfo(const char * server_name
/* [in] */,
974 const char * group_name
/* [in] */,
975 uint32_t level
/* [in] */,
976 uint8_t **buffer
/* [out] [ref] */)
978 struct NetGroupGetInfo r
;
979 struct libnetapi_ctx
*ctx
= NULL
;
980 NET_API_STATUS status
;
983 status
= libnetapi_getctx(&ctx
);
989 r
.in
.server_name
= server_name
;
990 r
.in
.group_name
= group_name
;
994 r
.out
.buffer
= buffer
;
996 if (DEBUGLEVEL
>= 10) {
997 NDR_PRINT_IN_DEBUG(NetGroupGetInfo
, &r
);
1000 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
1001 werr
= NetGroupGetInfo_l(ctx
, &r
);
1003 werr
= NetGroupGetInfo_r(ctx
, &r
);
1006 r
.out
.result
= W_ERROR_V(werr
);
1008 if (DEBUGLEVEL
>= 10) {
1009 NDR_PRINT_OUT_DEBUG(NetGroupGetInfo
, &r
);
1012 return r
.out
.result
;
1015 /****************************************************************
1017 ****************************************************************/
1019 NET_API_STATUS
NetGroupAddUser(const char * server_name
/* [in] */,
1020 const char * group_name
/* [in] */,
1021 const char * user_name
/* [in] */)
1023 struct NetGroupAddUser r
;
1024 struct libnetapi_ctx
*ctx
= NULL
;
1025 NET_API_STATUS status
;
1028 status
= libnetapi_getctx(&ctx
);
1034 r
.in
.server_name
= server_name
;
1035 r
.in
.group_name
= group_name
;
1036 r
.in
.user_name
= user_name
;
1038 /* Out parameters */
1040 if (DEBUGLEVEL
>= 10) {
1041 NDR_PRINT_IN_DEBUG(NetGroupAddUser
, &r
);
1044 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
1045 werr
= NetGroupAddUser_l(ctx
, &r
);
1047 werr
= NetGroupAddUser_r(ctx
, &r
);
1050 r
.out
.result
= W_ERROR_V(werr
);
1052 if (DEBUGLEVEL
>= 10) {
1053 NDR_PRINT_OUT_DEBUG(NetGroupAddUser
, &r
);
1056 return r
.out
.result
;
1059 /****************************************************************
1061 ****************************************************************/
1063 NET_API_STATUS
NetGroupDelUser(const char * server_name
/* [in] */,
1064 const char * group_name
/* [in] */,
1065 const char * user_name
/* [in] */)
1067 struct NetGroupDelUser r
;
1068 struct libnetapi_ctx
*ctx
= NULL
;
1069 NET_API_STATUS status
;
1072 status
= libnetapi_getctx(&ctx
);
1078 r
.in
.server_name
= server_name
;
1079 r
.in
.group_name
= group_name
;
1080 r
.in
.user_name
= user_name
;
1082 /* Out parameters */
1084 if (DEBUGLEVEL
>= 10) {
1085 NDR_PRINT_IN_DEBUG(NetGroupDelUser
, &r
);
1088 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
1089 werr
= NetGroupDelUser_l(ctx
, &r
);
1091 werr
= NetGroupDelUser_r(ctx
, &r
);
1094 r
.out
.result
= W_ERROR_V(werr
);
1096 if (DEBUGLEVEL
>= 10) {
1097 NDR_PRINT_OUT_DEBUG(NetGroupDelUser
, &r
);
1100 return r
.out
.result
;
1103 /****************************************************************
1105 ****************************************************************/
1107 NET_API_STATUS
NetGroupGetUsers(const char * server_name
/* [in] */,
1108 const char * group_name
/* [in] */,
1109 uint32_t level
/* [in] */,
1110 uint8_t **buffer
/* [out] [ref] */,
1111 uint32_t prefmaxlen
/* [in] */,
1112 uint32_t *entries_read
/* [out] [ref] */,
1113 uint32_t *total_entries
/* [out] [ref] */,
1114 uint32_t *resume_handle
/* [in,out] [ref] */)
1116 struct NetGroupGetUsers r
;
1117 struct libnetapi_ctx
*ctx
= NULL
;
1118 NET_API_STATUS status
;
1121 status
= libnetapi_getctx(&ctx
);
1127 r
.in
.server_name
= server_name
;
1128 r
.in
.group_name
= group_name
;
1130 r
.in
.prefmaxlen
= prefmaxlen
;
1131 r
.in
.resume_handle
= resume_handle
;
1133 /* Out parameters */
1134 r
.out
.buffer
= buffer
;
1135 r
.out
.entries_read
= entries_read
;
1136 r
.out
.total_entries
= total_entries
;
1137 r
.out
.resume_handle
= resume_handle
;
1139 if (DEBUGLEVEL
>= 10) {
1140 NDR_PRINT_IN_DEBUG(NetGroupGetUsers
, &r
);
1143 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
1144 werr
= NetGroupGetUsers_l(ctx
, &r
);
1146 werr
= NetGroupGetUsers_r(ctx
, &r
);
1149 r
.out
.result
= W_ERROR_V(werr
);
1151 if (DEBUGLEVEL
>= 10) {
1152 NDR_PRINT_OUT_DEBUG(NetGroupGetUsers
, &r
);
1155 return r
.out
.result
;
1158 /****************************************************************
1160 ****************************************************************/
1162 NET_API_STATUS
NetLocalGroupAdd(const char * server_name
/* [in] */,
1163 uint32_t level
/* [in] */,
1164 uint8_t *buffer
/* [in] [ref] */,
1165 uint32_t *parm_err
/* [out] [ref] */)
1167 struct NetLocalGroupAdd r
;
1168 struct libnetapi_ctx
*ctx
= NULL
;
1169 NET_API_STATUS status
;
1172 status
= libnetapi_getctx(&ctx
);
1178 r
.in
.server_name
= server_name
;
1180 r
.in
.buffer
= buffer
;
1182 /* Out parameters */
1183 r
.out
.parm_err
= parm_err
;
1185 if (DEBUGLEVEL
>= 10) {
1186 NDR_PRINT_IN_DEBUG(NetLocalGroupAdd
, &r
);
1189 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
1190 werr
= NetLocalGroupAdd_l(ctx
, &r
);
1192 werr
= NetLocalGroupAdd_r(ctx
, &r
);
1195 r
.out
.result
= W_ERROR_V(werr
);
1197 if (DEBUGLEVEL
>= 10) {
1198 NDR_PRINT_OUT_DEBUG(NetLocalGroupAdd
, &r
);
1201 return r
.out
.result
;
1204 /****************************************************************
1206 ****************************************************************/
1208 NET_API_STATUS
NetLocalGroupDel(const char * server_name
/* [in] */,
1209 const char * group_name
/* [in] */)
1211 struct NetLocalGroupDel r
;
1212 struct libnetapi_ctx
*ctx
= NULL
;
1213 NET_API_STATUS status
;
1216 status
= libnetapi_getctx(&ctx
);
1222 r
.in
.server_name
= server_name
;
1223 r
.in
.group_name
= group_name
;
1225 /* Out parameters */
1227 if (DEBUGLEVEL
>= 10) {
1228 NDR_PRINT_IN_DEBUG(NetLocalGroupDel
, &r
);
1231 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
1232 werr
= NetLocalGroupDel_l(ctx
, &r
);
1234 werr
= NetLocalGroupDel_r(ctx
, &r
);
1237 r
.out
.result
= W_ERROR_V(werr
);
1239 if (DEBUGLEVEL
>= 10) {
1240 NDR_PRINT_OUT_DEBUG(NetLocalGroupDel
, &r
);
1243 return r
.out
.result
;
1246 /****************************************************************
1247 NetLocalGroupGetInfo
1248 ****************************************************************/
1250 NET_API_STATUS
NetLocalGroupGetInfo(const char * server_name
/* [in] */,
1251 const char * group_name
/* [in] */,
1252 uint32_t level
/* [in] */,
1253 uint8_t **buffer
/* [out] [ref] */)
1255 struct NetLocalGroupGetInfo r
;
1256 struct libnetapi_ctx
*ctx
= NULL
;
1257 NET_API_STATUS status
;
1260 status
= libnetapi_getctx(&ctx
);
1266 r
.in
.server_name
= server_name
;
1267 r
.in
.group_name
= group_name
;
1270 /* Out parameters */
1271 r
.out
.buffer
= buffer
;
1273 if (DEBUGLEVEL
>= 10) {
1274 NDR_PRINT_IN_DEBUG(NetLocalGroupGetInfo
, &r
);
1277 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
1278 werr
= NetLocalGroupGetInfo_l(ctx
, &r
);
1280 werr
= NetLocalGroupGetInfo_r(ctx
, &r
);
1283 r
.out
.result
= W_ERROR_V(werr
);
1285 if (DEBUGLEVEL
>= 10) {
1286 NDR_PRINT_OUT_DEBUG(NetLocalGroupGetInfo
, &r
);
1289 return r
.out
.result
;
1292 /****************************************************************
1293 NetLocalGroupSetInfo
1294 ****************************************************************/
1296 NET_API_STATUS
NetLocalGroupSetInfo(const char * server_name
/* [in] */,
1297 const char * group_name
/* [in] */,
1298 uint32_t level
/* [in] */,
1299 uint8_t *buffer
/* [in] [ref] */,
1300 uint32_t *parm_err
/* [out] [ref] */)
1302 struct NetLocalGroupSetInfo r
;
1303 struct libnetapi_ctx
*ctx
= NULL
;
1304 NET_API_STATUS status
;
1307 status
= libnetapi_getctx(&ctx
);
1313 r
.in
.server_name
= server_name
;
1314 r
.in
.group_name
= group_name
;
1316 r
.in
.buffer
= buffer
;
1318 /* Out parameters */
1319 r
.out
.parm_err
= parm_err
;
1321 if (DEBUGLEVEL
>= 10) {
1322 NDR_PRINT_IN_DEBUG(NetLocalGroupSetInfo
, &r
);
1325 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
1326 werr
= NetLocalGroupSetInfo_l(ctx
, &r
);
1328 werr
= NetLocalGroupSetInfo_r(ctx
, &r
);
1331 r
.out
.result
= W_ERROR_V(werr
);
1333 if (DEBUGLEVEL
>= 10) {
1334 NDR_PRINT_OUT_DEBUG(NetLocalGroupSetInfo
, &r
);
1337 return r
.out
.result
;
1340 /****************************************************************
1342 ****************************************************************/
1344 NET_API_STATUS
NetLocalGroupEnum(const char * server_name
/* [in] */,
1345 uint32_t level
/* [in] */,
1346 uint8_t **buffer
/* [out] [ref] */,
1347 uint32_t prefmaxlen
/* [in] */,
1348 uint32_t *entries_read
/* [out] [ref] */,
1349 uint32_t *total_entries
/* [out] [ref] */,
1350 uint32_t *resume_handle
/* [in,out] [ref] */)
1352 struct NetLocalGroupEnum r
;
1353 struct libnetapi_ctx
*ctx
= NULL
;
1354 NET_API_STATUS status
;
1357 status
= libnetapi_getctx(&ctx
);
1363 r
.in
.server_name
= server_name
;
1365 r
.in
.prefmaxlen
= prefmaxlen
;
1366 r
.in
.resume_handle
= resume_handle
;
1368 /* Out parameters */
1369 r
.out
.buffer
= buffer
;
1370 r
.out
.entries_read
= entries_read
;
1371 r
.out
.total_entries
= total_entries
;
1372 r
.out
.resume_handle
= resume_handle
;
1374 if (DEBUGLEVEL
>= 10) {
1375 NDR_PRINT_IN_DEBUG(NetLocalGroupEnum
, &r
);
1378 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
1379 werr
= NetLocalGroupEnum_l(ctx
, &r
);
1381 werr
= NetLocalGroupEnum_r(ctx
, &r
);
1384 r
.out
.result
= W_ERROR_V(werr
);
1386 if (DEBUGLEVEL
>= 10) {
1387 NDR_PRINT_OUT_DEBUG(NetLocalGroupEnum
, &r
);
1390 return r
.out
.result
;
1393 /****************************************************************
1395 ****************************************************************/
1397 NET_API_STATUS
NetRemoteTOD(const char * server_name
/* [in] */,
1398 uint8_t **buffer
/* [out] [ref] */)
1400 struct NetRemoteTOD r
;
1401 struct libnetapi_ctx
*ctx
= NULL
;
1402 NET_API_STATUS status
;
1405 status
= libnetapi_getctx(&ctx
);
1411 r
.in
.server_name
= server_name
;
1413 /* Out parameters */
1414 r
.out
.buffer
= buffer
;
1416 if (DEBUGLEVEL
>= 10) {
1417 NDR_PRINT_IN_DEBUG(NetRemoteTOD
, &r
);
1420 if (LIBNETAPI_LOCAL_SERVER(server_name
)) {
1421 werr
= NetRemoteTOD_l(ctx
, &r
);
1423 werr
= NetRemoteTOD_r(ctx
, &r
);
1426 r
.out
.result
= W_ERROR_V(werr
);
1428 if (DEBUGLEVEL
>= 10) {
1429 NDR_PRINT_OUT_DEBUG(NetRemoteTOD
, &r
);
1432 return r
.out
.result
;