From bd8d399c6d1405e8e5cae80ff3d1317e136ace5f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20Salvet?= Date: Mon, 20 Mar 2006 14:16:40 +0000 Subject: [PATCH] When checking ATTR_USERTAG in match_flesh_conditions(), ensure the event is of correct type. Select only UserTag events in where SQL clause when processing ATTR_USERTAG event condition. --- org.glite.lb.server/src/query.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/org.glite.lb.server/src/query.c b/org.glite.lb.server/src/query.c index 076c9cd..0d77044 100644 --- a/org.glite.lb.server/src/query.c +++ b/org.glite.lb.server/src/query.c @@ -594,8 +594,8 @@ static char *ec_to_head_where(edg_wll_Context ctx,const edg_wll_QueryRec **ec) * with all conditions in same "or clause" */ for ( n = 0; ec[m][n].attr; n++ ) - if ( (ec[m][n].attr == EDG_WLL_QUERY_ATTR_USERTAG) - || (ec[m][n].attr == EDG_WLL_QUERY_ATTR_INSTANCE) ) + if ( /* (ec[m][n].attr == EDG_WLL_QUERY_ATTR_USERTAG) || */ + (ec[m][n].attr == EDG_WLL_QUERY_ATTR_INSTANCE) ) break; if ( ec[m][n].attr ) continue; @@ -675,6 +675,15 @@ static char *ec_to_head_where(edg_wll_Context ctx,const edg_wll_QueryRec **ec) trio_asprintf(&conds, "e.host %s '%|Ss'", opToString(ec[m][n].op), ec[m][n].value.c); break; + case EDG_WLL_QUERY_ATTR_USERTAG: + if ( conds ) + { + trio_asprintf(&out, "%s OR e.code = %d", conds, EDG_WLL_EVENT_USERTAG); + free(conds); conds = out; + } + else + trio_asprintf(&conds, "e.code = %d", EDG_WLL_EVENT_USERTAG); + break; case EDG_WLL_QUERY_ATTR_EVENT_TYPE: if ( conds ) { @@ -1082,7 +1091,8 @@ static int match_flesh_conditions(const edg_wll_Event *e,const edg_wll_QueryRec } else if ( ec[i][j].attr == EDG_WLL_QUERY_ATTR_USERTAG ) { - if ( !strcmp(ec[i][j].attr_id.tag,e->userTag.name) + if ( e->any.type == EDG_WLL_EVENT_USERTAG && + !strcmp(ec[i][j].attr_id.tag,e->userTag.name) && cmp_string(e->userTag.value,ec[i][j].op,ec[i][j].value.c)) break; } -- 1.8.2.3