From c09b65cba8220b49bb25b1ba6c6ffd2f6e850583 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Fri, 15 May 2015 21:41:14 +0200 Subject: [PATCH] frontend, parser: Allow typed access to host objects from any context. That is, even from the "generic" or "filter" contexts. --- src/frontend/analyzer.c | 3 ++- src/parser/analyzer.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/frontend/analyzer.c b/src/frontend/analyzer.c index 4bd3702..01e1ad3 100644 --- a/src/frontend/analyzer.c +++ b/src/frontend/analyzer.c @@ -95,7 +95,8 @@ analyze_expr(int context, sdb_store_expr_t *e, sdb_strbuf_t *errbuf) if (context == (int)e->data.data.integer) return 0; if ((e->data.data.integer == SDB_HOST) && - ((context == SDB_SERVICE) || (context == SDB_METRIC))) + ((context == SDB_SERVICE) || (context == SDB_METRIC) + || (context < 0))) return 0; sdb_strbuf_sprintf(errbuf, "Invalid expression %s.%s " "in %s context", diff --git a/src/parser/analyzer.c b/src/parser/analyzer.c index 01539ed..e03cbdb 100644 --- a/src/parser/analyzer.c +++ b/src/parser/analyzer.c @@ -347,7 +347,7 @@ analyze_typed(int context, sdb_ast_typed_t *t, sdb_strbuf_t *errbuf) /* self-references are allowed and services and metrics may reference * their parent host; everything may reference attributes */ - if ((context != t->type) && (context != UNSPEC_CONTEXT) + if ((context != t->type) && (context > 0) && (((context != SDB_SERVICE) && (context != SDB_METRIC)) || (t->type != SDB_HOST)) && (t->type != SDB_ATTRIBUTE)) { -- 2.30.2