From ef8bd7c4f7ae8192ea05db070962ecf0ff3615f3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 20 Dec 2002 20:21:31 +0000 Subject: Forward port the change to talloc_init() to make all talloc contexts named. Ensure we can query them. Jeremy. (This used to be commit 09a218a9f6fb0bd922940467bf8500eb4f1bcf84) --- source3/nsswitch/winbindd.c | 20 ++++++++++++++++++++ source3/nsswitch/winbindd_ads.c | 2 +- source3/nsswitch/winbindd_group.c | 6 +++--- source3/nsswitch/winbindd_pam.c | 4 ++-- source3/nsswitch/winbindd_rpc.c | 12 ++++++------ source3/nsswitch/winbindd_user.c | 8 ++++---- source3/nsswitch/winbindd_util.c | 4 ++-- 7 files changed, 38 insertions(+), 18 deletions(-) (limited to 'source3/nsswitch') diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index 24d08a4e88..de71730551 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -58,6 +58,25 @@ static BOOL reload_services_file(BOOL test) return(ret); } +/******************************************************************* + Print out all talloc memory info. +********************************************************************/ + +void return_all_talloc_info(int msg_type, pid_t src_pid, void *buf, size_t len) +{ + TALLOC_CTX *ctx = talloc_init("info context"); + char *info = NULL; + + if (!ctx) + return; + + info = talloc_describe_all(ctx); + if (info) + DEBUG(10,(info)); + message_send_pid(src_pid, MSG_TALLOC_USAGE, info, info ? strlen(info) + 1: 0, True); + talloc_destroy(ctx); +} + #if DUMP_CORE /**************************************************************************** ** @@ -864,6 +883,7 @@ static void usage(void) } register_msg_pool_usage(); + message_register(MSG_REQ_TALLOC_USAGE, return_all_talloc_info); /* Loop waiting for requests */ diff --git a/source3/nsswitch/winbindd_ads.c b/source3/nsswitch/winbindd_ads.c index 709b134c45..261c2f2237 100644 --- a/source3/nsswitch/winbindd_ads.c +++ b/source3/nsswitch/winbindd_ads.c @@ -677,7 +677,7 @@ static NTSTATUS alternate_name(struct winbindd_domain *domain) ads = ads_cached_connection(domain); if (!ads) return NT_STATUS_UNSUCCESSFUL; - if (!(ctx = talloc_init_named("alternate_name"))) { + if (!(ctx = talloc_init("alternate_name"))) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/nsswitch/winbindd_group.c b/source3/nsswitch/winbindd_group.c index ab6268583f..6b2f05f436 100644 --- a/source3/nsswitch/winbindd_group.c +++ b/source3/nsswitch/winbindd_group.c @@ -64,7 +64,7 @@ static BOOL fill_grent_mem(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx; NTSTATUS status; - if (!(mem_ctx = talloc_init_named("fill_grent_mem(%s)", domain->name))) + if (!(mem_ctx = talloc_init("fill_grent_mem(%s)", domain->name))) return False; /* Initialise group membership information */ @@ -408,7 +408,7 @@ static BOOL get_sam_group_entries(struct getent_state *ent) if (ent->got_sam_entries) return False; - if (!(mem_ctx = talloc_init_named("get_sam_group_entries(%s)", + if (!(mem_ctx = talloc_init("get_sam_group_entries(%s)", ent->domain_name))) { DEBUG(1, ("get_sam_group_entries: could not create talloc context!\n")); return False; @@ -820,7 +820,7 @@ enum winbindd_result winbindd_getgroups(struct winbindd_cli_state *state) DEBUG(3, ("[%5d]: getgroups %s\n", state->pid, state->request.data.username)); - if (!(mem_ctx = talloc_init_named("winbindd_getgroups(%s)", + if (!(mem_ctx = talloc_init("winbindd_getgroups(%s)", state->request.data.username))) return WINBINDD_ERROR; diff --git a/source3/nsswitch/winbindd_pam.c b/source3/nsswitch/winbindd_pam.c index 733ccb4cd6..c5b68ea058 100644 --- a/source3/nsswitch/winbindd_pam.c +++ b/source3/nsswitch/winbindd_pam.c @@ -77,7 +77,7 @@ enum winbindd_result winbindd_pam_auth(struct winbindd_cli_state *state) DEBUG(3, ("[%5d]: pam auth %s\n", state->pid, state->request.data.auth.user)); - if (!(mem_ctx = talloc_init_named("winbind pam auth for %s", state->request.data.auth.user))) { + if (!(mem_ctx = talloc_init("winbind pam auth for %s", state->request.data.auth.user))) { DEBUG(0, ("winbindd_pam_auth: could not talloc_init()!\n")); result = NT_STATUS_NO_MEMORY; goto done; @@ -179,7 +179,7 @@ enum winbindd_result winbindd_pam_auth_crap(struct winbindd_cli_state *state) /* Ensure null termination */ state->request.data.auth_crap.domain[sizeof(state->request.data.auth_crap.domain)-1]='\0'; - if (!(mem_ctx = talloc_init_named("winbind pam auth crap for (utf8) %s", state->request.data.auth_crap.user))) { + if (!(mem_ctx = talloc_init("winbind pam auth crap for (utf8) %s", state->request.data.auth_crap.user))) { DEBUG(0, ("winbindd_pam_auth_crap: could not talloc_init()!\n")); result = NT_STATUS_NO_MEMORY; goto done; diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c index d3a418027d..ddd2fc4946 100644 --- a/source3/nsswitch/winbindd_rpc.c +++ b/source3/nsswitch/winbindd_rpc.c @@ -71,7 +71,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain, ctr.sam.info1 = &info1; - ctx2 = talloc_init_named("winbindd dispinfo"); + ctx2 = talloc_init("winbindd dispinfo"); if (!ctx2) { result = NT_STATUS_NO_MEMORY; goto done; @@ -152,7 +152,7 @@ static NTSTATUS enum_dom_groups(struct winbindd_domain *domain, uint32 count = 0, start = *num_entries; TALLOC_CTX *mem_ctx2; - mem_ctx2 = talloc_init_named("enum_dom_groups[rpc]"); + mem_ctx2 = talloc_init("enum_dom_groups[rpc]"); status = cli_samr_enum_dom_groups(hnd->cli, mem_ctx2, &dom_pol, &start, @@ -212,7 +212,7 @@ static NTSTATUS enum_local_groups(struct winbindd_domain *domain, uint32 count = 0, start = *num_entries; TALLOC_CTX *mem_ctx2; - mem_ctx2 = talloc_init_named("enum_dom_local_groups[rpc]"); + mem_ctx2 = talloc_init("enum_dom_local_groups[rpc]"); result = cli_samr_enum_als_groups( hnd->cli, mem_ctx2, &dom_pol, &start, 0xFFFF, &info2, &count); @@ -257,7 +257,7 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain, DEBUG(3,("rpc: name_to_sid name=%s\n", name)); - if (!(mem_ctx = talloc_init_named("name_to_sid[rpc] for [%s]\\[%s]", domain->name, name))) { + if (!(mem_ctx = talloc_init("name_to_sid[rpc] for [%s]\\[%s]", domain->name, name))) { DEBUG(0, ("talloc_init failed!\n")); return NT_STATUS_NO_MEMORY; } @@ -587,7 +587,7 @@ static NTSTATUS sequence_number(struct winbindd_domain *domain, uint32 *seq) *seq = DOM_SEQUENCE_NONE; - if (!(mem_ctx = talloc_init_named("sequence_number[rpc]"))) + if (!(mem_ctx = talloc_init("sequence_number[rpc]"))) return NT_STATUS_NO_MEMORY; /* Get sam handle */ @@ -667,7 +667,7 @@ static NTSTATUS domain_sid(struct winbindd_domain *domain, DOM_SID *sid) DEBUG(3,("rpc: domain_sid\n")); - if (!(mem_ctx = talloc_init_named("domain_sid[rpc]"))) + if (!(mem_ctx = talloc_init("domain_sid[rpc]"))) return NT_STATUS_NO_MEMORY; /* Get sam handle */ diff --git a/source3/nsswitch/winbindd_user.c b/source3/nsswitch/winbindd_user.c index bb281463ce..5ae2fe7870 100644 --- a/source3/nsswitch/winbindd_user.c +++ b/source3/nsswitch/winbindd_user.c @@ -137,7 +137,7 @@ enum winbindd_result winbindd_getpwnam(struct winbindd_cli_state *state) from the winbind_lookup_by_name() call and use it in a winbind_lookup_userinfo() */ - if (!(mem_ctx = talloc_init_named("winbindd_getpwnam([%s]\\[%s])", + if (!(mem_ctx = talloc_init("winbindd_getpwnam([%s]\\[%s])", name_domain, name_user))) { DEBUG(1, ("out of memory\n")); return WINBINDD_ERROR; @@ -217,7 +217,7 @@ enum winbindd_result winbindd_getpwuid(struct winbindd_cli_state *state) /* Get some user info */ - if (!(mem_ctx = talloc_init_named("winbind_getpwuid(%d)", + if (!(mem_ctx = talloc_init("winbind_getpwuid(%d)", state->request.data.uid))) { DEBUG(1, ("out of memory\n")); @@ -336,7 +336,7 @@ static BOOL get_sam_user_entries(struct getent_state *ent) if (ent->num_sam_entries) return False; - if (!(mem_ctx = talloc_init_named("get_sam_user_entries(%s)", + if (!(mem_ctx = talloc_init("get_sam_user_entries(%s)", ent->domain_name))) return False; @@ -531,7 +531,7 @@ enum winbindd_result winbindd_list_users(struct winbindd_cli_state *state) DEBUG(3, ("[%5d]: list users\n", state->pid)); - if (!(mem_ctx = talloc_init_named("winbindd_list_users"))) + if (!(mem_ctx = talloc_init("winbindd_list_users"))) return WINBINDD_ERROR; /* Enumerate over trusted domains */ diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c index d2c5bbbb9d..3671c88e2b 100644 --- a/source3/nsswitch/winbindd_util.c +++ b/source3/nsswitch/winbindd_util.c @@ -166,7 +166,7 @@ void rescan_trusted_domains(void) DEBUG(1, ("scanning trusted domain list\n")); - if (!(mem_ctx = talloc_init_named("init_domain_list"))) + if (!(mem_ctx = talloc_init("init_domain_list"))) return; for (domain = _domain_list; domain; domain = domain->next) { @@ -335,7 +335,7 @@ BOOL winbindd_lookup_name_by_sid(DOM_SID *sid, /* Lookup name */ - if (!(mem_ctx = talloc_init_named("winbindd_lookup_name_by_sid"))) + if (!(mem_ctx = talloc_init("winbindd_lookup_name_by_sid"))) return False; result = domain->methods->sid_to_name(domain, mem_ctx, sid, &names, type); -- cgit