aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-05-16 16:05:59 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2024-05-16 16:05:59 +0100
commit0ecec4a2d2ee0337c51746b4b8ddd43e21276e05 (patch)
tree8c99b12f87aee6e01b8466097816e42122253b17 /src/libserver
parentbecf47bff76a0d1c9be00bdc2abe3a6e948862e3 (diff)
downloadrspamd-0ecec4a2d2ee0337c51746b4b8ddd43e21276e05.tar.gz
rspamd-0ecec4a2d2ee0337c51746b4b8ddd43e21276e05.zip
[Minor] Relax mailto processing with no TLD
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/url.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c
index b0ece195b..137e5b73c 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -559,7 +559,6 @@ void rspamd_url_init(const char *tld_file)
sizeof(struct url_matcher), 13000);
url_scanner->search_trie_full = rspamd_multipattern_create_sized(13000,
RSPAMD_MULTIPATTERN_ICASE | RSPAMD_MULTIPATTERN_UTF8);
- url_scanner->has_tld_file = true;
}
else {
url_scanner->matchers_full = NULL;
@@ -572,6 +571,10 @@ void rspamd_url_init(const char *tld_file)
if (tld_file != NULL) {
ret = rspamd_url_parse_tld_file(tld_file, url_scanner);
+
+ if (ret) {
+ url_scanner->has_tld_file = true;
+ }
}
if (url_scanner->matchers_full && url_scanner->matchers_full->len > 1000) {
@@ -2525,8 +2528,13 @@ rspamd_url_parse(struct rspamd_url *uri,
}
}
else {
- /* Ignore IP like domains for mailto, as it is really never supported */
- return URI_ERRNO_TLD_MISSING;
+ if (url_scanner->has_tld_file) {
+ /* Ignore IP like domains for mailto, as it is really never supported */
+ return URI_ERRNO_TLD_MISSING;
+ }
+ else {
+ uri->flags |= RSPAMD_URL_FLAG_NO_TLD;
+ }
}
}
}