}
if (all_chars_domain) {
- /* Additionally check for a numeric IP as we can have some number here... */
- rspamd_url_maybe_regenerate_from_ip(uri, pool);
+ /* Additionally check for a numeric IP as we can have some number here */
+ /* Skip for mailto: as email domains cannot be numeric IPs (see #5823) */
+ if (uri->protocol != PROTOCOL_MAILTO) {
+ rspamd_url_maybe_regenerate_from_ip(uri, pool);
+
+ if (last_c == '.' && uri->hostlen > 1) {
+ /* Skip the last dot */
+ uri->tldlen = uri->hostlen - 1;
+ }
+ else {
+ uri->tldlen = uri->hostlen;
+ }
- if (last_c == '.' && uri->hostlen > 1) {
- /* Skip the last dot */
- uri->tldlen = uri->hostlen - 1;
+ uri->tldshift = uri->hostshift;
+ is_whole_hostname_tld = true;
}
- else {
- uri->tldlen = uri->hostlen;
- }
-
- uri->tldshift = uri->hostshift;
- is_whole_hostname_tld = true;
}
}
-- Check backslashes using existing obscured flag
if cfg.check_backslash and bit.band(flags, url_flags_tab.obscured) ~= 0 then
- lua_util.debugm(N, task, "URL contains backslashes")
- table.insert(findings, {
- symbol = symbols.backslash,
- options = { host or "obscured" }
- })
+ local url_text = url:get_text()
+ -- We check if we *really* have backslashes here as obscured flag is ambiguous
+ if url_text and url_text:find('\\', 1, true) then
+ lua_util.debugm(N, task, "URL contains backslashes")
+ table.insert(findings, {
+ symbol = symbols.backslash,
+ options = { host or "obscured" }
+ })
+ end
end
-- Only get full URL text if length/@ checks are enabled (expensive for long URLs)