Version information
Latest
Steps to replicate
- Have a domain such as domain.com with MX entry
- Have a subdomain such as feedback.domain.com with another MX entry
- Enable SpamExperts for domain.com
Actual result
MX entries for feedback.domain.com gets cleared out
Expected result
Removing MX entries should be an exact match, not all MX entries for domain.com zone
Other notes
SpamExperts module uses listmxs function ( https://documentation.cpanel.net/display/DD/WHM+API+1+Functions+-+listmxs ) , which will return MX entries for the domain including subdomains.
That in itself is fine, but you should do an exact match for the domain when removing MX entries.
In
|
private function removeMXRecords($domain) |
|
{ |
|
$this->_logger->debug("Removing MX records for '{$domain}'"); |
|
$records = $this->getMxRecords($domain); |
|
|
|
// Reorder list so the highest line is handled first, because line numbers *will* change |
|
$this->_logger->debug("MX sort before:" . serialize($records)); |
|
$records = array_sort($records, 'Line', SORT_DESC); // Sort by highest number first |
|
$this->_logger->debug("MX sort after:" . serialize($records)); |
|
|
|
if (is_array($records)) { |
|
|
|
// Remove all found MX records. |
|
foreach ($records as $record) { |
|
$this->_logger->debug("Removing record for {$domain} (Line: {$record['Line']})"); |
|
|
|
$this->removeDNSRecord($domain, $record['Line']); |
|
} |
|
} |
|
|
|
return true; |
|
} |
you simply loop over every matched entry and removes it, even for subdomains.
Alternatively you can implement UAPI where it does actual filtering on the exact domain in https://documentation.cpanel.net/display/DD/UAPI+Functions+-+Email%3A%3Alist_mxs
Version information
Latest
Steps to replicate
Actual result
MX entries for feedback.domain.com gets cleared out
Expected result
Removing MX entries should be an exact match, not all MX entries for
domain.comzoneOther notes
SpamExperts module uses
listmxsfunction ( https://documentation.cpanel.net/display/DD/WHM+API+1+Functions+-+listmxs ) , which will return MX entries for the domain including subdomains.That in itself is fine, but you should do an exact match for the domain when removing MX entries.
In
cpanel-addon/library/SpamFilter/PanelSupport/Cpanel.php
Lines 1123 to 1144 in 75cc25c
Alternatively you can implement UAPI where it does actual filtering on the exact domain in https://documentation.cpanel.net/display/DD/UAPI+Functions+-+Email%3A%3Alist_mxs