]> source.dussan.org Git - rspamd.git/commitdiff
Fix selecting URLs for sending to redirector.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 17 Jun 2015 13:33:54 +0000 (14:33 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 17 Jun 2015 13:34:27 +0000 (14:34 +0100)
src/plugins/surbl.c

index 39dfc2894e31e3835c3156d4336052c0f1a4afce..428e2902ec5e855e7b1ff5bd005c77be47b41773 100644 (file)
@@ -1069,6 +1069,7 @@ surbl_tree_url_callback (gpointer key, gpointer value, void *data)
        rspamd_regexp_t *re;
        gint idx = 0, state = 0;
        ac_trie_pat_t *pat;
+       gboolean found = FALSE;
 
        task = param->task;
        debug_task ("check url %s", struri (url));
@@ -1089,8 +1090,19 @@ surbl_tree_url_callback (gpointer key, gpointer value, void *data)
                                re = g_hash_table_lookup (
                                                surbl_module_ctx->redirector_hosts,
                                                pat->ptr);
-                               if (re == NULL || rspamd_regexp_search (re, url->string, 0,
+                               if (re == NULL) {
+                                       /* Perform exact match */
+                                       if (pat->len == url->hostlen && memcmp (pat->ptr,
+                                                       url->host, pat->len) == 0) {
+                                               found = TRUE;
+                                       }
+                               }
+                               else if (rspamd_regexp_search (re, url->string, 0,
                                                NULL, NULL, TRUE)) {
+                                       found = TRUE;
+                               }
+
+                               if (found) {
                                        if (surbl_module_ctx->redirector_symbol != NULL) {
                                                rspamd_task_insert_result (param->task,
                                                                surbl_module_ctx->redirector_symbol,