diff options
author | Jeremy Allison <jra@samba.org> | 2006-12-16 01:32:57 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:16:31 -0500 |
commit | bf8988feaf818782d708da69d186295e140ade10 (patch) | |
tree | caa986eac6f98fef76f138931d619c02114bfe2b /source3/nsswitch | |
parent | 2829b1db3484c102b3220cca0258004c5088568b (diff) | |
download | samba-bf8988feaf818782d708da69d186295e140ade10.tar.gz samba-bf8988feaf818782d708da69d186295e140ade10.tar.bz2 samba-bf8988feaf818782d708da69d186295e140ade10.zip |
r20206: Start cleaning up the talloc_ctx mess.
child->mem_ctx isn't actually used for
anything, so remove it.
Jeremy.
(This used to be commit a7f294b59238826c11e579a7b1a4dca7284bb89d)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r-- | source3/nsswitch/winbindd.h | 1 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_async.c | 3 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_cm.c | 3 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_dual.c | 26 |
4 files changed, 20 insertions, 13 deletions
diff --git a/source3/nsswitch/winbindd.h b/source3/nsswitch/winbindd.h index 2d46be0908..b62cc0af19 100644 --- a/source3/nsswitch/winbindd.h +++ b/source3/nsswitch/winbindd.h @@ -141,7 +141,6 @@ struct winbindd_child { struct winbindd_domain *domain; pstring logfilename; - TALLOC_CTX *mem_ctx; struct fd_event event; struct timed_event *lockout_policy_event; struct winbindd_async_request *requests; diff --git a/source3/nsswitch/winbindd_async.c b/source3/nsswitch/winbindd_async.c index 09426973e8..93dea6f48c 100644 --- a/source3/nsswitch/winbindd_async.c +++ b/source3/nsswitch/winbindd_async.c @@ -996,6 +996,9 @@ enum winbindd_result winbindd_dual_lookuprids(struct winbindd_domain *domain, if (result != NULL) { state->response.extra_data.data = SMB_STRDUP(result); + if (!state->response.extra_data.data) { + return WINBINDD_ERROR; + } state->response.length += len+1; } diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c index ea2c0b1eac..a18f5cf31b 100644 --- a/source3/nsswitch/winbindd_cm.c +++ b/source3/nsswitch/winbindd_cm.c @@ -520,6 +520,7 @@ static BOOL get_dc_name_via_netlogon(const struct winbindd_domain *domain, result = cm_connect_netlogon(our_domain, &netlogon_pipe); if (!NT_STATUS_IS_OK(result)) { + talloc_destroy(mem_ctx); return False; } @@ -1264,10 +1265,12 @@ static NTSTATUS cm_open_connection(struct winbindd_domain *domain, if (!add_sockaddr_to_array(mem_ctx, domain->dcaddr.sin_addr, 445, &addrs, &num_addrs)) { set_domain_offline(domain); + talloc_destroy(mem_ctx); return NT_STATUS_NO_MEMORY; } if (!add_sockaddr_to_array(mem_ctx, domain->dcaddr.sin_addr, 139, &addrs, &num_addrs)) { set_domain_offline(domain); + talloc_destroy(mem_ctx); return NT_STATUS_NO_MEMORY; } diff --git a/source3/nsswitch/winbindd_dual.c b/source3/nsswitch/winbindd_dual.c index a61b158c24..cbf9a7c3d0 100644 --- a/source3/nsswitch/winbindd_dual.c +++ b/source3/nsswitch/winbindd_dual.c @@ -238,7 +238,6 @@ static void schedule_async_request(struct winbindd_child *child) sizeof(*request->request), async_main_request_sent, request); - talloc_destroy(child->mem_ctx); return; } @@ -599,7 +598,7 @@ static void account_lockout_policy_handler(struct timed_event *te, { struct winbindd_child *child = (struct winbindd_child *)private_data; - + TALLOC_CTX *mem_ctx = NULL; struct winbindd_methods *methods; SAM_UNK_INFO_12 lockout_policy; NTSTATUS result; @@ -612,13 +611,21 @@ static void account_lockout_policy_handler(struct timed_event *te, methods = child->domain->methods; - result = methods->lockout_policy(child->domain, child->mem_ctx, &lockout_policy); + mem_ctx = talloc_init("account_lockout_policy_handler ctx"); + if (!mem_ctx) { + result = NT_STATUS_NO_MEMORY; + } else { + result = methods->lockout_policy(child->domain, mem_ctx, &lockout_policy); + } + + talloc_destroy(mem_ctx); + if (!NT_STATUS_IS_OK(result)) { - DEBUG(10,("account_lockout_policy_handler: failed to call lockout_policy\n")); - return; + DEBUG(10,("account_lockout_policy_handler: lockout_policy failed error %s\n", + nt_errstr(result))); } - child->lockout_policy_event = add_timed_event(child->mem_ctx, + child->lockout_policy_event = add_timed_event(NULL, timeval_current_ofs(3600, 0), "account_lockout_policy_handler", account_lockout_policy_handler, @@ -828,15 +835,10 @@ static BOOL fork_domain_child(struct winbindd_child *child) /* The child is ok with online/offline messages now. */ message_unblock(); - child->mem_ctx = talloc_init("child_mem_ctx"); - if (child->mem_ctx == NULL) { - return False; - } - if (child->domain != NULL && lp_winbind_offline_logon()) { /* We might be in the idmap child...*/ child->lockout_policy_event = add_timed_event( - child->mem_ctx, timeval_zero(), + NULL, timeval_zero(), "account_lockout_policy_handler", account_lockout_policy_handler, child); |