summaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
authorChristof Schmitt via samba-technical <samba-technical@lists.samba.org>2018-06-28 11:50:13 -0700
committerRalph Boehme <slow@samba.org>2018-07-07 13:41:09 +0200
commit3430c9c3c27b4c5fe5d38797acc7aa6aeb03c2b4 (patch)
tree689b800499dac8b3d614b921999a19c046b15b12 /lib/util
parent4ad2a716fb0733e44f5bc000fb85e31aff83e682 (diff)
downloadsamba-3430c9c3c27b4c5fe5d38797acc7aa6aeb03c2b4.tar.gz
lib:charset: Fix error messages from charset conversion
When e.g. trying to access a filename through Samba that does not adhere to the encoding configured in 'unix charset', the log will show the encoding problem, followed by "strstr_m: src malloc fail". The problem is that strstr_m assumes that any failure from push/pull_ucs2_talloc is a memory allocation problem, which is not correct. Address this by removing the misleading messages and add a missing message in convert_string_talloc_handle. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/charset/convert_string.c1
-rw-r--r--lib/util/charset/util_str.c3
2 files changed, 1 insertions, 3 deletions
diff --git a/lib/util/charset/convert_string.c b/lib/util/charset/convert_string.c
index 50065f8e076..196302aacfd 100644
--- a/lib/util/charset/convert_string.c
+++ b/lib/util/charset/convert_string.c
@@ -375,6 +375,7 @@ bool convert_string_talloc_handle(TALLOC_CTX *ctx, struct smb_iconv_handle *ic,
}
ob = talloc_zero_array(ctx, char, destlen);
if (ob == NULL) {
+ DBG_ERR("Could not talloc destination buffer.\n");
errno = ENOMEM;
return false;
}
diff --git a/lib/util/charset/util_str.c b/lib/util/charset/util_str.c
index 6feed1742ac..3f5b247bd92 100644
--- a/lib/util/charset/util_str.c
+++ b/lib/util/charset/util_str.c
@@ -570,13 +570,11 @@ char *strstr_m(const char *src, const char *findstr)
frame = talloc_stackframe();
if (!push_ucs2_talloc(frame, &src_w, src, &converted_size)) {
- DBG_WARNING("src malloc fail\n");
TALLOC_FREE(frame);
return NULL;
}
if (!push_ucs2_talloc(frame, &find_w, findstr, &converted_size)) {
- DBG_WARNING("find malloc fail\n");
TALLOC_FREE(frame);
return NULL;
}
@@ -591,7 +589,6 @@ char *strstr_m(const char *src, const char *findstr)
*p = 0;
if (!pull_ucs2_talloc(frame, &s2, src_w, &converted_size)) {
TALLOC_FREE(frame);
- DEBUG(0,("strstr_m: dest malloc fail\n"));
return NULL;
}
retp = discard_const_p(char, (s+strlen(s2)));