aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-17 13:13:02 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-17 13:13:02 +0100
commitbaa26167fbb7844292cc1fd830e91bcb68e7ea48 (patch)
treed23b2cf1778ac48a630835e19b2120c08d7025ad
parentf14a3db518a6c5e98f08a1d78e1a81cf2da61e3c (diff)
downloadrspamd-baa26167fbb7844292cc1fd830e91bcb68e7ea48.tar.gz
rspamd-baa26167fbb7844292cc1fd830e91bcb68e7ea48.zip
Split emails and urls.
-rw-r--r--src/libmime/message.c3
-rw-r--r--src/libserver/html.c18
-rw-r--r--src/libserver/html.h2
3 files changed, 16 insertions, 7 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c
index cdd532f5a..a8df8aea9 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -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);
diff --git a/src/libserver/html.c b/src/libserver/html.c
index 18a71930f..421a89829 100644
--- a/src/libserver/html.c
+++ b/src/libserver/html.c
@@ -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);
}
diff --git a/src/libserver/html.h b/src/libserver/html.h
index 1a98a3e9a..c70d7d6ed 100644
--- a/src/libserver/html.h
+++ b/src/libserver/html.h
@@ -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