Skip to content

Commit a1e7034

Browse files
committed
FIX #3939: Import TXT resource records with semicolons and respecting it's case
1 parent b115572 commit a1e7034

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

interface/web/dns/dns_import.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
$line = trim($line);
217217
if ($line != '' && substr($line, 0, 1) != ';'){
218218
if(strpos($line, ";") !== FALSE) {
219-
if (!preg_match("/v=DKIM|v=DMARC/",$line)) {
219+
if(!preg_match("/\"[^\"]+;[^\"]*\"/", $line)) {
220220
$line = substr($line, 0, strpos($line, ";"));
221221
}
222222
}
@@ -267,12 +267,13 @@
267267
$parts = explode(' ', $line);
268268

269269
// make elements lowercase
270-
$dkim=@($parts[3]=='"v=DKIM1;')?true:false;
271-
$dmarc=@($parts[3]=='"v=DMARC1;')?true:false;
272-
273270
$new_parts = array();
274271
foreach($parts as $part){
275-
if(!$dkim && !$dmarc) {
272+
if(
273+
(strpos($part, ';') === false) &&
274+
(!preg_match("/^\"/", $part)) &&
275+
(!preg_match("/\"$/", $part))
276+
) {
276277
$new_parts[] = strtolower($part);
277278
} else {
278279
$new_parts[] = $part;

0 commit comments

Comments
 (0)