mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-08 06:42:27 -04:00
fuse-overlayfs: force default_permissions,allow_other
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
b78f52f24b
commit
8ba49ca75a
32
main.c
32
main.c
@ -1716,6 +1716,7 @@ ovl_do_open (fuse_req_t req, fuse_ino_t parent, const char *name, int flags, mod
|
|||||||
if (!n)
|
if (!n)
|
||||||
{
|
{
|
||||||
struct ovl_node *p;
|
struct ovl_node *p;
|
||||||
|
const struct fuse_ctx *ctx = fuse_req_ctx (req);
|
||||||
|
|
||||||
if ((flags & O_CREAT) == 0)
|
if ((flags & O_CREAT) == 0)
|
||||||
{
|
{
|
||||||
@ -1746,6 +1747,13 @@ ovl_do_open (fuse_req_t req, fuse_ino_t parent, const char *name, int flags, mod
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (fchown (fd, ctx->uid, ctx->gid) < 0)
|
||||||
|
{
|
||||||
|
/* FIXME: create the file in the working dir. */
|
||||||
|
unlinkat (get_upper_layer (lo)->fd, path, 0);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
n = make_ovl_node (path, get_upper_layer (lo), name, 0, false);
|
n = make_ovl_node (path, get_upper_layer (lo), name, 0, false);
|
||||||
if (n == NULL)
|
if (n == NULL)
|
||||||
{
|
{
|
||||||
@ -2653,6 +2661,13 @@ fuse_opt_proc (void *data, const char *arg, int key, struct fuse_args *outargs)
|
|||||||
if (strcmp (arg, "--debug") == 0)
|
if (strcmp (arg, "--debug") == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
if (strcmp (arg, "allow_root") == 0)
|
||||||
|
return 1;
|
||||||
|
if (strcmp (arg, "default_permissions") == 0)
|
||||||
|
return 1;
|
||||||
|
if (strcmp (arg, "allow_other") == 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
/* Ignore unknown arguments. */
|
/* Ignore unknown arguments. */
|
||||||
if (key == -1)
|
if (key == -1)
|
||||||
return 0;
|
return 0;
|
||||||
@ -2660,12 +2675,25 @@ fuse_opt_proc (void *data, const char *arg, int key, struct fuse_args *outargs)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char **
|
||||||
|
get_new_args (int *argc, char **argv)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char **newargv = malloc (sizeof (char *) * (*argc + 2));
|
||||||
|
newargv[0] = argv[0];
|
||||||
|
newargv[1] = "-odefault_permissions,allow_other";
|
||||||
|
for (i = 1; i < *argc; i++)
|
||||||
|
newargv[i + 1] = argv[i];
|
||||||
|
(*argc)++;
|
||||||
|
return newargv;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct fuse_args args = FUSE_ARGS_INIT (argc, argv);
|
|
||||||
struct fuse_session *se;
|
struct fuse_session *se;
|
||||||
struct fuse_cmdline_opts opts;
|
struct fuse_cmdline_opts opts;
|
||||||
|
char **newargv = get_new_args (&argc, argv);
|
||||||
struct ovl_data lo = {.debug = 0,
|
struct ovl_data lo = {.debug = 0,
|
||||||
.uid_mappings = NULL,
|
.uid_mappings = NULL,
|
||||||
.gid_mappings = NULL,
|
.gid_mappings = NULL,
|
||||||
@ -2675,11 +2703,13 @@ main (int argc, char *argv[])
|
|||||||
.lowerdir = NULL,
|
.lowerdir = NULL,
|
||||||
};
|
};
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
struct fuse_args args = FUSE_ARGS_INIT (argc, newargv);
|
||||||
|
|
||||||
if (fuse_opt_parse (&args, &lo, ovl_opts, fuse_opt_proc) == -1)
|
if (fuse_opt_parse (&args, &lo, ovl_opts, fuse_opt_proc) == -1)
|
||||||
return 1;
|
return 1;
|
||||||
if (fuse_parse_cmdline (&args, &opts) != 0)
|
if (fuse_parse_cmdline (&args, &opts) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (opts.show_help)
|
if (opts.show_help)
|
||||||
{
|
{
|
||||||
printf ("usage: %s [options] <mountpoint>\n\n", argv[0]);
|
printf ("usage: %s [options] <mountpoint>\n\n", argv[0]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user