From: Jeremy Allison <jra@samba.org>
To: Steve French <smfrench@gmail.com>
Cc: Xiaoli Feng <xifeng@redhat.com>,
CIFS <linux-cifs@vger.kernel.org>,
samba-technical <samba-technical@lists.samba.org>
Subject: Re: [PATCH][SMB3] allow files to be created with backslash in file name
Date: Fri, 1 Jan 2021 12:06:50 -0800 [thread overview]
Message-ID: <20210101200650.GA42108@jeremy-acer> (raw)
In-Reply-To: <CAH2r5mt+5LQB59w0SPEp2Q-9ZZ2PV=XDMtGpy2pedhF8eKif0A@mail.gmail.com>
On Fri, Jan 01, 2021 at 09:12:14AM -0600, Steve French wrote:
>On Fri, Jan 1, 2021 at 12:00 AM Jeremy Allison <jra@samba.org> wrote:
>>
>> On Thu, Dec 31, 2020 at 09:35:23PM -0600, Steve French via samba-technical wrote:
>> >
>> >This patch may be even more important to Samba, as alternative ways of
>> >storing these files can create more problems. Interestingly Samba
>> >server reports local files with backslashes in them over the wire
>> >without remapping, even though these are illegal in SMB3 which would
>> >cause confusion on the client(s). Has anyone tried Windows mounting
>>
>> Samba should mangle names containing '\' to 8.3 names.
>
>You were right mangled names was enabled. But that is also
>interesting - it does expose a bug in smbclient.
>
>When you connect smbclient - doing a ls of a subdirectory with
>reserved characters worked, but doing an ls of the parent (root
>directory of share) caused smbclient to disconnect. See below
>
>smb: \> ls rsvd-chars
> rsvd-chars D 0 Fri Jan 1 08:55:49 2021
>
>556368460 blocks of size 1024. 296010296 blocks available
>smb: \> ls
> . D 0 Fri Jan 1 08:54:28 2021
> .. D 0 Thu Dec 31 21:42:28 2020
> topdir D 0 Mon Dec 14 16:01:25 2020
> lock1.txt A 200 Fri Dec 18 12:28:18 2020
> lock_rw_shared.dat A 200 Fri Dec 18 12:28:18 2020
> lock_rw_exclusive.dat A 200 Fri Dec 18 12:28:18 2020
> autounlock.txt A 200 Fri Dec 18 12:28:18 2020
>is_bad_finfo_name: bad finfo->name
>NT_STATUS_INVALID_NETWORK_RESPONSE listing \*
This is coming from the following code which is designed to
protect the client from a malicious server returning a '\' or '/'
character in an filename component.
/****************************************************************************
Check if a returned directory name is safe.
****************************************************************************/
static NTSTATUS is_bad_name(bool windows_names, const char *name)
{
const char *bad_name_p = NULL;
bad_name_p = strchr(name, '/');
if (bad_name_p != NULL) {
/*
* Windows and POSIX names can't have '/'.
* Server is attacking us.
*/
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
if (windows_names) {
bad_name_p = strchr(name, '\\');
if (bad_name_p != NULL) {
/*
* Windows names can't have '\\'.
* Server is attacking us.
*/
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
}
return NT_STATUS_OK;
}
prev parent reply other threads:[~2021-01-01 20:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-01 3:35 [PATCH][SMB3] allow files to be created with backslash in file name Steve French
2021-01-01 6:00 ` Jeremy Allison
[not found] ` <CAH2r5mt+5LQB59w0SPEp2Q-9ZZ2PV=XDMtGpy2pedhF8eKif0A@mail.gmail.com>
2021-01-01 19:58 ` Jeremy Allison
[not found] ` <CAH2r5mvt_cHDbT0xaeLNQn=5cQ0T2-wPgpMkYEGQNdtDZ3kP=A@mail.gmail.com>
2021-01-02 2:58 ` Jeremy Allison
2021-01-02 3:49 ` Steve French
2021-01-02 5:25 ` Jeremy Allison
2021-01-03 0:19 ` Steve French
2021-01-03 1:21 ` Jeremy Allison
2021-01-03 1:25 ` Jeremy Allison
2021-01-03 3:45 ` Steve French
2021-01-03 4:13 ` Jeremy Allison
2021-01-01 20:06 ` Jeremy Allison [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210101200650.GA42108@jeremy-acer \
--to=jra@samba.org \
--cc=linux-cifs@vger.kernel.org \
--cc=samba-technical@lists.samba.org \
--cc=smfrench@gmail.com \
--cc=xifeng@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).