[SCM] Samba Shared Repository - branch v3-devel updated - release-3-2-0pre2-4153-g5d91c91

Günther Deschner gd at samba.org
Fri Sep 12 12:13:44 GMT 2008


The branch, v3-devel has been updated
       via  5d91c9184c27def47f20fc089cc127d780387ed8 (commit)
       via  a94318be4656a668be0295988ed0743105d830c9 (commit)
       via  e8b27b69f33fb33c670026b3a24ed95a2f0099fe (commit)
       via  735bc2e425ce629745495190cd1c721ccb583d24 (commit)
      from  e065802a61f22e9fdcd4b911805c42c46a79b3f2 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-devel


- Log -----------------------------------------------------------------
commit 5d91c9184c27def47f20fc089cc127d780387ed8
Author: Günther Deschner <gd at samba.org>
Date:   Fri Sep 12 11:47:39 2008 +0200

    netapi: fix NetUserGetLocalGroups.
    
    Guenther

commit a94318be4656a668be0295988ed0743105d830c9
Author: Günther Deschner <gd at samba.org>
Date:   Fri Sep 12 11:28:42 2008 +0200

    netapi: fix NetGroupGetUsers (only enumerates users).
    
    Guenther

commit e8b27b69f33fb33c670026b3a24ed95a2f0099fe
Author: Günther Deschner <gd at samba.org>
Date:   Fri Sep 12 11:28:03 2008 +0200

    netapi: fix NetUserSetGroups.
    
    Guenther

commit 735bc2e425ce629745495190cd1c721ccb583d24
Author: Günther Deschner <gd at samba.org>
Date:   Fri Sep 12 11:13:20 2008 +0200

    netapi: fix NetGroupSetUsers.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source/lib/netapi/group.c |   49 +++++++++++++++++++++++++-------------------
 source/lib/netapi/user.c  |   44 ++++++++++++++++++++--------------------
 2 files changed, 50 insertions(+), 43 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/netapi/group.c b/source/lib/netapi/group.c
index 2e0c4dc..c3fccb4 100644
--- a/source/lib/netapi/group.c
+++ b/source/lib/netapi/group.c
@@ -1391,10 +1391,15 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx,
 	}
 
 	for (i=0; i < names.count; i++) {
+
+		if (member_types.ids[i] != SID_NAME_USER) {
+			continue;
+		}
+
 		status = add_GROUP_USERS_INFO_X_buffer(ctx,
 						       r->in.level,
 						       names.names[i].string,
-						       member_types.ids[i],
+						       7,
 						       r->out.buffer,
 						       &entries_read);
 		if (!NT_STATUS_IS_OK(status)) {
@@ -1454,6 +1459,7 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx,
 	struct samr_Ids user_rids, name_types;
 	struct samr_Ids group_rids, group_types;
 	struct samr_RidTypeArray *rid_array = NULL;
+	struct lsa_String *lsa_names = NULL;
 
 	uint32_t *add_rids = NULL;
 	uint32_t *del_rids = NULL;
@@ -1549,39 +1555,40 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx,
 			break;
 	}
 
+	lsa_names = talloc_array(ctx, struct lsa_String, r->in.num_entries);
+	if (!lsa_names) {
+		werr = WERR_NOMEM;
+		goto done;
+	}
+
 	for (i=0; i < r->in.num_entries; i++) {
 
 		switch (r->in.level) {
 			case 0:
-				init_lsa_String(&lsa_account_name, i0->grui0_name);
+				init_lsa_String(&lsa_names[i], i0->grui0_name);
 				i0++;
 				break;
 			case 1:
-				init_lsa_String(&lsa_account_name, i1->grui1_name);
+				init_lsa_String(&lsa_names[i], i1->grui1_name);
 				i1++;
 				break;
 		}
+	}
 
-		status = rpccli_samr_LookupNames(pipe_cli, ctx,
-						 &domain_handle,
-						 1,
-						 &lsa_account_name,
-						 &user_rids,
-						 &name_types);
-		if (!NT_STATUS_IS_OK(status)) {
-			werr = ntstatus_to_werror(status);
-			goto done;
-		}
-
-		if (!add_rid_to_array_unique(ctx,
-					     user_rids.ids[0],
-					     &member_rids,
-					     &num_member_rids)) {
-			werr = WERR_GENERAL_FAILURE;
-			goto done;
-		}
+	status = rpccli_samr_LookupNames(pipe_cli, ctx,
+					 &domain_handle,
+					 r->in.num_entries,
+					 lsa_names,
+					 &user_rids,
+					 &name_types);
+	if (!NT_STATUS_IS_OK(status)) {
+		werr = ntstatus_to_werror(status);
+		goto done;
 	}
 
+	member_rids = user_rids.ids;
+	num_member_rids = user_rids.count;
+
 	status = rpccli_samr_QueryGroupMember(pipe_cli, ctx,
 					      &group_handle,
 					      &rid_array);
diff --git a/source/lib/netapi/user.c b/source/lib/netapi/user.c
index 62df2f9..7d0c47f 100644
--- a/source/lib/netapi/user.c
+++ b/source/lib/netapi/user.c
@@ -2938,6 +2938,7 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx,
 	struct samr_Ids user_rids, name_types;
 	struct samr_Ids group_rids;
 	struct samr_RidWithAttributeArray *rid_array = NULL;
+	struct lsa_String *lsa_names = NULL;
 
 	uint32_t *add_rids = NULL;
 	uint32_t *del_rids = NULL;
@@ -3021,39 +3022,40 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx,
 			break;
 	}
 
+	lsa_names = talloc_array(ctx, struct lsa_String, r->in.num_entries);
+	if (!lsa_names) {
+		werr = WERR_NOMEM;
+		goto done;
+	}
+
 	for (i=0; i < r->in.num_entries; i++) {
 
 		switch (r->in.level) {
 			case 0:
-				init_lsa_String(&lsa_account_name, i0->grui0_name);
+				init_lsa_String(&lsa_names[i], i0->grui0_name);
 				i0++;
 				break;
 			case 1:
-				init_lsa_String(&lsa_account_name, i1->grui1_name);
+				init_lsa_String(&lsa_names[i], i1->grui1_name);
 				i1++;
 				break;
 		}
+	}
 
-		status = rpccli_samr_LookupNames(pipe_cli, ctx,
-						 &domain_handle,
-						 1,
-						 &lsa_account_name,
-						 &group_rids,
-						 &name_types);
-		if (!NT_STATUS_IS_OK(status)) {
-			werr = ntstatus_to_werror(status);
-			goto done;
-		}
-
-		if (!add_rid_to_array_unique(ctx,
-					     group_rids.ids[0],
-					     &member_rids,
-					     &num_member_rids)) {
-			werr = WERR_GENERAL_FAILURE;
-			goto done;
-		}
+	status = rpccli_samr_LookupNames(pipe_cli, ctx,
+					 &domain_handle,
+					 r->in.num_entries,
+					 lsa_names,
+					 &group_rids,
+					 &name_types);
+	if (!NT_STATUS_IS_OK(status)) {
+		werr = ntstatus_to_werror(status);
+		goto done;
 	}
 
+	member_rids = group_rids.ids;
+	num_member_rids = group_rids.count;
+
 	status = rpccli_samr_GetGroupsForUser(pipe_cli, ctx,
 					      &user_handle,
 					      &rid_array);
@@ -3426,8 +3428,6 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx,
 	}
 
 	return werr;
-
-	return WERR_NOT_SUPPORTED;
 }
 
 /****************************************************************


-- 
Samba Shared Repository


More information about the samba-cvs mailing list