/[smeserver]/rpms/e-smith-quota/sme8/e-smith-quota-2.2.0-UpperCaseUnits.patch
ViewVC logotype

Contents of /rpms/e-smith-quota/sme8/e-smith-quota-2.2.0-UpperCaseUnits.patch

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


Revision 1.1 - (show annotations) (download)
Sun Nov 28 09:20:53 2010 UTC (13 years, 5 months ago) by wellsi
Branch: MAIN
CVS Tags: e-smith-quota-2_2_0-10_el5_sme, e-smith-quota-2_2_0-8_el5_sme, e-smith-quota-2_2_0-9_el5_sme, HEAD
- Quota panel should only accept uppercase units [SME: 6406]

1 diff -ruN e-smith-quota-2.2.0.old/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/quota.pm e-smith-quota-2.2.0/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/quota.pm
2 --- e-smith-quota-2.2.0.old/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/quota.pm 2010-11-28 09:03:23.000000000 +0000
3 +++ e-smith-quota-2.2.0/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/quota.pm 2010-11-28 09:07:13.000000000 +0000
4 @@ -268,38 +268,28 @@
5 }
6 my $softlim = $q->param ('soft');
7
8 - unless ($softlim =~ /^(.+?)\s*([kmgt])?$/i )
9 + if (($softlim !~ /^(.+?)\s*([KMGT])?$/ ) || (!looks_like_number ($1)))
10 {
11 return $self->error('SOFT_VAL_MUST_BE_NUMBER', 'Initial');
12 }
13 - my $value = $1;
14 - unless (looks_like_number($value))
15 - {
16 - return $self->error('SOFT_VAL_MUST_BE_NUMBER', 'Initial');
17 - }
18 my $exponent = 1; # Entries with no suffix are assumed to be in megabytes.
19 if (defined ($2))
20 {
21 - $exponent = index("kmgt",lc($2));
22 + $exponent = index("KMGT",$2);
23 }
24 - $softlim = ($value * 1024 ** $exponent);
25 + $softlim = ($1 * 1024 ** $exponent);
26
27 my $hardlim = $q->param ('hard');
28 - unless ($hardlim =~ /^(.+?)\s*([kmgt])?$/i )
29 + if (($hardlim !~ /^(.+?)\s*([KMGT])?$/ ) || (!looks_like_number ($1)))
30 {
31 return $self->error('HARD_VAL_MUST_BE_NUMBER', 'Initial');
32 }
33 - my $value = $1;
34 - unless (looks_like_number($value))
35 - {
36 - return $self->error('HARD_VAL_MUST_BE_NUMBER', 'Initial');
37 - }
38 my $exponent = 1; # Entries with no suffix are assumed to be in megabytes.
39 if (defined ($2))
40 {
41 - $exponent = index("kmgt",lc($2));
42 + $exponent = index("KMGT",$2);
43 }
44 - $hardlim = ($value * 1024 ** $exponent);
45 + $hardlim = ($1 * 1024 ** $exponent);
46
47 #------------------------------------------------------------
48 # Make sure that soft limit is less than hard limit.

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