manish-yadav / pdns-gui

Automatically exported from code.google.com/p/pdns-gui
0 stars 0 forks source link

regex patterns used in validation appear to be incorrectly written #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I see the following preg regex patterns used in the system.
/^[a-z,\.,0-9,-,_]+\s[a-z,\.,0-9,-,_]+%DOMAIN%\s%SERIAL%$/
'/^[a-z,\.,0-9,-,_]+\s[a-z,\.,0-9,-,_]+'.$this->domain->getName().'\s[0-
9]+$/'
/^[a-z,.,0-9,-,_]+$/ (x2)

There are a few issues here:
* Inconsistency in use of . vs \. (not really an issue, but the third 
pattern is a little inconsistent)
* $this->domain->getName() should be preg_quote($this->domain->getName(), 
'/'),  otherwise characters like . do not get interpreted correctly.
* The [] parts of the pattern are written incorrectly.
The [] parts of the pattern appear as if they were writing a comma 
separated list of values, this is NOT how regular expressions work. The 
inclusion of the commas in that list makes an invalid , a valid part of an 
entry, and the way it's written actually makes the - invalid.

{{{
/^[a-z,.,0-9,-,_]+$/ should be /^[-_a-z0-9\.]+$/
/^[a-z,\.,0-9,-,_]+\s[a-z,\.,0-9,-,_]+%DOMAIN%\s%SERIAL%$/ should be /^[-_a-
z0-9\.]+\s[-_a-z0-9\.]+%DOMAIN%\s%SERIAL%$/
'/^[a-z,\.,0-9,-,_]+\s[a-z,\.,0-9,-,_]+'.$this->domain->getName().'\s[0-
9]+$/' should be '/^[-_a-z0-9\.]+\s[-_a-z0-9\.]+'.preg_quote($this->domain-
>getName(),'/').'\s[0-9]+$/'
}}}

Original issue reported on code.google.com by nadir.se...@gmail.com on 21 Mar 2010 at 2:13

GoogleCodeExporter commented 8 years ago
Fixed in commit 95

Original comment by level7systems@googlemail.com on 25 Apr 2010 at 10:53