Choose style:

Author Topic: Incorrect regex for static DHCP  (Read 5518 times)

0 Members and 1 Guest are viewing this topic.

Offline mtnmkr

  • Newbie
  • Posts: 2
  • Thanks: 0
  • Registered : 18/01/2015
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Incorrect regex for static DHCP
« on: January 18, 2015, 11:56:19 pm »
The hostname validation regex for static DHCP leases prevents assigning perfectly valid hostnames, per the guidelines in RFCs 952 and 1123.

Current regex: /^[a-zA-Z0-9]+$/
Should be more like: /^[a-z0-9][a-z0-9\-]*$/i

This shouldn't be difficult to fix.

Offline matt

  • Backer
  • *
  • Posts: 151
  • Thanks: 1
  • Registered : 26/08/2013
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Incorrect regex for static DHCP
« Reply #1 on: January 19, 2015, 11:14:48 am »
The hostname validation regex for static DHCP leases prevents assigning perfectly valid hostnames, per the guidelines in RFCs 952 and 1123.

Current regex: /^[a-zA-Z0-9]+$/
Should be more like: /^[a-z0-9][a-z0-9\-]*$/i

This shouldn't be difficult to fix.

Technically they can't end with a hyphen either, more like:

[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]
or
[A-Za-z0-9]([A-Za-z0-9\-]*[A-Za-z0-9])?

Offline mtnmkr

  • Newbie
  • Posts: 2
  • Thanks: 0
  • Registered : 18/01/2015
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Incorrect regex for static DHCP
« Reply #2 on: January 21, 2015, 09:07:38 pm »
Good point.  So then /^[a-z0-9][a-z0-9\-]*[a-z0-9]$/i should work.  Either way, it should be a pretty easy thing to fix.  Until then, I guess I won't be able to assign static leases for my servers.  :(

I guess I could always use the OpenWRT section, assuming it bypasses the input validation on the Almond side.  It's not that big a deal since I can't really swap all my servers over yet anyway.
« Last Edit: January 21, 2015, 09:50:56 pm by mtnmkr »

 

Page created in 0.049 seconds with 18 queries.