1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2025-12-01 05:43:04 +00:00

add semicolon to DKIM record data (#825)

* add semicolon to dkim record data

Addresses https://github.com/atech/postal/issues/812

As the semicolon at the end of a DKIM record is optional, some DNS software removes it.
The above change sanitizes the DKIM record before it gets checked

* fixed method typo

fixed a typo caused by my US spelling checker

* typo fix v2

a proper fix for the typo
هذا الالتزام موجود في:
Morne Lotze
2019-06-11 11:41:39 +02:00
ملتزم من قبل Charlie Smurthwaite
الأصل 0fb323af3f
التزام 7ca7b43fda

عرض الملف

@@ -69,6 +69,10 @@ class Domain
# DKIM # DKIM
# #
def sanitised_dkim_record
return records.first.strip.ends_with?(';') ? records.first.strip : "#{records.first.strip};"
end
def check_dkim_record def check_dkim_record
domain = "#{dkim_record_name}.#{name}" domain = "#{dkim_record_name}.#{name}"
result = resolver.getresources(domain, Resolv::DNS::Resource::IN::TXT) result = resolver.getresources(domain, Resolv::DNS::Resource::IN::TXT)
@@ -80,7 +84,7 @@ class Domain
if records.size > 1 if records.size > 1
self.dkim_status = 'Invalid' self.dkim_status = 'Invalid'
self.dkim_error = "There are #{records.size} records for at #{domain}. There should only be one." self.dkim_error = "There are #{records.size} records for at #{domain}. There should only be one."
elsif records.first.strip != self.dkim_record elsif sanitised_dkim_record != self.dkim_record
self.dkim_status = 'Invalid' self.dkim_status = 'Invalid'
self.dkim_error = "The DKIM record at #{domain} does not match the record we have provided. Please check it has been copied correctly." self.dkim_error = "The DKIM record at #{domain} does not match the record we have provided. Please check it has been copied correctly."
else else