From 986a271663c7f37797bec011b2ee9379e82ac4fe Mon Sep 17 00:00:00 2001 From: Florent Villard Date: Wed, 17 Sep 2003 17:41:09 +0000 Subject: better check of ip addresses in dhcp check that server has been run in client dns check that the program is run as root in drakwizard remove bad quotes in po --- dhcp_wizard/Dhcp.pm | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'dhcp_wizard') diff --git a/dhcp_wizard/Dhcp.pm b/dhcp_wizard/Dhcp.pm index 6aa67a38..7bf306c6 100755 --- a/dhcp_wizard/Dhcp.pm +++ b/dhcp_wizard/Dhcp.pm @@ -74,23 +74,23 @@ $o->{pages} = { next => 'summary' }, dhcp_warning => { - name => N('Warning'), - data => [ { label => N('You are in dhcp, server may not work with your configuration.') } ], + name => N('Warning') . "\n\n" . N('You are in dhcp, server may not work with your configuration.'), + ignore => 1, next => 'ip_range' }, ip_range_error => { - name => N('Error'), - data => [ { label => N('The IP range specified is not correct.') } ], + name => N('Error') . "\n\n" . N('The IP range specified is not correct.'), + ignore => 1, next => 'ip_range' }, ip_range_warning => { - name => N('Warning'), - data => [ { label => N('The IP range specified is not in server address range.') } ], + name => N('Warning') . "\n\n" . N('The IP range specified is not in server address range.'), + ignore => 1, next => 'summary' }, server_in_range => { - name => N('Error'), - data => [ { label => N('The IP of the server must not be in range.') } ], + name => N('Error') . "\n\n" . N('The IP of the server must not be in range.'), + ignore => 1, next => 'ip_range' }, summary => { @@ -104,8 +104,7 @@ $o->{pages} = { next => 'end' }, end => { - name => N('Congratulations'), - data => [ { label => N('The wizard successfully configured the DHCP services of your server.') } ], + name => N('Congratulations') . "\n\n" . N('The wizard successfully configured the DHCP services of your server.'), end => 1, next => 0 }, @@ -128,8 +127,11 @@ sub compute_range2 { } sub check { + my $check_ip = sub { return 0 if ($_[0] < 0 || $_[0] > 255); 1 }; my $r1_trunc = "$1.$2.$3" if $o->{var}{ip1} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; + foreach ($1, $2, $3, $4) { $check_ip->($_) or return 'ip_range_error' } my $r2_trunc = "$1.$2.$3" if $o->{var}{ip2} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; + foreach ($1, $2, $3, $4) { $check_ip->($_) or return 'ip_range_error' } my $d1 = "$4" if $o->{var}{ip1} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; my $d2 = "$4" if $o->{var}{ip2} =~ /(\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})/; -- cgit v1.2.1