X-Git-Url: https://git.treefish.org/fex.git/blobdiff_plain/97b87610331f53e756d032ad21db786037f921a1..20160104:/cgi-bin/fur diff --git a/cgi-bin/fur b/cgi-bin/fur index 2a75445..5db49c4 100755 --- a/cgi-bin/fur +++ b/cgi-bin/fur @@ -7,6 +7,7 @@ BEGIN { ($ENV{PERLINIT}||'') =~ /(.+)/s and eval $1 } +use utf8; use Fcntl qw(:flock :seek :mode); # import from fex.ph @@ -39,16 +40,17 @@ my $user = my $id = my $verify = ''; &check_maint; -unless (@local_domains and @local_rdomains) { +unless (@local_domains or @local_rdomains) { html_error($error, "No domains for registrations are defined.", "Contact $ENV{SERVER_ADMIN} for details." ); } -unless (@local_hosts and ipin($ENV{REMOTE_ADDR}||0,@local_hosts)) { +unless (@local_hosts and ipin($ra,@local_hosts) or + @local_rhosts and ipin($ra,@local_rhosts)) { html_error($error, - "Registrations from your host ($ENV{REMOTE_ADDR}) are not allowed.", + "Registrations from your host ($ra) are not allowed.", "Contact $ENV{SERVER_ADMIN} for details." ); } @@ -88,9 +90,9 @@ if ($confirm) { } # if (-f "$user/@") { http_die("$user is already activated") } open $user,'>',"$user/@" or http_die("open $user/@ - $!\n"); - print {$user} $id,"\n"; + print {$user} $id,"\n"; close $user or http_die("close $user/@ - $!\n"); - + http_header("200 OK"); print html_header($head); my $url = "$ENV{PROTO}://$ENV{HTTP_HOST}/fup/" . b64("from=$user&id=$id"); @@ -103,11 +105,11 @@ if ($confirm) { '

' 'or you can use:' '

' - ' + '
' ' ' ' ' ' ' - '
URL:$ENV{PROTO}://$ENV{HTTP_HOST}/fup/
Sender:$user
auth-ID:$id
+ '' '' )); furlog("confirm: account $user created"); @@ -124,7 +126,7 @@ unless ($user or $exuser or $demouser) { ' accept-charset="UTF-8"' ' enctype="multipart/form-data">' )); - + if (@local_domains and @local_hosts and ipin($ra,@local_hosts)) { $reg = $ra; if (grep(/\*/,@local_domains)) { @@ -150,8 +152,8 @@ unless ($user or $exuser or $demouser) { )); } } - - if (@local_rdomains and @local_rhosts and + + if (@local_rdomains and @local_rhosts and (not @registration_hosts or ipin($ra,@registration_hosts))) { print "

or

\n" if $reg; $reg = $ra; @@ -161,7 +163,7 @@ unless ($user or $exuser or $demouser) { '

' )); } - + if (@demo) { print "

or

\n" if $reg; $reg = $ra; @@ -173,7 +175,7 @@ unless ($user or $exuser or $demouser) { '

' )); } - + if ($reg) { pq(qq( '

' @@ -244,7 +246,7 @@ if ($exuser) { $mydomains .= "|$mdomain" if $mdomain; $user .= '@'.$domain if $domain and $user !~ /@/; # $user .= '@'.$mdomain if $mdomain and $user !~ /@/; - + unless (@local_hosts and ipin($ra,@local_hosts)) { html_error($error, "Registrations from your host ($ra) are not allowed.", @@ -274,7 +276,7 @@ if (-f "$user/@") { $error, "you are already registered". " (I have lost my auth-ID)" - ); + ); } unless (-d $user) { @@ -295,7 +297,7 @@ if ($exuser) { print {$rf} "\@LOCAL_RHOSTS\n"; close $rf; if (open $user,'>',"$user/.auto") { - print {$user} "fur:external\n"; + print {$user} "fur:external\n"; close $user; } } elsif ($demouser) { @@ -305,13 +307,13 @@ if ($exuser) { printf {$quota} "sender:%d\n",$demo[0]; close $quota; if (open $user,'>',"$user/.auto") { - print {$user} "fur:demo\n"; + print {$user} "fur:demo\n"; close $user; } open $demouser,'>',"$demouser/.demo" and close $demouser; } else { if (open $user,'>',"$user/.auto") { - print {$user} "fur:internal\n"; + print {$user} "fur:internal\n"; close $user; } } @@ -320,7 +322,7 @@ $id = randstring(6); if ("@local_domains" eq "*") { open $id,'>',"$user/@" or http_die("open $user/@ - $!\n"); - print {$id} $id,"\n"; + print {$id} $id,"\n"; close $id or http_die("close $user/@ - $!\n"); http_header("200 OK"); print html_header($head); @@ -340,7 +342,7 @@ if ("@local_domains" eq "*") { # from fexsend if ($verify eq 'no') { open $id,'>',"$user/@" or http_die("open $user/@ - $!\n"); - print {$id} $id,"\n"; + print {$id} $id,"\n"; close $id or http_die("close $user/@ - $!\n"); http_header("200 OK",'Content-Type: text/plain'); print "$ENV{PROTO}://$ENV{HTTP_HOST}/fup?from=$user&ID=$id\n"; @@ -390,7 +392,7 @@ close $mail or http_die("cannot send mail - $!\n"); http_header("200 OK"); print html_header($head); print "confirmation e-mail has been sent to $user\n"; -print "\n"; +print "\n"; furlog("confirmation request mailed to $user"); exit; @@ -398,12 +400,12 @@ exit; # standard log sub furlog { my $msg = "@_"; - + $msg =~ s/\n/ /g; $msg =~ s/\s+$//; $msg = sprintf "%s [%s_%s] %s %s\n", isodate(time),$$,$ENV{REQUESTCOUNT},$fra,$msg; - + writelog($log,$msg); }