Marius Burkard
2016-06-03 bd4c2e96fd4566bfcd8042f82ccac090419734a3
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
1 files modified
11 ■■■■ changed files
interface/web/dns/dns_import.php 11 ●●●● patch | view | raw | blame | history
interface/web/dns/dns_import.php
@@ -216,7 +216,7 @@
        $line = trim($line);
        if ($line != '' && substr($line, 0, 1) != ';'){
            if(strpos($line, ";") !== FALSE) {
                if (!preg_match("/v=DKIM|v=DMARC/",$line)) {
                if(!preg_match("/\"[^\"]+;[^\"]*\"/", $line)) {
                    $line = substr($line, 0, strpos($line, ";"));
                }
            }
@@ -267,12 +267,13 @@
        $parts = explode(' ', $line);
        // make elements lowercase
        $dkim=@($parts[3]=='"v=DKIM1;')?true:false;
        $dmarc=@($parts[3]=='"v=DMARC1;')?true:false;
        $new_parts = array();
        foreach($parts as $part){
            if(!$dkim && !$dmarc) {
        if(
            (strpos($part, ';') === false) &&
            (!preg_match("/^\"/", $part)) &&
            (!preg_match("/\"$/", $part))
        ) {
                $new_parts[] = strtolower($part);
            } else {
                $new_parts[] = $part;