From: Tom Talpey <tom@talpey.com>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: Hyunchul Lee <hyc.lee@gmail.com>,
linux-cifs@vger.kernel.org,
Ronnie Sahlberg <ronniesahlberg@gmail.com>,
Ralph Boehme <slow@samba.org>, Steve French <smfrench@gmail.com>
Subject: Re: [PATCH v4] ksmbd: use LOOKUP_BENEATH to prevent the out of share access
Date: Wed, 29 Sep 2021 11:01:28 -0400 [thread overview]
Message-ID: <3ea034dc-971f-4ea1-b65a-2ff06c8a1c81@talpey.com> (raw)
In-Reply-To: <CAKYAXd-aC9Zfc-tsN_VSABELFdhFfE7y28gX3_B-yoTzyqCviw@mail.gmail.com>
On 9/29/2021 8:40 AM, Namjae Jeon wrote:
> 2021-09-29 0:18 GMT+09:00, Tom Talpey <tom@talpey.com>:
>> On 9/24/2021 11:06 AM, Hyunchul Lee wrote:
>>> instead of removing '..' in a given path, call
>>> kern_path with LOOKUP_BENEATH flag to prevent
>>> the out of share access.
>>> <snip> <snip> <snip>
>>> -char *convert_to_nt_pathname(char *filename, char *sharepath)
>>> +char *convert_to_nt_pathname(char *filename)
>>> {
>>> char *ab_pathname;
>>> - int len, name_len;
>>>
>>> - name_len = strlen(filename);
>>> - ab_pathname = kmalloc(name_len, GFP_KERNEL);
>>> - if (!ab_pathname)
>>> - return NULL;
>>> -
>>> - ab_pathname[0] = '\\';
>>> - ab_pathname[1] = '\0';
>>> + if (strlen(filename) == 0) {
>>> + ab_pathname = kmalloc(2, GFP_KERNEL);
>>> + ab_pathname[0] = '\\';
>>> + ab_pathname[1] = '\0';
>>
>> This converts the empty filename to "\" - the volume root!?
> "\" is relative to the share. i.e. the share root.
Is that the right thing to do? Does the Samba server do this?
I believe the Windows server will fail such a path, but I can't
check right now.
Tom.
next prev parent reply other threads:[~2021-09-29 15:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-24 15:06 [PATCH v4] ksmbd: use LOOKUP_BENEATH to prevent the out of share access Hyunchul Lee
2021-09-24 17:20 ` Jeremy Allison
2021-09-25 0:08 ` Namjae Jeon
2021-09-25 0:21 ` Namjae Jeon
2021-09-25 0:43 ` Namjae Jeon
2021-09-25 17:45 ` Steve French
2021-09-28 15:18 ` Tom Talpey
2021-09-29 12:40 ` Namjae Jeon
2021-09-29 15:01 ` Tom Talpey [this message]
2021-09-29 23:52 ` Namjae Jeon
2021-09-30 0:01 ` Hyunchul Lee
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=3ea034dc-971f-4ea1-b65a-2ff06c8a1c81@talpey.com \
--to=tom@talpey.com \
--cc=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=ronniesahlberg@gmail.com \
--cc=slow@samba.org \
--cc=smfrench@gmail.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