From a6983f8df7f34704bf52edb8b8e4a9800a8e8b88 Mon Sep 17 00:00:00 2001 From: Joe Cooper Date: Fri, 3 Jun 2016 14:48:13 -0700 Subject: [PATCH] strict/warn, close $OUT filehandle --- bind8/zone_dnssecmigrate_dt.cgi | 43 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/bind8/zone_dnssecmigrate_dt.cgi b/bind8/zone_dnssecmigrate_dt.cgi index f627ce974..5d108bc21 100755 --- a/bind8/zone_dnssecmigrate_dt.cgi +++ b/bind8/zone_dnssecmigrate_dt.cgi @@ -1,21 +1,19 @@ #!/usr/local/bin/perl # Migrate an existing DNSSEC signed zone to using the DNSSEC-Tools suite for DNSSEC-related automation +use strict; +use warnings; +our (%access, %text, %in, %config); require './bind8-lib.pl'; -local $zone; -local $dom; -local $desc; -local $err; - &error_setup($text{'dt_zone_err'}); &ReadParse(); -$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{'master_ecannot'}); $access{'dnssec'} || &error($text{'dnssec_ecannot'}); -$desc = &ip6int_to_net(&arpa_to_ip($dom)); +my $desc = &ip6int_to_net(&arpa_to_ip($dom)); &ui_print_unbuffered_header($desc, $text{'dt_enable_title'}, "", undef, undef, undef, undef, &restart_links($zone)); @@ -31,7 +29,7 @@ if (&have_dnssec_tools_support()) { # generate the keyrec file print &text('dt_zone_createkrf', $dom),"
\n"; - $err = &dt_genkrf($zone, $z_chroot, $k_chroot); + my $err = &dt_genkrf($zone, $z_chroot, $k_chroot); if ($err) { &unlock_file($z_chroot); &error($err); @@ -52,19 +50,20 @@ if (&have_dnssec_tools_support()) { print &text('dt_zone_rrf_updating', $dom),"
\n"; $rrfile = $config{"dnssectools_rollrec"}; &lock_file($rrfile); - open(OUT,">> $rrfile") || &error($text{'dt_zone_errfopen'}); - print OUT "roll \"$dom\"\n"; - print OUT " zonename \"$dom\"\n"; - print OUT " zonefile \"$z_chroot\"\n"; - print OUT " keyrec \"$k_chroot\"\n"; - print OUT " kskphase \"0\"\n"; - print OUT " zskphase \"0\"\n"; - print OUT " ksk_rolldate \" \"\n"; - print OUT " ksk_rollsecs \"0\"\n"; - print OUT " zsk_rolldate \" \"\n"; - print OUT " zsk_rollsecs \"0\"\n"; - print OUT " maxttl \"0\"\n"; - print OUT " phasestart \"new\"\n"; + open(my $OUT, ">>", $rrfile) || &error($text{'dt_zone_errfopen'}); + print $OUT "roll \"$dom\"\n"; + print $OUT " zonename \"$dom\"\n"; + print $OUT " zonefile \"$z_chroot\"\n"; + print $OUT " keyrec \"$k_chroot\"\n"; + print $OUT " kskphase \"0\"\n"; + print $OUT " zskphase \"0\"\n"; + print $OUT " ksk_rolldate \" \"\n"; + print $OUT " ksk_rollsecs \"0\"\n"; + print $OUT " zsk_rolldate \" \"\n"; + print $OUT " zsk_rollsecs \"0\"\n"; + print $OUT " maxttl \"0\"\n"; + print $OUT " phasestart \"new\"\n"; + close($OUT); &unlock_file($config{"dnssectools_rollrec"}); print $text{'dt_zone_done'},"
\n";