regex match: Require *all* regular expressions to match.
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sun, 23 Nov 2008 18:07:10 +0000 (19:07 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sun, 23 Nov 2008 18:07:10 +0000 (19:07 +0100)
Before, when there were multiple regular expressions for the same field,
for example the host, only of of those regular expressions needed to
match for a successful overall match.

The new behavior is not that *all* regular expressions need to match for
a successful overall match. This makes the behavior much easier to
understand.

src/match_regex.c

index 15f3c77..9233d80 100644 (file)
@@ -109,17 +109,17 @@ static int mr_match_regexen (mr_regex_t *re_head, /* {{{ */
                {
                        DEBUG ("regex match: Regular expression `%s' matches `%s'.",
                                        re->re_str, string);
-                       return (FC_MATCH_MATCHES);
                }
                else
                {
                        DEBUG ("regex match: Regular expression `%s' does not match `%s'.",
                                        re->re_str, string);
+                       return (FC_MATCH_NO_MATCH);
                }
 
        }
 
-       return (FC_MATCH_NO_MATCH);
+       return (FC_MATCH_MATCHES);
 } /* }}} int mr_match_regexen */
 
 static int mr_config_add_regex (mr_regex_t **re_head, /* {{{ */