diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c index 0c9af18c..561a2f29 100644 --- a/src/lowntfs-3g.c +++ b/src/lowntfs-3g.c @@ -2743,8 +2743,11 @@ static void ntfs_fuse_listxattr(fuse_req_t req, fuse_ino_t ino, size_t size) ret = -errno; goto out; } + /* Return with no result for symlinks, fifo, etc. */ + if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT)) + goto exit; + /* otherwise file must be readable */ #if !KERNELPERMS | (POSIXACLS & !KERNELACLS) - /* file must be readable */ if (!ntfs_allowed_access(&security,ni,S_IREAD)) { ret = -EACCES; goto exit; @@ -2890,8 +2893,13 @@ static void ntfs_fuse_getxattr(fuse_req_t req, fuse_ino_t ino, const char *name, res = -errno; goto out; } + /* Return with no result for symlinks, fifo, etc. */ + if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT)) { + res = -ENODATA; + goto exit; + } + /* otherwise file must be readable */ #if !KERNELPERMS | (POSIXACLS & !KERNELACLS) - /* file must be readable */ if (!ntfs_allowed_access(&security, ni, S_IREAD)) { res = -errno; goto exit; @@ -3074,12 +3082,24 @@ static void ntfs_fuse_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name, } break; default : + /* User xattr not allowed for symlinks, fifo, etc. */ + if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT)) { + res = -EPERM; + goto exit; + } if (!ntfs_allowed_access(&security,ni,S_IWRITE)) { res = -EACCES; goto exit; } break; } +#else + /* User xattr not allowed for symlinks, fifo, etc. */ + if ((namespace == XATTRNS_USER) + && (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT))) { + res = -EPERM; + goto exit; + } #endif lename_len = fix_xattr_prefix(name, namespace, &lename); if ((lename_len == -1) @@ -3296,12 +3316,24 @@ static void ntfs_fuse_removexattr(fuse_req_t req, fuse_ino_t ino, const char *na } break; default : + /* User xattr not allowed for symlinks, fifo, etc. */ + if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT)) { + res = -EPERM; + goto exit; + } if (!ntfs_allowed_access(&security,ni,S_IWRITE)) { res = -EACCES; goto exit; } break; } +#else + /* User xattr not allowed for symlinks, fifo, etc. */ + if ((namespace == XATTRNS_USER) + && (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT))) { + res = -EPERM; + goto exit; + } #endif lename_len = fix_xattr_prefix(name, namespace, &lename); if (lename_len == -1) { diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index d6974a96..b2c2bb36 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -2604,8 +2604,11 @@ static int ntfs_fuse_listxattr(const char *path, char *list, size_t size) ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); if (!ni) return -errno; + /* Return with no result for symlinks, fifo, etc. */ + if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT)) + goto exit; + /* otherwise file must be readable */ #if !KERNELPERMS | (POSIXACLS & !KERNELACLS) - /* file must be readable */ if (!ntfs_allowed_access(&security,ni,S_IREAD)) { ret = -EACCES; goto exit; @@ -2803,8 +2806,13 @@ static int ntfs_fuse_getxattr(const char *path, const char *name, ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); if (!ni) return -errno; + /* Return with no result for symlinks, fifo, etc. */ + if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT)) { + res = -ENODATA; + goto exit; + } + /* otherwise file must be readable */ #if !KERNELPERMS | (POSIXACLS & !KERNELACLS) - /* file must be readable */ if (!ntfs_allowed_access(&security, ni, S_IREAD)) { res = -errno; goto exit; @@ -2966,12 +2974,24 @@ static int ntfs_fuse_setxattr(const char *path, const char *name, } break; default : + /* User xattr not allowed for symlinks, fifo, etc. */ + if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT)) { + res = -EPERM; + goto exit; + } if (!ntfs_allowed_access(&security,ni,S_IWRITE)) { res = -EACCES; goto exit; } break; } +#else + /* User xattr not allowed for symlinks, fifo, etc. */ + if ((namespace == XATTRNS_USER) + && (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT))) { + res = -EPERM; + goto exit; + } #endif lename_len = fix_xattr_prefix(name, namespace, &lename); if ((lename_len == -1) @@ -3180,12 +3200,24 @@ static int ntfs_fuse_removexattr(const char *path, const char *name) } break; default : + /* User xattr not allowed for symlinks, fifo, etc. */ + if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT)) { + res = -EPERM; + goto exit; + } if (!ntfs_allowed_access(&security,ni,S_IWRITE)) { res = -EACCES; goto exit; } break; } +#else + /* User xattr not allowed for symlinks, fifo, etc. */ + if ((namespace == XATTRNS_USER) + && (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT))) { + res = -EPERM; + goto exit; + } #endif lename_len = fix_xattr_prefix(name, namespace, &lename); if (lename_len == -1) {