X-Git-Url: https://git.treefish.org/fex.git/blobdiff_plain/7fa382617fbaccc0ce522b2b3adbbee9db5ad227..97b87610331f53e756d032ad21db786037f921a1:/cgi-bin/rup diff --git a/cgi-bin/rup b/cgi-bin/rup index 10a78b6..53fa952 100755 --- a/cgi-bin/rup +++ b/cgi-bin/rup @@ -5,17 +5,16 @@ # Author: Ulli Horlacher # +BEGIN { ($ENV{PERLINIT}||'') =~ /(.+)/s and eval $1 } + use Fcntl qw(:flock :seek :mode); -use CGI qw(:standard); -use CGI::Carp qw(fatalsToBrowser); -use Fcntl qw(:flock); use Digest::MD5 qw(md5_hex); # add fex lib (our $FEXLIB) = $ENV{FEXLIB} =~ /(.+)/; die "$0: no $FEXLIB\n" unless -d $FEXLIB; -our ($keep_default,$dkeydir,$akeydir,$mdomain,$logdir,$fra); +our ($keep_default,$dkeydir,$akeydir,$mdomain,@logdir,$fra); our $akey = ''; # load common code, local config : $HOME/lib/fex.ph @@ -25,13 +24,13 @@ our $error = 'F*EX redirect ERROR'; chdir $spooldir or die "$spooldir - $!\n"; -my $log = "$logdir/rup.log"; - $from = $id = $oto = $nto = $file = ''; # look for CGI parameters -foreach my $v (param) { - $vv = param($v); +our %PARAM; +&parse_parameters; +foreach my $v (keys %PARAM) { + my $vv = $PARAM{$v}; $vv =~ s/[<>\'\`\"\000-\037]//g; if ($v =~ /^akey$/i and $vv =~ /^(\w+)$/) { $akey = $1; @@ -201,7 +200,7 @@ if (rename "$oto/$from/$fkey","$nto/$from/$fkey") { unlink "$nto/$from/$fkey/notify"; unlink "$nto/$from/$fkey/error"; unlink "$nto/$from/$fkey/download"; - if (slurp("$oto/$from/$fkey/$comment") =~ 'NOMAIL') { + if (slurp("$oto/$from/$fkey/comment")||'' =~ /NOMAIL/) { unlink "$nto/$from/$fkey/comment"; } $dkey = randstring(8); @@ -239,12 +238,15 @@ sub ruplog { $msg =~ s/\n/ /g; $msg =~ s/\s+$//; - - if (open $log,'>>',$log) { - flock $log,LOCK_EX; - seek $log,0,SEEK_END; - printf {$log} "%s [%s_%s] (%s) %s\n", - isodate(time),$$,$ENV{REQUESTCOUNT},$fra,$msg; - close $log; + $msg = sprintf "%s [%s_%s] (%s) %s\n", + isodate(time),$$,$ENV{REQUESTCOUNT},$fra,$msg; + + foreach my $log (@logdir) { + if (open $log,'>>',"$log/rup.log") { + flock $log,LOCK_EX; + seek $log,0,SEEK_END; + printf {$log} $msg; + close $log; + } } }