diff --git a/dhcpd/CHANGELOG b/dhcpd/CHANGELOG index ab0642470..5ae96d089 100644 --- a/dhcpd/CHANGELOG +++ b/dhcpd/CHANGELOG @@ -26,3 +26,5 @@ Support the new configuration file format for custom options, as used in DHCPd v ---- Changes since 1.430 ---- Fixed bug that can cause option definitions and values to be incorrectly ordered. Custom option types defined at a higher level (such as in a subnet) can be used in the Edit Options page at lower levels (such as in a host). +---- Changes since 1.440 ---- +When a subnet or host is renamed, the user's ACL is updated to match. diff --git a/dhcpd/save_host.cgi b/dhcpd/save_host.cgi index 4ed92005a..fc10238ed 100755 --- a/dhcpd/save_host.cgi +++ b/dhcpd/save_host.cgi @@ -29,6 +29,7 @@ else { &error("$text{'eacl_np'} $text{'eacl_puh'}") unless &can('rw', \%access, $host) && (!$npar || &can('rw', \%access, $npar)); + $oldname = $host->{'values'}->[0]; } # save @@ -139,6 +140,10 @@ else { elsif ($par eq $npar) { # Update host &save_directive($par, [ $host ], [ $host ], $indent); + if ($oldname ne $in{'name'}) { + &drop_dhcpd_acl('hst', \%access, $oldname); + &save_dhcpd_acl('rw', 'hst', \%access, $in{'name'}); + } } else { # Move this host diff --git a/dhcpd/save_subnet.cgi b/dhcpd/save_subnet.cgi index 75b4d6fb1..2dd9db0d8 100755 --- a/dhcpd/save_subnet.cgi +++ b/dhcpd/save_subnet.cgi @@ -67,6 +67,7 @@ else { &error("'$in{'network'}' $text{'ssub_invalidsubaddr'}"); &check_ipaddress($in{'netmask'}) || &error("'$in{'netmask'}' $text{'ssub_invalidnmask'}"); + $oldnetwork = $sub->{'values'}->[0]; $sub->{'values'} = [ $in{'network'}, "netmask", $in{'netmask'} ]; } @@ -177,8 +178,14 @@ else { &save_directive($npar, [ ], [ $sub ], $nindent); } elsif ($par eq $npar) { - # Update the subnet + # Update the subnet in the current parent &save_directive($par, [ $sub ], [ $sub ], $nindent); + if ($in{'network'} ne $oldnetwork) { + # Fix the ACL + &drop_dhcpd_acl('sub', \%access, $oldnetwork); + &save_dhcpd_acl('rw','sub',\%access, + $in{'network'}); + } } else { # Move the subnet