Skip to content
Snippets Groups Projects
Commit a1e70342 authored by Cristian G. Segarra's avatar Cristian G. Segarra
Browse files

FIX #3939: Import TXT resource records with semicolons and respecting it's case

parent b1155720
No related branches found
No related tags found
1 merge request!351FIX #3939: Import TXT resource records with semicolons and respecting it's case
...@@ -216,7 +216,7 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name' ...@@ -216,7 +216,7 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
$line = trim($line); $line = trim($line);
if ($line != '' && substr($line, 0, 1) != ';'){ if ($line != '' && substr($line, 0, 1) != ';'){
if(strpos($line, ";") !== FALSE) { if(strpos($line, ";") !== FALSE) {
if (!preg_match("/v=DKIM|v=DMARC/",$line)) { if(!preg_match("/\"[^\"]+;[^\"]*\"/", $line)) {
$line = substr($line, 0, strpos($line, ";")); $line = substr($line, 0, strpos($line, ";"));
} }
} }
...@@ -267,12 +267,13 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name' ...@@ -267,12 +267,13 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
$parts = explode(' ', $line); $parts = explode(' ', $line);
// make elements lowercase // make elements lowercase
$dkim=@($parts[3]=='"v=DKIM1;')?true:false;
$dmarc=@($parts[3]=='"v=DMARC1;')?true:false;
$new_parts = array(); $new_parts = array();
foreach($parts as $part){ foreach($parts as $part){
if(!$dkim && !$dmarc) { if(
(strpos($part, ';') === false) &&
(!preg_match("/^\"/", $part)) &&
(!preg_match("/\"$/", $part))
) {
$new_parts[] = strtolower($part); $new_parts[] = strtolower($part);
} else { } else {
$new_parts[] = $part; $new_parts[] = $part;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment