Fix the bug of AUDIT_PERM field added without a watch
Subsystems (2)
PATCH 4/5 Fix the bug of AUDIT_PERM field added without a watch
Hello Steve,
AUDIT_PERM field should used after a watch given.
For example,
auditctl -a exit,always -F perm=r
No error message is outputed.
I think we should add checking for it.
Signed-off-by Zhang Xiliang <[email protected]>
--- lib/libaudit.c | 2 ++ src/auditctl.c | 5 +++++ 2 files changed, 7 insertions(+), 0 deletions(-)
lib/libaudit.c +2 -0
@@ -1046,6 +1046,8 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair,return -7 ; else if (op != AUDIT_EQUAL) return -13; + else if (audit_permadded != 1) + return -22; else {unsigned int i, len, val =0 ;
src/auditctl.c +5 -0
@@ -857,6 +857,11 @@ static int setopt(int count, char *vars[]) "-F value should be number for %s\n", optarg); retval =-1 ;break ; +case -22 : +fprintf (stderr, +"permission option needs a watch given prior to it\n" ); + retval =-1 ; +break ;default : retval =-1 ;break ;
Quoted 7 lines · On Wednesday 06 August 2008 04:15:09 Zhang Xiliang wrote:
AUDIT_PERMfield should used after a watch given.For example,
auditctl -a exit,always -F perm=rNo error message is outputed.
I think we should add checking for it.
This is a legal rule. The kernel will pick the syscalls that satisfy the read permission. Typically, you would have other fields in addition. So...I'm not applying this patch.
Thanks,
-Steve