From 96233956371f0312e894be5d03675377128af8ad Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 23 Apr 2019 19:41:21 +0100 Subject: [PATCH] [Fix] Fix processing of the ip urls in file --- src/libserver/url.c | 10 ++++++---- src/libserver/url.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libserver/url.c b/src/libserver/url.c index 8ad073ae2..96e3118eb 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -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; + } } } } diff --git a/src/libserver/url.h b/src/libserver/url.h index e724d44ff..59dcd1615 100644 --- a/src/libserver/url.h +++ b/src/libserver/url.h @@ -39,7 +39,7 @@ struct rspamd_url_tag { struct rspamd_url { gchar *raw; gchar *string; - gint protocol; + guint protocol; guint port; gchar *user; -- 2.39.5