From 095879911f518e4d4c447caa352498b449590301 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Wed, 19 Oct 2016 21:27:20 -0700 Subject: [PATCH] MAC addresses must have a :, - or . in them --- dhcpd/lookup_host.cgi | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dhcpd/lookup_host.cgi b/dhcpd/lookup_host.cgi index 5116c0f79..576dc1343 100755 --- a/dhcpd/lookup_host.cgi +++ b/dhcpd/lookup_host.cgi @@ -12,11 +12,13 @@ $conf = &get_config(); @hosts = &find_recursive("host", $conf); # Check to see if the host contains 6 hex bytes for a Mac address -(my $justbytes = $in{'host'}) =~ s/[^A-Fa-f0-9]//g; -if ($justbytes =~ /^[0-9a-f]{12}$/i) { - # Treat this host as a mac address with arbitrary formatting - $in{'host'} = join(':', unpack("(A2)*", $justbytes) ); -} +if ($in{'host'} =~ /:|\-|\./) { + (my $justbytes = $in{'host'}) =~ s/[^A-Fa-f0-9]//g; + if ($justbytes =~ /^[0-9a-f]{12}$/i) { + # Treat this host as a mac address with arbitrary formatting + $in{'host'} = join(':', unpack("(A2)*", $justbytes) ); + } + } # Look for a match %access = &get_module_acl();