/[smecontribs]/rpms/smeserver-geneweb/contribs8/smeserver-geneweb-2.0-ip_number-validation.patch
ViewVC logotype

Contents of /rpms/smeserver-geneweb/contribs8/smeserver-geneweb-2.0-ip_number-validation.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sun Mar 3 04:48:05 2013 UTC (11 years, 9 months ago) by unnilennium
Branch: MAIN
CVS Tags: smeserver-geneweb-2_0-24_el5_sme, smeserver-geneweb-2_0-26_el5_sme, smeserver-geneweb-2_0-25_el5_sme, HEAD
Initial import

1 --- 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
2 +++ smeserver-geneweb-2.0/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/geneweb.pm 2008-01-15 22:56:19.000000000 -0700
3 @@ -23,7 +23,6 @@
4 get_value
5 get_only
6 change_settings
7 - must_be_ip
8 must_be_local
9 );
10
11 @@ -160,38 +159,25 @@
12 subroutine to validate IP input.
13 =cut
14
15 -#sub must_be_ip
16 -#{
17 -# my ($fm, $data) = @_;
18 -# #return "OK" unless $value;
19 -# if (CGI::FormMagick::Validator::ip_number($fm, $data))
20 -# {
21 -# return 'OK';
22 -# }
23 -# return 'NOT_VALID_IP';
24 -# #return $fm->call_fm_validation("ip_number",$data,'');
25 -#}
26 -
27 -=head2 must_be_local
28 -
29 -validation method to ensure input is an IP number.
30 -=cut
31 -
32 sub must_be_local
33 {
34 my $self = shift;
35 my $q = $self->{cgi};
36 - my $data = $q->param("geneweb_only");
37 + my $gw_ip = $q->param("geneweb_only");
38 # Make sure that the IP is indeed local.
39 my $ndb = esmith::NetworksDB->open_ro;
40 my @local_list = $ndb->local_access_spec;
41
42 foreach my $spec (@local_list)
43 {
44 - if (Net::IPv4Addr::ipv4_in_network($spec, $data))
45 - {
46 - return 'OK';
47 - }
48 + my $gw_ip = $db->get_prop("geneweb", "only", $q->param("geneweb_only") || '');
49 + if ($gw_ip)
50 + {
51 + if (Net::IPv4Addr::ipv4_in_network($spec, $gw_ip))
52 + {
53 + return 'OK';
54 + }
55 + }
56 }
57 # Not OK. The IP is not on any of our local networks.
58 return 'ERR_IP_NOT_LOCAL';

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed