Skip to content

Commit

Permalink
Item13117: CHECK is no longer an array.
Browse files Browse the repository at this point in the history
Merge a few multiple CHECK options.  No reason they need a check array.

Also fix a checker that didn't seem to be working.
  • Loading branch information
gac410 committed Jan 14, 2015
1 parent 1fbf9c9 commit e11f80a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions core/lib/Foswiki.spec
Expand Up @@ -271,7 +271,7 @@ $Foswiki::cfg{Sessions}{ExpireCookiesAfter} = 0;
# {Sessions}{MapIP2SID}).
$Foswiki::cfg{Sessions}{IDsInURLs} = 0;

# **STRING 20 CHECK='undefok emptyok' EXPERT DISPLAY_IF="{UseClientSessions}" CHECK="iff:'{UseClientSessions}'"**
# **STRING 20 EXPERT DISPLAY_IF="{UseClientSessions}" CHECK="undefok emptyok iff:'{UseClientSessions}'"**
# By default the Foswiki session cookie is only accessible by the host which
# sets it. To change the scope of this cookie you can set this to any other
# value (ie. company.com). Make sure that Foswiki can access its own cookie.
Expand Down Expand Up @@ -351,14 +351,14 @@ $Foswiki::cfg{Session}{filePermission} = 0600;
# be performed.
$Foswiki::cfg{Validation}{Method} = 'strikeone';

# **NUMBER CHECK="min:1" EXPERT DISPLAY_IF="{Validation}{Method}!='none'" CHECK="iff:'{Validation}{Method} ne q<none>'"**
# **NUMBER EXPERT DISPLAY_IF="{Validation}{Method}!='none'" CHECK="min:1 iff:'{Validation}{Method} ne q<none>'"**
# Validation keys are stored for a maximum of this amount of time before
# they are invalidated. Time in seconds. A shorter time reduces the risk
# of a hacker finding and re-using one of the keys, at the cost of more
# frequent confirmation prompts for users.
$Foswiki::cfg{Validation}{ValidForTime} = 3600;

# **NUMBER CHECK="min:10" EXPERT DISPLAY_IF="{Validation}{Method}!='none'" CHECK="iff:'{Validation}{Method} ne q<none>'"**
# **NUMBER EXPERT DISPLAY_IF="{Validation}{Method}!='none'" CHECK="min:10 iff:'{Validation}{Method} ne q<none>'"**
# The maximum number of validation keys to store in a session. There is one
# key stored for each page rendered. If the number of keys exceeds this
# number, the oldest keys will be force-expired to bring the number down.
Expand Down Expand Up @@ -729,7 +729,7 @@ $Foswiki::cfg{AuthRealm} =
# mod_perl. This option is not compatible with =plain= text passwords.
$Foswiki::cfg{Htpasswd}{AutoDetect} = $TRUE;
# **NUMBER CHECK="min:0" DISPLAY_IF="{PasswordManager}=='Foswiki::Users::HtPasswdUser' && {Htpasswd}{Encoding}=='bcrypt'" CHECK="iff:'{PasswordManager}=~/:HtPasswdUser/ && {Htpasswd}{Encoding} eq q<bcrypt>'"**
# **NUMBER DISPLAY_IF="{PasswordManager}=='Foswiki::Users::HtPasswdUser' && {Htpasswd}{Encoding}=='bcrypt'" CHECK="min:0 iff:'{PasswordManager}=~/:HtPasswdUser/ && {Htpasswd}{Encoding} eq q<bcrypt>'"**
# Specify the cost that should be incured when computing the hash of a
# password. This number should be increased as CPU speeds increase.
# The iterations of the hash is roughly 2^cost - default is 8, or 256
Expand Down
19 changes: 9 additions & 10 deletions core/lib/Foswiki/Configure/Checkers/NUMBER.pm
Expand Up @@ -29,17 +29,16 @@ sub check_current_value {
return;
}

my $check = $this->{item}->{CHECK};

if ( defined $check->{min} ) {
my $v = eval "$check->{min}";
$reporter->ERROR("Value must be at least $check->{min}[0]")
if ( defined $v && $val < $v );
my $min = $this->{item}->CHECK_option('min');
if ( defined $min ) {
$reporter->ERROR("Value must be at least $min")
if ( $val < $min );
}
if ( defined $check->{max} ) {
my $v = eval "$check->{max}";
$reporter->ERROR("Value must be no greater than $check->{min}[0]")
if ( defined $v && $val > $v );

my $max = $this->{item}->CHECK_option('max');
if ( defined $max ) {
$reporter->ERROR("Value must be no greater than $max")
if ( $val > $max );
}
}

Expand Down
1 change: 1 addition & 0 deletions core/lib/Foswiki/Configure/Checkers/OCTAL.pm
Expand Up @@ -29,6 +29,7 @@ sub check_current_value {
$reporter->ERROR("Value must be at least $min")
if ( defined $v && $val < $v );
}

my $max = $this->{item}->CHECK_option('max');
if ( defined $max ) {
my $v = eval "0$max";
Expand Down

0 comments on commit e11f80a

Please sign in to comment.