/[smeserver]/rpms/e-smith-base/sme8/e-smith-base-5.2.0_added_verification_of_pptp_clients_against_dhcp.patch
ViewVC logotype

Diff of /rpms/e-smith-base/sme8/e-smith-base-5.2.0_added_verification_of_pptp_clients_against_dhcp.patch

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

Revision 1.1 by stephdl, Sun Apr 6 15:58:18 2014 UTC Revision 1.2 by stephdl, Wed Apr 23 20:04:56 2014 UTC
# Line 1  Line 1 
1  diff -Nur e-smith-base-5.2.0-old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/remoteaccess e-smith-base-5.2.0/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/remoteaccess  diff -Nur e-smith-base-5.2.0-old/root/usr/lib/perl5/site_perl/esmith/console/configure.pm e-smith-base-5.2.0/root/usr/lib/perl5/site_perl/esmith/console/configure.pm
2  --- e-smith-base-5.2.0-old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/remoteaccess 2014-04-05 17:51:15.278940872 +0200  --- e-smith-base-5.2.0-old/root/usr/lib/perl5/site_perl/esmith/console/configure.pm     2014-04-05 17:51:15.298943308 +0200
3  +++ e-smith-base-5.2.0/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/remoteaccess     2014-04-06 10:27:07.542188253 +0200  +++ e-smith-base-5.2.0/root/usr/lib/perl5/site_perl/esmith/console/configure.pm 2014-04-23 20:50:33.256817438 +0200
4  @@ -48,6 +48,10 @@  @@ -7,6 +7,8 @@
5          <trans>Number of PPTP clients</trans>   use esmith::db;
6       </entry>   use esmith::ethernet;
7       <entry>   use Net::IPv4Addr qw(:all);
 +       <base>NUMBER_OF_PPTP_CLIENTS_MUST_BE_LESSER_THAN_NUMBER_OF_IP_IN_DHCP_RANGE</base>  
 +       <trans>The number of pptp clients is greater than the number of reserved IP for DHCP. You should take a smaller number.</trans>  
 +    </entry>  
 +    <entry>  
          <base>LABEL_SSH_PORT</base>  
          <trans>TCP Port for secure shell access</trans>  
      </entry>  
 diff -Nur e-smith-base-5.2.0-old/root/etc/e-smith/web/functions/remoteaccess e-smith-base-5.2.0/root/etc/e-smith/web/functions/remoteaccess  
 --- e-smith-base-5.2.0-old/root/etc/e-smith/web/functions/remoteaccess  2014-04-05 17:51:15.278940872 +0200  
 +++ e-smith-base-5.2.0/root/etc/e-smith/web/functions/remoteaccess      2014-04-06 09:20:55.799381623 +0200  
 @@ -113,7 +113,7 @@  
   
          <subroutine src="show_ipsecrw_section()"/>  
   
 -       <field type="text" id="pptpSessions" size="3" validation="zero_or_positive()"  
 +       <field type="text" id="pptpSessions" size="3" validation="zero_or_positive(), pptp_and_dhcp_range ()"  
             value="get_pptp_sessions()">  
             <label>LABEL_PPTP</label>  
             <description>DESC_PPTP</description>  
 diff -Nur e-smith-base-5.2.0-old/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/remoteaccess.pm e-smith-base-5.2.0/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/remoteaccess.pm  
 --- e-smith-base-5.2.0-old/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/remoteaccess.pm 2014-04-05 17:51:15.298943308 +0200  
 +++ e-smith-base-5.2.0/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/remoteaccess.pm     2014-04-06 10:25:12.267521705 +0200  
 @@ -31,6 +31,7 @@  
  use File::Basename;  
  use Exporter;  
  use Carp;  
