Update ACLs when renaming hosts or subnets

This commit is contained in:
Jamie Cameron
2009-01-14 23:43:49 +00:00
parent f4b0fa917d
commit 314b56366d
3 changed files with 15 additions and 1 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -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