From 41888fca9dcd1092f3a4f65d34d5e87b0c39763d Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Tue, 4 Nov 2014 08:34:28 +0100 Subject: [PATCH] frontend/analyzer: Check name parameters for FETCH. --- src/frontend/analyzer.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/frontend/analyzer.c b/src/frontend/analyzer.c index 8c6b74d..93debf5 100644 --- a/src/frontend/analyzer.c +++ b/src/frontend/analyzer.c @@ -144,9 +144,13 @@ sdb_fe_analyze(sdb_conn_node_t *node) /* For now, this function checks basic matcher attributes only; * later, this may be turned into one of multiple AST visitors. */ if (node->cmd == CONNECTION_FETCH) { - if (CONN_FETCH(node)->filter) - filter = CONN_FETCH(node)->filter->matcher; - context = CONN_FETCH(node)->type; + conn_fetch_t *fetch = CONN_FETCH(node); + if (((fetch->type == SDB_HOST) && fetch->name) + || ((fetch->type != SDB_HOST) && (! fetch->name))) + return -1; + if (fetch->filter) + filter = fetch->filter->matcher; + context = fetch->type; } else if (node->cmd == CONNECTION_LIST) { if (CONN_LIST(node)->filter) -- 2.30.2