--- smeserver-geneweb-2.0/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/geneweb.pm.ip_number-validation 2008-01-15 22:48:36.000000000 -0700 +++ smeserver-geneweb-2.0/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/geneweb.pm 2008-01-15 22:56:19.000000000 -0700 @@ -23,7 +23,6 @@ get_value get_only change_settings - must_be_ip must_be_local ); @@ -160,38 +159,25 @@ subroutine to validate IP input. =cut -#sub must_be_ip -#{ -# my ($fm, $data) = @_; -# #return "OK" unless $value; -# if (CGI::FormMagick::Validator::ip_number($fm, $data)) -# { -# return 'OK'; -# } -# return 'NOT_VALID_IP'; -# #return $fm->call_fm_validation("ip_number",$data,''); -#} - -=head2 must_be_local - -validation method to ensure input is an IP number. -=cut - sub must_be_local { my $self = shift; my $q = $self->{cgi}; - my $data = $q->param("geneweb_only"); + my $gw_ip = $q->param("geneweb_only"); # Make sure that the IP is indeed local. my $ndb = esmith::NetworksDB->open_ro; my @local_list = $ndb->local_access_spec; foreach my $spec (@local_list) { - if (Net::IPv4Addr::ipv4_in_network($spec, $data)) - { - return 'OK'; - } + my $gw_ip = $db->get_prop("geneweb", "only", $q->param("geneweb_only") || ''); + if ($gw_ip) + { + if (Net::IPv4Addr::ipv4_in_network($spec, $gw_ip)) + { + return 'OK'; + } + } } # Not OK. The IP is not on any of our local networks. return 'ERR_IP_NOT_LOCAL';