Skip to content

Commit

Permalink
Smack: fix for /smack/access output, use string instead of byte
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Jarkko Sakkinen authored and Casey Schaufler committed Oct 12, 2011
1 parent 84088ba commit f8859d9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions security/smack/smackfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit f8859d9

Please sign in to comment.