diff options
author | Erik Fonnesbeck <efonnes@gmail.com> | 2010-11-09 05:14:29 -0700 |
---|---|---|
committer | Erik Fonnesbeck <efonnes@gmail.com> | 2010-11-09 05:14:29 -0700 |
commit | 678dfd0fa8d629bd45edad576c99d03aa8f40d70 (patch) | |
tree | f3fc53954b667acbc7c1c43cc0ddca4f258531a6 /etc/inc/services.inc | |
parent | 5d27a3dc148ed4ad8228605b2547e1115d66f86b (diff) | |
download | pfsense-678dfd0fa8d629bd45edad576c99d03aa8f40d70.zip pfsense-678dfd0fa8d629bd45edad576c99d03aa8f40d70.tar.gz |
Add a setting for the data type of values used with DHCP option numbers and input validation for each type. Fixes #962
Diffstat (limited to 'etc/inc/services.inc')
-rw-r--r-- | etc/inc/services.inc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 487178e..68a7128 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -120,7 +120,11 @@ function services_dhcpd_configure() { foreach ($dhcpdcfg as $dhcpif => $dhcpifconf) { if(is_array($dhcpifconf['numberoptions']) && is_array($dhcpifconf['numberoptions']['item'])) { foreach($dhcpifconf['numberoptions']['item'] as $itemidx => $item) { - $custoptions .= "option custom-{$dhcpif}-{$itemidx} code {$item['number']} = text;\n"; + if(!empty($item['type'])) + $itemtype = $item['type']; + else + $itemtype = "text"; + $custoptions .= "option custom-{$dhcpif}-{$itemidx} code {$item['number']} = {$itemtype};\n"; } } } @@ -314,7 +318,10 @@ EOD; $dhcpdconf .= "\n"; if($dhcpifconf['numberoptions']['item']) { foreach($dhcpifconf['numberoptions']['item'] as $itemidx => $item) { - $dhcpdconf .= " option custom-{$dhcpif}-{$itemidx} \"{$item['value']}\";\n"; + if(empty($item['type']) || $item['type'] == "text") + $dhcpdconf .= " option custom-{$dhcpif}-{$itemidx} \"{$item['value']}\";\n"; + else + $dhcpdconf .= " option custom-{$dhcpif}-{$itemidx} {$item['value']};\n"; } } |