X-Git-Url: https://git.treefish.org/fex.git/blobdiff_plain/7fa382617fbaccc0ce522b2b3adbbee9db5ad227..e60096926213ce02293a261254ff065cae44c1c8:/cgi-bin/fur diff --git a/cgi-bin/fur b/cgi-bin/fur index 3d91f55..94f6a1e 100755 --- a/cgi-bin/fur +++ b/cgi-bin/fur @@ -5,12 +5,9 @@ # Author: Ulli Horlacher # -use CGI qw(:standard); -use CGI::Carp qw(fatalsToBrowser); -use Fcntl qw(:flock :seek :mode); +BEGIN { ($ENV{PERLINIT}||'') =~ /(.+)/s and eval $1 } -$CGI::LIST_CONTEXT_WARN = 0; -$CGI::LIST_CONTEXT_WARN = 0; +use Fcntl qw(:flock :seek :mode); # import from fex.ph our (@local_hosts,@local_domains,@local_rhosts,@local_rdomains); @@ -18,7 +15,7 @@ our (@registration_hosts,@registration_domains); our ($usage_conditions); # import from fex.pp -our ($mdomain,$logdir,$spooldir,$fra,$hostname,$sendmail,$admin,$bcc); +our ($mdomain,@logdir,$spooldir,$fra,$hostname,$sendmail,$admin,$bcc); our $error = "F*EX user registration ERROR"; @@ -33,7 +30,7 @@ die "$0: no $FEXLIB\n" unless -d $FEXLIB; # load common code, local config: $HOME/lib/fex.ph require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n"; -my $log = "$logdir/fur.log"; +my $log = 'fur.log'; my $head = "$ENV{SERVER_NAME} F*EX user registration"; chdir $spooldir or die "$spooldir - $!\n"; @@ -50,9 +47,11 @@ unless (@local_domains or @local_rdomains) { } # look for CGI parameters -foreach my $v (param) { - my $vv = despace(param($v)); - debuglog("Param: $v=\"$vv\""); +our %PARAM; +&parse_parameters; +foreach my $v (keys %PARAM) { + my $vv = despace($PARAM{$v}); + # debuglog("Param: $v=\"$vv\""); $CASE = $v =~ /^user$/i ? $user = normalize_address($vv): $v =~ /^exuser$/i ? $exuser = normalize_address($vv): @@ -339,7 +338,7 @@ if ($verify eq 'no') { http_header("200 OK",'Content-Type: text/plain'); print "$ENV{PROTO}://$ENV{HTTP_HOST}/fup?from=$user&ID=$id\n"; furlog("direct: account $user created"); - if ($bcc and open my $mail,"|$sendmail '$bcc' 2>>$log") { + if ($bcc and open my $mail,"|$sendmail '$bcc' 2>>$logdir[0]/$log") { pq($mail,qq( 'From: fex' 'To: $bcc' @@ -395,14 +394,10 @@ sub furlog { $msg =~ s/\n/ /g; $msg =~ s/\s+$//; + $msg = sprintf "%s [%s_%s] %s %s\n", + isodate(time),$$,$ENV{REQUESTCOUNT},$fra,$msg; - 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; - } + writelog($log,$msg); } sub normalize_address {