[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Mon Dec 28 07:00:08 MST 2009


The branch, master has been updated
       via  2c49678... s3: Remove some unused code
       via  d53cfb7... s3: Simplify winbindd_list_trusted_domains() slightly
       via  2daa084... s3: Simplify "setup_domain_child" slightly
      from  72d9359... python: Remove sys.path line rather than updating it when installing to python system path.

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


- Log -----------------------------------------------------------------
commit 2c49678ce5d9203a0af2fa82961c0ebc59e1488f
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 28 14:56:58 2009 +0100

    s3: Remove some unused code
    
    Watch the #if 0 -- we never stored this in the cache anymore

commit d53cfb7675ff6b5f77871cea6931da1d6d605afe
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 28 13:49:01 2009 +0100

    s3: Simplify winbindd_list_trusted_domains() slightly

commit 2daa084da4db5a72b1677c4702718bbcb35261f1
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 28 10:57:01 2009 +0100

    s3: Simplify "setup_domain_child" slightly

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

Summary of changes:
 source3/winbindd/winbindd_cache.c  |  101 ------------------------------------
 source3/winbindd/winbindd_domain.c |    2 -
 source3/winbindd/winbindd_dual.c   |    2 +-
 source3/winbindd/winbindd_misc.c   |   54 ++++++++-----------
 4 files changed, 24 insertions(+), 135 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index 8de636c..169824b 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -2451,53 +2451,8 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
 				char ***alt_names,
 				DOM_SID **dom_sids)
 {
- 	struct winbind_cache *cache = get_cache(domain);
- 	struct cache_entry *centry = NULL;
  	NTSTATUS status;
-	int i;
-
-	if (!cache->tdb)
-		goto do_query;
-
-	centry = wcache_fetch(cache, domain, "TRUSTDOMS/%s", domain->name);
-
-	if (!centry) {
- 		goto do_query;
-	}
-
-	*num_domains = centry_uint32(centry);
-
-	if (*num_domains) {
-		(*names) 	= TALLOC_ARRAY(mem_ctx, char *, *num_domains);
-		(*alt_names) 	= TALLOC_ARRAY(mem_ctx, char *, *num_domains);
-		(*dom_sids) 	= TALLOC_ARRAY(mem_ctx, DOM_SID, *num_domains);
-
-		if (! (*dom_sids) || ! (*names) || ! (*alt_names)) {
-			smb_panic_fn("trusted_domains out of memory");
- 		}
-	} else {
-		(*names) = NULL;
-		(*alt_names) = NULL;
-		(*dom_sids) = NULL;
-	}
-
-	for (i=0; i<(*num_domains); i++) {
-		(*names)[i] = centry_string(centry, mem_ctx);
-		(*alt_names)[i] = centry_string(centry, mem_ctx);
-		if (!centry_sid(centry, &(*dom_sids)[i])) {
-			sid_copy(&(*dom_sids)[i], &global_sid_NULL);
-		}
-	}
-
- 	status = centry->status;
-
-	DEBUG(10,("trusted_domains: [Cached] - cached info for domain %s (%d trusts) status: %s\n",
-		domain->name, *num_domains, nt_errstr(status) ));
-
- 	centry_free(centry);
- 	return status;
 
-do_query:
 	(*num_domains) = 0;
 	(*dom_sids) = NULL;
 	(*names) = NULL;
@@ -2521,33 +2476,6 @@ do_query:
 	if (!NT_STATUS_IS_ERR(status)) {
 		status = NT_STATUS_OK;
 	}
-
-
-#if 0    /* Disabled as we want the trust dom list to be managed by
-	    the main parent and always to make the query.  --jerry */
-
-	/* and save it */
-	refresh_sequence_number(domain, false);
-
- 	centry = centry_start(domain, status);
-	if (!centry)
-		goto skip_save;
-
-	centry_put_uint32(centry, *num_domains);
-
-	for (i=0; i<(*num_domains); i++) {
-		centry_put_string(centry, (*names)[i]);
-		centry_put_string(centry, (*alt_names)[i]);
-		centry_put_sid(centry, &(*dom_sids)[i]);
- 	}
-
-	centry_end(centry, "TRUSTDOMS/%s", domain->name);
-
- 	centry_free(centry);
-
-skip_save:
-#endif
-
  	return status;
 }	
 
@@ -3557,34 +3485,6 @@ static int validate_nss_na(TALLOC_CTX *mem_ctx, const char *keystr,
 	return 0;
 }
 
-static int validate_trustdoms(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf,
-			      struct tdb_validation_status *state)
-{
-	struct cache_entry *centry = create_centry_validate(keystr, dbuf, state);
-	int32 num_domains, i;
-
-	if (!centry) {
-		return 1;
-	}
-
-	num_domains = centry_uint32(centry);
-
-	for (i=0; i< num_domains; i++) {
-		DOM_SID sid;
-		(void)centry_string(centry, mem_ctx);
-		(void)centry_string(centry, mem_ctx);
-		(void)centry_sid(centry, &sid);
-	}
-
-	centry_free(centry);
-
-	if (!(state->success)) {
-		return 1;
-	}
-	DEBUG(10,("validate_trustdoms: %s ok\n", keystr));
-	return 0;
-}
-
 static int validate_trustdomcache(TALLOC_CTX *mem_ctx, const char *keystr, 
 				  TDB_DATA dbuf,
 				  struct tdb_validation_status *state)
