]> source.dussan.org Git - rspamd.git/commitdiff
Split emails and urls.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 17 Jul 2015 12:13:02 +0000 (13:13 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 17 Jul 2015 12:13:02 +0000 (13:13 +0100)
src/libmime/message.c
src/libserver/html.c
src/libserver/html.h

index cdd532f5a32aef97560a80cfa97cf40730ef6b8a..a8df8aea990fb61bbef15c8e1f451b69ab6051db 100644 (file)
@@ -1142,7 +1142,8 @@ process_text_part (struct rspamd_task *task,
                                text_part->html,
                                part_content,
                                &text_part->urls_offset,
-                               task->urls);
+                               task->urls,
+                               task->emails);
 
                rspamd_url_text_extract (task->task_pool, task, text_part, TRUE);
 
index 18a71930f4e918e6e6c9efbd1256aacddd55b9b0..421a898291ecf0cefd3991c57fce0e278f66fe7c 100644 (file)
@@ -1243,12 +1243,13 @@ rspamd_html_process_url_tag (rspamd_mempool_t *pool, struct html_tag *tag)
 
 GByteArray*
 rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc,
-               GByteArray *in, GList **exceptions, GHashTable *urls)
+               GByteArray *in, GList **exceptions, GHashTable *urls,  GHashTable *emails)
 {
        const guchar *p, *c, *end, *tag_start = NULL, *savep = NULL;
        guchar t;
        gboolean closing = FALSE, need_decode = FALSE, save_space = FALSE, balanced;
        GByteArray *dest;
+       GHashTable *target_tbl;
        guint obrace = 0, ebrace = 0;
        GNode *cur_level = NULL;
        gint substate, len, href_offset = -1;
@@ -1565,13 +1566,20 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc,
 
                                                if (url != NULL) {
 
-                                                       turl = g_hash_table_lookup (urls, url);
+                                                       if (url->protocol == PROTOCOL_MAILTO) {
+                                                               target_tbl = emails;
+                                                       }
+                                                       else {
+                                                               target_tbl = urls;
+                                                       }
+
+                                                       turl = g_hash_table_lookup (target_tbl, url);
 
                                                        if (turl != NULL && turl->phished_url == NULL) {
-                                                               g_hash_table_insert (urls, url, url);
+                                                               g_hash_table_insert (target_tbl, url, url);
                                                        }
                                                        else if (turl == NULL) {
-                                                               g_hash_table_insert (urls, url, url);
+                                                               g_hash_table_insert (target_tbl, url, url);
                                                        }
                                                        else {
                                                                url = NULL;
@@ -1622,5 +1630,5 @@ rspamd_html_process_part (rspamd_mempool_t *pool,
                struct html_content *hc,
                GByteArray *in)
 {
-       return rspamd_html_process_part_full (pool, hc, in, NULL, NULL);
+       return rspamd_html_process_part_full (pool, hc, in, NULL, NULL, NULL);
 }
index 1a98a3e9a886f954fa3e29dc694826ab99901378..c70d7d6ed2eff5e8b3e9db01ef8dc9e9028d49c2 100644 (file)
@@ -59,6 +59,6 @@ GByteArray* rspamd_html_process_part (rspamd_mempool_t *pool,
 
 GByteArray* rspamd_html_process_part_full (rspamd_mempool_t *pool,
                struct html_content *hc,
-               GByteArray *in, GList **exceptions, GHashTable *urls);
+               GByteArray *in, GList **exceptions, GHashTable *urls, GHashTable *emails);
 
 #endif