aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/eaops.c
diff options
context:
space:
mode:
authorRyan O'Hara <rohara@redhat.com>2006-05-22 10:08:35 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-05-22 10:08:35 -0400
commit639b6d79b8c20cce4079fb035640c65456324d1c (patch)
treeef3cf33f8b7f3d943ced0e461e1987cd34fc8c42 /fs/gfs2/eaops.c
parentd2f222e6310b073ae3d91b8d3d676621fae1314e (diff)
[GFS2] selinux support
This adds support to GFS2 for selinux extended attributes. There is a known bug in gfs2_ea_get() which is believed to be independant of this patch. Further patches will follow once that bug is fixed in order to make GFS2 use as much of the generic eattr infrastructure as possible. Signed-off-by: Ryan O'Hara <rohara@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/eaops.c')
-rw-r--r--fs/gfs2/eaops.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/fs/gfs2/eaops.c b/fs/gfs2/eaops.c
index 85c1dbace88b..2243b44ecb07 100644
--- a/fs/gfs2/eaops.c
+++ b/fs/gfs2/eaops.c
@@ -43,6 +43,10 @@ unsigned int gfs2_ea_name2type(const char *name, char **truncated_name)
43 type = GFS2_EATYPE_USR; 43 type = GFS2_EATYPE_USR;
44 if (truncated_name) 44 if (truncated_name)
45 *truncated_name = strchr(name, '.') + 1; 45 *truncated_name = strchr(name, '.') + 1;
46 } else if (strncmp(name, "security.", 9) == 0) {
47 type = GFS2_EATYPE_SECURITY;
48 if (truncated_name)
49 *truncated_name = strchr(name, '.') + 1;
46 } else { 50 } else {
47 type = GFS2_EATYPE_UNUSED; 51 type = GFS2_EATYPE_UNUSED;
48 if (truncated_name) 52 if (truncated_name)
@@ -166,6 +170,36 @@ static int system_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
166 return gfs2_ea_remove_i(ip, er); 170 return gfs2_ea_remove_i(ip, er);
167} 171}
168 172
173static int security_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
174{
175 struct inode *inode = ip->i_vnode;
176 int error = permission(inode, MAY_READ, NULL);
177 if (error)
178 return error;
179
180 return gfs2_ea_get_i(ip, er);
181}
182
183static int security_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
184{
185 struct inode *inode = ip->i_vnode;
186 int error = permission(inode, MAY_WRITE, NULL);
187 if (error)
188 return error;
189
190 return gfs2_ea_set_i(ip, er);
191}
192
193static int security_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
194{
195 struct inode *inode = ip->i_vnode;
196 int error = permission(inode, MAY_WRITE, NULL);
197 if (error)
198 return error;
199
200 return gfs2_ea_remove_i(ip, er);
201}
202
169static struct gfs2_eattr_operations gfs2_user_eaops = { 203static struct gfs2_eattr_operations gfs2_user_eaops = {
170 .eo_get = user_eo_get, 204 .eo_get = user_eo_get,
171 .eo_set = user_eo_set, 205 .eo_set = user_eo_set,
@@ -180,6 +214,13 @@ struct gfs2_eattr_operations gfs2_system_eaops = {
180 .eo_name = "system", 214 .eo_name = "system",
181}; 215};
182 216
217struct gfs2_eattr_operations gfs2_security_eaops = {
218 .eo_get = security_eo_get,
219 .eo_set = security_eo_set,
220 .eo_remove = security_eo_remove,
221 .eo_name = "security",
222};
223
183struct gfs2_eattr_operations *gfs2_ea_ops[] = { 224struct gfs2_eattr_operations *gfs2_ea_ops[] = {
184 NULL, 225 NULL,
185 &gfs2_user_eaops, 226 &gfs2_user_eaops,