#
use File::Basename;
-use CGI::Carp qw(fatalsToBrowser);
use Fcntl qw(:flock :seek :mode);
use POSIX qw(strftime locale_h);
use Cwd qw(getcwd abs_path);
use utf8;
+# use CGI::Carp qw(fatalsToBrowser);
# import from fex.pp
our ($bs,$tmpdir,@doc_dirs);
foreach (@files) {
if (/^\// or /\.\.\//) {
# absolute path or relative path with parent directory is not allowed
+ errorlog("$streamfile: $_ is not allowed for streaming");
+ http_error(403);
+ }
+ unless (-e $_) {
+ errorlog("$streamfile: $_ does not exist");
http_error(403);
}
if (@s = stat($_) and not($s[2] & S_IRGRP) or not -r $_) {
# file must be readable by user and group
+ errorlog("$streamfile: $_ is not readable by user and group");
http_error(403);
}
}
} else {
# eval code with output substitution
local $__ = '';
+ local $^W = 0;
tie *STDOUT => "Buffer",\$__;
- $__ .= eval('package DOP;' . $pc);
+ my $r .= eval('package DOP;' . $pc);
+ $__ .= $r if $pc !~ /;\s*$/;
untie *STDOUT;
last if $timeout;
$dynamic = $htmldoc =~ s/<<(.+?)>>/$__/s;
return '';
}
-# tie STDOUT to buffer variable (redefining print)
+# tie STDOUT to buffer variable (redefining print and printf)
package Buffer;
sub TIEHANDLE {