[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sat Jan 2 04:09:34 MST 2010


The branch, master has been updated
       via  063900a... s3: Fix a typo
       via  a66341b... s3: simplify find_root_domain, find_our_domain() never fails
       via  133f023... s3: Use global_sid_Builtin in find_builtin_domain
       via  92345f4... s3: Avoid adding a domain twice
       via  22a4a00... s3: Make free_domain_list() static
       via  583d192... s3: Adapt sid_dup_talloc to README.Coding
       via  d05e17f... s3: Introduce domain_is_forest_root() helper function
      from  5047548... s4-dsdb: force REVISION_ADS for new and updated ACLs in dsdb

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 063900ae631ccee1474ffa0ccd19e2e01bb6defd
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Dec 30 20:15:33 2009 +0100

    s3: Fix a typo

commit a66341b993c74c6db1c064bd48ff52acb704d9c9
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Dec 30 20:09:52 2009 +0100

    s3: simplify find_root_domain, find_our_domain() never fails

commit 133f023d58de8106d41d59dfc3c22e63a5653701
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Dec 30 20:11:36 2009 +0100

    s3: Use global_sid_Builtin in find_builtin_domain

commit 92345f49e3f9c18a21f8a0d5b9af86f383476c4c
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 28 18:11:34 2009 +0100

    s3: Avoid adding a domain twice
    
    If we found a match with sid==NULL, we ended up adding the domain twice

commit 22a4a000cecb971a16a1303e8b16fb659f5ccdec
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 28 18:03:14 2009 +0100

    s3: Make free_domain_list() static

commit 583d192e4715e5fa72041e6ea43dbf6c2a559c36
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Dec 30 11:30:13 2009 +0100

    s3: Adapt sid_dup_talloc to README.Coding

commit d05e17f875300615c0b8543291e7e021448ddff1
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Dec 30 10:25:41 2009 +0100

    s3: Introduce domain_is_forest_root() helper function
    
    Hopefully this makes the flag tests a bit more understandable

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

Summary of changes:
 source3/lib/util_sid.c            |   17 ++++++++-------
 source3/winbindd/winbindd_ads.c   |    7 +----
 source3/winbindd/winbindd_dual.c  |    2 +-
 source3/winbindd/winbindd_proto.h |    2 +-
 source3/winbindd/winbindd_util.c  |   38 +++++++++++++++++++-----------------
 5 files changed, 33 insertions(+), 33 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c
index 639269c..1f47bf3 100644
--- a/source3/lib/util_sid.c
+++ b/source3/lib/util_sid.c
@@ -557,17 +557,18 @@ char *sid_binstring_hex(const DOM_SID *sid)
  Tallocs a duplicate SID. 
 ********************************************************************/ 
 
-DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, const DOM_SID *src)
+struct dom_sid *sid_dup_talloc(TALLOC_CTX *ctx, const struct dom_sid *src)
 {
-	DOM_SID *dst;
-	
-	if(!src)
+	struct dom_sid *dst;
+
+	if (src == NULL) {
 		return NULL;
-	
-	if((dst = TALLOC_ZERO_P(ctx, DOM_SID)) != NULL) {
-		sid_copy( dst, src);
 	}
-	
+	dst = talloc_zero(ctx, struct dom_sid);
+	if (dst == NULL) {
+		return NULL;
+	}
+	sid_copy(dst, src);
 	return dst;
 }
 
diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c
index b0ca9b8..d15fb86 100644
--- a/source3/winbindd/winbindd_ads.c
+++ b/source3/winbindd/winbindd_ads.c
@@ -1263,7 +1263,6 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
 	int			i;
 	uint32			flags;	
 	struct rpc_pipe_client *cli;
-	uint32                 fr_flags = (NETR_TRUST_FLAG_IN_FOREST | NETR_TRUST_FLAG_TREEROOT);
 	int ret_count;
 
 	DEBUG(3,("ads: trusted_domains\n"));
@@ -1274,9 +1273,7 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
 	   query for all trusts.  If not, then just look for domain
 	   trusts in the target forest */
 
-	if ( domain->primary ||
-		((domain->domain_flags&fr_flags) == fr_flags) ) 
-	{
+	if (domain->primary || domain_is_forest_root(domain)) {
 		flags = NETR_TRUST_FLAG_OUTBOUND |
 			NETR_TRUST_FLAG_INBOUND |
 			NETR_TRUST_FLAG_IN_FOREST;
@@ -1354,7 +1351,7 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
 
 			wcache_tdc_add_domain( &d );
 			ret_count++;
-		} else if ( (domain->domain_flags&fr_flags) == fr_flags ) {
+		} else if (domain_is_forest_root(domain)) {
 			/* Check if we already have this record. If
 			 * we are following our forest root that is not
 			 * our primary domain, we want to keep trust
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index bccd63f..74b2b99 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -610,7 +610,7 @@ void winbind_msg_offline(struct messaging_context *msg_ctx,
 	}
 
 	for (child = children; child != NULL; child = child->next) {
-		/* Don't send message to internal childs.  We've already
+		/* Don't send message to internal children.  We've already
 		   done so above. */
 		if (!child->domain || winbindd_internal_child(child)) {
 			continue;
diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h
index 263e326..93d5748 100644
--- a/source3/winbindd/winbindd_proto.h
+++ b/source3/winbindd/winbindd_proto.h
@@ -412,7 +412,7 @@ enum winbindd_result winbindd_dual_pam_chng_pswd_auth_crap(struct winbindd_domai
 /* The following definitions come from winbindd/winbindd_util.c  */
 
 struct winbindd_domain *domain_list(void);
-void free_domain_list(void);
+bool domain_is_forest_root(const struct winbindd_domain *domain);
 void rescan_trusted_domains(struct tevent_context *ev, struct tevent_timer *te,
 			    struct timeval now, void *private_data);
 enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domain,
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c
index 1760382..3e03f40 100644
--- a/source3/winbindd/winbindd_util.c
+++ b/source3/winbindd/winbindd_util.c
@@ -58,7 +58,7 @@ struct winbindd_domain *domain_list(void)
 
 /* Free all entries in the trusted domain list */
 
-void free_domain_list(void)
+static void free_domain_list(void)
 {
 	struct winbindd_domain *domain = _domain_list;
 
@@ -143,13 +143,14 @@ static struct winbindd_domain *add_trusted_domain(const char *domain_name, const
 		}
 	}
 
-	/* See if we found a match.  Check if we need to update the
-	   SID. */
-
-	if ( domain && sid) {
-		if ( sid_equal( &domain->sid, &global_sid_NULL ) )
+	if (domain != NULL) {
+		/*
+		 * We found a match. Possibly update the SID
+		 */
+		if ((sid != NULL)
+		    && sid_equal(&domain->sid, &global_sid_NULL)) {
 			sid_copy( &domain->sid, sid );
-
+		}
 		return domain;
 	}
 
@@ -223,6 +224,14 @@ done:
 	return domain;
 }
 
+bool domain_is_forest_root(const struct winbindd_domain *domain)
+{
+	const uint32_t fr_flags =
+		(NETR_TRUST_FLAG_TREEROOT|NETR_TRUST_FLAG_IN_FOREST);
+
+	return ((domain->domain_flags & fr_flags) == fr_flags);
+}
+
 /********************************************************************
   rescan our domains looking for new trusted domains
 ********************************************************************/
@@ -243,8 +252,6 @@ static void add_trusted_domains( struct winbindd_domain *domain )
 	TALLOC_CTX *mem_ctx;
 	struct winbindd_request *request;
 	struct winbindd_response *response;
-	uint32 fr_flags = (NETR_TRUST_FLAG_TREEROOT|NETR_TRUST_FLAG_IN_FOREST);
-
 	struct trustdom_state *state;
 
 	mem_ctx = talloc_init("add_trusted_domains");
@@ -269,7 +276,7 @@ static void add_trusted_domains( struct winbindd_domain *domain )
 	/* Flags used to know how to continue the forest trust search */
 
 	state->primary = domain->primary;
-	state->forest_root = ((domain->domain_flags & fr_flags) == fr_flags );
+	state->forest_root = domain_is_forest_root(domain);
 
 	request->length = sizeof(*request);
 	request->cmd = WINBINDD_LIST_TRUSTDOM;
@@ -792,23 +799,18 @@ struct winbindd_domain *find_root_domain(void)
 {
 	struct winbindd_domain *ours = find_our_domain();
 
-	if ( !ours )
-		return NULL;
-
-	if ( strlen(ours->forest_name) == 0 )
+	if (ours->forest_name[0] == '\0') {
 		return NULL;
+	}
 
 	return find_domain_from_name( ours->forest_name );
 }
 
 struct winbindd_domain *find_builtin_domain(void)
 {
-	DOM_SID sid;
 	struct winbindd_domain *domain;
 
-	string_to_sid(&sid, "S-1-5-32");
-	domain = find_domain_from_sid(&sid);
-
+	domain = find_domain_from_sid(&global_sid_Builtin);
 	if (domain == NULL) {
 		smb_panic("Could not find BUILTIN domain");
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list