# Author: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
#
-use CGI qw':standard';
-use CGI::Carp qw'fatalsToBrowser';
+BEGIN { ($ENV{PERLINIT}||'') =~ /(.+)/s and eval $1 }
+
use Fcntl qw':flock :seek';
use Cwd qw'abs_path';
use File::Basename;
our $error = 'F*EX download ERROR';
our $head = "$ENV{SERVER_NAME} F*EX download";
# import from fex.pp
-our ($spooldir,$tmpdir,$logdir,$skeydir,$dkeydir,$durl);
-our ($bs,$fop_auth,$timeout,$keep_default);
+our ($spooldir,$tmpdir,@logdir,$skeydir,$dkeydir,$durl);
+our ($bs,$fop_auth,$timeout,$keep_default,$nowarning);
our ($limited_download,$admin,$akey,$adlm,$amdl);
our (@file_link_dirs);
}
}
-my $log = "$logdir/fop.log";
+my $log = 'fop.log';
chdir $spooldir or die "$spooldir - $!\n";
$filename,$ENV{REMOTE_ADDR},isodate(time);
close $log;
}
- if (open $log,'>>',$log) {
- printf {$log}
- "%s [%s_%s] %s %s deleted\n",
- isodate(time),$$,$ENV{REQUESTCOUNT},$ra,encode_Q($file);
- close $log;
+ foreach my $logdir (@logdir) {
+ my $msg = sprintf "%s [%s_%s] %s %s deleted\n",
+ isodate(time),$$,$ENV{REQUESTCOUNT},$ra,encode_Q($file);
+ if (open $log,'>>',"$logdir/$log") {
+ print {$log} $msg;
+ close $log;
+ }
}
http_header('200 OK',"X-File: $file");
print html_header($head),
if (@anonymous_upload and ipin($ra,@anonymous_upload)) {
unlink "$dkeydir/$dkey" if $dkey;
if (rmrf($file)) {
- if (open $log,'>>',$log) {
- printf {$log}
- "%s [%s_%s] %s %s purged\n",
- isodate(time),$$,$ENV{REQUESTCOUNT},$ra,encode_Q($file);
- close $log;
+ foreach my $logdir (@logdir) {
+ my $msg = sprintf "%s [%s_%s] %s %s purged\n",
+ isodate(time),$$,$ENV{REQUESTCOUNT},$ra,encode_Q($file);
+ if (open $log,'>>',"$logdir/$log") {
+ print {$log} $msg;
+ close $log;
+ }
}
http_header('200 OK',"X-File: $file");
print html_header($head),
# already downloaded?
if ($limited_download and $limited_download !~ /^n/i
and $from ne $to # fex to yourself is ok!
- and $to !~ /$amdl/ # allowed multi download recipients
and $from !~ /^_?fexmail/ # fexmail is ok!
and $to !~ /^_?fexmail/ # fexmail is ok!
and $to !~ /^anonymous/ # anonymous fex is ok!
+ and $to !~ /$amdl/ # allowed multi download recipients
and $http_client !~ /$adlm/ # allowed download managers
and $file !~ /\/STDFEX$/ # xx is ok!
and (slurp("$file/comment")||'') !~ /^!\*!/ # multi download allow flag
chomp;
if ($ra) {
# allow downloads from same ip
- $_ = '' if $ra eq $_;
+ $_ = '' if /\Q$ra/;
# allow downloads from sender ip
$_ = '' if (readlink("$file/ip")||'') eq $ra;
}
# another stupid IE bug-workaround
# http://drupal.org/node/163445
# http://support.microsoft.com/kb/323308
- if ($http_client =~ /MSIE/) {
+ if ($http_client =~ /MSIE/ and not $nowarning) {
# $type = 'application/x-msdownload';
if ($ignorewarning) {
$type .= "; filename=$filename";