• R/O
  • HTTP
  • SSH

BrynKernel-AOSP: 提交


Commit MetaInfo

修订版b5050c0486b7478078be5ea7a746e7c726025b61 (tree)
时间2020-11-19 02:26:32
作者Boris Protopopov <pboris@amaz...>
CommiterGreg Kroah-Hartman

Log Message

Convert trailing spaces and periods in path components

commit 57c176074057531b249cf522d90c22313fa74b0b upstream.

When converting trailing spaces and periods in paths, do so
for every component of the path, not just the last component.
If the conversion is not done for every path component, then
subsequent operations in directories with trailing spaces or
periods (e.g. create(), mkdir()) will fail with ENOENT. This
is because on the server, the directory will have a special
symbol in its name, and the client needs to provide the same.

Signed-off-by: Boris Protopopov <pboris@amazon.com>
Acked-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>



--- a/fs/cifs/cifs_unicode.c
+++ b/fs/cifs/cifs_unicode.c
@@ -493,7 +493,13 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
493493 else if (map_chars == SFM_MAP_UNI_RSVD) {
494494 bool end_of_string;
496- if (i == srclen - 1)
496+ /**
497+ * Remap spaces and periods found at the end of every
498+ * component of the path. The special cases of '.' and
499+ * '..' do not need to be dealt with explicitly because
500+ * they are addressed in namei.c:link_path_walk().
501+ **/
502+ if ((i == srclen - 1) || (source[i+1] == '\\'))
497503 end_of_string = true;
498504 else
499505 end_of_string = false;
Show on old repository browser