/[smeserver]/rpms/e-smith-base/sme10/e-smith-base-5.8.0-bz6536-bz10974-validate_subnet.patch
ViewVC logotype

Annotation of /rpms/e-smith-base/sme10/e-smith-base-5.8.0-bz6536-bz10974-validate_subnet.patch

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


Revision 1.3 - (hide annotations) (download)
Sun Jun 6 20:38:41 2021 UTC (3 years, 5 months ago) by jpp
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +0 -0 lines
FILE REMOVED
5.8.1

1 jpp 1.1 diff -Nur e-smith-base-5.8.0.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/localnetworks.pm e-smith-base-5.8.0/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/localnetworks.pm
2     --- e-smith-base-5.8.0.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/localnetworks.pm 2006-03-14 11:20:43.000000000 -0500
3     +++ e-smith-base-5.8.0/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/localnetworks.pm 2020-06-27 22:39:20.952000000 -0400
4     @@ -18,6 +18,7 @@
5     use Exporter;
6     use Carp;
7     use Net::IPv4Addr;
8     +use Net::Netmask;
9    
10     our @ISA = qw(esmith::FormMagick Exporter);
11    
12     @@ -287,14 +288,14 @@
13     sub subnet_mask
14     {
15     my ( $fm, $data ) = @_;
16     - if ( CGI::FormMagick::Validator::ip_number( $fm, $data ) eq "OK" )
17     + # we test for a valid mask or bit mask
18     + my $tip="192.168.50.1";
19     + my $block = new Net::Netmask("$tip/$data") or return "INVALID_SUBNET_MASK";
20 jpp 1.2 + if ($block->mask() eq "$data" || $block->bits() eq "$data")
21 jpp 1.1 {
22     return "OK";
23     }
24     - else
25     - {
26     - return "INVALID_SUBNET_MASK";
27     - }
28     + return "INVALID_SUBNET_MASK";
29     }
30    
31     =head1 ADDING AND REMOVING NETWORKS
32     @@ -308,6 +309,10 @@
33     my ($fm) = @_;
34     my $networkAddress = $fm->{cgi}->param('networkAddress');
35     my $networkMask = $fm->{cgi}->param('networkMask');
36     + # we transform bit mask to regular mask
37     + my $block = new Net::Netmask("$networkAddress/$networkMask");
38     + $networkMask = $block->mask();
39     +
40     my $networkRouter = $fm->{cgi}->param('networkRouter');
41    
42     my $network_db = esmith::NetworksDB->open()
43     diff -Nur e-smith-base-5.8.0.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/remoteaccess.pm e-smith-base-5.8.0/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/remoteaccess.pm
44     --- e-smith-base-5.8.0.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/remoteaccess.pm 2016-02-04 18:14:13.000000000 -0500
45     +++ e-smith-base-5.8.0/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/remoteaccess.pm 2020-06-27 22:39:20.948000000 -0400
46     @@ -32,6 +32,7 @@
47     use Exporter;
48     use Carp;
49     use Socket qw( inet_aton );
50     +use Net::Netmask;
51    
52     our @ISA = qw(esmith::FormMagick Exporter);
53    
54     @@ -450,8 +451,15 @@
55     sub subnet_mask_or_blank
56     {
57     my ($self, $mask) = @_;
58     -
59     - if ($self->ip_number_or_blank($mask) eq 'OK')
60     + if (!defined($mask) || $mask eq "")
61     + {
62     + return "OK";
63     + }
64     + chomp $mask ;
65     + # we test for a valid mask or bit mask
66     + my $tip="192.168.50.1";
67     + my $block = new Net::Netmask("$tip/$mask") or return "INVALID_SUBNET_MASK";
68 jpp 1.2 + if ($block->mask() eq "$mask" || $block->bits() eq "$mask")
69 jpp 1.1 {
70     return "OK";
71     }
72     @@ -479,6 +487,10 @@
73     my $net = $q->param('validFromNetwork');
74     my $mask = $q->param('validFromMask');
75    
76     + # we transform bit mask to regular mask
77     + my $block = new Net::Netmask("$net/$mask");
78     + $mask = $block->mask();
79     +
80     # do nothing if no network was added
81     return 1 unless ($net && $mask);
82    

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