From b067a5e4e83556d11a68ea1837ce4698762c123d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 3 Nov 2009 10:59:18 +0100 Subject: s3: Remove debug_ctx() smbd just crashed on me: In a debug message I called a routine preparing a string that itself used debug_ctx. The outer routine also used it after the inner routine had returned. It was still referencing the talloc context that the outer debug_ctx() had given us, which the inner DEBUG had already freed. --- source3/smbd/change_trust_pw.c | 2 +- source3/smbd/filename_util.c | 6 +++--- source3/smbd/oplock.c | 10 +++++----- source3/smbd/oplock_onefs.c | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/change_trust_pw.c b/source3/smbd/change_trust_pw.c index 72a72a78b5..ec3046e0d2 100644 --- a/source3/smbd/change_trust_pw.c +++ b/source3/smbd/change_trust_pw.c @@ -92,7 +92,7 @@ NTSTATUS change_trust_account_password( const char *domain, const char *remote_m failed: if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0,("%s : change_trust_account_password: Failed to change password for domain %s.\n", - current_timestring(debug_ctx(), False), domain)); + current_timestring(talloc_tos(), False), domain)); } else DEBUG(5,("change_trust_account_password: sucess!\n")); diff --git a/source3/smbd/filename_util.c b/source3/smbd/filename_util.c index 8c099657c4..aad8a08e2b 100644 --- a/source3/smbd/filename_util.c +++ b/source3/smbd/filename_util.c @@ -107,7 +107,7 @@ NTSTATUS create_synthetic_smb_fname_split(TALLOC_CTX *ctx, } /** - * Return a string using the debug_ctx() + * Return a string using the talloc_tos() */ const char *smb_fname_str_dbg(const struct smb_filename *smb_fname) { @@ -117,7 +117,7 @@ const char *smb_fname_str_dbg(const struct smb_filename *smb_fname) if (smb_fname == NULL) { return ""; } - status = get_full_smb_filename(debug_ctx(), smb_fname, &fname); + status = get_full_smb_filename(talloc_tos(), smb_fname, &fname); if (!NT_STATUS_IS_OK(status)) { return ""; } @@ -125,7 +125,7 @@ const char *smb_fname_str_dbg(const struct smb_filename *smb_fname) } /** - * Return a debug string using the debug_ctx(). This can only be called from + * Return a debug string using the talloc_tos(). This can only be called from * DEBUG() macros due to the debut_ctx(). */ const char *fsp_str_dbg(const struct files_struct *fsp) diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index dd8d5372fb..cdb6093fe9 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -433,7 +433,7 @@ void process_oplock_async_level2_break_message(struct messaging_context *msg_ctx message_to_share_mode_entry(&msg, (char *)data->data); DEBUG(10, ("Got oplock async level 2 break message from pid %s: " - "%s/%lu\n", procid_str(debug_ctx(), &src), + "%s/%lu\n", procid_str(talloc_tos(), &src), file_id_string_tos(&msg.id), msg.share_file_id)); fsp = initial_break_processing(msg.id, msg.share_file_id); @@ -478,7 +478,7 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx, message_to_share_mode_entry(&msg, (char *)data->data); DEBUG(10, ("Got oplock break message from pid %s: %s/%lu\n", - procid_str(debug_ctx(), &src), file_id_string_tos(&msg.id), + procid_str(talloc_tos(), &src), file_id_string_tos(&msg.id), msg.share_file_id)); fsp = initial_break_processing(msg.id, msg.share_file_id); @@ -586,7 +586,7 @@ static void process_kernel_oplock_break(struct messaging_context *msg_ctx, file_id = (unsigned long)IVAL(data->data, 24); DEBUG(10, ("Got kernel oplock break message from pid %s: %s/%u\n", - procid_str(debug_ctx(), &src), file_id_string_tos(&id), + procid_str(talloc_tos(), &src), file_id_string_tos(&id), (unsigned int)file_id)); fsp = initial_break_processing(id, file_id); @@ -682,7 +682,7 @@ static void process_oplock_break_response(struct messaging_context *msg_ctx, message_to_share_mode_entry(&msg, (char *)data->data); DEBUG(10, ("Got oplock break response from pid %s: %s/%lu mid %u\n", - procid_str(debug_ctx(), &src), file_id_string_tos(&msg.id), + procid_str(talloc_tos(), &src), file_id_string_tos(&msg.id), msg.share_file_id, (unsigned int)msg.op_mid)); /* Here's the hack from open.c, store the mid in the 'port' field */ @@ -711,7 +711,7 @@ static void process_open_retry_message(struct messaging_context *msg_ctx, message_to_share_mode_entry(&msg, (char *)data->data); DEBUG(10, ("Got open retry msg from pid %s: %s mid %u\n", - procid_str(debug_ctx(), &src), file_id_string_tos(&msg.id), + procid_str(talloc_tos(), &src), file_id_string_tos(&msg.id), (unsigned int)msg.op_mid)); schedule_deferred_open_smb_message(msg.op_mid); diff --git a/source3/smbd/oplock_onefs.c b/source3/smbd/oplock_onefs.c index 4a9efe6929..c80925ced3 100644 --- a/source3/smbd/oplock_onefs.c +++ b/source3/smbd/oplock_onefs.c @@ -67,22 +67,22 @@ const char *onefs_cb_record_str_dbg(const struct onefs_callback_record *r) char *result; if (r == NULL) { - result = talloc_strdup(debug_ctx(), "NULL callback record"); + result = talloc_strdup(talloc_tos(), "NULL callback record"); return result; } switch (r->state) { case ONEFS_OPEN_FILE: - result = talloc_asprintf(debug_ctx(), "cb record %llu for " + result = talloc_asprintf(talloc_tos(), "cb record %llu for " "file %s", r->id, fsp_str_dbg(r->data.fsp)); case ONEFS_WAITING_FOR_OPLOCK: - result = talloc_asprintf(debug_ctx(), "cb record %llu for " + result = talloc_asprintf(talloc_tos(), "cb record %llu for " "pending mid %d", r->id, (int)r->data.mid); break; default: - result = talloc_asprintf(debug_ctx(), "cb record %llu unknown " + result = talloc_asprintf(talloc_tos(), "cb record %llu unknown " "state %d", r->id, r->state); break; } -- cgit