Skip to content
Snippets Groups Projects
Commit bd4c2e96 authored by Marius Burkard's avatar Marius Burkard
Browse files

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
parents 833d4ecc a1e70342
No related branches found
No related tags found
No related merge requests found
......@@ -216,7 +216,7 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
$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 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
$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;
......
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