Linux-2.6.12-rc2
[linux-2.6/next.git] / fs / devpts / xattr_security.c
blob864cb5c79baaf71b02f8dcf8ffe484f344d7b163
1 /*
2 * Security xattr support for devpts.
4 * Author: Stephen Smalley <sds@epoch.ncsc.mil>
5 * Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version.
12 #include <linux/string.h>
13 #include <linux/fs.h>
14 #include <linux/security.h>
15 #include <linux/xattr.h>
17 static size_t
18 devpts_xattr_security_list(struct inode *inode, char *list, size_t list_len,
19 const char *name, size_t name_len)
21 return security_inode_listsecurity(inode, list, list_len);
24 static int
25 devpts_xattr_security_get(struct inode *inode, const char *name,
26 void *buffer, size_t size)
28 if (strcmp(name, "") == 0)
29 return -EINVAL;
30 return security_inode_getsecurity(inode, name, buffer, size);
33 static int
34 devpts_xattr_security_set(struct inode *inode, const char *name,
35 const void *value, size_t size, int flags)
37 if (strcmp(name, "") == 0)
38 return -EINVAL;
39 return security_inode_setsecurity(inode, name, value, size, flags);
42 struct xattr_handler devpts_xattr_security_handler = {
43 .prefix = XATTR_SECURITY_PREFIX,
44 .list = devpts_xattr_security_list,
45 .get = devpts_xattr_security_get,
46 .set = devpts_xattr_security_set,