]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Treat unnormalised URLs as obscured
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 26 Mar 2018 12:12:35 +0000 (13:12 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 26 Mar 2018 12:12:35 +0000 (13:12 +0100)
src/libserver/html.c

index b27e07fadf1c1702b2c3bb0d144a881ec3e78597..ec81cc06adce2100affeb7f90e9fbbb24b1f7abb 100644 (file)
@@ -1634,6 +1634,10 @@ rspamd_process_html_url (rspamd_mempool_t *pool, struct rspamd_url *url,
        gchar *url_str;
        gint rc;
 
+       if (url->flags & RSPAMD_URL_FLAG_UNNORMALISED) {
+               url->flags |= RSPAMD_URL_FLAG_OBSCURED;
+       }
+
        if (url->querylen > 0) {
 
                if (rspamd_url_find (pool, url->query, url->querylen, &url_str, TRUE,
@@ -1658,6 +1662,18 @@ rspamd_process_html_url (rspamd_mempool_t *pool, struct rspamd_url *url,
                                        target_tbl = tbl_urls;
                                }
 
+                               if (query_url->flags
+                                               & (RSPAMD_URL_FLAG_UNNORMALISED|RSPAMD_URL_FLAG_OBSCURED|
+                                                       RSPAMD_URL_FLAG_NUMERIC)) {
+                                       /* Set obscured flag if query url is bad */
+                                       url->flags |= RSPAMD_URL_FLAG_OBSCURED;
+                               }
+
+                               /* And vice-versa */
+                               if (url->flags & RSPAMD_URL_FLAG_OBSCURED) {
+                                       query_url->flags |= RSPAMD_URL_FLAG_OBSCURED;
+                               }
+
                                if ((existing = g_hash_table_lookup (target_tbl,
                                                query_url)) == NULL) {
                                        g_hash_table_insert (target_tbl,