From 4953a60b7bdadf2b5a502be8ee3c2e00ddba0570 Mon Sep 17 00:00:00 2001 From: jpandre Date: Mon, 26 Jan 2009 09:00:36 +0000 Subject: [PATCH] Fixed access to user extended attributes when Posix ACLs are enabled --- src/ntfs-3g.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index a0e58c1c..8447d4e3 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -2258,7 +2258,7 @@ static int ntfs_fuse_getxattr(const char *path, const char *name, /* trusted only readable by root */ if ((namespace == XATTRNS_TRUSTED) && security.uid) - return -EACCES; + return -EPERM; #endif ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); if (!ni) @@ -2410,10 +2410,11 @@ static int ntfs_fuse_setxattr(const char *path, const char *name, if (!ni) return -errno; #if POSIXACLS - if (((namespace == XATTRNS_SECURITY) - || (namespace == XATTRNS_TRUSTED)) - && !ntfs_allowed_as_owner(&security,path,ni)) { - res = -errno; + if (security.uid + && ((namespace == XATTRNS_SECURITY) + || (namespace == XATTRNS_TRUSTED) + || !ntfs_allowed_as_owner(&security,path,ni))) { + res = -EPERM; ntfs_inode_close(ni); return (res); } @@ -2579,10 +2580,11 @@ static int ntfs_fuse_removexattr(const char *path, const char *name) if (!ni) return -errno; #if POSIXACLS - if (((namespace == XATTRNS_SECURITY) - || (namespace == XATTRNS_TRUSTED)) - && !ntfs_allowed_as_owner(&security,path,ni)) { - res = -errno; + if (security.uid + && ((namespace == XATTRNS_SECURITY) + || (namespace == XATTRNS_TRUSTED) + || !ntfs_allowed_as_owner(&security,path,ni))) { + res = -EPERM; ntfs_inode_close(ni); return (res); }