Skip to content

Commit

Permalink
Merge pull request #329 from giuseppe/honor-user-overlay
Browse files Browse the repository at this point in the history
main: honor user.overlay. xattrs
  • Loading branch information
rhatdan authored Nov 22, 2021
2 parents 85412df + 5f43fb1 commit bafeebf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ open_by_handle_at (int mount_fd, struct file_handle *handle, int flags)
#define ORIGIN_XATTR "user.fuseoverlayfs.origin"
#define OPAQUE_XATTR "user.fuseoverlayfs.opaque"
#define XATTR_CONTAINERS_PREFIX "user.containers."
#define UNPRIVILEGED_XATTR_PREFIX "user.overlay."
#define UNPRIVILEGED_OPAQUE_XATTR "user.overlay.opaque"
#define PRIVILEGED_XATTR_PREFIX "trusted.overlay."
#define PRIVILEGED_OPAQUE_XATTR "trusted.overlay.opaque"
#define PRIVILEGED_ORIGIN_XATTR "trusted.overlay.origin"
Expand Down Expand Up @@ -495,8 +497,9 @@ has_prefix (const char *str, const char *pref)
static bool
can_access_xattr (const char *name)
{
return !has_prefix (name, XATTR_PREFIX) \
&& !has_prefix (name, PRIVILEGED_XATTR_PREFIX);
return !has_prefix (name, XATTR_PREFIX)
&& !has_prefix (name, PRIVILEGED_XATTR_PREFIX)
&& !has_prefix (name, UNPRIVILEGED_XATTR_PREFIX);
}

static ssize_t
Expand Down Expand Up @@ -683,6 +686,8 @@ is_directory_opaque (struct ovl_layer *l, const char *path)
ssize_t s;

s = l->ds->getxattr (l, path, PRIVILEGED_OPAQUE_XATTR, b, sizeof (b));
if (s < 0 && errno == ENODATA)
s = l->ds->getxattr (l, path, UNPRIVILEGED_OPAQUE_XATTR, b, sizeof (b));
if (s < 0 && errno == ENODATA)
s = l->ds->getxattr (l, path, OPAQUE_XATTR, b, sizeof (b));

Expand Down

0 comments on commit bafeebf

Please sign in to comment.