From c39ce7aa14f2424c874cc58b5ce5249a05fabe66 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 22 Jan 2004 20:24:49 +0000 Subject: perl_checker fixes --- client_wizard/Bind_client.pm | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'client_wizard') diff --git a/client_wizard/Bind_client.pm b/client_wizard/Bind_client.pm index 8da87403..bfd1c675 100755 --- a/client_wizard/Bind_client.pm +++ b/client_wizard/Bind_client.pm @@ -40,7 +40,7 @@ my $o = { client_ip => '', client_name => '' }, - needed_rpm => [ ], + needed_rpm => [], defaultimage => "$ENV{__WIZ_HOME__}client_wizard/images/DNS.png", init => sub { if (! -f "/var/named/$wiz_domain_name.db") { @@ -101,7 +101,7 @@ $o->{pages} = { }; sub check_dhcp { - $wiz->{net}->is_dhcp() and return 'dhcp_warning'; + $wiz->{net}->is_dhcp and return 'dhcp_warning'; } sub name { @@ -122,9 +122,9 @@ sub get_root { } sub up_serial { - my ($file) = @_; + my ($file) = @_; - my (undef, undef, undef, $mday, $mon, $year) = gmtime(time); + my (undef, undef, undef, $mday, $mon, $year) = gmtime(time()); $year += 1900; my $serial_nbm = sprintf "%4dY%2dm%2d00", $year, $mon, $mday; output($file, map { @@ -146,31 +146,32 @@ sub test { !$o->{client_name} and return 'error'; !$o->{client_ip} and return 'error'; my $s_trunc = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $ds = "$4" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $dc = "$4" if $o->{var}{client_ip} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; + my $ds = $4 if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; + my $dc = $4 if $o->{var}{client_ip} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; my $sc_trunc = "$1.$2.$3" if $o->{var}{client_ip} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - (!$sc_trunc || !$dc || !$ds || !$s_trunc || ($s_trunc != $sc_trunc) || ($dc == $ds || $dc < 0 || $dc > 255)) and return 'error'; + (!$sc_trunc || !$dc || !$ds || !$s_trunc || $s_trunc != $sc_trunc || ($dc == $ds || $dc < 0 || $dc > 255)) and return 'error'; } sub do_it { $::testing and return; my $date = `date`; chomp($date); - my $wiz_ip_net = "$1.$2.$3.0" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; + #my $wiz_ip_net = "$1.$2.$3.0" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; my $s_trunc = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $ds = "$4" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $dc = "$4" if $o->{var}{client_ip} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; + #my $ds = $4 if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; + my $dc = $4 if $o->{var}{client_ip} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; my $file="/var/named/$wiz_domain_name.db"; my $client_name = $o->{var}{client_name}; $client_name =~ s/\.$wiz_domain_name$//; MDK::Common::cp_af($file, $file.".orig"); + local *NEW; open(NEW, ">> $file") or die "can not open $file"; print NEW "\n$client_name IN A $o->{var}{client_ip} ; $date\n\n"; close(NEW) or die "can not close $file"; up_serial($file); - my $file="/var/named/$s_trunc.rev"; + $file="/var/named/$s_trunc.rev"; MDK::Common::cp_af($file, $file.".orig"); open(NEW, ">> $file") or die "can not open $file"; print NEW "\n$dc IN PTR $o->{var}{client_name}. ; $date\n\n"; @@ -184,7 +185,7 @@ sub do_it { } sub new { - my ($class, $conf) = @_; + my ($class) = @_; bless { o => $o, }, $class; -- cgit v1.2.1