]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix processing of the ip urls in file
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 23 Apr 2019 18:41:21 +0000 (19:41 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 23 Apr 2019 18:41:21 +0000 (19:41 +0100)
src/libserver/url.c
src/libserver/url.h

index 8ad073ae210a12e150124f4046b40e04ef976f2a..96e3118eb16e5b60e5c948e2d6c275bc579277ad 100644 (file)
@@ -2004,7 +2004,7 @@ rspamd_url_parse (struct rspamd_url *uri,
                }
        }
 
-       if (uri->protocol & (PROTOCOL_HTTP|PROTOCOL_HTTPS|PROTOCOL_MAILTO|PROTOCOL_FTP)) {
+       if (uri->protocol & (PROTOCOL_HTTP|PROTOCOL_HTTPS|PROTOCOL_MAILTO|PROTOCOL_FTP|PROTOCOL_FILE)) {
                /* Find TLD part */
                rspamd_multipattern_lookup (url_scanner->search_trie,
                                uri->host, uri->hostlen,
@@ -2017,9 +2017,11 @@ rspamd_url_parse (struct rspamd_url *uri,
                                        return URI_ERRNO_TLD_MISSING;
                                }
                        } else {
-                               /* Assume tld equal to host */
-                               uri->tld = uri->host;
-                               uri->tldlen = uri->hostlen;
+                               if (!rspamd_url_is_ip (uri, pool)) {
+                                       /* Assume tld equal to host */
+                                       uri->tld = uri->host;
+                                       uri->tldlen = uri->hostlen;
+                               }
                        }
                }
        }
index e724d44ff82aa5e9f621551b69830f68aa98cdd0..59dcd16156fb7f8b936d6cfdbbfdcd41439279e2 100644 (file)
@@ -39,7 +39,7 @@ struct rspamd_url_tag {
 struct rspamd_url {
        gchar *raw;
        gchar *string;
-       gint protocol;
+       guint protocol;
        guint port;
 
        gchar *user;