Add the checking of exclude filter list for the field which is not AUDIT_MSGTYPE
Subsystems (2)
PATCH 3/4 Add the checking of exclude filter list for the field which is not AUDIT_MSGTYPE
Hello Steve,
When field is not AUDIT_MSGTYPE, it is invalid for exclude filter list. I think the fields shoud be check before sending to kernel. I add checking and error message "-18" to realize it.
Signed-off-by Zhang Xiliang <[email protected]>
--- lib/deprecated.c | 3 +++ lib/libaudit.c | 3 +++ src/auditctl.c | 5 +++++ 3 files changed, 11 insertions(+), 0 deletions(-)
lib/deprecated.c +3 -0
@@ -440,6 +440,9 @@ int audit_rule_fieldpair(struct audit_rule *rule, const char *pair, int flags)if (field ==AUDIT_PPID && (flags !=AUDIT_FILTER_EXIT || flags !=AUDIT_FILTER_ENTRY ))return -17 ; + +if (flags ==AUDIT_FILTER_EXCLUDE ) +return -18 ; rule->values[rule->field_count] =strtol (v,NULL ,0 );break ;
lib/libaudit.c +3 -0
@@ -1085,6 +1085,9 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair,if (field ==AUDIT_PPID && (flags !=AUDIT_FILTER_EXIT || flags !=AUDIT_FILTER_ENTRY ))return -17 ; + +if (flags ==AUDIT_FILTER_EXCLUDE ) +return -18 ; rule->values[rule->field_count] =strtol (v,NULL ,0 );break ;
src/auditctl.c +5 -0
@@ -794,6 +794,11 @@ static int setopt(int count, char *vars[]) "Field %s can only be used with exit and entry filter list\n", optarg); retval =-1 ;break ; +case -18 : +fprintf (stderr, +"Field %s can not be used with exclude filter list\n" , optarg); + retval =-1 ; +break ;default : retval =-1 ;break ;
Signature · 2 lines
Regards Zhang Xiliang
Steve Grubb
AppliedQuoted 3 lines · On Saturday 02 August 2008 06:13:11 zhangxiliang wrote:
When field is not
AUDIT_MSGTYPE, it is invalid for exclude filter list. I think the fields shoud be check before sending to kernel. I add checking and error message "-18" to realize it.
Applied. Thanks !
-Steve