@@ -3666,7 +3566,6 @@ struct key_val_struct {
 	{"DR/", validate_dr},
 	{"DE/", validate_de},
 	{"NSS/PWINFO/", validate_pwinfo},
-	{"TRUSTDOMS/", validate_trustdoms},
 	{"TRUSTDOMCACHE/", validate_trustdomcache},
 	{"NSS/NA/", validate_nss_na},
 	{"NSS/AN/", validate_nss_an},
diff --git a/source3/winbindd/winbindd_domain.c b/source3/winbindd/winbindd_domain.c
index 40e3801..45da57e 100644
--- a/source3/winbindd/winbindd_domain.c
+++ b/source3/winbindd/winbindd_domain.c
@@ -80,6 +80,4 @@ void setup_domain_child(struct winbindd_domain *domain,
 {
 	setup_child(domain, child, domain_dispatch_table,
 		    "log.wb", domain->name);
-
-	child->domain = domain;
 }
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index 9a80d48..bccd63f 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -502,7 +502,7 @@ void setup_child(struct winbindd_domain *domain, struct winbindd_child *child,
 			  "logname == NULL");
 	}
 
-	child->domain = NULL;
+	child->domain = domain;
 	child->table = table;
 	child->queue = tevent_queue_create(NULL, "winbind_child");
 	SMB_ASSERT(child->queue != NULL);
diff --git a/source3/winbindd/winbindd_misc.c b/source3/winbindd/winbindd_misc.c
index e80f1cd..c665140 100644
--- a/source3/winbindd/winbindd_misc.c
+++ b/source3/winbindd/winbindd_misc.c
@@ -102,6 +102,12 @@ void winbindd_list_trusted_domains(struct winbindd_cli_state *state)
 		goto done;
 	}
 
+	extra_data = talloc_strdup(state->mem_ctx, "");
+	if (extra_data == NULL) {
+		request_error(state);
+		goto done;
+	}
+
 	for ( i = 0; i < num_domains; i++ ) {
 		struct winbindd_domain *domain;
 		bool is_online = true;		
@@ -111,41 +117,27 @@ void winbindd_list_trusted_domains(struct winbindd_cli_state *state)
 		if (domain) {
 			is_online = domain->online;
 		}
-
-		if ( !extra_data ) {
-			extra_data = talloc_asprintf(state->mem_ctx, 
-						     "%s\\%s\\%s\\%s\\%s\\%s\\%s\\%s",
-						     d->domain_name,
-						     d->dns_name ? d->dns_name : d->domain_name,
-						     sid_string_talloc(state->mem_ctx, &d->sid),
-						     get_trust_type_string(d),
-						     trust_is_transitive(d) ? "Yes" : "No",
-						     trust_is_inbound(d) ? "Yes" : "No",
-						     trust_is_outbound(d) ? "Yes" : "No",
-						     is_online ? "Online" : "Offline" );
-		} else {
-			extra_data = talloc_asprintf(state->mem_ctx, 
-						     "%s\n%s\\%s\\%s\\%s\\%s\\%s\\%s\\%s",
-						     extra_data,
-						     d->domain_name,
-						     d->dns_name ? d->dns_name : d->domain_name,
-						     sid_string_talloc(state->mem_ctx, &d->sid),
-						     get_trust_type_string(d),
-						     trust_is_transitive(d) ? "Yes" : "No",
-						     trust_is_inbound(d) ? "Yes" : "No",
-						     trust_is_outbound(d) ? "Yes" : "No",
-						     is_online ? "Online" : "Offline" );
-		}
-	}
-
-	extra_data_len = 0;
-	if (extra_data != NULL) {
-		extra_data_len = strlen(extra_data);
+		extra_data = talloc_asprintf_append_buffer(
+			extra_data,
+			"%s\\%s\\%s\\%s\\%s\\%s\\%s\\%s\n",
+			d->domain_name,
+			d->dns_name ? d->dns_name : d->domain_name,
+			sid_string_talloc(state->mem_ctx, &d->sid),
+			get_trust_type_string(d),
+			trust_is_transitive(d) ? "Yes" : "No",
+			trust_is_inbound(d) ? "Yes" : "No",
+			trust_is_outbound(d) ? "Yes" : "No",
+			is_online ? "Online" : "Offline" );
 	}
 
+	extra_data_len = strlen(extra_data);
 	if (extra_data_len > 0) {
+
+		/* Strip the last \n */
+		extra_data[extra_data_len-1] = '\0';
+
 		state->response->extra_data.data = extra_data;
-		state->response->length += extra_data_len+1;
+		state->response->length += extra_data_len;
 	}
 
 	request_ok(state);	


-- 
Samba Shared Repository


More information about the samba-cvs mailing list