diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /fs/reiserfs/xattr_security.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'fs/reiserfs/xattr_security.c')
-rw-r--r-- | fs/reiserfs/xattr_security.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c new file mode 100644 index 000000000000..e044d5117117 --- /dev/null +++ b/fs/reiserfs/xattr_security.c | |||
@@ -0,0 +1,69 @@ | |||
1 | #include <linux/reiserfs_fs.h> | ||
2 | #include <linux/errno.h> | ||
3 | #include <linux/fs.h> | ||
4 | #include <linux/pagemap.h> | ||
5 | #include <linux/xattr.h> | ||
6 | #include <linux/reiserfs_xattr.h> | ||
7 | #include <asm/uaccess.h> | ||
8 | |||
9 | #define XATTR_SECURITY_PREFIX "security." | ||
10 | |||
11 | static int | ||
12 | security_get (struct inode *inode, const char *name, void *buffer, size_t size) | ||
13 | { | ||
14 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) | ||
15 | return -EINVAL; | ||
16 | |||
17 | if (is_reiserfs_priv_object(inode)) | ||
18 | return -EPERM; | ||
19 | |||
20 | return reiserfs_xattr_get (inode, name, buffer, size); | ||
21 | } | ||
22 | |||
23 | static int | ||
24 | security_set (struct inode *inode, const char *name, const void *buffer, | ||
25 | size_t size, int flags) | ||
26 | { | ||
27 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) | ||
28 | return -EINVAL; | ||
29 | |||
30 | if (is_reiserfs_priv_object(inode)) | ||
31 | return -EPERM; | ||
32 | |||
33 | return reiserfs_xattr_set (inode, name, buffer, size, flags); | ||
34 | } | ||
35 | |||
36 | static int | ||
37 | security_del (struct inode *inode, const char *name) | ||
38 | { | ||
39 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) | ||
40 | return -EINVAL; | ||
41 | |||
42 | if (is_reiserfs_priv_object(inode)) | ||
43 | return -EPERM; | ||
44 | |||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | static int | ||
49 | security_list (struct inode *inode, const char *name, int namelen, char *out) | ||
50 | { | ||
51 | int len = namelen; | ||
52 | |||
53 | if (is_reiserfs_priv_object(inode)) | ||
54 | return 0; | ||
55 | |||
56 | if (out) | ||
57 | memcpy (out, name, len); | ||
58 | |||
59 | return len; | ||
60 | } | ||
61 | |||
62 | |||
63 | struct reiserfs_xattr_handler security_handler = { | ||
64 | .prefix = XATTR_SECURITY_PREFIX, | ||
65 | .get = security_get, | ||
66 | .set = security_set, | ||
67 | .del = security_del, | ||
68 | .list = security_list, | ||
69 | }; | ||