2 * Unix SMB/CIFS implementation.
4 * Copyright (C) Guenther Deschner 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/>.
22 #include "librpc/gen_ndr/libnetapi.h"
23 #include "lib/netapi/netapi.h"
24 #include "lib/netapi/netapi_private.h"
25 #include "lib/netapi/libnetapi.h"
27 /****************************************************************
28 ****************************************************************/
30 WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx,
31 struct NetGroupAdd *r)
33 struct cli_state *cli = NULL;
34 struct rpc_pipe_client *pipe_cli = NULL;
37 POLICY_HND connect_handle, domain_handle, group_handle;
38 struct lsa_String lsa_group_name;
39 struct dom_sid2 *domain_sid = NULL;
42 struct GROUP_INFO_0 *info0 = NULL;
43 struct GROUP_INFO_1 *info1 = NULL;
44 struct GROUP_INFO_2 *info2 = NULL;
45 struct GROUP_INFO_3 *info3 = NULL;
46 union samr_GroupInfo info;
48 ZERO_STRUCT(connect_handle);
49 ZERO_STRUCT(domain_handle);
50 ZERO_STRUCT(group_handle);
53 return WERR_INVALID_PARAM;
56 switch (r->in.level) {
58 info0 = (struct GROUP_INFO_0 *)r->in.buf;
61 info1 = (struct GROUP_INFO_1 *)r->in.buf;
64 info2 = (struct GROUP_INFO_2 *)r->in.buf;
67 info3 = (struct GROUP_INFO_3 *)r->in.buf;
70 werr = WERR_UNKNOWN_LEVEL;
74 werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
75 if (!W_ERROR_IS_OK(werr)) {
79 werr = libnetapi_open_pipe(ctx, cli, PI_SAMR, &pipe_cli);
80 if (!W_ERROR_IS_OK(werr)) {
84 werr = libnetapi_samr_open_domain(ctx, pipe_cli,
85 SAMR_ACCESS_ENUM_DOMAINS |
86 SAMR_ACCESS_OPEN_DOMAIN,
87 SAMR_DOMAIN_ACCESS_CREATE_GROUP |
88 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT,
92 if (!W_ERROR_IS_OK(werr)) {
96 switch (r->in.level) {
98 init_lsa_String(&lsa_group_name, info0->grpi0_name);
101 init_lsa_String(&lsa_group_name, info1->grpi1_name);
104 init_lsa_String(&lsa_group_name, info2->grpi2_name);
107 init_lsa_String(&lsa_group_name, info3->grpi3_name);
111 status = rpccli_samr_CreateDomainGroup(pipe_cli, ctx,
115 SAMR_GROUP_ACCESS_SET_INFO,
119 if (!NT_STATUS_IS_OK(status)) {
120 werr = ntstatus_to_werror(status);
124 switch (r->in.level) {
126 if (info1->grpi1_comment) {
127 init_lsa_String(&info.description,
128 info1->grpi1_comment);
130 status = rpccli_samr_SetGroupInfo(pipe_cli, ctx,
132 GROUPINFODESCRIPTION,
137 if (info2->grpi2_comment) {
138 init_lsa_String(&info.description,
139 info2->grpi2_comment);
141 status = rpccli_samr_SetGroupInfo(pipe_cli, ctx,
143 GROUPINFODESCRIPTION,
145 if (!NT_STATUS_IS_OK(status)) {
146 werr = ntstatus_to_werror(status);
151 if (info2->grpi2_attributes != 0) {
152 info.attributes.attributes = info2->grpi2_attributes;
153 status = rpccli_samr_SetGroupInfo(pipe_cli, ctx,
161 if (info3->grpi3_comment) {
162 init_lsa_String(&info.description,
163 info3->grpi3_comment);
165 status = rpccli_samr_SetGroupInfo(pipe_cli, ctx,
167 GROUPINFODESCRIPTION,
169 if (!NT_STATUS_IS_OK(status)) {
170 werr = ntstatus_to_werror(status);
175 if (info3->grpi3_attributes != 0) {
176 info.attributes.attributes = info3->grpi3_attributes;
177 status = rpccli_samr_SetGroupInfo(pipe_cli, ctx,
187 if (!NT_STATUS_IS_OK(status)) {
188 werr = ntstatus_to_werror(status);
196 rpccli_samr_DeleteDomainGroup(pipe_cli, ctx,
204 if (is_valid_policy_hnd(&group_handle)) {
205 rpccli_samr_Close(pipe_cli, ctx, &group_handle);
207 if (is_valid_policy_hnd(&domain_handle)) {
208 rpccli_samr_Close(pipe_cli, ctx, &domain_handle);
210 if (is_valid_policy_hnd(&connect_handle)) {
211 rpccli_samr_Close(pipe_cli, ctx, &connect_handle);
217 /****************************************************************
218 ****************************************************************/
220 WERROR NetGroupAdd_l(struct libnetapi_ctx *ctx,
221 struct NetGroupAdd *r)
223 return NetGroupAdd_r(ctx, r);
226 /****************************************************************
227 ****************************************************************/
229 WERROR NetGroupDel_r(struct libnetapi_ctx *ctx,
230 struct NetGroupDel *r)
232 struct cli_state *cli = NULL;
233 struct rpc_pipe_client *pipe_cli = NULL;
236 POLICY_HND connect_handle, domain_handle, group_handle;
237 struct lsa_String lsa_group_name;
238 struct dom_sid2 *domain_sid = NULL;
241 struct samr_Ids rids;
242 struct samr_Ids types;
243 union samr_GroupInfo *info = NULL;
244 struct samr_RidTypeArray *rid_array = NULL;
246 ZERO_STRUCT(connect_handle);
247 ZERO_STRUCT(domain_handle);
248 ZERO_STRUCT(group_handle);
250 if (!r->in.group_name) {
251 return WERR_INVALID_PARAM;
254 werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
255 if (!W_ERROR_IS_OK(werr)) {
259 werr = libnetapi_open_pipe(ctx, cli, PI_SAMR, &pipe_cli);
260 if (!W_ERROR_IS_OK(werr)) {
264 werr = libnetapi_samr_open_domain(ctx, pipe_cli,
265 SAMR_ACCESS_ENUM_DOMAINS |
266 SAMR_ACCESS_OPEN_DOMAIN,
267 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT,
271 if (!W_ERROR_IS_OK(werr)) {
275 init_lsa_String(&lsa_group_name, r->in.group_name);
277 status = rpccli_samr_LookupNames(pipe_cli, ctx,
283 if (!NT_STATUS_IS_OK(status)) {
284 werr = ntstatus_to_werror(status);
288 if (types.ids[0] != SID_NAME_DOM_GRP) {
289 werr = WERR_INVALID_DATATYPE;
293 status = rpccli_samr_OpenGroup(pipe_cli, ctx,
296 SAMR_GROUP_ACCESS_GET_MEMBERS |
297 SAMR_GROUP_ACCESS_REMOVE_MEMBER |
298 SAMR_GROUP_ACCESS_ADD_MEMBER |
299 SAMR_GROUP_ACCESS_LOOKUP_INFO,
302 if (!NT_STATUS_IS_OK(status)) {
303 werr = ntstatus_to_werror(status);
307 status = rpccli_samr_QueryGroupInfo(pipe_cli, ctx,
311 if (!NT_STATUS_IS_OK(status)) {
312 werr = ntstatus_to_werror(status);
316 if (!(info->attributes.attributes & SE_GROUP_ENABLED)) {
317 werr = WERR_ACCESS_DENIED;
321 status = rpccli_samr_QueryGroupMember(pipe_cli, ctx,
324 if (!NT_STATUS_IS_OK(status)) {
325 werr = ntstatus_to_werror(status);
330 struct lsa_Strings names;
331 struct samr_Ids member_types;
333 status = rpccli_samr_LookupRids(pipe_cli, ctx,
339 if (!NT_STATUS_IS_OK(status)) {
340 werr = ntstatus_to_werror(status);
345 for (i=0; i < rid_array->count; i++) {
347 status = rpccli_samr_DeleteGroupMember(pipe_cli, ctx,
350 if (!NT_STATUS_IS_OK(status)) {
351 werr = ntstatus_to_werror(status);
356 status = rpccli_samr_DeleteDomainGroup(pipe_cli, ctx,
358 if (!NT_STATUS_IS_OK(status)) {
359 werr = ntstatus_to_werror(status);
363 ZERO_STRUCT(group_handle);
372 if (is_valid_policy_hnd(&group_handle)) {
373 rpccli_samr_Close(pipe_cli, ctx, &group_handle);
375 if (is_valid_policy_hnd(&domain_handle)) {
376 rpccli_samr_Close(pipe_cli, ctx, &domain_handle);
378 if (is_valid_policy_hnd(&connect_handle)) {
379 rpccli_samr_Close(pipe_cli, ctx, &connect_handle);
385 /****************************************************************
386 ****************************************************************/
388 WERROR NetGroupDel_l(struct libnetapi_ctx *ctx,
389 struct NetGroupDel *r)
391 return NetGroupDel_r(ctx, r);
394 /****************************************************************
395 ****************************************************************/
397 WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx,
398 struct NetGroupSetInfo *r)
400 struct cli_state *cli = NULL;
401 struct rpc_pipe_client *pipe_cli = NULL;
404 POLICY_HND connect_handle, domain_handle, group_handle;
405 struct lsa_String lsa_group_name;
406 struct dom_sid2 *domain_sid = NULL;
408 struct samr_Ids rids;
409 struct samr_Ids types;
410 union samr_GroupInfo info;
411 struct GROUP_INFO_0 *g0;
412 struct GROUP_INFO_1 *g1;
413 struct GROUP_INFO_2 *g2;
414 struct GROUP_INFO_3 *g3;
415 struct GROUP_INFO_1002 *g1002;
416 struct GROUP_INFO_1005 *g1005;
418 ZERO_STRUCT(connect_handle);
419 ZERO_STRUCT(domain_handle);
420 ZERO_STRUCT(group_handle);
422 if (!r->in.group_name) {
423 return WERR_INVALID_PARAM;
426 werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
427 if (!W_ERROR_IS_OK(werr)) {
431 werr = libnetapi_open_pipe(ctx, cli, PI_SAMR, &pipe_cli);
432 if (!W_ERROR_IS_OK(werr)) {
436 werr = libnetapi_samr_open_domain(ctx, pipe_cli,
437 SAMR_ACCESS_ENUM_DOMAINS |
438 SAMR_ACCESS_OPEN_DOMAIN,
439 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT,
443 if (!W_ERROR_IS_OK(werr)) {
447 init_lsa_String(&lsa_group_name, r->in.group_name);
449 status = rpccli_samr_LookupNames(pipe_cli, ctx,
455 if (!NT_STATUS_IS_OK(status)) {
456 werr = ntstatus_to_werror(status);
460 if (types.ids[0] != SID_NAME_DOM_GRP) {
461 werr = WERR_INVALID_DATATYPE;
465 status = rpccli_samr_OpenGroup(pipe_cli, ctx,
467 SAMR_GROUP_ACCESS_SET_INFO |
468 SAMR_GROUP_ACCESS_LOOKUP_INFO,
471 if (!NT_STATUS_IS_OK(status)) {
472 werr = ntstatus_to_werror(status);
476 switch (r->in.level) {
478 g0 = (struct GROUP_INFO_0 *)r->in.buf;
479 init_lsa_String(&info.name, g0->grpi0_name);
480 status = rpccli_samr_SetGroupInfo(pipe_cli, ctx,
486 g1 = (struct GROUP_INFO_1 *)r->in.buf;
487 init_lsa_String(&info.description, g1->grpi1_comment);
488 status = rpccli_samr_SetGroupInfo(pipe_cli, ctx,
490 GROUPINFODESCRIPTION,
494 g2 = (struct GROUP_INFO_2 *)r->in.buf;
495 init_lsa_String(&info.description, g2->grpi2_comment);
496 status = rpccli_samr_SetGroupInfo(pipe_cli, ctx,
498 GROUPINFODESCRIPTION,
500 if (!NT_STATUS_IS_OK(status)) {
501 werr = ntstatus_to_werror(status);
504 info.attributes.attributes = g2->grpi2_attributes;
505 status = rpccli_samr_SetGroupInfo(pipe_cli, ctx,
511 g3 = (struct GROUP_INFO_3 *)r->in.buf;
512 init_lsa_String(&info.description, g3->grpi3_comment);
513 status = rpccli_samr_SetGroupInfo(pipe_cli, ctx,
515 GROUPINFODESCRIPTION,
517 if (!NT_STATUS_IS_OK(status)) {
518 werr = ntstatus_to_werror(status);
521 info.attributes.attributes = g3->grpi3_attributes;
522 status = rpccli_samr_SetGroupInfo(pipe_cli, ctx,
528 g1002 = (struct GROUP_INFO_1002 *)r->in.buf;
529 init_lsa_String(&info.description, g1002->grpi1002_comment);
530 status = rpccli_samr_SetGroupInfo(pipe_cli, ctx,
532 GROUPINFODESCRIPTION,
536 g1005 = (struct GROUP_INFO_1005 *)r->in.buf;
537 info.attributes.attributes = g1005->grpi1005_attributes;
538 status = rpccli_samr_SetGroupInfo(pipe_cli, ctx,
544 status = NT_STATUS_INVALID_LEVEL;
548 if (!NT_STATUS_IS_OK(status)) {
549 werr = ntstatus_to_werror(status);
560 if (is_valid_policy_hnd(&group_handle)) {
561 rpccli_samr_Close(pipe_cli, ctx, &group_handle);
563 if (is_valid_policy_hnd(&domain_handle)) {
564 rpccli_samr_Close(pipe_cli, ctx, &domain_handle);
566 if (is_valid_policy_hnd(&connect_handle)) {
567 rpccli_samr_Close(pipe_cli, ctx, &connect_handle);
573 /****************************************************************
574 ****************************************************************/
576 WERROR NetGroupSetInfo_l(struct libnetapi_ctx *ctx,
577 struct NetGroupSetInfo *r)
579 return NetGroupSetInfo_r(ctx, r);
582 /****************************************************************
583 ****************************************************************/
585 static WERROR map_group_info_to_buffer(TALLOC_CTX *mem_ctx,
587 struct samr_GroupInfoAll *info,
588 struct dom_sid2 *domain_sid,
592 struct GROUP_INFO_0 info0;
593 struct GROUP_INFO_1 info1;
594 struct GROUP_INFO_2 info2;
595 struct GROUP_INFO_3 info3;
599 info0.grpi0_name = info->name.string;
601 *buffer = (uint8_t *)talloc_memdup(mem_ctx, &info0, sizeof(info0));
605 info1.grpi1_name = info->name.string;
606 info1.grpi1_comment = info->description.string;
608 *buffer = (uint8_t *)talloc_memdup(mem_ctx, &info1, sizeof(info1));
612 info2.grpi2_name = info->name.string;
613 info2.grpi2_comment = info->description.string;
614 info2.grpi2_group_id = rid;
615 info2.grpi2_attributes = info->attributes;
617 *buffer = (uint8_t *)talloc_memdup(mem_ctx, &info2, sizeof(info2));
621 info3.grpi3_name = info->name.string;
622 info3.grpi3_comment = info->description.string;
623 info3.grpi3_attributes = info->attributes;
625 if (!sid_compose((struct dom_sid *)&info3.grpi3_group_sid, domain_sid, rid)) {
629 *buffer = (uint8_t *)talloc_memdup(mem_ctx, &info3, sizeof(info3));
633 return WERR_UNKNOWN_LEVEL;
636 W_ERROR_HAVE_NO_MEMORY(*buffer);
641 /****************************************************************
642 ****************************************************************/
644 WERROR NetGroupGetInfo_r(struct libnetapi_ctx *ctx,
645 struct NetGroupGetInfo *r)
647 struct cli_state *cli = NULL;
648 struct rpc_pipe_client *pipe_cli = NULL;
651 POLICY_HND connect_handle, domain_handle, group_handle;
652 struct lsa_String lsa_group_name;
653 struct dom_sid2 *domain_sid = NULL;
655 struct samr_Ids rids;
656 struct samr_Ids types;
657 union samr_GroupInfo *info = NULL;
659 ZERO_STRUCT(connect_handle);
660 ZERO_STRUCT(domain_handle);
661 ZERO_STRUCT(group_handle);
663 if (!r->in.group_name) {
664 return WERR_INVALID_PARAM;
667 werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
668 if (!W_ERROR_IS_OK(werr)) {
672 werr = libnetapi_open_pipe(ctx, cli, PI_SAMR, &pipe_cli);
673 if (!W_ERROR_IS_OK(werr)) {
677 werr = libnetapi_samr_open_domain(ctx, pipe_cli,
678 SAMR_ACCESS_ENUM_DOMAINS |
679 SAMR_ACCESS_OPEN_DOMAIN,
680 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT,
684 if (!W_ERROR_IS_OK(werr)) {
688 init_lsa_String(&lsa_group_name, r->in.group_name);
690 status = rpccli_samr_LookupNames(pipe_cli, ctx,
696 if (!NT_STATUS_IS_OK(status)) {
697 werr = ntstatus_to_werror(status);
701 if (types.ids[0] != SID_NAME_DOM_GRP) {
702 werr = WERR_INVALID_DATATYPE;
706 status = rpccli_samr_OpenGroup(pipe_cli, ctx,
708 SAMR_GROUP_ACCESS_LOOKUP_INFO,
711 if (!NT_STATUS_IS_OK(status)) {
712 werr = ntstatus_to_werror(status);
716 status = rpccli_samr_QueryGroupInfo(pipe_cli, ctx,
720 if (!NT_STATUS_IS_OK(status)) {
721 werr = ntstatus_to_werror(status);
725 werr = map_group_info_to_buffer(ctx, r->in.level,
726 &info->all2, domain_sid, rids.ids[0],
728 if (!W_ERROR_IS_OK(werr)) {
736 if (is_valid_policy_hnd(&group_handle)) {
737 rpccli_samr_Close(pipe_cli, ctx, &group_handle);
739 if (is_valid_policy_hnd(&domain_handle)) {
740 rpccli_samr_Close(pipe_cli, ctx, &domain_handle);
742 if (is_valid_policy_hnd(&connect_handle)) {
743 rpccli_samr_Close(pipe_cli, ctx, &connect_handle);
749 /****************************************************************
750 ****************************************************************/
752 WERROR NetGroupGetInfo_l(struct libnetapi_ctx *ctx,
753 struct NetGroupGetInfo *r)
755 return NetGroupGetInfo_r(ctx, r);
758 /****************************************************************
759 ****************************************************************/
761 WERROR NetGroupAddUser_r(struct libnetapi_ctx *ctx,
762 struct NetGroupAddUser *r)
764 struct cli_state *cli = NULL;
765 struct rpc_pipe_client *pipe_cli = NULL;
768 POLICY_HND connect_handle, domain_handle, group_handle;
769 struct lsa_String lsa_group_name, lsa_user_name;
770 struct dom_sid2 *domain_sid = NULL;
772 struct samr_Ids rids;
773 struct samr_Ids types;
775 ZERO_STRUCT(connect_handle);
776 ZERO_STRUCT(domain_handle);
777 ZERO_STRUCT(group_handle);
779 if (!r->in.group_name) {
780 return WERR_INVALID_PARAM;
783 werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
784 if (!W_ERROR_IS_OK(werr)) {
788 werr = libnetapi_open_pipe(ctx, cli, PI_SAMR, &pipe_cli);
789 if (!W_ERROR_IS_OK(werr)) {
793 werr = libnetapi_samr_open_domain(ctx, pipe_cli,
794 SAMR_ACCESS_ENUM_DOMAINS |
795 SAMR_ACCESS_OPEN_DOMAIN,
796 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT,
800 if (!W_ERROR_IS_OK(werr)) {
804 init_lsa_String(&lsa_group_name, r->in.group_name);
806 status = rpccli_samr_LookupNames(pipe_cli, ctx,
812 if (!NT_STATUS_IS_OK(status)) {
813 werr = WERR_GROUP_NOT_FOUND;
817 if (types.ids[0] != SID_NAME_DOM_GRP) {
818 werr = WERR_GROUP_NOT_FOUND;
822 status = rpccli_samr_OpenGroup(pipe_cli, ctx,
824 SAMR_GROUP_ACCESS_ADD_MEMBER,
827 if (!NT_STATUS_IS_OK(status)) {
828 werr = ntstatus_to_werror(status);
832 init_lsa_String(&lsa_user_name, r->in.user_name);
834 status = rpccli_samr_LookupNames(pipe_cli, ctx,
840 if (!NT_STATUS_IS_OK(status)) {
841 werr = WERR_USER_NOT_FOUND;
845 if (types.ids[0] != SID_NAME_USER) {
846 werr = WERR_USER_NOT_FOUND;
850 status = rpccli_samr_AddGroupMember(pipe_cli, ctx,
854 if (!NT_STATUS_IS_OK(status)) {
855 werr = ntstatus_to_werror(status);
866 if (is_valid_policy_hnd(&group_handle)) {
867 rpccli_samr_Close(pipe_cli, ctx, &group_handle);
869 if (is_valid_policy_hnd(&domain_handle)) {
870 rpccli_samr_Close(pipe_cli, ctx, &domain_handle);
872 if (is_valid_policy_hnd(&connect_handle)) {
873 rpccli_samr_Close(pipe_cli, ctx, &connect_handle);
879 /****************************************************************
880 ****************************************************************/
882 WERROR NetGroupAddUser_l(struct libnetapi_ctx *ctx,
883 struct NetGroupAddUser *r)
885 return NetGroupAddUser_r(ctx, r);
888 /****************************************************************
889 ****************************************************************/
891 WERROR NetGroupDelUser_r(struct libnetapi_ctx *ctx,
892 struct NetGroupDelUser *r)
894 struct cli_state *cli = NULL;
895 struct rpc_pipe_client *pipe_cli = NULL;
898 POLICY_HND connect_handle, domain_handle, group_handle;
899 struct lsa_String lsa_group_name, lsa_user_name;
900 struct dom_sid2 *domain_sid = NULL;
902 struct samr_Ids rids;
903 struct samr_Ids types;
905 ZERO_STRUCT(connect_handle);
906 ZERO_STRUCT(domain_handle);
907 ZERO_STRUCT(group_handle);
909 if (!r->in.group_name) {
910 return WERR_INVALID_PARAM;
913 werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
914 if (!W_ERROR_IS_OK(werr)) {
918 werr = libnetapi_open_pipe(ctx, cli, PI_SAMR, &pipe_cli);
919 if (!W_ERROR_IS_OK(werr)) {
923 werr = libnetapi_samr_open_domain(ctx, pipe_cli,
924 SAMR_ACCESS_ENUM_DOMAINS |
925 SAMR_ACCESS_OPEN_DOMAIN,
926 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT,
930 if (!W_ERROR_IS_OK(werr)) {
934 init_lsa_String(&lsa_group_name, r->in.group_name);
936 status = rpccli_samr_LookupNames(pipe_cli, ctx,
942 if (!NT_STATUS_IS_OK(status)) {
943 werr = WERR_GROUP_NOT_FOUND;
947 if (types.ids[0] != SID_NAME_DOM_GRP) {
948 werr = WERR_GROUP_NOT_FOUND;
952 status = rpccli_samr_OpenGroup(pipe_cli, ctx,
954 SAMR_GROUP_ACCESS_REMOVE_MEMBER,
957 if (!NT_STATUS_IS_OK(status)) {
958 werr = ntstatus_to_werror(status);
962 init_lsa_String(&lsa_user_name, r->in.user_name);
964 status = rpccli_samr_LookupNames(pipe_cli, ctx,
970 if (!NT_STATUS_IS_OK(status)) {
971 werr = WERR_USER_NOT_FOUND;
975 if (types.ids[0] != SID_NAME_USER) {
976 werr = WERR_USER_NOT_FOUND;
980 status = rpccli_samr_DeleteGroupMember(pipe_cli, ctx,
983 if (!NT_STATUS_IS_OK(status)) {
984 werr = ntstatus_to_werror(status);
995 if (is_valid_policy_hnd(&group_handle)) {
996 rpccli_samr_Close(pipe_cli, ctx, &group_handle);
998 if (is_valid_policy_hnd(&domain_handle)) {
999 rpccli_samr_Close(pipe_cli, ctx, &domain_handle);
1001 if (is_valid_policy_hnd(&connect_handle)) {
1002 rpccli_samr_Close(pipe_cli, ctx, &connect_handle);
1008 /****************************************************************
1009 ****************************************************************/
1011 WERROR NetGroupDelUser_l(struct libnetapi_ctx *ctx,
1012 struct NetGroupDelUser *r)
1014 return NetGroupDelUser_r(ctx, r);
1017 /****************************************************************
1018 ****************************************************************/
1020 WERROR NetGroupEnum_r(struct libnetapi_ctx *ctx,
1021 struct NetGroupEnum *r)
1023 return WERR_NOT_SUPPORTED;
1026 /****************************************************************
1027 ****************************************************************/
1029 WERROR NetGroupEnum_l(struct libnetapi_ctx *ctx,
1030 struct NetGroupEnum *r)
1032 return WERR_NOT_SUPPORTED;