lib/TWiki/Configure/Checkers/MSWin32.pm
changeset 0 414e01d06fd5
equal deleted inserted replaced
-1:000000000000 0:414e01d06fd5
       
     1 package TWiki::Configure::Checkers::MSWin32;
       
     2 
       
     3 use strict;
       
     4 
       
     5 sub check {
       
     6     my $this = shift;
       
     7     # ActivePerl-only function: returns number if
       
     8     # successful, otherwise treated as a literal (bareword).
       
     9     my $isActivePerl= eval 'Win32::BuildNumber !~ /Win32/';
       
    10 
       
    11     # FIXME: Advice in this section should be reviewed and tested by people
       
    12     # using ActivePerl
       
    13     my $perl5shell = $ENV{PERL5SHELL} || '';
       
    14     my $n = $perl5shell.
       
    15       $this->NOTE(<<HERE);
       
    16 This environment variable is used by Win32 Perls to run
       
    17 commands from TWiki scripts - it determines which shell program is used to run
       
    18 commands that use 'pipes'.  Examples of shell programs are cmd.exe,
       
    19 command.com (aka 'DOS Prompt'), and Cygwin's 'bash'
       
    20 (<strong>recommended</strong> if Cygwin is installed).
       
    21 <p>
       
    22 To use 'bash' with ActiveState or other Win32 Perl you should set the
       
    23 PERL5SHELL environment variable to something like
       
    24 <tt><strong>c:/YOURCYGWINDIR/bin/bash.exe -c</strong></tt>
       
    25 This should be set in the System Environment, and ideally set directly in the
       
    26 web server (e.g. using the Apache <tt>SetEnv</tt> directive).
       
    27 HERE
       
    28 
       
    29     if( $isActivePerl ) {
       
    30         $n .= $this->WARN(<<HERE);
       
    31 ActiveState Perl on IIS does not support safe pipes, which is the mechanism used by TWiki to prevent a range
       
    32 of attacks aimed at arbitrary command execution on the server. You are <b>highly</b> recommended not to use this
       
    33 particular configuration on a public server (one exposed to the internet)
       
    34 HERE
       
    35         if( Win32::BuildNumber() < 631 ) {
       
    36             $n .= $this->WARN(<<HERE);
       
    37 ActiveState Perl must be upgraded to at least build 631
       
    38 if you are going to use PERL5SHELL, which was broken in earlier builds.
       
    39 HERE
       
    40         }
       
    41     }
       
    42     return $n;
       
    43 }
       
    44 
       
    45 1;