Skip to content

Commit

Permalink
Update DNSResolver.cpp
Browse files Browse the repository at this point in the history
DKIM signature verification when published DNS record is CNAME

Only seems to be a issue on 5.7.x

For details see:
https://www.hmailserver.com/forum/viewtopic.php?f=7&t=34834&p=218884#p218884
  • Loading branch information
RvdHout authored and martinknafve committed Mar 7, 2020
1 parent b3d3564 commit 554765d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions hmailserver/source/Server/Common/TCPIP/DNSResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,20 @@ namespace HM

bool result = resolver.Query(sDomain, DNS_TYPE_TEXT, foundRecords);

if (foundRecords.size() == 0)
{
// The queries for TXT didn't return any records. Attempt to look up via CNAME
std::vector<DNSRecord> foundCNames;
bool cnameQueryResult = resolver.Query(sDomain, DNS_TYPE_CNAME, foundCNames);

// A CNAME should only point at a single host name.
if (cnameQueryResult && foundCNames.size() == 1)
{
auto cnameHostName = foundCNames[0].GetValue();
return GetTXTRecords(cnameHostName, foundResult);
}
}

foundResult = GetDnsRecordsValues_(foundRecords);

return result;
Expand Down

0 comments on commit 554765d

Please sign in to comment.