summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorJarkko Sakkinen <jarkko.sakkinen@intel.com>2011-10-10 14:29:28 +0300
committerCasey Schaufler <cschaufler@cschaufler-intel.(none)>2011-10-12 14:30:07 -0700
commitf8859d98c1d1e73393285fb9dd57007839956247 (patch)
treea6937380935074702febe48239bb891b4242752d /security
parent84088ba239293abb24260c6c36d86e8775b6707f (diff)
Smack: fix for /smack/access output, use string instead of byte
Small fix for the output of access SmackFS file. Use string is instead of byte. Makes it easier to extend API if it is needed. Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@intel.com>
Diffstat (limited to 'security')
-rw-r--r--security/smack/smackfs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 54f6e18dea2f..5498c4a2d1ae 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -1497,6 +1497,7 @@ static ssize_t smk_write_access(struct file *file, const char __user *buf,
{
struct smack_rule rule;
char *data;
+ int res;
if (!capable(CAP_MAC_ADMIN))
return -EPERM;
@@ -1508,8 +1509,10 @@ static ssize_t smk_write_access(struct file *file, const char __user *buf,
if (count < SMK_LOADLEN || smk_parse_rule(data, &rule))
return -EINVAL;
- data[0] = smk_access(rule.smk_subject, rule.smk_object,
- rule.smk_access, NULL) == 0;
+ res = smk_access(rule.smk_subject, rule.smk_object, rule.smk_access,
+ NULL);
+ data[0] = res == 0 ? '1' : '0';
+ data[1] = '\0';
simple_transaction_set(file, 1);
return SMK_LOADLEN;