]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
* Also try to search for headers in raw headers
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 23 Apr 2009 16:05:26 +0000 (20:05 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 23 Apr 2009 16:05:26 +0000 (20:05 +0400)
src/expressions.c

index 0ad9f1a726d8f6a98d55a5e5235a4d13fa3e2988..e656cc433fed0b021a68542a9cce21ad4d860c0b 100644 (file)
@@ -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;
 }