From de2fc6b14ce763258d0f8b1efef726e86b117d69 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Mon, 2 Nov 2020 11:33:38 +0100 Subject: [PATCH] main: always remap ids when specified if a mapping is specified, make sure it is always honored, also when using xattr permissions. Closes: https://github.com/containers/fuse-overlayfs/issues/253 Signed-off-by: Giuseppe Scrivano --- direct.c | 7 ------- fuse-overlayfs.h | 1 - main.c | 7 ++----- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/direct.c b/direct.c index a25c6b3..4aa5c55 100644 --- a/direct.c +++ b/direct.c @@ -213,12 +213,6 @@ direct_num_of_layers (const char *opaque, const char *path) return 1; } -static bool -direct_must_be_remapped (struct ovl_layer *l) -{ - return l->has_privileged_stat_override == 0 && l->has_stat_override == 0; -} - struct data_source direct_access_ds = { .num_of_layers = direct_num_of_layers, @@ -234,5 +228,4 @@ struct data_source direct_access_ds = .getxattr = direct_getxattr, .listxattr = direct_listxattr, .readlinkat = direct_readlinkat, - .must_be_remapped = direct_must_be_remapped, }; diff --git a/fuse-overlayfs.h b/fuse-overlayfs.h index b046ffb..edde0d9 100644 --- a/fuse-overlayfs.h +++ b/fuse-overlayfs.h @@ -134,7 +134,6 @@ struct data_source int (*listxattr)(struct ovl_layer *l, const char *path, char *buf, size_t size); int (*getxattr)(struct ovl_layer *l, const char *path, const char *name, char *buf, size_t size); ssize_t (*readlinkat)(struct ovl_layer *l, const char *path, char *buf, size_t bufsiz); - bool (*must_be_remapped)(struct ovl_layer *l); }; /* passthrough to the file system. */ diff --git a/main.c b/main.c index 2d2eff6..3eb6195 100644 --- a/main.c +++ b/main.c @@ -865,11 +865,8 @@ rpl_stat (fuse_req_t req, struct ovl_node *node, int fd, const char *path, struc if (ret < 0) return ret; - if (l->ds->must_be_remapped && l->ds->must_be_remapped (l)) - { - st->st_uid = find_mapping (st->st_uid, data, true, true); - st->st_gid = find_mapping (st->st_gid, data, true, false); - } + st->st_uid = find_mapping (st->st_uid, data, true, true); + st->st_gid = find_mapping (st->st_gid, data, true, false); st->st_ino = node->tmp_ino; st->st_dev = node->tmp_dev;