Ignored permissions when listing xattrs for special files
Special files (FIFOs, SOCKETs, etc.) are not allowed to have user extended attributes. When listing their extended attributes, return none without checking whether the calling process is allowed to access these files.edge.strict_endians
parent
3103a6c383
commit
f61b34ee2c
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue