1 |
stephdl |
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 |
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 |
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 |
4 |
|
|
@@ -48,6 +48,10 @@ |
5 |
|
|
<trans>Number of PPTP clients</trans> |
6 |
|
|
</entry> |
7 |
|
|
<entry> |
8 |
|
|
+ <base>NUMBER_OF_PPTP_CLIENTS_MUST_BE_LESSER_THAN_NUMBER_OF_IP_IN_DHCP_RANGE</base> |
9 |
|
|
+ <trans>The number of pptp clients is greater than the number of reserved IP for DHCP. You should take a smaller number.</trans> |
10 |
|
|
+ </entry> |
11 |
|
|
+ <entry> |
12 |
|
|
<base>LABEL_SSH_PORT</base> |
13 |
|
|
<trans>TCP Port for secure shell access</trans> |
14 |
|
|
</entry> |
15 |
|
|
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 |
16 |
|
|
--- e-smith-base-5.2.0-old/root/etc/e-smith/web/functions/remoteaccess 2014-04-05 17:51:15.278940872 +0200 |
17 |
|
|
+++ e-smith-base-5.2.0/root/etc/e-smith/web/functions/remoteaccess 2014-04-06 09:20:55.799381623 +0200 |
18 |
|
|
@@ -113,7 +113,7 @@ |
19 |
|
|
|
20 |
|
|
<subroutine src="show_ipsecrw_section()"/> |
21 |
|
|
|
22 |
|
|
- <field type="text" id="pptpSessions" size="3" validation="zero_or_positive()" |
23 |
|
|
+ <field type="text" id="pptpSessions" size="3" validation="zero_or_positive(), pptp_and_dhcp_range ()" |
24 |
|
|
value="get_pptp_sessions()"> |
25 |
|
|
<label>LABEL_PPTP</label> |
26 |
|
|
<description>DESC_PPTP</description> |
27 |
|
|
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 |
28 |
|
|
--- 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 |
29 |
|
|
+++ 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 |
30 |
|
|
@@ -31,6 +31,7 @@ |
31 |
|
|
use File::Basename; |
32 |
|
|
use Exporter; |
33 |
|
|
use Carp; |
34 |
|
|
+use Socket qw( inet_aton ); |
35 |
|
|
|
36 |
|
|
our @ISA = qw(esmith::FormMagick Exporter); |
37 |
|
|
|
38 |
|
|
@@ -40,7 +41,7 @@ |
39 |
|
|
show_valid_from_list add_new_valid_from remove_valid_from |
40 |
|
|
validate_network_and_mask ip_number_or_blank subnet_mask_or_blank |
41 |
|
|
show_telnet_section get_serial_console show_ftp_section |
42 |
|
|
- get_ipsecrw_sessions show_ipsecrw_section |
43 |
|
|
+ get_ipsecrw_sessions show_ipsecrw_section pptp_and_dhcp_range |
44 |
|
|
); |
45 |
|
|
|
46 |
|
|
|
47 |
|
|
@@ -370,6 +371,36 @@ |
48 |
|
|
|
49 |
|
|
=pod |
50 |
|
|
|
51 |
|
|
+=head2 pptp_and_dhcp_range |
52 |
|
|
+ |
53 |
|
|
+Validate the input of pptp session if it is not superior than the maximum number of ip between dhcpd_start and dhcpd_end |
54 |
|
|
+ |
55 |
|
|
+=cut |
56 |
|
|
+ |
57 |
|
|
+sub pptp_and_dhcp_range |
58 |
|
|
+{ |
59 |
|
|
+ my $self = shift; |
60 |
|
|
+ my $val = shift || 0; |
61 |
|
|
+ my $dhcp_status = $db->get_prop('dhcpd','status') || 'disabled'; |
62 |
|
|
+ my $dhcp_end = $db->get_prop('dhcpd','end') || ''; |
63 |
|
|
+ my $dhcp_start = $db->get_prop('dhcpd','start') || ''; |
64 |
|
|
+ |
65 |
|
|
+ if ( $dhcp_status eq 'enabled' ) |
66 |
|
|
+ { |
67 |
|
|
+ my $ip_start = unpack 'N', inet_aton($dhcp_start); |
68 |
|
|
+ my $ip_end = unpack 'N', inet_aton($dhcp_end); |
69 |
|
|
+ my $ip_count = $ip_end - $ip_start; |
70 |
|
|
+ return 'OK' if( $val < $ip_count ); |
71 |
|
|
+ return $self->localise('NUMBER_OF_PPTP_CLIENTS_MUST_BE_LESSER_THAN_NUMBER_OF_IP_IN_DHCP_RANGE'); |
72 |
|
|
+ } |
73 |
|
|
+ else |
74 |
|
|
+ { |
75 |
|
|
+ return 'OK'; |
76 |
|
|
+ } |
77 |
|
|
+} |
78 |
|
|
+ |
79 |
|
|
+=pod |
80 |
|
|
+ |
81 |
|
|
=head2 _get_valid_from |
82 |
|
|
|
83 |
|
|
Reads the ValidFrom property of config entry httpd-admin and returns a list |