Skip to content

Commit

Permalink
Add option for domains to search
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Sep 29, 2011
1 parent acb9085 commit 6f28a79
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions dhcpd/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ Hostname, IP address and MAC address clashes are now only checked for in the sam
Multiple leases can now be deleted at once, thanks to a suggestion from Berni Elbourn.
---- Changes since 1.540 ----
Added a Module Config option to automatically refresh the lease list every few seconds, and a link to force a manual refresh.
---- Changes since 1.560 ----
Added a client option for subnets and groups for DNS domains to search.
11 changes: 10 additions & 1 deletion dhcpd/edit_options.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ print &option_input($text{'eopt_domname'}, "domain-name", \@opts, 3);
print &option_input($text{'eopt_dnsserv'}, "domain-name-servers", \@opts, 2);
print "</tr>\n";

print "<tr>\n";
print &option_input($text{'eopt_domsearch'}, "domain-search", \@opts, 6);
print "</tr>\n";

print "<tr>\n";
print &option_input($text{'eopt_timeserv'}, "time-servers", \@opts, 2);
print &option_input($text{'eopt_logserv'}, "log-servers", \@opts, 2);
Expand Down Expand Up @@ -230,6 +234,7 @@ print "<input type=submit value=\"$text{'save'}\"></form>\n"
# 3 - String
# 4 - Yes/no flag
# 5 - IP address pairs
# 6 - String list
sub option_input
{
local($rv, $v, $i);
Expand All @@ -240,7 +245,7 @@ for($i=0; $i<@{$_[2]}; $i++) {
}
}
$rv = "<td><b>$_[0]</b></td>\n";
if ($_[3] == 5 || $_[4]) { $rv .= "<td colspan=3 nowrap>"; }
if ($_[3] == 5 || $_[3] == 6 || $_[4]) { $rv .= "<td colspan=3 nowrap>"; }
else { $rv .= "<td nowrap>"; }
$rv .= sprintf "<input type=radio name=$_[1]_def value=1 %s> $text{'default'}\n",
$v ? "" : "checked";
Expand Down Expand Up @@ -281,6 +286,10 @@ elsif ($_[3] == 5) {
}
$rv .= "\">\n";
}
elsif ($_[3] == 6) {
@vl = map { s/,//g; $_ } grep { $_ ne "," } @vl;
$rv .= "<input name=$_[1] size=50 value=\"".join(" ", @vl)."\">\n";
}
if ($_[4]) {
$rv .= &ui_checkbox($_[1]."_bool", 1, $_[4], lc($bool) eq "true");
}
Expand Down
1 change: 1 addition & 0 deletions dhcpd/lang/en
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ eopt_smask=Subnet mask
eopt_baddr=Broadcast address
eopt_domname=Domain name
eopt_dnsserv=DNS servers
eopt_domsearch=DNS domains to search
eopt_timeserv=Time servers
eopt_logserv=Log servers
eopt_swapserv=Swap server
Expand Down
7 changes: 5 additions & 2 deletions dhcpd/save_options.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ else {
&save_option("broadcast-address", 0, $client, $indent);
&save_option("domain-name", 3, $client, $indent);
&save_option("domain-name-servers", 2, $client, $indent);
&save_option("domain-search", 6, $client, $indent);
&save_option("time-servers", 2, $client, $indent);
&save_option("log-servers", 2, $client, $indent);
&save_option("swap-server", 2, $client, $indent);
Expand Down Expand Up @@ -227,8 +228,7 @@ else {
$nv =~ /^-?\d+$/ || &error("'$nv' $text{'sopt_invalidint'}");
}
elsif ($_[1] == 2) {
local $ip;
foreach $ip (@nv) {
foreach my $ip (@nv) {
&to_ipaddress($ip) ||
&error("'$ip' $text{'sopt_invalidip'}");
}
Expand All @@ -250,6 +250,9 @@ else {
}
$nv = join(", ", @nnv);
}
elsif ($_[1] == 6) {
$nv = join(", ", map { "\"$_\"" } @nv);
}
local @bool = !$_[4] ? ( ) :
$in{$_[0]."_bool"} ? ( "true" ) : ( "false" );
local $dir = { 'name' => 'option',
Expand Down

0 comments on commit 6f28a79

Please sign in to comment.