All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cifs: alloc_path_with_tree_prefix: do not append sep. if the path is empty
@ 2021-12-29 21:32 Eugene Korenevsky
  2021-12-29 21:40 ` bug: DFS namespaces with non-ASCII symbols cannot be mounted Eugene Korenevsky
  0 siblings, 1 reply; 3+ messages in thread
From: Eugene Korenevsky @ 2021-12-29 21:32 UTC (permalink / raw)
  To: linux-cifs; +Cc: Steve French

alloc_path_with_tree_prefix() concatenates tree prefix and the path.
Windows CIFS client does not append separator after the tree prefix if
the path is empty. Let's do the same.

This fixes mounting DFS namespaces with names containing non-ASCII symbols.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215440
Signed-off-by: Eugene Korenevsky <ekorenevsky@astralinux.ru>
---
 fs/cifs/smb2pdu.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 8b3670388cda..88ea0163257c 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2527,8 +2527,13 @@ alloc_path_with_tree_prefix(__le16 **out_path, int *out_size, int *out_len,
 
 	cp = load_nls_default();
 	cifs_strtoUTF16(*out_path, treename, treename_len, cp);
-	UniStrcat(*out_path, sep);
-	UniStrcat(*out_path, path);
+
+	/* Do not append the separator if the path is empty */
+	if (path[0] != cpu_to_le16(0x0000)) {
+		UniStrcat(*out_path, sep);
+		UniStrcat(*out_path, path);
+	}
+
 	unload_nls(cp);
 
 	return 0;
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug: DFS namespaces with non-ASCII symbols cannot be mounted
  2021-12-29 21:32 [PATCH] cifs: alloc_path_with_tree_prefix: do not append sep. if the path is empty Eugene Korenevsky
@ 2021-12-29 21:40 ` Eugene Korenevsky
  2022-01-12 17:19   ` Eugene Korenevsky
  0 siblings, 1 reply; 3+ messages in thread
From: Eugene Korenevsky @ 2021-12-29 21:40 UTC (permalink / raw)
  To: linux-cifs

Please pay attention to the bug:
https://bugzilla.kernel.org/show_bug.cgi?id=215440

The patch in previous message is a solution.

But the problem is more
global: after tis patch, Windows SMB server returns undocumented response
STATUS_OBJECT_NAME_INVALID to SMB2 CREATE request for DFS referrals at
non-ASCII DFS namespace. And 'ls' for mounted  non-ASCII DFS namespace
fails.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bug: DFS namespaces with non-ASCII symbols cannot be mounted
  2021-12-29 21:40 ` bug: DFS namespaces with non-ASCII symbols cannot be mounted Eugene Korenevsky
@ 2022-01-12 17:19   ` Eugene Korenevsky
  0 siblings, 0 replies; 3+ messages in thread
From: Eugene Korenevsky @ 2022-01-12 17:19 UTC (permalink / raw)
  To: linux-cifs

On Thu, Dec 30, 2021 at 12:40:31AM +0300, Eugene Korenevsky wrote:


> Please pay attention to the bug:
> https://bugzilla.kernel.org/show_bug.cgi?id=215440

SMB 1.0 ('vers=1.0' mount option) is not affected by this bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-12 17:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-29 21:32 [PATCH] cifs: alloc_path_with_tree_prefix: do not append sep. if the path is empty Eugene Korenevsky
2021-12-29 21:40 ` bug: DFS namespaces with non-ASCII symbols cannot be mounted Eugene Korenevsky
2022-01-12 17:19   ` Eugene Korenevsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.