diff options
Diffstat (limited to 'fs/reiserfs/xattr_security.c')
| -rw-r--r-- | fs/reiserfs/xattr_security.c | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c index e044d5117117..5e90a95ad60b 100644 --- a/fs/reiserfs/xattr_security.c +++ b/fs/reiserfs/xattr_security.c | |||
| @@ -9,57 +9,55 @@ | |||
| 9 | #define XATTR_SECURITY_PREFIX "security." | 9 | #define XATTR_SECURITY_PREFIX "security." |
| 10 | 10 | ||
| 11 | static int | 11 | static int |
| 12 | security_get (struct inode *inode, const char *name, void *buffer, size_t size) | 12 | security_get(struct inode *inode, const char *name, void *buffer, size_t size) |
| 13 | { | 13 | { |
| 14 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) | 14 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) |
| 15 | return -EINVAL; | 15 | return -EINVAL; |
| 16 | 16 | ||
| 17 | if (is_reiserfs_priv_object(inode)) | 17 | if (is_reiserfs_priv_object(inode)) |
| 18 | return -EPERM; | 18 | return -EPERM; |
| 19 | 19 | ||
| 20 | return reiserfs_xattr_get (inode, name, buffer, size); | 20 | return reiserfs_xattr_get(inode, name, buffer, size); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | static int | 23 | static int |
| 24 | security_set (struct inode *inode, const char *name, const void *buffer, | 24 | security_set(struct inode *inode, const char *name, const void *buffer, |
| 25 | size_t size, int flags) | 25 | size_t size, int flags) |
| 26 | { | 26 | { |
| 27 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) | 27 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) |
| 28 | return -EINVAL; | 28 | return -EINVAL; |
| 29 | 29 | ||
| 30 | if (is_reiserfs_priv_object(inode)) | 30 | if (is_reiserfs_priv_object(inode)) |
| 31 | return -EPERM; | 31 | return -EPERM; |
| 32 | 32 | ||
| 33 | return reiserfs_xattr_set (inode, name, buffer, size, flags); | 33 | return reiserfs_xattr_set(inode, name, buffer, size, flags); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | static int | 36 | static int security_del(struct inode *inode, const char *name) |
| 37 | security_del (struct inode *inode, const char *name) | ||
| 38 | { | 37 | { |
| 39 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) | 38 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) |
| 40 | return -EINVAL; | 39 | return -EINVAL; |
| 41 | 40 | ||
| 42 | if (is_reiserfs_priv_object(inode)) | 41 | if (is_reiserfs_priv_object(inode)) |
| 43 | return -EPERM; | 42 | return -EPERM; |
| 44 | 43 | ||
| 45 | return 0; | 44 | return 0; |
| 46 | } | 45 | } |
| 47 | 46 | ||
| 48 | static int | 47 | static int |
| 49 | security_list (struct inode *inode, const char *name, int namelen, char *out) | 48 | security_list(struct inode *inode, const char *name, int namelen, char *out) |
| 50 | { | 49 | { |
| 51 | int len = namelen; | 50 | int len = namelen; |
| 52 | 51 | ||
| 53 | if (is_reiserfs_priv_object(inode)) | 52 | if (is_reiserfs_priv_object(inode)) |
| 54 | return 0; | 53 | return 0; |
| 55 | 54 | ||
| 56 | if (out) | 55 | if (out) |
| 57 | memcpy (out, name, len); | 56 | memcpy(out, name, len); |
| 58 | 57 | ||
| 59 | return len; | 58 | return len; |
| 60 | } | 59 | } |
| 61 | 60 | ||
| 62 | |||
| 63 | struct reiserfs_xattr_handler security_handler = { | 61 | struct reiserfs_xattr_handler security_handler = { |
| 64 | .prefix = XATTR_SECURITY_PREFIX, | 62 | .prefix = XATTR_SECURITY_PREFIX, |
| 65 | .get = security_get, | 63 | .get = security_get, |
