[SCM] Samba Shared Repository - branch v3-2-stable updated - release-3-2-0rc2-83-g748a15f

Karolin Seeger kseeger at samba.org
Thu Jun 26 07:21:24 GMT 2008


The branch, v3-2-stable has been updated
       via  748a15f7b3ea1de70cff64e5b8f7f06b93be9ea4 (commit)
       via  8c4e75cbfc069608d7d6f899243096d198589aba (commit)
      from  90ad03b06e9df879b2139b9208912bc476ecd99d (commit)

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


- Log -----------------------------------------------------------------
commit 748a15f7b3ea1de70cff64e5b8f7f06b93be9ea4
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jun 25 15:23:52 2008 -0700

    Part of fix for #5551. Split out the group enumeration functions to a BUILTIN and a Domain
    specific version. Stops the domain groups appearing twice.
    Jeremy.
    (cherry picked from commit ee7af33ec6e752b1b1898b50aebc96e66ea423db)

commit 8c4e75cbfc069608d7d6f899243096d198589aba
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jun 25 12:44:27 2008 -0700

    Final (hopefully :-) part of fix for bug #5551. Allow passdb backend to enumerate domain groups.
    Jeremy
    (cherry picked from commit 269521ee08b962040afe63ea74130ba27f29e092)

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

Summary of changes:
 source/winbindd/winbindd_passdb.c |   84 ++++++++++++++++++++++++++-----------
 1 files changed, 59 insertions(+), 25 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/winbindd/winbindd_passdb.c b/source/winbindd/winbindd_passdb.c
index 8b2016c..e4cf029 100644
--- a/source/winbindd/winbindd_passdb.c
+++ b/source/winbindd/winbindd_passdb.c
@@ -28,35 +28,31 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
 
-/* list all domain groups */
-static NTSTATUS enum_dom_groups(struct winbindd_domain *domain,
+static NTSTATUS enum_groups_internal(struct winbindd_domain *domain,
 				TALLOC_CTX *mem_ctx,
 				uint32 *num_entries, 
-				struct acct_info **info)
-{
-	/* We don't have domain groups */
-	*num_entries = 0;
-	*info = NULL;
-	return NT_STATUS_OK;
-}
-
-/* List all domain groups */
-
-static NTSTATUS enum_local_groups(struct winbindd_domain *domain,
-				TALLOC_CTX *mem_ctx,
-				uint32 *num_entries, 
-				struct acct_info **info)
+				struct acct_info **info,
+				enum lsa_SidType sidtype)
 {
 	struct pdb_search *search;
-	struct samr_displayentry *aliases;
+	struct samr_displayentry *entries;
 	int i;
 	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
 
-	search = pdb_search_aliases(&domain->sid);
+	if (sidtype == SID_NAME_ALIAS) {
+		search = pdb_search_aliases(&domain->sid);
+	} else {
+		search = pdb_search_groups();
+	}
+
 	if (search == NULL) goto done;
 
-	*num_entries = pdb_search_entries(search, 0, 0xffffffff, &aliases);
-	if (*num_entries == 0) goto done;
+	*num_entries = pdb_search_entries(search, 0, 0xffffffff, &entries);
+	if (*num_entries == 0) {
+		/* Zero entries isn't an error */
+		result = NT_STATUS_OK;
+		goto done;
+	}
 
 	*info = TALLOC_ARRAY(mem_ctx, struct acct_info, *num_entries);
 	if (*info == NULL) {
@@ -65,9 +61,9 @@ static NTSTATUS enum_local_groups(struct winbindd_domain *domain,
 	}
 
 	for (i=0; i<*num_entries; i++) {
-		fstrcpy((*info)[i].acct_name, aliases[i].account_name);
-		fstrcpy((*info)[i].acct_desc, aliases[i].description);
-		(*info)[i].rid = aliases[i].rid;
+		fstrcpy((*info)[i].acct_name, entries[i].account_name);
+		fstrcpy((*info)[i].acct_desc, entries[i].description);
+		(*info)[i].rid = entries[i].rid;
 	}
 
 	result = NT_STATUS_OK;
@@ -76,6 +72,19 @@ static NTSTATUS enum_local_groups(struct winbindd_domain *domain,
 	return result;
 }
 
+/* List all local groups (aliases) */
+static NTSTATUS enum_local_groups(struct winbindd_domain *domain,
+				TALLOC_CTX *mem_ctx,
+				uint32 *num_entries, 
+				struct acct_info **info)
+{
+	return enum_groups_internal(domain,
+				mem_ctx,
+				num_entries,
+				info,
+				SID_NAME_ALIAS);
+}
+
 /* convert a single name to a sid in a domain */
 static NTSTATUS name_to_sid(struct winbindd_domain *domain,
 			    TALLOC_CTX *mem_ctx,
@@ -349,6 +358,18 @@ static NTSTATUS password_policy(struct winbindd_domain *domain,
  BUILTIN specific functions.
 *********************************************************************/
 
+/* list all domain groups */
+static NTSTATUS builtin_enum_dom_groups(struct winbindd_domain *domain,
+				TALLOC_CTX *mem_ctx,
+				uint32 *num_entries, 
+				struct acct_info **info)
+{
+	/* BUILTIN doesn't have domain groups */
+	*num_entries = 0;
+	*info = NULL;
+	return NT_STATUS_OK;
+}
+
 /* Query display info for a domain.  This returns enough information plus a
    bit extra to give an overview of domain users for the User Manager
    application. */
@@ -404,6 +425,19 @@ static NTSTATUS builtin_trusted_domains(struct winbindd_domain *domain,
  SAM specific functions.
 *********************************************************************/
 
+/* list all domain groups */
+static NTSTATUS sam_enum_dom_groups(struct winbindd_domain *domain,
+				TALLOC_CTX *mem_ctx,
+				uint32 *num_entries, 
+				struct acct_info **info)
+{
+	return enum_groups_internal(domain,
+				mem_ctx,
+				num_entries,
+				info,
+				SID_NAME_DOM_GRP);
+}
+
 static NTSTATUS sam_query_user_list(struct winbindd_domain *domain,
 				TALLOC_CTX *mem_ctx,
 				uint32 *num_entries,
@@ -666,7 +700,7 @@ static NTSTATUS sam_trusted_domains(struct winbindd_domain *domain,
 struct winbindd_methods builtin_passdb_methods = {
 	false,
 	builtin_query_user_list,
-	enum_dom_groups,
+	builtin_enum_dom_groups,
 	enum_local_groups,
 	name_to_sid,
 	sid_to_name,
@@ -685,7 +719,7 @@ struct winbindd_methods builtin_passdb_methods = {
 struct winbindd_methods sam_passdb_methods = {
 	false,
 	sam_query_user_list,
-	enum_dom_groups,
+	sam_enum_dom_groups,
 	enum_local_groups,
 	name_to_sid,
 	sid_to_name,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list