From: Vsevolod Stakhov Date: Tue, 23 Apr 2019 18:41:21 +0000 (+0100) Subject: [Fix] Fix processing of the ip urls in file X-Git-Tag: 1.9.3~76 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=96233956371f0312e894be5d03675377128af8ad;p=thirdparty%2Frspamd.git [Fix] Fix processing of the ip urls in file --- diff --git a/src/libserver/url.c b/src/libserver/url.c index 8ad073ae21..96e3118eb1 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 e724d44ff8..59dcd16156 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;