Cristian G. Segarra
2016-05-31 a1e703424e1108fbd64f17a274b241dd1fafaa43
FIX #3939: Import TXT resource records with semicolons and respecting it's case
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;