The branch, master has been updated via d41836f... s3: Simplify trustdom_state via 13cdaf9... s3: Make "struct trustdom_state" its own talloc context from d61b072... libwbclient: Talloc is no longer used
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit d41836fb62e3059e042bf72d4392c2e85b55c582 Author: Volker Lendecke <v...@samba.org> Date: Sun Apr 25 10:36:58 2010 +0200 s3: Simplify trustdom_state Don't store information explicitly as boolean flags that can be easily retrieved from the domain when it's actually needed. commit 13cdaf9417ab08425d9b7e244a6830d34147b889 Author: Volker Lendecke <v...@samba.org> Date: Sun Apr 25 10:25:55 2010 +0200 s3: Make "struct trustdom_state" its own talloc context ----------------------------------------------------------------------- Summary of changes: source3/winbindd/winbindd_util.c | 38 ++++++++++++++------------------------ 1 files changed, 14 insertions(+), 24 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index 0209a31..83cc36b 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -237,9 +237,7 @@ bool domain_is_forest_root(const struct winbindd_domain *domain) ********************************************************************/ struct trustdom_state { - TALLOC_CTX *mem_ctx; - bool primary; - bool forest_root; + struct winbindd_domain *domain; struct winbindd_response *response; }; @@ -249,39 +247,31 @@ static void rescan_forest_trusts( void ); static void add_trusted_domains( struct winbindd_domain *domain ) { - TALLOC_CTX *mem_ctx; struct winbindd_request *request; struct winbindd_response *response; struct trustdom_state *state; - mem_ctx = talloc_init("add_trusted_domains"); - if (mem_ctx == NULL) { + state = TALLOC_ZERO_P(NULL, struct trustdom_state); + if (state == NULL) { DEBUG(0, ("talloc_init failed\n")); return; } - request = TALLOC_ZERO_P(mem_ctx, struct winbindd_request); - response = TALLOC_P(mem_ctx, struct winbindd_response); - state = TALLOC_P(mem_ctx, struct trustdom_state); + request = TALLOC_ZERO_P(state, struct winbindd_request); + response = TALLOC_P(state, struct winbindd_response); - if ((request == NULL) || (response == NULL) || (state == NULL)) { + if ((request == NULL) || (response == NULL)) { DEBUG(0, ("talloc failed\n")); - talloc_destroy(mem_ctx); + TALLOC_FREE(state); return; } - - state->mem_ctx = mem_ctx; state->response = response; - - /* Flags used to know how to continue the forest trust search */ - - state->primary = domain->primary; - state->forest_root = domain_is_forest_root(domain); + state->domain = domain; request->length = sizeof(*request); request->cmd = WINBINDD_LIST_TRUSTDOM; - async_domain_request(mem_ctx, domain, request, response, + async_domain_request(state, domain, request, response, trustdom_recv, state); } @@ -294,7 +284,7 @@ static void trustdom_recv(void *private_data, bool success) if ((!success) || (response->result != WINBINDD_OK)) { DEBUG(1, ("Could not receive trustdoms\n")); - talloc_destroy(state->mem_ctx); + TALLOC_FREE(state); return; } @@ -368,23 +358,23 @@ static void trustdom_recv(void *private_data, bool success) && !forest_root) */ - if ( state->primary ) { + if (state->domain->primary) { /* If this is our primary domain and we are not in the forest root, we have to scan the root trusts first */ - if ( !state->forest_root ) + if (!domain_is_forest_root(state->domain)) rescan_forest_root_trusts(); else rescan_forest_trusts(); - } else if ( state->forest_root ) { + } else if (domain_is_forest_root(state->domain)) { /* Once we have done root forest trust search, we can go on to search the trusted forests */ rescan_forest_trusts(); } - talloc_destroy(state->mem_ctx); + TALLOC_FREE(state); return; } -- Samba Shared Repository