fix perl 5.8.8 compat
This commit is contained in:
parent
78aa8b0bfa
commit
79f3acfc8e
15
rdns-manager
15
rdns-manager
|
@ -10,11 +10,17 @@ use vars '$VERSION'; $VERSION = '1.1.0'; #Version nu
|
||||||
|
|
||||||
use 5.008_008;
|
use 5.008_008;
|
||||||
|
|
||||||
use Data::Validate::IP qw(is_public_ipv4 is_public_ipv6); #for validating v4/v6 addresses
|
use Data::Validate::IP qw/is_public_ipv4 is_public_ipv6/; #for validating v4/v6 addresses
|
||||||
use Getopt::Long qw(:config posix_default bundling pass_through); #for intelligently handling cli arguments
|
use Getopt::Long qw/:config posix_default bundling pass_through/; #for intelligently handling cli arguments
|
||||||
use Net::DNS; #for doing forward and reverse lookups
|
use Net::DNS; #for doing forward and reverse lookups
|
||||||
use Net::IP; #for converting IPs to their reverse zones
|
use Net::IP; #for converting IPs to their reverse zones
|
||||||
|
|
||||||
|
use File::Copy qw/copy/;
|
||||||
|
use Net::DNS::ZoneFile;
|
||||||
|
use Net::DNS::ZoneParse qw/writezone/;
|
||||||
|
use POSIX qw/strftime/;
|
||||||
|
use Regexp::Common;
|
||||||
|
|
||||||
#conf
|
#conf
|
||||||
my $def_rdns = 'hosted-by.mycompany.com'; #Recomend default is "hosted-by.your-website.tld".
|
my $def_rdns = 'hosted-by.mycompany.com'; #Recomend default is "hosted-by.your-website.tld".
|
||||||
my $def_dns = '8.8.8.8'; #Recommended default is 8.8.8.8 or 4.2.2.1.
|
my $def_dns = '8.8.8.8'; #Recommended default is 8.8.8.8 or 4.2.2.1.
|
||||||
|
@ -70,7 +76,6 @@ Configuration:
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
sub validate_domain {
|
sub validate_domain {
|
||||||
require Regexp::Common;
|
|
||||||
my $domain = shift;
|
my $domain = shift;
|
||||||
return 1 if $domain =~ /^$RE{net}{domain}\.?$/;
|
return 1 if $domain =~ /^$RE{net}{domain}\.?$/;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -120,7 +125,6 @@ sub does_zone_exist {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
sub get_zone_array {
|
sub get_zone_array {
|
||||||
require Net::DNS::ZoneFile;
|
|
||||||
#returns 1 on record exists, 0 on record doesn't exist, -1 on zone exists but isn't writeable, -2 on file exists but isn't a zone, -3 on file doesn't exist
|
#returns 1 on record exists, 0 on record doesn't exist, -1 on zone exists but isn't writeable, -2 on file exists but isn't a zone, -3 on file doesn't exist
|
||||||
my $ip = shift;
|
my $ip = shift;
|
||||||
my ($rec,$zone) = get_arpa $ip;
|
my ($rec,$zone) = get_arpa $ip;
|
||||||
|
@ -141,15 +145,12 @@ sub does_record_exist {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
sub generate_soa_serial {
|
sub generate_soa_serial {
|
||||||
require POSIX qw(strftime);
|
|
||||||
my $cur_serial = shift;
|
my $cur_serial = shift;
|
||||||
my $yyyymmdd = strftime "%Y%m%d", localtime;
|
my $yyyymmdd = strftime "%Y%m%d", localtime;
|
||||||
return $cur_serial+1 if $cur_serial =~ /^$yyyymmdd[0-9]{2}$/;
|
return $cur_serial+1 if $cur_serial =~ /^$yyyymmdd[0-9]{2}$/;
|
||||||
return $yyyymmdd."00";
|
return $yyyymmdd."00";
|
||||||
}
|
}
|
||||||
sub write_zone {
|
sub write_zone {
|
||||||
require File::Copy qw(copy);
|
|
||||||
require Net::DNS::ZoneParse qw(writezone);
|
|
||||||
my $zone = shift;
|
my $zone = shift;
|
||||||
my @z = @_;
|
my @z = @_;
|
||||||
foreach(@z) {$_->serial(generate_soa_serial $_->serial) if $_->type eq "SOA";} #update SOA
|
foreach(@z) {$_->serial(generate_soa_serial $_->serial) if $_->type eq "SOA";} #update SOA
|
||||||
|
|
Loading…
Reference in New Issue