mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
audit: validate comparison operations, store them in sane form
Don't store the field->op in the messy (and very inconvenient for e.g. audit_comparator()) form; translate to dense set of values and do full validation of userland-submitted value while we are at it. ->audit_init_rule() and ->audit_match_rule() get new values now; in-tree instances updated. Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
36c4f1b18c
commit
5af75d8d58
5 changed files with 94 additions and 84 deletions
|
|
@ -2492,7 +2492,7 @@ static int smack_audit_rule_init(u32 field, u32 op, char *rulestr, void **vrule)
|
|||
if (field != AUDIT_SUBJ_USER && field != AUDIT_OBJ_USER)
|
||||
return -EINVAL;
|
||||
|
||||
if (op != AUDIT_EQUAL && op != AUDIT_NOT_EQUAL)
|
||||
if (op != Audit_equal && op != Audit_not_equal)
|
||||
return -EINVAL;
|
||||
|
||||
*rule = smk_import(rulestr, 0);
|
||||
|
|
@ -2556,9 +2556,9 @@ static int smack_audit_rule_match(u32 secid, u32 field, u32 op, void *vrule,
|
|||
* both pointers will point to the same smack_known
|
||||
* label.
|
||||
*/
|
||||
if (op == AUDIT_EQUAL)
|
||||
if (op == Audit_equal)
|
||||
return (rule == smack);
|
||||
if (op == AUDIT_NOT_EQUAL)
|
||||
if (op == Audit_not_equal)
|
||||
return (rule != smack);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue