From abdf9dea61f5dd95bb85646e7c4531ba8650851d Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Wed, 3 Jun 2015 16:58:22 +0200 Subject: [PATCH 1/2] lib/util/charset: fix conversion failure logging Move catch-all debug statement with loglevel 0 from behind the switch clause into the switch clause as default case. Fixes an issue that resulted in the log being flooded with level 0 messages in case someone put a file with an illegal UTF8 encoding (eg '\xA0test') on the server. Bug: https://bugzilla.samba.org/show_bug.cgi?id=11323 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison (cherry picked from commit 1c60dc5c3252685d51324481063461f60cf968fe) --- lib/util/charset/convert_string.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/util/charset/convert_string.c b/lib/util/charset/convert_string.c index 2e66680..50065f8 100644 --- a/lib/util/charset/convert_string.c +++ b/lib/util/charset/convert_string.c @@ -434,8 +434,10 @@ bool convert_string_talloc_handle(TALLOC_CTX *ctx, struct smb_iconv_handle *ic, reason="Illegal multibyte sequence"; DEBUG(3,("convert_string_talloc: Conversion error: %s(%s)\n",reason,inbuf)); break; + default: + DEBUG(0,("Conversion error: %s(%s)\n",reason,inbuf)); + break; } - DEBUG(0,("Conversion error: %s(%s)\n",reason,inbuf)); /* smb_panic(reason); */ TALLOC_FREE(ob); return false; -- 2.1.0 From 6923331c94b4ce8b9f58c3d3ec45dcbae544cc27 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Wed, 3 Jun 2015 17:07:46 +0200 Subject: [PATCH 2/2] smbd/trans2: add a useful diagnostic for files with bad encoding Catch conversion error and log the path of the offending file. Bug: https://bugzilla.samba.org/show_bug.cgi?id=11323 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Tue Jun 9 21:00:02 CEST 2015 on sn-devel-104 (cherry picked from commit 0615b72a6b62d590831f1c24c5678dd29b9a2338) --- source3/smbd/trans2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 16498b3..bf6f406 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2376,6 +2376,10 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx, ppdata, end_data, &last_entry_off); + if (NT_STATUS_EQUAL(status, NT_STATUS_ILLEGAL_CHARACTER)) { + DEBUG(1,("Conversion error: illegal character: %s\n", + smb_fname_str_dbg(smb_fname))); + } TALLOC_FREE(fname); TALLOC_FREE(smb_fname); if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) { -- 2.1.0