diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-05-17 16:56:45 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-17 16:56:45 +0600 |
commit | c13a45b71d7edcb692c2f1269a517bf26d471b3c (patch) | |
tree | c645ee0616310de80c8387873155f1c600f9720e /src | |
parent | f0ba143490b2b8828623b2e498a56bc01fdaff40 (diff) | |
parent | 155edbd80d904794f2aefd9cc5daa097eef21565 (diff) | |
download | rspamd-c13a45b71d7edcb692c2f1269a517bf26d471b3c.tar.gz rspamd-c13a45b71d7edcb692c2f1269a517bf26d471b3c.zip |
Merge pull request #4973 from rspamd/vstakhov-fix-dmarc-rua
Fix parsing of DMARC records with spaces
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/url.c | 14 |
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; + } } } } |