From ac39c49ec490a2bf08f3f2fe732b5b16efde43e3 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Thu, 6 May 2010 22:20:44 -0700 Subject: [PATCH] Multi-value options support --- dhcpd/CHANGELOG | 2 ++ dhcpd/edit_options.cgi | 3 ++- dhcpd/save_options.cgi | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dhcpd/CHANGELOG b/dhcpd/CHANGELOG index 937a74861..d3ac8208f 100644 --- a/dhcpd/CHANGELOG +++ b/dhcpd/CHANGELOG @@ -35,3 +35,5 @@ Converted buttons on the module's main page to use the Webmin UI library. Expired leases are no longer counted towards usage on the DHCP Leases page. Added a mode to the DHCP Leases page to show usage by subnet, thanks to a suggestion by Coles. When applying the configuration fails with an error mentioning a line in the config file, 10 lines around that will also be displayed by Webmin in the error. +---- Changes since 1.510 ---- +Added support for multi-value options, thanks to a patch from Luke Suchocki. diff --git a/dhcpd/edit_options.cgi b/dhcpd/edit_options.cgi index 01684a5dd..1a002fa84 100755 --- a/dhcpd/edit_options.cgi +++ b/dhcpd/edit_options.cgi @@ -147,8 +147,9 @@ if ($config{'dhcpd_version'} >= 3) { printf "\n", $o->{'values'}->[2]; print "$text{'eopt_dtype'}\n"; + my $a=scalar(@{$o->{'values'}})-1; printf "\n", - $o->{'values'}->[4]; + join(" ",@{$o->{'values'}}[4..$a]); print " \n"; } diff --git a/dhcpd/save_options.cgi b/dhcpd/save_options.cgi index 97c7fdc65..af6524944 100755 --- a/dhcpd/save_options.cgi +++ b/dhcpd/save_options.cgi @@ -98,7 +98,7 @@ if ($config{'dhcpd_version'} >= 3) { &error(&text('sopt_edname', $in{"dname_$i"})); $in{"dnum_$i"} =~ /^\d+$/ || &error(&text('sopt_ednum', $in{"dnum_$i"})); - $in{"dtype_$i"} =~ /^[a-z0-9\.\-\_]+$/i || + $in{"dtype_$i"} =~ /^[a-z0-9\s\.\-\_]+$/i || &error(&text('sopt_edtype', $in{"dtype_$i"})); push(@newdefs, { 'name' => 'option', 'values' => [ $in{"dname_$i"}, "code",