diff options
author | Rafal Krypa <r.krypa@samsung.com> | 2012-07-09 13:36:34 -0400 |
---|---|---|
committer | Casey Schaufler <casey@schaufler-ca.com> | 2012-07-13 18:49:24 -0400 |
commit | 65ee7f45cf075adcdd6b6ef365f5a5507f1ea5c5 (patch) | |
tree | f674119c2d4e6eb877bb283dce89bdafa0442fa4 /security/smack | |
parent | 3518721a8932b2a243f415c374aef020380efc9d (diff) |
Smack: don't show empty rules when /smack/load or /smack/load2 is read
This patch removes empty rules (i.e. with access set to '-') from the
rule list presented to user space.
Smack by design never removes labels nor rules from its lists. Access
for a rule may be set to '-' to effectively disable it. Such rules would
show up in the listing generated when /smack/load or /smack/load2 is
read. This may cause clutter if many rules were disabled.
As a rule with access set to '-' is equivalent to no rule at all, they
may be safely hidden from the listing.
Targeted for git://git.gitorious.org/smack-next/kernel.git
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Diffstat (limited to 'security/smack')
-rw-r--r-- | security/smack/smackfs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 29b760d6b746..d31e6d957c21 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c | |||
@@ -518,6 +518,9 @@ static void smk_rule_show(struct seq_file *s, struct smack_rule *srp, int max) | |||
518 | if (strlen(srp->smk_subject) >= max || strlen(srp->smk_object) >= max) | 518 | if (strlen(srp->smk_subject) >= max || strlen(srp->smk_object) >= max) |
519 | return; | 519 | return; |
520 | 520 | ||
521 | if (srp->smk_access == 0) | ||
522 | return; | ||
523 | |||
521 | seq_printf(s, "%s %s", srp->smk_subject, srp->smk_object); | 524 | seq_printf(s, "%s %s", srp->smk_subject, srp->smk_object); |
522 | 525 | ||
523 | seq_putc(s, ' '); | 526 | seq_putc(s, ' '); |
@@ -532,8 +535,6 @@ static void smk_rule_show(struct seq_file *s, struct smack_rule *srp, int max) | |||
532 | seq_putc(s, 'a'); | 535 | seq_putc(s, 'a'); |
533 | if (srp->smk_access & MAY_TRANSMUTE) | 536 | if (srp->smk_access & MAY_TRANSMUTE) |
534 | seq_putc(s, 't'); | 537 | seq_putc(s, 't'); |
535 | if (srp->smk_access == 0) | ||
536 | seq_putc(s, '-'); | ||
537 | 538 | ||
538 | seq_putc(s, '\n'); | 539 | seq_putc(s, '\n'); |
539 | } | 540 | } |