From: Vsevolod Stakhov Date: Thu, 23 Apr 2009 16:05:26 +0000 (+0400) Subject: * Also try to search for headers in raw headers X-Git-Tag: 0.2.7~174 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0cc688fe0be5662e761639d853745153a13522f2;p=thirdparty%2Frspamd.git * Also try to search for headers in raw headers --- diff --git a/src/expressions.c b/src/expressions.c index 0ad9f1a726..e656cc433f 100644 --- a/src/expressions.c +++ b/src/expressions.c @@ -830,13 +830,14 @@ rspamd_header_exists (struct worker_task *task, GList *args) { struct expression_argument *arg; GList *headerlist; + char *c; if (args == NULL || task == NULL) { return FALSE; } arg = get_function_arg (args->data, task, TRUE); - if (arg->type == EXPRESSION_ARGUMENT_BOOL) { + if (!arg || arg->type == EXPRESSION_ARGUMENT_BOOL) { msg_warn ("rspamd_header_exists: invalid argument to function is passed"); return FALSE; } @@ -846,6 +847,13 @@ rspamd_header_exists (struct worker_task *task, GList *args) g_list_free (headerlist); return TRUE; } + else { + /* Also check in raw headers */ + if ((c = strstr (task->raw_headers, (char *)arg->data)) != NULL && + (c == task->raw_headers || *(c - 1) == '\n')) { + return TRUE; + } + } return FALSE; }