while (it) {
if (it->type == EXPR_REGEXP || it->type == EXPR_STR) {
g_queue_free (stack);
- msg_warn ("get_function_arg: cannot parse function arguments that contains regexps or strings");
- return NULL;
+ res->type = EXPRESSION_ARGUMENT_EXPR;
+ res->data = expr;
+ return res;
} else if (it->type == EXPR_FUNCTION) {
cur = (gsize)call_expression_function ((struct expression_function *)it->content.operand, task);
msg_debug ("get_function_arg: function %s returned %s", ((struct expression_function *)it->content.operand)->name,
enum {
EXPRESSION_ARGUMENT_NORMAL,
EXPRESSION_ARGUMENT_BOOL,
+ EXPRESSION_ARGUMENT_EXPR,
} type; /**< type of argument (text or other function) */
void *data; /**< pointer to its data */
};
static gboolean
rspamd_regexp_match_number (struct worker_task *task, GList *args)
{
- char *param_pattern;
int param_count, res = 0;
- struct rspamd_regexp *re;
struct expression_argument *arg;
GList *cur;
}
}
else {
- param_pattern = (char *)arg->data;
- if (*param_pattern != '/') {
- /* Skip non-regexp arguments */
- cur = g_list_next (cur);
- continue;
- }
- /* This is regexp, so compile and create g_regexp object */
- if ((re = re_cache_check (param_pattern)) == NULL) {
- re = parse_regexp (task->task_pool, param_pattern, task->cfg->raw_mode);
- if (re == NULL) {
- msg_warn ("rspamd_regexp_match_number: cannot compile regexp for function");
- return FALSE;
- }
- re_cache_add (param_pattern, re);
- }
if (process_regexp_expression (cur->data, task)) {
res ++;
}