Fixed attachment rule evaluation

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2020-03-03 11:09:34 +01:00
parent 5e58f74981
commit ee7f5d970b

View File

@ -340,9 +340,12 @@ int check_attachment_rule(struct parser_state *state, struct rule *rule){
size_t nmatch=0; size_t nmatch=0;
int ismatch = 0; int ismatch = 0;
if(state->n_attachments == 0) return RULE_UNDEF; // If no attachment rule, then return RULE_UNDEF
if(rule->emptyaname == 1 && rule->emptyatype == 1 && rule->attachment_size == 0) return RULE_UNDEF;
// If we have attachments, but no attachment rules, then return RULE_NO_MATCH
if(state->n_attachments == 0 && (rule->emptyaname == 0 || rule->emptyatype == 0 || rule->attachment_size)) return RULE_NO_MATCH;
if(rule->emptyaname == 1 && rule->emptyatype == 1) return RULE_UNDEF;
for(i=1; i<=state->n_attachments; i++){ for(i=1; i<=state->n_attachments; i++){
ismatch = 0; ismatch = 0;