From ee7f5d970bbe913b57fef21a33e09f1260665e4b Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Tue, 3 Mar 2020 11:09:34 +0100 Subject: [PATCH] Fixed attachment rule evaluation Signed-off-by: Janos SUTO --- src/rules.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/rules.c b/src/rules.c index 6cb40b5b..d78472e2 100644 --- a/src/rules.c +++ b/src/rules.c @@ -340,9 +340,12 @@ int check_attachment_rule(struct parser_state *state, struct rule *rule){ size_t nmatch=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++){ ismatch = 0;