Commit a96fa8b9 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Merge branch...

Merge branch '5923-cname-record-appear-on-another-domain-when-they-contain-the-machine-cn' into '1.4-dev'

Resolve "cname record appear on another domain when they contain the machine cn"

See merge request fusiondirectory/fd-plugins!520

(cherry picked from commit 678e867f)

d58b2156 🚑 fix(dns) Use more restritive regexp for record filter
parent f6055e9f
......@@ -83,7 +83,17 @@ class DnsRecordsFilteredAttribute extends DnsRecordsAttribute
}
$ips = $this->plugin->parent->getBaseObject()->ipHostNumber;
$cn = preg_replace('/\$$/', '', $this->plugin->parent->getBaseObject()->cn);
if (in_array($values[2], $ips) || (!empty($cn) && (($values[0] == $cn) || preg_match('/'.preg_quote($cn.'.'.$this->getZoneName(), '/i').'/', $value[2])))) {
if (
in_array($values[2], $ips) ||
(
!empty($cn) &&
(
($values[0] == $cn) ||
preg_match('/^'.preg_quote($cn.'.'.$this->getZoneName(), '/i').'$/', $value[2]) ||
preg_match('/ '.preg_quote($cn.'.'.$this->getZoneName(), '/i').'$/', $value[2])
)
)
) {
return $values;
} else {
return array();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment