Blame view
fs/reiserfs/xattr_trusted.c
1.15 KB
b24413180 License cleanup: ... |
1 |
// SPDX-License-Identifier: GPL-2.0 |
f466c6fdb move private bits... |
2 |
#include "reiserfs.h" |
16f7e0fe2 [PATCH] capable/c... |
3 |
#include <linux/capability.h> |
1da177e4c Linux-2.6.12-rc2 |
4 5 6 7 |
#include <linux/errno.h> #include <linux/fs.h> #include <linux/pagemap.h> #include <linux/xattr.h> |
c45ac8887 take private bits... |
8 |
#include "xattr.h" |
17093991a fs/reiserfs: use ... |
9 |
#include <linux/uaccess.h> |
1da177e4c Linux-2.6.12-rc2 |
10 |
|
1da177e4c Linux-2.6.12-rc2 |
11 |
static int |
b296821a7 xattr_handler: pa... |
12 13 |
trusted_get(const struct xattr_handler *handler, struct dentry *unused, struct inode *inode, const char *name, void *buffer, size_t size) |
1da177e4c Linux-2.6.12-rc2 |
14 |
{ |
b296821a7 xattr_handler: pa... |
15 |
if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode)) |
bd4c625c0 reiserfs: run scr... |
16 |
return -EPERM; |
1da177e4c Linux-2.6.12-rc2 |
17 |
|
b296821a7 xattr_handler: pa... |
18 |
return reiserfs_xattr_get(inode, xattr_full_name(handler, name), |
79a628d14 reiserfs: switch ... |
19 |
buffer, size); |
1da177e4c Linux-2.6.12-rc2 |
20 21 22 |
} static int |
593012268 switch xattr_hand... |
23 24 25 |
trusted_set(const struct xattr_handler *handler, struct dentry *unused, struct inode *inode, const char *name, const void *buffer, size_t size, int flags) |
1da177e4c Linux-2.6.12-rc2 |
26 |
{ |
593012268 switch xattr_hand... |
27 |
if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode)) |
bd4c625c0 reiserfs: run scr... |
28 |
return -EPERM; |
1da177e4c Linux-2.6.12-rc2 |
29 |
|
593012268 switch xattr_hand... |
30 |
return reiserfs_xattr_set(inode, |
79a628d14 reiserfs: switch ... |
31 32 |
xattr_full_name(handler, name), buffer, size, flags); |
1da177e4c Linux-2.6.12-rc2 |
33 |
} |
764a5c6b1 xattr handlers: S... |
34 |
static bool trusted_list(struct dentry *dentry) |
1da177e4c Linux-2.6.12-rc2 |
35 |
{ |
764a5c6b1 xattr handlers: S... |
36 |
return capable(CAP_SYS_ADMIN) && !IS_PRIVATE(d_inode(dentry)); |
1da177e4c Linux-2.6.12-rc2 |
37 |
} |
94d09a98c reiserfs: constif... |
38 |
const struct xattr_handler reiserfs_xattr_trusted_handler = { |
1da177e4c Linux-2.6.12-rc2 |
39 40 41 |
.prefix = XATTR_TRUSTED_PREFIX, .get = trusted_get, .set = trusted_set, |
1da177e4c Linux-2.6.12-rc2 |
42 43 |
.list = trusted_list, }; |