From: Josef 'Jeff' Sipek Date: Fri, 30 Apr 2021 20:39:15 +0000 (-0400) Subject: lib: event filter - Rename EVENT_FILTER_NODE_TYPE_EVENT_FIELD to denote wildcard... X-Git-Tag: 2.3.16~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcb47858e1058e2d4cf384fc0354df9508b49b92;p=thirdparty%2Fdovecot%2Fcore.git lib: event filter - Rename EVENT_FILTER_NODE_TYPE_EVENT_FIELD to denote wildcard matching --- diff --git a/src/lib/event-filter-parser.y b/src/lib/event-filter-parser.y index 640b48bc05..8f53dfd0d2 100644 --- a/src/lib/event-filter-parser.y +++ b/src/lib/event-filter-parser.y @@ -41,10 +41,10 @@ static struct event_filter_node *key_value(struct event_filter_parser_state *sta else if (strcmp(a, "source_location") == 0) type = EVENT_FILTER_NODE_TYPE_EVENT_SOURCE_LOCATION; else - type = EVENT_FILTER_NODE_TYPE_EVENT_FIELD; + type = EVENT_FILTER_NODE_TYPE_EVENT_FIELD_WILDCARD; /* only fields support comparators other than EQ */ - if ((type != EVENT_FILTER_NODE_TYPE_EVENT_FIELD) && + if ((type != EVENT_FILTER_NODE_TYPE_EVENT_FIELD_WILDCARD) && (op != EVENT_FILTER_OP_CMP_EQ)) { state->error = "Only fields support inequality comparisons"; return NULL; @@ -91,7 +91,7 @@ static struct event_filter_node *key_value(struct event_filter_parser_state *sta node->category.ptr = event_category_find_registered(b); } break; - case EVENT_FILTER_NODE_TYPE_EVENT_FIELD: + case EVENT_FILTER_NODE_TYPE_EVENT_FIELD_WILDCARD: node->field.key = p_strdup(state->pool, a); node->field.value.str = p_strdup(state->pool, b); diff --git a/src/lib/event-filter-private.h b/src/lib/event-filter-private.h index e5f05ea0a1..09ce1a0a8a 100644 --- a/src/lib/event-filter-private.h +++ b/src/lib/event-filter-private.h @@ -24,7 +24,7 @@ enum event_filter_node_type { EVENT_FILTER_NODE_TYPE_EVENT_NAME_WILDCARD, /* str */ EVENT_FILTER_NODE_TYPE_EVENT_SOURCE_LOCATION, /* str + int */ EVENT_FILTER_NODE_TYPE_EVENT_CATEGORY, /* cat */ - EVENT_FILTER_NODE_TYPE_EVENT_FIELD, /* field */ + EVENT_FILTER_NODE_TYPE_EVENT_FIELD_WILDCARD, /* field */ }; enum event_filter_log_type { diff --git a/src/lib/event-filter.c b/src/lib/event-filter.c index 49f3d3e908..cd7fb7ca8d 100644 --- a/src/lib/event-filter.c +++ b/src/lib/event-filter.c @@ -260,7 +260,7 @@ event_filter_add_fields(pool_t pool, struct event_filter_node *node; node = p_new(pool, struct event_filter_node, 1); - node->type = EVENT_FILTER_NODE_TYPE_EVENT_FIELD; + node->type = EVENT_FILTER_NODE_TYPE_EVENT_FIELD_WILDCARD; node->op = EVENT_FILTER_OP_CMP_EQ; node->field.key = p_strdup(pool, fields[i].key); node->field.value.str = p_strdup(pool, fields[i].value); @@ -464,7 +464,7 @@ event_filter_export_query_expr(const struct event_filter_query_internal *query, } else str_append(dest, event_filter_category_from_log_type(node->category.log_type)); break; - case EVENT_FILTER_NODE_TYPE_EVENT_FIELD: + case EVENT_FILTER_NODE_TYPE_EVENT_FIELD_WILDCARD: str_append_c(dest, '"'); event_filter_append_escaped(dest, node->field.key); str_append_c(dest, '"'); @@ -647,7 +647,7 @@ event_filter_query_match_cmp(struct event_filter_node *node, strcmp(event->source_filename, node->str) != 0); case EVENT_FILTER_NODE_TYPE_EVENT_CATEGORY: return event_has_category(event, node, log_type); - case EVENT_FILTER_NODE_TYPE_EVENT_FIELD: + case EVENT_FILTER_NODE_TYPE_EVENT_FIELD_WILDCARD: return event_match_field(event, &node->field, node->op); } @@ -815,7 +815,7 @@ event_filter_query_update_category(struct event_filter_query_internal *query, case EVENT_FILTER_NODE_TYPE_EVENT_NAME_EXACT: case EVENT_FILTER_NODE_TYPE_EVENT_NAME_WILDCARD: case EVENT_FILTER_NODE_TYPE_EVENT_SOURCE_LOCATION: - case EVENT_FILTER_NODE_TYPE_EVENT_FIELD: + case EVENT_FILTER_NODE_TYPE_EVENT_FIELD_WILDCARD: break; case EVENT_FILTER_NODE_TYPE_EVENT_CATEGORY: if (node->category.name == NULL)