8  +use Socket qw( inet_aton );  +use Socket qw( inet_aton );
   
  our @ISA = qw(esmith::FormMagick Exporter);  
   
 @@ -40,7 +41,7 @@  
                 show_valid_from_list add_new_valid_from remove_valid_from  
                 validate_network_and_mask ip_number_or_blank subnet_mask_or_blank  
                 show_telnet_section get_serial_console show_ftp_section  
 -               get_ipsecrw_sessions show_ipsecrw_section  
 +               get_ipsecrw_sessions show_ipsecrw_section pptp_and_dhcp_range  
  );  
   
   
 @@ -370,6 +371,36 @@  
   
  =pod  
   
 +=head2 pptp_and_dhcp_range  
 +  
 +Validate the input of pptp session if it is not superior than the maximum number of ip between dhcpd_start and dhcpd_end  
 +  
 +=cut  
 +  
 +sub pptp_and_dhcp_range  
 +{  
 +  my $self = shift;  
 +  my $val = shift || 0;  
 +  my $dhcp_status     = $db->get_prop('dhcpd','status') || 'disabled';  
 +  my $dhcp_end        = $db->get_prop('dhcpd','end') || '';  
 +  my $dhcp_start      = $db->get_prop('dhcpd','start') || '';  
 +  
 +    if ( $dhcp_status eq 'enabled' )  
 +        {  
 +        my $ip_start     = unpack 'N', inet_aton($dhcp_start);  
 +        my $ip_end       = unpack 'N', inet_aton($dhcp_end);  
 +        my $ip_count     = $ip_end - $ip_start;  
 +        return 'OK' if( $val < $ip_count );  
 +        return $self->localise('NUMBER_OF_PPTP_CLIENTS_MUST_BE_LESSER_THAN_NUMBER_OF_IP_IN_DHCP_RANGE');  
 +        }  
 +    else  
 +        {  
 +        return 'OK';  
 +        }  
 +}  
 +  
 +=pod  
9  +  +
  =head2 _get_valid_from  
10    
11   Reads the ValidFrom property of config entry httpd-admin and returns a list   our @adapters;
12     our $console;
13    @@ -1852,7 +1854,7 @@
14             (
15              title => gettext("Select end of DHCP host number range"),
16              text  =>
17    -         gettext("Please enter the last host address in this range. If you are using the standard server defaults and have no particular preference, you should keep the default value."),
18    +         gettext("Please enter the last host address in this range. If you are using the standard server defaults and have no particular preference, you should keep the default value. Think to add enough ip for pptp sessions."),
19              value   => $serverEnd
20             );
21    
22    @@ -1862,6 +1864,12 @@
23         {
24             if ( isValidIP($choice) )
25             {
26    +        # retrieve values to verifiy if ip_count > pptp_sessions
27    +        my $ip_start      = unpack 'N', inet_aton($serverStart);
28    +        my $ip_end        = unpack 'N', inet_aton($choice);
29    +        my $ip_count      = $ip_end - $ip_start;
30    +        my $pptp_sessions = $db->get_prop('pptpd','sessions');
31    +
32                my $dhcp_net = ipv4_network($choice, $priv_mask);
33                if ($dhcp_net eq $priv_net)
34                {
35    @@ -1872,8 +1880,8 @@
36                    # beginning.
37                    if (cmpIP($serverStart, $choice) < 0)
38                    {
39    -                   if ((cmpIP($priv_ip, $serverStart) < 0) ||
40    -                       (cmpIP($choice, $priv_ip) < 0))
41    +                   if (((cmpIP($priv_ip, $serverStart) < 0) ||
42    +                       (cmpIP($choice, $priv_ip) < 0)) && ($ip_count > $pptp_sessions))
43                        {
44                            # need to check for valid range as well.
45                            unless ($choice eq $serverEnd)
46    @@ -1882,6 +1890,13 @@
47                            }
48                            goto DNS_FORWARDER;
49                        }
50    +            # We want to verify that the number of pptp_IP reserved is not superior
51    +            # than the number of dhcp_IP set in the range
52    +            elsif ($ip_count <= $pptp_sessions)
53    +            {
54    +            $errmsg = gettext("There is not enough IP in the range to include all your pptp sessions");
55    +            $choice = $pptp_sessions . ' allowed pptp clients';
56    +            }
57                        else
58                        {
59                            $errmsg = gettext("The IP range cannot include our private network address.");


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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