summaryrefslogtreecommitdiff
path: root/source3/smbd/mangle_hash2.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-09-10 10:46:18 -0700
committerJeremy Allison <jra@samba.org>2013-09-11 16:38:43 -0700
commit776db7d38597a29536e4127837ffa3b4f4ce35ab (patch)
treed4cf5531b51a96b930fa8ee654e9bdfbb8029ca3 /source3/smbd/mangle_hash2.c
parent40db5637911fa6307187f2ea1f3bce951746fbec (diff)
downloadsamba-776db7d38597a29536e4127837ffa3b4f4ce35ab.tar.gz
samba-776db7d38597a29536e4127837ffa3b4f4ce35ab.tar.bz2
samba-776db7d38597a29536e4127837ffa3b4f4ce35ab.zip
Fix is_legal_name() to not emit character conversion error messages.
Using next_codepoint() does the same check, but without the conversion message. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'source3/smbd/mangle_hash2.c')
-rw-r--r--source3/smbd/mangle_hash2.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c
index 655c72745a..c2910f82c8 100644
--- a/source3/smbd/mangle_hash2.c
+++ b/source3/smbd/mangle_hash2.c
@@ -626,21 +626,17 @@ static bool is_legal_name(const char *name)
while (*name) {
if (((unsigned int)name[0]) > 128 && (name[1] != 0)) {
/* Possible start of mb character. */
- char mbc[2];
size_t size = 0;
+ (void)next_codepoint(name, &size);
/*
- * Note that if CH_UNIX is utf8 a string may be 3
- * bytes, but this is ok as mb utf8 characters don't
- * contain embedded ascii bytes. We are really checking
- * for mb UNIX asian characters like Japanese (SJIS) here.
- * JRA.
+ * Note that we're only looking for multibyte
+ * encoding here. No encoding with a length > 1
+ * contains invalid characters.
*/
- if (convert_string(CH_UNIX, CH_UTF16LE, name, 2, mbc, 2, &size)) {
- if (size == 2) {
- /* Was a good mb string. */
- name += 2;
- continue;
- }
+ if (size > 1) {
+ /* Was a mb string. */
+ name += size;
+ continue;
}
}