Securifi Community Forum

Securifi Products => Almond+ => Topic started by: mtnmkr on January 18, 2015, 11:56:19 pm

Title: Incorrect regex for static DHCP
Post by: mtnmkr 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.
Title: Re: Incorrect regex for static DHCP
Post by: matt 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])?
Title: Re: Incorrect regex for static DHCP
Post by: mtnmkr 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.