[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 06/28] 9pfs: local: open/opendir: don't follo
From: |
Greg Kurz |
Subject: |
Re: [Qemu-devel] [PATCH v2 06/28] 9pfs: local: open/opendir: don't follow symlinks |
Date: |
Mon, 27 Feb 2017 15:35:19 +0100 |
On Mon, 27 Feb 2017 12:49:01 +0000
Stefan Hajnoczi <address@hidden> wrote:
> On Sun, Feb 26, 2017 at 11:42:18PM +0100, Greg Kurz wrote:
> > @@ -48,6 +49,24 @@ typedef struct {
> > int mountfd;
> > } LocalData;
> >
> > +int local_open_nofollow(FsContext *fs_ctx, const char *path, int flags,
> > + mode_t mode)
> > +{
> > + LocalData *data = fs_ctx->private;
> > +
> > + /* All paths are relative to the path data->mountfd points to */
> > + while (*path == '/') {
> > + path++;
> > + }
> > +
> > + return openat_nofollow(data->mountfd, path, flags, mode);
>
> What about all the other openat_nofollow() users? They don't explicitly
$ git grep openat_nofollow
hw/9pfs/9p-local.c: return openat_nofollow(data->mountfd, path, flags, mode);
hw/9pfs/9p-util.c:int openat_nofollow(int dirfd, const char *path, int flags,
mode_t mode)
hw/9pfs/9p-util.h:int openat_nofollow(int dirfd, const char *path, int flags,
mode_t mode);
> strip leading slashes. Perhaps this should be part of a renamed
> relative_openat_nofollow() function.
>
> > +}
> > +
> > +int local_opendir_nofollow(FsContext *fs_ctx, const char *path)
> > +{
> > + return local_open_nofollow(fs_ctx, path, O_DIRECTORY | O_RDONLY, 0);
>
> Why not strip slashes here?
Because this one calls the other one above.
pgpzy32_X4eKx.pgp
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v2 00/28] Series short description, Greg Kurz, 2017/02/26
- [Qemu-devel] [PATCH v2 01/28] 9pfs: local: move xattr security ops to 9p-xattr.c, Greg Kurz, 2017/02/26
- [Qemu-devel] [PATCH v2 02/28] 9pfs: remove side-effects in local_init(), Greg Kurz, 2017/02/26
- [Qemu-devel] [PATCH v2 03/28] 9pfs: remove side-effects in local_open() and local_opendir(), Greg Kurz, 2017/02/26
- [Qemu-devel] [PATCH v2 04/28] 9pfs: introduce openat_nofollow() helper, Greg Kurz, 2017/02/26
- [Qemu-devel] [PATCH v2 05/28] 9pfs: local: keep a file descriptor on the shared folder, Greg Kurz, 2017/02/26
- [Qemu-devel] [PATCH v2 06/28] 9pfs: local: open/opendir: don't follow symlinks, Greg Kurz, 2017/02/26
- [Qemu-devel] [PATCH v2 07/28] 9pfs: local: lgetxattr: don't follow symlinks, Greg Kurz, 2017/02/26
- [Qemu-devel] [PATCH v2 08/28] 9pfs: local: llistxattr: don't follow symlinks, Greg Kurz, 2017/02/26
- [Qemu-devel] [PATCH v2 09/28] 9pfs: local: lsetxattr: don't follow symlinks, Greg Kurz, 2017/02/26
- [Qemu-devel] [PATCH v2 10/28] 9pfs: local: lremovexattr: don't follow symlinks, Greg Kurz, 2017/02/26
- [Qemu-devel] [PATCH v2 11/28] 9pfs: local: unlinkat: don't follow symlinks, Greg Kurz, 2017/02/26