about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-08-12 12:40:25 +0200
committerStarfall <us@starfall.systems>2020-08-25 13:36:49 -0500
commitf2099bcc533a221a597fabc585ddfe7f295db851 (patch)
tree8437386bb0d319fa28a7199c29781bd2ab985590 /lib
parentd1cf10154133d63a770fe263d788908b04571513 (diff)
Improve email address validation (#14565)
* Increase DNS timeout from 1 second to 5 seconds for MX check

1 seconds is rather short when using a recursive DNS resolver which
hasn't got a cached result already available. Use 5 seconds instead,
which is the timeout value we use for outgoing HTTP queries.

* Add more precise error messages for invalid e-mail addresses
Diffstat (limited to 'lib')
-rw-r--r--lib/mastodon/email_domain_blocks_cli.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/mastodon/email_domain_blocks_cli.rb b/lib/mastodon/email_domain_blocks_cli.rb
index 7fe1efaaa..55a637d68 100644
--- a/lib/mastodon/email_domain_blocks_cli.rb
+++ b/lib/mastodon/email_domain_blocks_cli.rb
@@ -63,7 +63,7 @@ module Mastodon
         ips       = []
 
         Resolv::DNS.open do |dns|
-          dns.timeouts = 1
+          dns.timeouts = 5
           hostnames = dns.getresources(email_domain_block.domain, Resolv::DNS::Resource::IN::MX).to_a.map { |e| e.exchange.to_s }
 
           ([email_domain_block.domain] + hostnames).uniq.each do |hostname|