[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/5] 9pfs: local: resolve special directories in
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 2/5] 9pfs: local: resolve special directories in paths |
Date: |
Thu, 18 May 2017 09:19:20 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 |
On 05/18/2017 03:41 AM, Greg Kurz wrote:
> [...]
>>>> + } else if (!strcmp(name, "..")) {
>>>> + if (!strcmp(dir_path->data, ".")) {
>>>> + /* ".." relative to the root is "." */
>>>> + v9fs_path_sprintf(target, ".");
>>>> + } else {
>>>> + char *tmp = g_path_get_dirname(dir_path->data);
>>>> + /* ".." relative to "foo/bar" is equivalent to "foo" */
>>>>
>>>
>>> True only if bar is not a symlink to some other directory. What
>>> guarantees do you have that you are not going to be inadvertently
>>> skipping a traversal through symlinks and thereby picking the wrong
>>> location for '..'?
>>>
>>
>> My understanding is that symlinks are supposed to be resolved by the client,
>> and we shouldn't follow them in the server.
>>
>
> Eric,
>
> Do you have any comment further comment or can I go on with this change ?
I'd update the comment to mention that the equivalency between
"foo/bar/.." and "foo" is _because_ the client has already resolved
symlinks, and then I think you're good to go.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH 3/5] 9pfs: local: simplify file opening, Greg Kurz, 2017/05/05
[Qemu-devel] [PATCH 4/5] 9pfs: local: metadata file for the VirtFS root, Greg Kurz, 2017/05/05
[Qemu-devel] [PATCH 5/5] 9pfs: local: forbid client access to metadata, Greg Kurz, 2017/05/05