diff options
author | Atte Heikkilä <atteh.mailbox@gmail.com> | 2022-09-27 23:57:21 +0200 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2022-10-05 08:15:44 +0200 |
commit | dbab80e2071ad8c702e50dab43326608a127d27b (patch) | |
tree | a380652e4821b2f52af84ef4cb766768b18ae949 /fs/ksmbd/connection.h | |
parent | ksmbd: Fix user namespace mapping (diff) | |
download | linux-dbab80e2071ad8c702e50dab43326608a127d27b.tar.xz linux-dbab80e2071ad8c702e50dab43326608a127d27b.zip |
ksmbd: make utf-8 file name comparison work in __caseless_lookup()
Case-insensitive file name lookups with __caseless_lookup() use
strncasecmp() for file name comparison. strncasecmp() assumes an
ISO8859-1-compatible encoding, which is not the case here as UTF-8
is always used. As such, use of strncasecmp() here produces correct
results only if both strings use characters in the ASCII range only.
Fix this by using utf8_strncasecmp() if CONFIG_UNICODE is set. On
failure or if CONFIG_UNICODE is not set, fallback to strncasecmp().
Also, as we are adding an include for `linux/unicode.h', include it
in `fs/ksmbd/connection.h' as well since it should be explicit there.
Signed-off-by: Atte Heikkilä <atteh.mailbox@gmail.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/ksmbd/connection.h')
-rw-r--r-- | fs/ksmbd/connection.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ksmbd/connection.h b/fs/ksmbd/connection.h index 41d96f5cef06..3643354a3fa7 100644 --- a/fs/ksmbd/connection.h +++ b/fs/ksmbd/connection.h @@ -14,6 +14,7 @@ #include <net/request_sock.h> #include <linux/kthread.h> #include <linux/nls.h> +#include <linux/unicode.h> #include "smb_common.h" #include "ksmbd_work.h" |