Re: [PATCH v3 07/12] LXC: fuse: Change files owner to the root user of container

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 23, 2013 at 12:06:51PM +0800, Gao feng wrote:
> Otherwise we will fail to mount the meminfo file.
> This patch also allows any users to access the
> fuse mount point.
> 
> Signed-off-by: Gao feng <gaofeng@xxxxxxxxxxxxxx>
> ---
>  src/lxc/lxc_fuse.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c
> index b6df99c..ddb737c 100644
> --- a/src/lxc/lxc_fuse.c
> +++ b/src/lxc/lxc_fuse.c
> @@ -49,6 +49,9 @@ static int lxcProcGetattr(const char *path, struct stat *stbuf)
>      char *mempath = NULL;
>      struct stat sb;
>  
> +    struct fuse_context *context = fuse_get_context();
> +    virDomainDefPtr def = (virDomainDefPtr)context->private_data;
> +
>      memset(stbuf, 0, sizeof(struct stat));
>      if (virAsprintf(&mempath, "/proc/%s", path) < 0) {
>          virReportOOMError();
> @@ -66,6 +69,8 @@ static int lxcProcGetattr(const char *path, struct stat *stbuf)
>              goto cleanup;
>          }
>  
> +        stbuf->st_uid = def->idmap.uidmap ? def->idmap.uidmap[0].target : 0;
> +        stbuf->st_gid = def->idmap.gidmap ? def->idmap.gidmap[0].target : 0;
>          stbuf->st_mode = sb.st_mode;
>          stbuf->st_nlink = 1;
>          stbuf->st_blksize = sb.st_blksize;
> @@ -307,6 +312,7 @@ int lxcSetupFuse(virLXCFusePtr *f, virDomainDefPtr def)
>      /* process name is libvirt_lxc */
>      if (fuse_opt_add_arg(&args, "libvirt_lxc") == -1 ||
>          fuse_opt_add_arg(&args, "-odirect_io") == -1 ||
> +        fuse_opt_add_arg(&args, "-oallow_other") == -1 ||
>          fuse_opt_add_arg(&args, "-ofsname=libvirt") == -1)
>          goto cleanup1;

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]