strict/warn

This commit is contained in:
Joe Cooper
2016-05-30 18:44:57 -07:00
parent a27441b24c
commit a214f413c5

View File

@@ -1,18 +1,22 @@
#!/usr/local/bin/perl
# Delete multiple records from a zone file
use strict;
use warnings;
# Globals
our (%access, %text, %in, %config);
require './bind8-lib.pl';
&ReadParse();
&error_setup($text{'drecs_err'});
$zone = &get_zone_name_or_error($in{'zone'}, $in{'view'});
$dom = $zone->{'name'};
my $zone = &get_zone_name_or_error($in{'zone'}, $in{'view'});
my $dom = $zone->{'name'};
&can_edit_zone($zone) ||
&error($text{'recs_ecannot'});
&can_edit_type($in{'type'}, \%access) ||
&error($text{'recs_ecannottype'});
# Find the records
@d = split(/\0/, $in{'d'});
my @d = split(/\0/, $in{'d'});
@d || &error($text{'drecs_enone'});
# Check if confirmation is needed
@@ -33,19 +37,20 @@ if (!$in{'confirm'} && $config{'confirm_rec'}) {
}
else {
# Delete them
@recs = &read_zone_file($zone->{'file'}, $dom);
my @recs = &read_zone_file($zone->{'file'}, $dom);
foreach $d (sort { $b <=> $a } @d) {
($num, $id) = split(/\//, $d, 2);
$r = &find_record_by_id(\@recs, $id, $num);
my %bumpedrev;
foreach my $d (sort { $b <=> $a } @d) {
my ($num, $id) = split(/\//, $d, 2);
my $r = &find_record_by_id(\@recs, $id, $num);
next if (!$r);
if ($in{'rev'}) {
# Find the reverse
$fulloldvalue0 = &convert_to_absolute(
my $fulloldvalue0 = &convert_to_absolute(
$r->{'values'}->[0], $dom);
$fulloldname = &convert_to_absolute(
my $fulloldname = &convert_to_absolute(
$r->{'name'}, $dom);
($orevconf, $orevfile, $orevrec) = &find_reverse(
my ($orevconf, $orevfile, $orevrec) = &find_reverse(
$r->{'values'}->[0], $in{'view'});
if ($orevrec && &can_edit_reverse($orevconf) &&
@@ -56,7 +61,7 @@ else {
&lock_file(&make_chroot($orevrec->{'file'}));
&delete_record($orevrec->{'file'} , $orevrec);
&lock_file(&make_chroot($orevfile));
@orrecs = &read_zone_file($orevfile, $orevconf->{'name'});
my @orrecs = &read_zone_file($orevfile, $orevconf->{'name'});
if (!$bumpedrev{$orevfile}++) {
&bump_soa_record($orevfile, \@orrecs);
}