Commit 135b6249 authored by Antoine Millet's avatar Antoine Millet
Browse files

Optimization of wildcards in ruleset

parent 7927f436
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -308,9 +308,14 @@ class CCServer(object):
            match = RE_FAST_RULE_MATCHING.match(rule.match)
            if match and match.group(1) != requester:
                continue
            elif rule.match == 'id':
                continue  # Optimization to handle wildcard matcher
            elif requester not in self.db.raw_query(rule.match):
                continue
            if rule.action == rule.ACCEPT:
                if rule.tql == 'id':  # Optimization to handle wildcard tql
                    allowed_result |= tql_response
                else:
                    allowed_result |= tql_response & self.db.raw_query(rule.tql)
            elif rule.action == rule.DENY:
                # Defer deny action to the end of process:
@@ -339,6 +344,8 @@ class CCServer(object):
            match = RE_FAST_RULE_MATCHING.match(rule.match)
            if match and match.group(1) != requester:
                continue
            elif rule.match == 'id':
                continue  # Optimization to handle wildcard matcher
            elif requester not in self.db.raw_query(rule.match):
                continue
            if rule.action == rule.ACCEPT: