operasoftware / dns-ui

Opera's LDAP-authenticated PowerDNS user interface
Apache License 2.0
283 stars 57 forks source link

regex for NAPTR #125

Closed joeyaben closed 5 years ago

joeyaben commented 5 years ago

I was not be able to add a NAPTR record within dns-ui, with the pdnsutil cli (pdnsutil add-record ZONE @ NAPTR '50 50 "s" "x-eduroam:radius.tls" "" _radsec._tcp.kennisnet.eduroam.nl') this is no issue.

After making some modifications to the data-content-pattern in the zone.php file I was be able to create the record within dns-ui.

old: <option value="NAPTR" data-content-pattern="[0-9]+\s+[0-9]+\s+&quot;[A-Z0-9]+&quot;\s+&quot;[\w+]+&quot;\s+&quot;[^&quot;]*&quot;\s+\S+">NAPTR</option>

new: <option value="NAPTR" data-content-pattern="[0-9]+\s+[0-9]+\s+&quot;[a-zA-Z0-9]&quot;+\s+&quot;[\S+]+&quot;+\s+&quot;[\S]*&quot;+\s+[\S]+">NAPTR</option>

I'm not sure if the new regex is causing some other issues, but for me it's working fine.

thomas-pike commented 5 years ago

The old regexp was trying to follow the specification of RFC 2915 but I see now that this was superseded by RFC 3403.

My proposed replacement would be: [0-9]+\s+[0-9]+\s+"[A-Za-z0-9]+"\s*"[^"]*"\s+"[^"]*"\s+\S+, or in HTML-escaped form: <option value="NAPTR" data-content-pattern="[0-9]+\s+[0-9]+\s+&quot;[A-Za-z0-9]+&quot;\s*&quot;[^&quot;]*&quot;\s+&quot;[^&quot;]*&quot;\s+\S+">NAPTR</option>