diff options
Diffstat (limited to 'grammar')
-rw-r--r-- | grammar/rainerscript.c | 24 | ||||
-rw-r--r-- | grammar/rainerscript.h | 6 |
2 files changed, 8 insertions, 22 deletions
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c index b74ff346..3caa585c 100644 --- a/grammar/rainerscript.c +++ b/grammar/rainerscript.c @@ -47,6 +47,7 @@ #include "obj.h" #include "modules.h" #include "ruleset.h" +#include "msg.h" #include "unicode-helper.h" DEFobjCurrIf(obj) @@ -177,18 +178,8 @@ DecodePropFilter(uchar *pline, struct cnfstmt *stmt) rsParsDestruct(pPars); ABORT_FINALIZE(iRet); } - iRet = propNameToID(cstrGetSzStrNoNULL(pCSPropName), &stmt->d.s_propfilt.propID); - if(iRet != RS_RET_OK) { - parser_errmsg("invalid property name '%s' in filter", - cstrGetSzStrNoNULL(pCSPropName)); - rsParsDestruct(pPars); - ABORT_FINALIZE(iRet); - } - if(stmt->d.s_propfilt.propID == PROP_CEE) { - /* in CEE case, we need to preserve the actual property name */ - stmt->d.s_propfilt.propName = ustrdup(cstrGetSzStrNoNULL(pCSPropName+2)); - stmt->d.s_propfilt.propNameLen = cstrLen(pCSPropName)-2; - } + CHKiRet(msgPropDescrFill(&stmt->d.s_propfilt.prop, cstrGetSzStrNoNULL(pCSPropName), + cstrLen(pCSPropName))); /* read operation */ iRet = parsDelimCStr(pPars, &pCSCompOp, ',', 1, 1, 1); @@ -2442,10 +2433,10 @@ cnfstmtPrintOnly(struct cnfstmt *stmt, int indent, sbool subtree) case S_PROPFILT: doIndent(indent); dbgprintf("PROPFILT\n"); doIndent(indent); dbgprintf("\tProperty.: '%s'\n", - propIDToName(stmt->d.s_propfilt.propID)); - if(stmt->d.s_propfilt.propName != NULL) { + propIDToName(stmt->d.s_propfilt.prop.id)); + if(stmt->d.s_propfilt.prop.name != NULL) { doIndent(indent); - dbgprintf("\tCEE-Prop.: '%s'\n", stmt->d.s_propfilt.propName); + dbgprintf("\tCEE-Prop.: '%s'\n", stmt->d.s_propfilt.prop.name); } doIndent(indent); dbgprintf("\tOperation: "); if(stmt->d.s_propfilt.isNegated) @@ -2605,7 +2596,7 @@ cnfstmtDestruct(struct cnfstmt *stmt) cnfstmtDestructLst(stmt->d.s_prifilt.t_else); break; case S_PROPFILT: - free(stmt->d.s_propfilt.propName); + msgPropDescrDestruct(&stmt->d.s_propfilt.prop); if(stmt->d.s_propfilt.regex_cache != NULL) rsCStrRegexDestruct(&stmt->d.s_propfilt.regex_cache); if(stmt->d.s_propfilt.pCSCompValue != NULL) @@ -2690,7 +2681,6 @@ cnfstmtNewPROPFILT(char *propfilt, struct cnfstmt *t_then) if((cnfstmt = cnfstmtNew(S_PROPFILT)) != NULL) { cnfstmt->printable = (uchar*)propfilt; cnfstmt->d.s_propfilt.t_then = t_then; - cnfstmt->d.s_propfilt.propName = NULL; cnfstmt->d.s_propfilt.regex_cache = NULL; cnfstmt->d.s_propfilt.pCSCompValue = NULL; if(DecodePropFilter((uchar*)propfilt, cnfstmt) != RS_RET_OK) { diff --git a/grammar/rainerscript.h b/grammar/rainerscript.h index 7bbd7456..7a4f1ac9 100644 --- a/grammar/rainerscript.h +++ b/grammar/rainerscript.h @@ -6,7 +6,6 @@ #include <sys/types.h> #include <regex.h> - #define LOG_NFACILITIES 24 /* current number of syslog facilities */ #define CNFFUNC_MAX_ARGS 32 /**< maximum number of arguments that any function can have (among @@ -182,10 +181,7 @@ struct cnfstmt { regex_t *regex_cache;/* cache for compiled REs, if used */ struct cstr_s *pCSCompValue;/* value to "compare" against */ sbool isNegated; - uintTiny propID;/* ID of the requested property */ - //es_str_t *propName;/* name of property for CEE-based filters */ - uchar *propName; - int propNameLen; + msgPropDescr_t prop; /* requested property */ struct cnfstmt *t_then; struct cnfstmt *t_else; } s_propfilt; |