* [PATCH] Cygwin: path: Fix UNC path handling for SMB3 mounted to a drive.
@ 2022-02-03 8:40 Takashi Yano
2022-02-03 8:58 ` Corinna Vinschen
0 siblings, 1 reply; 5+ messages in thread
From: Takashi Yano @ 2022-02-03 8:40 UTC (permalink / raw)
To: cygwin-patches
- If an UNC path is mounted to a drive using SMB3.11, accessing to
the drive fails with error "Too many levels of symbolic links."
This patch fixes the issue.
---
winsup/cygwin/path.cc | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 87ac2404a..4ad4e0821 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3495,10 +3495,19 @@ restart:
/* If incoming path has no trailing backslash, but final path
has one, drop trailing backslash from final path so the
- below string comparison has a chance to succeed. */
+ below string comparison has a chance to succeed.
+ On the contrary, if incoming path has trailing backslash,
+ but final path does not have one, add trailing backslash
+ to the final path. */
if (upath.Buffer[(upath.Length - 1) / sizeof (WCHAR)] != L'\\'
- && fpbuf[ret - 1] == L'\\')
+ && fpbuf[ret - 1] == L'\\')
fpbuf[--ret] = L'\0';
+ if (upath.Buffer[(upath.Length - 1) / sizeof (WCHAR)] == L'\\'
+ && fpbuf[ret - 1] != L'\\' && ret < NT_MAX_PATH - 1)
+ {
+ fpbuf[ret++] = L'\\';
+ fpbuf[ret] = L'\0';
+ }
fpbuf[1] = L'?'; /* \\?\ --> \??\ */
RtlInitCountedUnicodeString (&fpath, fpbuf, ret * sizeof (WCHAR));
if (!RtlEqualUnicodeString (&upath, &fpath, !!ci_flag))
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Cygwin: path: Fix UNC path handling for SMB3 mounted to a drive.
2022-02-03 8:40 [PATCH] Cygwin: path: Fix UNC path handling for SMB3 mounted to a drive Takashi Yano
@ 2022-02-03 8:58 ` Corinna Vinschen
2022-02-03 9:28 ` Takashi Yano
0 siblings, 1 reply; 5+ messages in thread
From: Corinna Vinschen @ 2022-02-03 8:58 UTC (permalink / raw)
To: cygwin-patches
On Feb 3 17:40, Takashi Yano wrote:
> - If an UNC path is mounted to a drive using SMB3.11, accessing to
> the drive fails with error "Too many levels of symbolic links."
> This patch fixes the issue.
LGTM, please push.
I'm curious. I'm using Samba as well and never saw this problem.
Can you describe how to reproduce?
Thanks,
Corinna
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Cygwin: path: Fix UNC path handling for SMB3 mounted to a drive.
2022-02-03 8:58 ` Corinna Vinschen
@ 2022-02-03 9:28 ` Takashi Yano
2022-02-03 10:59 ` Takashi Yano
0 siblings, 1 reply; 5+ messages in thread
From: Takashi Yano @ 2022-02-03 9:28 UTC (permalink / raw)
To: cygwin-patches
On Thu, 3 Feb 2022 09:58:19 +0100
Corinna Vinschen wrote:
> On Feb 3 17:40, Takashi Yano wrote:
> > - If an UNC path is mounted to a drive using SMB3.11, accessing to
> > the drive fails with error "Too many levels of symbolic links."
> > This patch fixes the issue.
>
> LGTM, please push.
Thanks for reviewing.
> I'm curious. I'm using Samba as well and never saw this problem.
> Can you describe how to reproduce?
I used samba under debian stretch last December, and
confirmed current code worked without the problem.
Recently, I have upgraded the server OS from stretch
to bullseye, and noticed this problem.
Perhaps, samba version and its protocol version may be
related.
My samba version is: Version 4.13.13-Debian
This also happens with shared folder under Windows 10
in my environment.
Win10 version is:
Microsoft Windows [Version 10.0.19044.1466]
The reproducible steps are as follows.
$ net use z: '\\server\sharedname'
The command completed successfully.
$ cd /cygdrive/z
/cygdrive/z: Too many levels of symbolic links.
$
--
Takashi Yano <takashi.yano@nifty.ne.jp>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Cygwin: path: Fix UNC path handling for SMB3 mounted to a drive.
2022-02-03 9:28 ` Takashi Yano
@ 2022-02-03 10:59 ` Takashi Yano
2022-02-03 11:36 ` Corinna Vinschen
0 siblings, 1 reply; 5+ messages in thread
From: Takashi Yano @ 2022-02-03 10:59 UTC (permalink / raw)
To: cygwin-patches
On Thu, 3 Feb 2022 18:28:32 +0900
Takashi Yano wrote:
> On Thu, 3 Feb 2022 09:58:19 +0100
> Corinna Vinschen wrote:
> > On Feb 3 17:40, Takashi Yano wrote:
> > > - If an UNC path is mounted to a drive using SMB3.11, accessing to
> > > the drive fails with error "Too many levels of symbolic links."
> > > This patch fixes the issue.
> > I'm curious. I'm using Samba as well and never saw this problem.
> > Can you describe how to reproduce?
>
> I used samba under debian stretch last December, and
> confirmed current code worked without the problem.
>
> Recently, I have upgraded the server OS from stretch
> to bullseye, and noticed this problem.
>
> Perhaps, samba version and its protocol version may be
> related.
>
> My samba version is: Version 4.13.13-Debian
I have just reconfirmed that this problem does not occur
if samba under debian stretch is used even with SMB3.11.
Samba version of stretch is: Version 4.5.16-Debian.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Cygwin: path: Fix UNC path handling for SMB3 mounted to a drive.
2022-02-03 10:59 ` Takashi Yano
@ 2022-02-03 11:36 ` Corinna Vinschen
0 siblings, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2022-02-03 11:36 UTC (permalink / raw)
To: cygwin-patches
On Feb 3 19:59, Takashi Yano wrote:
> On Thu, 3 Feb 2022 18:28:32 +0900
> Takashi Yano wrote:
> > On Thu, 3 Feb 2022 09:58:19 +0100
> > Corinna Vinschen wrote:
> > > On Feb 3 17:40, Takashi Yano wrote:
> > > > - If an UNC path is mounted to a drive using SMB3.11, accessing to
> > > > the drive fails with error "Too many levels of symbolic links."
> > > > This patch fixes the issue.
> > > I'm curious. I'm using Samba as well and never saw this problem.
> > > Can you describe how to reproduce?
> >
> > I used samba under debian stretch last December, and
> > confirmed current code worked without the problem.
> >
> > Recently, I have upgraded the server OS from stretch
> > to bullseye, and noticed this problem.
> >
> > Perhaps, samba version and its protocol version may be
> > related.
> >
> > My samba version is: Version 4.13.13-Debian
>
> I have just reconfirmed that this problem does not occur
> if samba under debian stretch is used even with SMB3.11.
>
> Samba version of stretch is: Version 4.5.16-Debian.
Indeed, I can reproduce it. I'm using Fedora 35 with Samba 4.15.3,
so there's probably a behavioural change. The reason I didn't
notice it is that I never use drive letters but always UNC paths.
Thanks!
Corinna
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-03 11:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 8:40 [PATCH] Cygwin: path: Fix UNC path handling for SMB3 mounted to a drive Takashi Yano
2022-02-03 8:58 ` Corinna Vinschen
2022-02-03 9:28 ` Takashi Yano
2022-02-03 10:59 ` Takashi Yano
2022-02-03 11:36 ` Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).