Handle short DHCP hostnames

This commit is contained in:
Jamie Cameron
2008-08-29 18:41:00 +00:00
parent 5b03e2755b
commit 4187d8df07
3 changed files with 11 additions and 2 deletions

View File

@@ -20,6 +20,11 @@ foreach $d (@d) {
}
($fn, $recs) = &get_dns_zone();
($old) = grep { lc($_->{'name'}) eq lc($d).'.' } @$recs;
if (!$old) {
# Search by hostname only
($old) = grep { lc($_->{'name'}) eq
lc($d).'.'.lc($config{'domain'}).'.' } @$recs;
}
if ($old) {
&bind8::delete_record($fn, $old);
&bind8::bump_soa_record($fn, $recs);

View File

@@ -1,4 +1,4 @@
desc=DHCP and DNS Hosts
category=servers
depends=bind8 dhcpd net
version=1.4
version=1.5

View File

@@ -7,11 +7,15 @@ require './dhcp-dns-lib.pl';
@hosts = &list_dhcp_hosts();
($fn, $recs) = &get_dns_zone();
if (!$in{'new'}) {
# Get existing host object
# Get existing host object and DNS record
($host) = grep { $_->{'values'}->[0] eq $in{'old'} } @hosts;
$host || &error($text{'edit_egone'});
$oldpar = $host->{'parent'};
($old) = grep { lc($_->{'name'}) eq lc($in{'old'}).'.' } @$recs;
if (!$old) {
($old) = grep { lc($_->{'name'}) eq
lc($in{'old'}).'.'.lc($config{'domain'}).'.' } @$recs;
}
if ($in{'subnet'} eq $in{'oldsubnet'}) {
$par = $oldpar;
}