X-Git-Url: https://git.treefish.org/fex.git/blobdiff_plain/7fa382617fbaccc0ce522b2b3adbbee9db5ad227..e60096926213ce02293a261254ff065cae44c1c8:/cgi-bin/fop?ds=inline diff --git a/cgi-bin/fop b/cgi-bin/fop index 4370fb6..949f084 100755 --- a/cgi-bin/fop +++ b/cgi-bin/fop @@ -5,8 +5,8 @@ # Author: Ulli Horlacher # -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; @@ -20,8 +20,8 @@ die "$0: no $FEXLIB\n" unless -d $FEXLIB; 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); @@ -46,7 +46,7 @@ if ($0 !~ m{/locale/.*/fop} and my $lang = $ENV{HTTP_ACCEPT_LANGUAGE}) { } } -my $log = "$logdir/fop.log"; +my $log = 'fop.log'; chdir $spooldir or die "$spooldir - $!\n"; @@ -397,11 +397,13 @@ if ($qs = $ENV{QUERY_STRING}) { $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), @@ -420,11 +422,13 @@ if ($qs = $ENV{QUERY_STRING}) { 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), @@ -553,7 +557,7 @@ if (-f $data) { 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; } @@ -746,7 +750,7 @@ sub sendfile { # 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";