Skip to content

Commit bd4c2e9

Browse files
author
Marius Burkard
committed
Merge branch 'stable-3.1' into 'stable-3.1'
FIX #3939: Import TXT resource records with semicolons and respecting it's case I replace the RegEx that ISPConfig uses to see if it must truncate the line sith a semicolon. Now the line does not get truncated if the semicolon is between quotes. Later, when ISPConfig lower the case of the parts of the lines, I changed the condition, so it does not lower the case of parts that begin or finish with quotes (First and last part or TXT RRs) or it has a semicolon, meaning it was between quotes and wasn't replaced previously. See merge request !351
2 parents 833d4ec + a1e7034 commit bd4c2e9

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)