Skip to content

Commit 366b1ad

Browse files
committed
Also relate spf record check to a soa
1 parent 8a03bc6 commit 366b1ad

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

interface/web/dns/dns_dmarc_edit.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,10 @@ function onSubmit() {
236236
}
237237

238238
// ... and an active spf-record (this breaks the current draft but DMARC is useless if you use DKIM or SPF
239-
$sql = "SELECT * FROM dns_rr WHERE name LIKE ? AND type='TXT' AND (data LIKE 'v=spf1%' AND active = 'y')";
240-
$temp = $app->db->queryAllRecords($sql, $domain_name.'.');
239+
$sql = "SELECT * FROM dns_rr
240+
LEFT JOIN dns_soa ON (dns_rr.zone=dns_soa.id)
241+
WHERE dns_soa.origin = ? AND (dns_rr.name LIKE ? OR dns_rr.name = '') AND type='TXT' AND data like 'v=spf1%' AND dns_rr.active='Y'";
242+
$temp = $app->db->queryAllRecords($sql, $soa['origin'], $soa['origin']);
241243
// abort if more than 1 active spf-records (backward-compatibility)
242244
if (is_array($temp[1])) {
243245
if (isset($app->tform->errorMessage )) $app->tform->errorMessage = '<br/>' . $app->tform->errorMessage;

0 commit comments

Comments
 (0)