commit 9623395: [Fix] Fix processing of the ip urls in file

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Apr 23 18:49:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-04-23 19:41:21 +0100
URL: https://github.com/rspamd/rspamd/commit/96233956371f0312e894be5d03675377128af8ad (HEAD -> master)

[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;


More information about the Commits mailing list