summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/auth/auth.c8
-rw-r--r--source3/include/talloc.h2
-rw-r--r--source3/lib/talloc.c6
-rw-r--r--source3/lib/tallocmsg.c2
-rw-r--r--source3/libads/ldap.c14
-rw-r--r--source3/libads/ldap_user.c4
-rw-r--r--source3/libsmb/clientgen.c2
-rw-r--r--source3/libsmb/clisecdesc.c2
-rw-r--r--source3/locking/posix.c4
-rw-r--r--source3/nmbd/nmbd.c20
-rw-r--r--source3/nsswitch/winbindd.c20
-rw-r--r--source3/nsswitch/winbindd_ads.c2
-rw-r--r--source3/nsswitch/winbindd_group.c6
-rw-r--r--source3/nsswitch/winbindd_pam.c4
-rw-r--r--source3/nsswitch/winbindd_rpc.c12
-rw-r--r--source3/nsswitch/winbindd_user.c8
-rw-r--r--source3/nsswitch/winbindd_util.c4
-rw-r--r--source3/param/loadparm.c2
-rw-r--r--source3/passdb/passdb.c2
-rw-r--r--source3/passdb/pdb_interface.c2
-rw-r--r--source3/printing/notify.c2
-rw-r--r--source3/printing/nt_printing.c8
-rw-r--r--source3/registry/reg_objects.c4
-rw-r--r--source3/rpc_parse/parse_misc.c2
-rw-r--r--source3/rpc_server/srv_pipe_hnd.c4
-rw-r--r--source3/rpc_server/srv_samr_nt.c2
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c2
-rw-r--r--source3/rpc_server/srv_srvsvc_nt.c4
-rw-r--r--source3/rpcclient/cmd_samr.c2
-rw-r--r--source3/rpcclient/rpcclient.c4
-rw-r--r--source3/smbd/nttrans.c4
-rw-r--r--source3/smbd/server.c31
-rw-r--r--source3/torture/vfstest.c2
-rw-r--r--source3/utils/net_ads.c4
-rw-r--r--source3/utils/net_rpc.c12
-rw-r--r--source3/utils/net_rpc_join.c2
-rw-r--r--source3/utils/net_rpc_samsync.c6
-rw-r--r--source3/utils/smbcacls.c2
-rw-r--r--source3/utils/smbcontrol.c38
-rw-r--r--source3/wrepld/server.c2
40 files changed, 179 insertions, 84 deletions
diff --git a/source3/auth/auth.c b/source3/auth/auth.c
index d730e39f44..dce14ed468 100644
--- a/source3/auth/auth.c
+++ b/source3/auth/auth.c
@@ -74,9 +74,9 @@ static const uint8 *get_ntlm_challenge(struct auth_context *auth_context)
continue;
}
- mem_ctx = talloc_init_named("auth_get_challenge for module %s", auth_method->name);
+ mem_ctx = talloc_init("auth_get_challenge for module %s", auth_method->name);
if (!mem_ctx) {
- smb_panic("talloc_init_named() failed!");
+ smb_panic("talloc_init() failed!");
}
challenge = auth_method->get_chal(auth_context, &auth_method->private_data, mem_ctx);
@@ -211,7 +211,7 @@ static NTSTATUS check_ntlm_password(const struct auth_context *auth_context,
return NT_STATUS_LOGON_FAILURE;
for (auth_method = auth_context->auth_method_list;auth_method; auth_method = auth_method->next) {
- mem_ctx = talloc_init_named("%s authentication for user %s\\%s", auth_method->name,
+ mem_ctx = talloc_init("%s authentication for user %s\\%s", auth_method->name,
user_info->domain.str, user_info->smb_name.str);
nt_status = auth_method->auth(auth_context, auth_method->private_data, mem_ctx, user_info, server_info);
@@ -290,7 +290,7 @@ static NTSTATUS make_auth_context(struct auth_context **auth_context)
{
TALLOC_CTX *mem_ctx;
- mem_ctx = talloc_init_named("authentication context");
+ mem_ctx = talloc_init("authentication context");
*auth_context = talloc(mem_ctx, sizeof(**auth_context));
if (!*auth_context) {
diff --git a/source3/include/talloc.h b/source3/include/talloc.h
index 64a5883041..4badddbb88 100644
--- a/source3/include/talloc.h
+++ b/source3/include/talloc.h
@@ -32,7 +32,7 @@
**/
typedef struct talloc_ctx TALLOC_CTX;
-TALLOC_CTX *talloc_init_named(char const *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
+TALLOC_CTX *talloc_init(char const *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
char *talloc_vasprintf(TALLOC_CTX *t, const char *fmt, va_list ap)
PRINTF_ATTRIBUTE(2, 0);
diff --git a/source3/lib/talloc.c b/source3/lib/talloc.c
index 5fffe58f9f..f0c13753b5 100644
--- a/source3/lib/talloc.c
+++ b/source3/lib/talloc.c
@@ -117,7 +117,7 @@ static void talloc_disenroll(TALLOC_CTX *t)
/** Create a new talloc context. **/
-TALLOC_CTX *talloc_init(void)
+static TALLOC_CTX *talloc_init_internal(void)
{
TALLOC_CTX *t;
@@ -139,12 +139,12 @@ TALLOC_CTX *talloc_init(void)
* Please call this in preference to talloc_init().
**/
- TALLOC_CTX *talloc_init_named(char const *fmt, ...)
+ TALLOC_CTX *talloc_init(char const *fmt, ...)
{
TALLOC_CTX *t;
va_list ap;
- t = talloc_init();
+ t = talloc_init_internal();
if (t && fmt) {
/*
* t->name must not be talloced.
diff --git a/source3/lib/tallocmsg.c b/source3/lib/tallocmsg.c
index 608cdad452..bbe1ee60a4 100644
--- a/source3/lib/tallocmsg.c
+++ b/source3/lib/tallocmsg.c
@@ -34,7 +34,7 @@ void msg_pool_usage(int msg_type, pid_t src_pid,
void *UNUSED(buf), size_t UNUSED(len))
{
char *reply;
- TALLOC_CTX *reply_pool = talloc_init_named("msg_pool_usage");
+ TALLOC_CTX *reply_pool = talloc_init("msg_pool_usage");
SMB_ASSERT(msg_type == MSG_REQ_POOL_USAGE);
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index af9a6451fe..97ccf76983 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -420,7 +420,7 @@ ADS_STATUS ads_do_paged_search(ADS_STRUCT *ads, const char *bind_path,
*res = NULL;
- if (!(ctx = talloc_init()))
+ if (!(ctx = talloc_init("ads_do_paged_search")))
return ADS_ERROR(LDAP_NO_MEMORY);
/* 0 means the conversion worked but the result was empty
@@ -642,7 +642,7 @@ ADS_STATUS ads_do_search(ADS_STRUCT *ads, const char *bind_path, int scope,
char *utf8_exp, *utf8_path, **search_attrs = NULL;
TALLOC_CTX *ctx;
- if (!(ctx = talloc_init())) {
+ if (!(ctx = talloc_init("ads_do_search"))) {
DEBUG(1,("ads_do_search: talloc_init() failed!"));
return ADS_ERROR(LDAP_NO_MEMORY);
}
@@ -1031,7 +1031,7 @@ static ADS_STATUS ads_add_machine_acct(ADS_STRUCT *ads, const char *hostname,
char *psp;
unsigned acct_control;
- if (!(ctx = talloc_init_named("machine_account")))
+ if (!(ctx = talloc_init("machine_account")))
return ADS_ERROR(LDAP_NO_MEMORY);
ret = ADS_ERROR(LDAP_NO_MEMORY);
@@ -1144,7 +1144,7 @@ static void dump_sd(const char *filed, struct berval **values)
SEC_DESC *psd = 0;
TALLOC_CTX *ctx = 0;
- if (!(ctx = talloc_init_named("sec_io_desc")))
+ if (!(ctx = talloc_init("sec_io_desc")))
return;
/* prepare data */
@@ -1246,7 +1246,7 @@ void ads_process_results(ADS_STRUCT *ads, void *res,
void *msg;
TALLOC_CTX *ctx;
- if (!(ctx = talloc_init()))
+ if (!(ctx = talloc_init("ads_process_results")))
return;
for (msg = ads_first_entry(ads, res); msg;
@@ -1429,7 +1429,7 @@ ADS_STATUS ads_set_machine_sd(ADS_STRUCT *ads, const char *hostname, char *dn)
msg = ads_first_entry(ads, res);
ads_pull_sid(ads, msg, attrs[1], &sid);
- if (!(ctx = talloc_init_named("sec_io_desc"))) {
+ if (!(ctx = talloc_init("sec_io_desc"))) {
ret = ADS_ERROR(LDAP_NO_MEMORY);
goto ads_set_sd_error;
}
@@ -1785,7 +1785,7 @@ ADS_STATUS ads_server_info(ADS_STRUCT *ads)
char *timestr;
TALLOC_CTX *ctx;
- if (!(ctx = talloc_init())) {
+ if (!(ctx = talloc_init("ads_server_info"))) {
return ADS_ERROR(LDAP_NO_MEMORY);
}
diff --git a/source3/libads/ldap_user.c b/source3/libads/ldap_user.c
index b6fef24b5c..de19e2da5e 100644
--- a/source3/libads/ldap_user.c
+++ b/source3/libads/ldap_user.c
@@ -50,7 +50,7 @@ ADS_STATUS ads_add_user_acct(ADS_STRUCT *ads, const char *user,
if (fullname && *fullname) name = fullname;
else name = user;
- if (!(ctx = talloc_init_named("ads_add_user_acct")))
+ if (!(ctx = talloc_init("ads_add_user_acct")))
return ADS_ERROR(LDAP_NO_MEMORY);
status = ADS_ERROR(LDAP_NO_MEMORY);
@@ -88,7 +88,7 @@ ADS_STATUS ads_add_group_acct(ADS_STRUCT *ads, const char *group,
char *new_dn;
const char *objectClass[] = {"top", "group", NULL};
- if (!(ctx = talloc_init_named("ads_add_group_acct")))
+ if (!(ctx = talloc_init("ads_add_group_acct")))
return ADS_ERROR(LDAP_NO_MEMORY);
status = ADS_ERROR(LDAP_NO_MEMORY);
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 28480043b9..c843d49d27 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -262,7 +262,7 @@ struct cli_state *cli_initialise(struct cli_state *cli)
if (!cli->outbuf || !cli->inbuf)
goto error;
- if ((cli->mem_ctx = talloc_init_named("cli based talloc")) == NULL)
+ if ((cli->mem_ctx = talloc_init("cli based talloc")) == NULL)
goto error;
memset(cli->outbuf, 0, cli->bufsize);
diff --git a/source3/libsmb/clisecdesc.c b/source3/libsmb/clisecdesc.c
index 5de67b1e05..7dd2747ff6 100644
--- a/source3/libsmb/clisecdesc.c
+++ b/source3/libsmb/clisecdesc.c
@@ -83,7 +83,7 @@ BOOL cli_set_secdesc(struct cli_state *cli, int fnum, SEC_DESC *sd)
prs_struct pd;
BOOL ret = False;
- if ((mem_ctx = talloc_init()) == NULL) {
+ if ((mem_ctx = talloc_init("cli_set_secdesc")) == NULL) {
DEBUG(0,("talloc_init failed.\n"));
goto cleanup;
}
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 94055de2b0..fcf19d21cf 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -1003,7 +1003,7 @@ BOOL set_posix_lock(files_struct *fsp, SMB_BIG_UINT u_offset, SMB_BIG_UINT u_cou
* semantics that if a write lock is added, then it will be first in the array.
*/
- if ((l_ctx = talloc_init()) == NULL) {
+ if ((l_ctx = talloc_init("set_posix_lock")) == NULL) {
DEBUG(0,("set_posix_lock: unable to init talloc context.\n"));
return True; /* Not a fatal error. */
}
@@ -1149,7 +1149,7 @@ BOOL release_posix_lock(files_struct *fsp, SMB_BIG_UINT u_offset, SMB_BIG_UINT u
}
}
- if ((ul_ctx = talloc_init()) == NULL) {
+ if ((ul_ctx = talloc_init("release_posix_lock")) == NULL) {
DEBUG(0,("release_posix_lock: unable to init talloc context.\n"));
return True; /* Not a fatal error. */
}
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 5987d70a45..988127e431 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -95,6 +95,25 @@ static void sig_hup(int sig)
sys_select_signal();
}
+/*******************************************************************
+ 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
/**************************************************************************** **
Prepare to dump a core file - carefully!
@@ -682,6 +701,7 @@ static BOOL open_sockets(BOOL isdaemon, int port)
message_register(MSG_FORCE_ELECTION, nmbd_message_election);
message_register(MSG_WINS_NEW_ENTRY, nmbd_wins_new_entry);
message_register(MSG_SHUTDOWN, nmbd_terminate);
+ message_register(MSG_REQ_TALLOC_USAGE, return_all_talloc_info);
DEBUG( 3, ( "Opening sockets %d\n", global_nmb_port ) );
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);
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 831aab0305..42de1c62bf 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -1462,7 +1462,7 @@ static char *lp_string(const char *s)
#endif
if (!lp_talloc)
- lp_talloc = talloc_init_named("lp_talloc");
+ lp_talloc = talloc_init("lp_talloc");
ret = (char *)talloc(lp_talloc, len + 100); /* leave room for substitution */
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index ef1c1180dd..ed5ddda4da 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -139,7 +139,7 @@ NTSTATUS pdb_init_sam(SAM_ACCOUNT **user)
TALLOC_CTX *mem_ctx;
NTSTATUS nt_status;
- mem_ctx = talloc_init_named("passdb internal SAM_ACCOUNT allocation");
+ mem_ctx = talloc_init("passdb internal SAM_ACCOUNT allocation");
if (!mem_ctx) {
DEBUG(0,("pdb_init_sam: error while doing talloc_init()\n"));
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 88070d8694..d21cc1d355 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -415,7 +415,7 @@ static NTSTATUS make_pdb_context(struct pdb_context **context)
{
TALLOC_CTX *mem_ctx;
- mem_ctx = talloc_init_named("pdb_context internal allocation context");
+ mem_ctx = talloc_init("pdb_context internal allocation context");
if (!mem_ctx) {
DEBUG(0, ("make_pdb_context: talloc init failed!\n"));
diff --git a/source3/printing/notify.c b/source3/printing/notify.c
index f55dbff47e..a89eb3f13c 100644
--- a/source3/printing/notify.c
+++ b/source3/printing/notify.c
@@ -146,7 +146,7 @@ static void send_spoolss_notify2_msg(struct spoolss_notify_msg *msg)
return;
if (!send_ctx)
- send_ctx = talloc_init_named("print notify queue");
+ send_ctx = talloc_init("print notify queue");
if (!send_ctx)
goto fail;
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index ab01e77c61..31f480a4dd 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -2574,7 +2574,7 @@ static void store_printer_guid(NT_PRINTER_INFO_LEVEL_2 *info2, GUID guid)
static WERROR publish_it(NT_PRINTER_INFO_LEVEL *printer)
{
ADS_STATUS ads_rc;
- TALLOC_CTX *ctx = talloc_init();
+ TALLOC_CTX *ctx = talloc_init("publish_it");
ADS_MODLIST mods = ads_init_mods(ctx);
char *prt_dn = NULL, *srv_dn, **srv_cn;
void *res = NULL;
@@ -3713,7 +3713,7 @@ static WERROR save_driver_init_2(NT_PRINTER_INFO_LEVEL *printer, uint8 *data, ui
* saved to tdb.
*/
- if ((ctx = talloc_init()) == NULL)
+ if ((ctx = talloc_init("save_driver_init_2")) == NULL)
return WERR_NOMEM;
if ((nt_devmode = (NT_DEVICEMODE*)malloc(sizeof(NT_DEVICEMODE))) == NULL) {
@@ -4397,7 +4397,7 @@ WERROR nt_printing_setsec(const char *printername, SEC_DESC_BUF *secdesc_ctr)
fstring key;
WERROR status;
- mem_ctx = talloc_init();
+ mem_ctx = talloc_init("nt_printing_setsec");
if (mem_ctx == NULL)
return WERR_NOMEM;
@@ -4744,7 +4744,7 @@ BOOL print_access_check(struct current_user *user, int snum, int access_type)
/* Get printer security descriptor */
- if(!(mem_ctx = talloc_init())) {
+ if(!(mem_ctx = talloc_init("print_access_check"))) {
errno = ENOMEM;
return False;
}
diff --git a/source3/registry/reg_objects.c b/source3/registry/reg_objects.c
index 663435daca..3289ebfe88 100644
--- a/source3/registry/reg_objects.c
+++ b/source3/registry/reg_objects.c
@@ -33,7 +33,7 @@
void regsubkey_ctr_init( REGSUBKEY_CTR *ctr )
{
if ( !ctr->ctx )
- ctr->ctx = talloc_init();
+ ctr->ctx = talloc_init("regsubkey_ctr_init for ctr %p", ctr);
}
/***********************************************************************
@@ -114,7 +114,7 @@ void regsubkey_ctr_destroy( REGSUBKEY_CTR *ctr )
void regval_ctr_init( REGVAL_CTR *ctr )
{
if ( !ctr->ctx )
- ctr->ctx = talloc_init();
+ ctr->ctx = talloc_init("regval_ctr_init for ctr %p", ctr);
}
/***********************************************************************
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index 5dcb49d399..86dd85066d 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -63,7 +63,7 @@ void main_loop_talloc_free(void)
TALLOC_CTX *main_loop_talloc_get(void)
{
if (!main_loop_talloc) {
- main_loop_talloc = talloc_init_named("main loop talloc (mainly parse_misc)");
+ main_loop_talloc = talloc_init("main loop talloc (mainly parse_misc)");
if (!main_loop_talloc)
smb_panic("main_loop_talloc: malloc fail\n");
}
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index 1695419687..6cdb6836eb 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -293,7 +293,7 @@ static void *make_internal_rpc_pipe_p(char *pipe_name,
ZERO_STRUCTP(p);
- if ((p->mem_ctx = talloc_init()) == NULL) {
+ if ((p->mem_ctx = talloc_init("pipe %s %p", pipe_name, p)) == NULL) {
DEBUG(0,("open_rpc_pipe_p: talloc_init failed.\n"));
SAFE_FREE(p);
return NULL;
@@ -544,7 +544,7 @@ void free_pipe_context(pipes_struct *p)
DEBUG(3,("free_pipe_context: destroying talloc pool of size %u\n", talloc_pool_size(p->mem_ctx) ));
talloc_destroy_pool(p->mem_ctx);
} else {
- p->mem_ctx = talloc_init();
+ p->mem_ctx = talloc_init("pipe %s %p", p->name, p);
if (p->mem_ctx == NULL)
p->fault_state = True;
}
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index 603dcd0017..fd152aa3b3 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -134,7 +134,7 @@ static struct samr_info *get_samr_info_by_sid(DOM_SID *psid)
fstrcpy(sid_str,"(NULL)");
}
- mem_ctx = talloc_init_named("samr_info for domain sid %s", sid_str);
+ mem_ctx = talloc_init("samr_info for domain sid %s", sid_str);
if ((info = (struct samr_info *)talloc(mem_ctx, sizeof(struct samr_info))) == NULL)
return NULL;
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index b5c5749f3c..68a2dcb83d 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -776,7 +776,7 @@ static void notify_msg_ctr_init( SPOOLSS_NOTIFY_MSG_CTR *ctr )
if ( !ctr )
return;
- ctr->ctx = talloc_init();
+ ctr->ctx = talloc_init("notify_msg_ctr_init %p", ctr);
return;
}
diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c
index 0384bb81a3..69f82bb96f 100644
--- a/source3/rpc_server/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srv_srvsvc_nt.c
@@ -237,7 +237,7 @@ static BOOL set_share_security(TALLOC_CTX *ctx, const char *share_name, SEC_DESC
fstring key;
BOOL ret = False;
- mem_ctx = talloc_init();
+ mem_ctx = talloc_init("set_share_security");
if (mem_ctx == NULL)
return False;
@@ -327,7 +327,7 @@ BOOL share_access_check(connection_struct *conn, int snum, user_struct *vuser, u
NT_USER_TOKEN *token = NULL;
BOOL ret = True;
- mem_ctx = talloc_init();
+ mem_ctx = talloc_init("share_access_check");
if (mem_ctx == NULL)
return False;
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 246e74dc35..5c6308d07c 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -1310,7 +1310,7 @@ static NTSTATUS cmd_samr_query_sec_obj(struct cli_state *cli,
SEC_DESC_BUF *sec_desc_buf=NULL;
BOOL domain = False;
- ctx=talloc_init();
+ ctx=talloc_init("cmd_samr_query_sec_obj");
if ((argc < 1) || (argc > 2)) {
printf("Usage: %s [rid|-d]\n", argv[0]);
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 646a6d9035..02fa91cf26 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -197,7 +197,7 @@ static void fetch_machine_sid(struct cli_state *cli)
if (got_domain_sid) return;
- if (!(mem_ctx=talloc_init()))
+ if (!(mem_ctx=talloc_init("fetch_machine_sid")))
{
DEBUG(0,("fetch_machine_sid: talloc_init returned NULL!\n"));
goto error;
@@ -479,7 +479,7 @@ static NTSTATUS do_cmd(struct cli_state *cli, struct cmd_set *cmd_entry,
/* Create mem_ctx */
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("do_cmd"))) {
DEBUG(0, ("talloc_init() failed\n"));
goto done;
}
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index bdefa6c4c1..740f450db6 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -985,7 +985,7 @@ static NTSTATUS set_sd(files_struct *fsp, char *data, uint32 sd_len, uint32 secu
* Init the parse struct we will unmarshall from.
*/
- if ((mem_ctx = talloc_init()) == NULL) {
+ if ((mem_ctx = talloc_init("set_sd")) == NULL) {
DEBUG(0,("set_sd: talloc_init failed.\n"));
return NT_STATUS_NO_MEMORY;
}
@@ -1538,7 +1538,7 @@ static int call_nt_transact_query_security_desc(connection_struct *conn,
*ppparams = params;
- if ((mem_ctx = talloc_init()) == NULL) {
+ if ((mem_ctx = talloc_init("call_nt_transact_query_security_desc")) == NULL) {
DEBUG(0,("call_nt_transact_query_security_desc: talloc_init failed.\n"));
return ERROR_DOS(ERRDOS,ERRnomem);
}
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 342c7c85cf..7581eb6001 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -463,6 +463,25 @@ BOOL reload_services(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
/*******************************************************************
prepare to dump a core file - carefully!
@@ -759,19 +778,18 @@ static BOOL init_structs(void )
setpgid( (pid_t)0, (pid_t)0);
#endif
- if (!directory_exist(lp_lockdir(), NULL)) {
+ if (!directory_exist(lp_lockdir(), NULL))
mkdir(lp_lockdir(), 0755);
- }
- if (is_daemon) {
+ if (is_daemon)
pidfile_create("smbd");
- }
- if (!message_init()) {
+ if (!message_init())
exit(1);
- }
+
register_msg_pool_usage();
register_dmalloc_msgs();
+ message_register(MSG_REQ_TALLOC_USAGE, return_all_talloc_info);
if (!print_backend_init())
exit(1);
@@ -840,7 +858,6 @@ static BOOL init_structs(void )
/* register our message handlers */
message_register(MSG_SMB_FORCE_TDIS, msg_force_tdis);
- talloc_init_named("dummy!");
smbd_process();
diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c
index c68d2b04d2..c8250f15f8 100644
--- a/source3/torture/vfstest.c
+++ b/source3/torture/vfstest.c
@@ -304,7 +304,7 @@ static NTSTATUS do_cmd(struct vfs_state *vfs, struct cmd_set *cmd_entry, char *c
if (mem_ctx == NULL) {
/* Create mem_ctx */
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("do_cmd"))) {
DEBUG(0, ("talloc_init() failed\n"));
goto done;
}
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index f0ea82d87c..72dbe49c16 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -180,7 +180,7 @@ static int net_ads_workgroup(int argc, const char **argv)
if (!(ads = ads_startup())) return -1;
- if (!(ctx = talloc_init_named("net_ads_workgroup"))) {
+ if (!(ctx = talloc_init("net_ads_workgroup"))) {
return -1;
}
@@ -748,7 +748,7 @@ static int net_ads_printer_publish(int argc, const char **argv)
struct in_addr server_ip;
NTSTATUS nt_status;
extern char *opt_workgroup;
- TALLOC_CTX *mem_ctx = talloc_init();
+ TALLOC_CTX *mem_ctx = talloc_init("net_ads_printer_publish");
ADS_MODLIST mods = ads_init_mods(mem_ctx);
char *prt_dn, *srv_dn, **srv_cn;
void *res = NULL;
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 092d625ae5..2b2a69eb99 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -62,7 +62,7 @@ static DOM_SID *net_get_remote_domain_sid(struct cli_state *cli)
goto error;
}
- if (!(mem_ctx=talloc_init()))
+ if (!(mem_ctx=talloc_init("net_get_remote_domain_sid")))
{
DEBUG(0,("net_get_remote_domain_sid: talloc_init returned NULL!\n"));
goto error;
@@ -138,7 +138,7 @@ static int run_rpc_command(struct cli_state *cli_arg, const int pipe_idx, int co
/* Create mem_ctx */
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("run_rpc_command"))) {
DEBUG(0, ("talloc_init() failed\n"));
cli_shutdown(cli);
return -1;
@@ -374,7 +374,7 @@ rpc_info_internals(const DOM_SID *domain_sid, struct cli_state *cli,
result = cli_samr_query_dom_info(cli, mem_ctx, &domain_pol,
2, &ctr);
if (NT_STATUS_IS_OK(result)) {
- TALLOC_CTX *ctx = talloc_init();
+ TALLOC_CTX *ctx = talloc_init("rpc_info_internals");
d_printf("Domain Name: %s\n", unistr2_tdup(ctx, &ctr.info.inf2.uni_domain));
d_printf("Domain SID: %s\n", sid_str);
d_printf("Sequence number: %u\n", ctr.info.inf2.seq_num);
@@ -1721,7 +1721,7 @@ static int rpc_trustdom_establish(int argc, const char **argv)
return -1;
}
- if (!(mem_ctx = talloc_init_named("establishing trust relationship to domain %s",
+ if (!(mem_ctx = talloc_init("establishing trust relationship to domain %s",
domain_name))) {
DEBUG(0, ("talloc_init() failed\n"));
cli_shutdown(cli);
@@ -1743,7 +1743,7 @@ static int rpc_trustdom_establish(int argc, const char **argv)
* Call LsaOpenPolicy and LsaQueryInfo
*/
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("rpc_trustdom_establish"))) {
DEBUG(0, ("talloc_init() failed\n"));
cli_shutdown(cli);
return -1;
@@ -1903,7 +1903,7 @@ static int rpc_trustdom_list(int argc, const char **argv)
* Listing trusted domains (stored in secrets.tdb, if local)
*/
- mem_ctx = talloc_init_named("trust relationships listing");
+ mem_ctx = talloc_init("trust relationships listing");
/*
* set domain and pdc name to local samba server (default)
diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c
index 4b78b7d283..1b711f7b43 100644
--- a/source3/utils/net_rpc_join.c
+++ b/source3/utils/net_rpc_join.c
@@ -141,7 +141,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
if (!(cli = net_make_ipc_connection(NET_FLAGS_PDC)))
return 1;
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("net_rpc_join_newstyle"))) {
DEBUG(0, ("Could not initialise talloc context\n"));
goto done;
}
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index 34d926ab61..1bd39e3ebb 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -128,7 +128,7 @@ static void dump_database(struct cli_state *cli, unsigned db_type, DOM_CRED *ret
SAM_DELTA_CTR *deltas;
uint32 num_deltas;
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("dump_database"))) {
return;
}
@@ -452,7 +452,7 @@ fetch_group_mem_info(uint32 rid, SAM_GROUP_MEM_INFO *delta)
d_printf("Group members of %s: ", grp->gr_name);
- if (!(t = talloc_init())) {
+ if (!(t = talloc_init("fetch_group_mem_info"))) {
DEBUG(0, ("could not talloc_init\n"));
return NT_STATUS_NO_MEMORY;
}
@@ -656,7 +656,7 @@ fetch_database(struct cli_state *cli, unsigned db_type, DOM_CRED *ret_creds,
SAM_DELTA_CTR *deltas;
uint32 num_deltas;
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("fetch_database"))) {
return;
}
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 043aa689cc..07b2aa7fec 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -777,7 +777,7 @@ You can string acls together with spaces, commas or newlines\n\
struct cli_state *cli;
- ctx=talloc_init();
+ ctx=talloc_init("main");
setlinebuf(stdout);
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 72ac2dd095..f4d197147f 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -43,6 +43,7 @@ static struct {
{"dmalloc-log-changed", MSG_REQ_DMALLOC_LOG_CHANGED },
{"shutdown", MSG_SHUTDOWN },
{"drvupgrade", MSG_PRINTER_DRVUPGRADE},
+ {"tallocdump", MSG_REQ_TALLOC_USAGE},
{NULL, -1}
};
@@ -75,8 +76,10 @@ static void usage(BOOL doexit)
static int pong_count;
static BOOL got_level;
+static BOOL got_pool;
static BOOL pong_registered = False;
static BOOL debuglevel_registered = False;
+static BOOL poolusage_registered = False;
static BOOL profilelevel_registered = False;
@@ -109,6 +112,22 @@ void pong_function(int msg_type, pid_t src, void *buf, size_t len)
}
/****************************************************************************
+ Prints out the current talloc list.
+****************************************************************************/
+void tallocdump_function(int msg_type, pid_t src, void *buf, size_t len)
+{
+ char *info = (char *)buf;
+
+ printf("Current talloc contexts for process %u\n", (unsigned int)src );
+ if (len == 0)
+ printf("None returned\n");
+ else
+ printf(info);
+ printf("\n");
+ got_pool = True;
+}
+
+/****************************************************************************
Prints out the current Debug level returned by MSG_DEBUGLEVEL
****************************************************************************/
void debuglevel_function(int msg_type, pid_t src, void *buf, size_t len)
@@ -347,6 +366,25 @@ static BOOL do_command(char *dest, char *msg_name, int iparams, char **params)
}
break;
+ case MSG_REQ_TALLOC_USAGE:
+ if (!poolusage_registered) {
+ message_register(MSG_TALLOC_USAGE, tallocdump_function);
+ poolusage_registered = True;
+ }
+ got_pool = False;
+ retval = send_message(dest, MSG_REQ_TALLOC_USAGE, NULL, 0, True);
+ if (retval) {
+ timeout_start = time(NULL);
+ while (!got_pool) {
+ message_dispatch();
+ if ((time(NULL) - timeout_start) > MAX_WAIT) {
+ fprintf(stderr,"tallocdump timeout\n");
+ break;
+ }
+ }
+ }
+ break;
+
case MSG_REQ_DEBUGLEVEL:
if (!debuglevel_registered) {
message_register(MSG_DEBUGLEVEL, debuglevel_function);
diff --git a/source3/wrepld/server.c b/source3/wrepld/server.c
index 295eb15596..144a5b570c 100644
--- a/source3/wrepld/server.c
+++ b/source3/wrepld/server.c
@@ -707,7 +707,7 @@ static void process(void)
}
/* Initialise the memory context */
- mem_ctx=talloc_init_named("wins repl talloc ctx");
+ mem_ctx=talloc_init("wins repl talloc ctx");
/* initialise the global partners table */
partner_count=init_wins_partner_table();