SpamExperts / cpanel-addon

WHM/cPanel add-on for providing integration with SpamExperts services
GNU General Public License v2.0
4 stars 8 forks source link

Enabling SpamExperts for domain removes MX entries from subdomains #242

Open lucasRolff opened 4 years ago

lucasRolff commented 4 years ago

Version information

Latest

Steps to replicate

  1. Have a domain such as domain.com with MX entry
  2. Have a subdomain such as feedback.domain.com with another MX entry
  3. 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 https://github.com/SpamExperts/cpanel-addon/blob/75cc25c48dc421f11c50f1cb14cc12edeade823f/library/SpamFilter/PanelSupport/Cpanel.php#L1123-L1144 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