X-Git-Url: http://git.treefish.org/fex.git/blobdiff_plain/e60096926213ce02293a261254ff065cae44c1c8..20160104:/cgi-bin/fup?ds=inline
diff --git a/cgi-bin/fup b/cgi-bin/fup
index b1e01e6..7d222f9 100755
--- a/cgi-bin/fup
+++ b/cgi-bin/fup
@@ -10,6 +10,7 @@
BEGIN { ($ENV{PERLINIT}||'') =~ /(.+)/s and eval $1 }
+use utf8;
use Encode;
use Fcntl qw':flock :seek :mode';
use IO::Handle;
@@ -37,7 +38,7 @@ our (@registration_hosts,@demo,@file_link_dirs);
our ($FEXHOME);
our ($spooldir,$durl,$tmpdir,@logdir,$logdir,$docdir,$hostname,$admin,$fra);
our ($keep_default,$recipient_quota,$sender_quota,$fex_yourself);
-our ($sendmail,$mdomain,$fop_auth,$mail_auth,$faillog);
+our ($sendmail,$mdomain,$fop_auth,$mail_auth,$faillog,$amdl);
our ($dkeydir,$ukeydir,$akeydir,$skeydir,$gkeydir,$xkeydir);
our ($MB,$DS);
our $RB; # read POST bytes (total)
@@ -57,7 +58,7 @@ my @header; # HTTP entity header
my $fileid; # file ID
my $captive;
my $muser; # main user fur sub or group user
-
+
# load common code, local config: $FEXLIB/fex.ph
require "$FEXLIB/fex.pp";
@@ -66,7 +67,7 @@ our ($info_1,$info_2,$info_login);
$locale = $ENV{LOCALE} || 'english';
foreach (
- "/var/lib/fex/locale/$locale/lib/fup.pl",
+ "/var/lib/fex/locale/$locale/lib/fup.pl",
"$FEXLIB/fup.pl",
) {
if (-f) {
@@ -129,7 +130,7 @@ if ($from and $id_forgotten and $mail_authid and not ($fop_auth or $nomail)) {
# public recipients? (needs no auth-ID for sender)
if ($to and $id and $id eq 'PUBLIC' and @public_recipients) {
-
+
unless ($from) {
http_die("missing sender e-mail address");
}
@@ -146,12 +147,12 @@ if ($to and $id and $id eq 'PUBLIC' and @public_recipients) {
}
# anonymous upload from enabled IP?
-if ($from =~ /^anonymous@/ and
+if ($from =~ /^anonymous@/ and
@anonymous_upload and ipin($ra,@anonymous_upload)) {
$id = $rid = $anonymous = 'anonymous';
if ($to =~ /^anonymous/) {
@to = ($to);
- $autodelete{$to} = $autodelete = 'NO';
+ $autodelete{$to} = $autodelete = $specific{'autodelete'}||'NO';
}
$nomail = $anonymous;
}
@@ -161,7 +162,7 @@ $comment = 'NOMAIL' if $nomail and not $comment;
# one time token
if ($okey) {
$to = "@to" or http_die("no recipient specified");
- $from = readlink "$to/\@OKEY/$okey"
+ $from = readlink "$to/\@OKEY/$okey"
or http_die("no upload key \"$okey
\" - ".
"request another one from $to
");
$from = untaint($from);
@@ -199,10 +200,9 @@ if ($from and $id and not ($gkey or $skey or $public or $okey)) {
# set akey link for HTTP sessions
# (need original id for consistant non-moving akey)
if (-d $akeydir and open $idf,'<',"$from/@" and my $id = getline($idf)) {
- $akey = untaint(md5_hex("$from:$id"));
- mksymlink("$akeydir/$akey","../$from");
- # show URL from fexsend
- if ($from eq $to and $comment eq '*') {
+ # akey for webbrowser or fexsend special
+ if (not $sid or ($from eq $to and ($comment eq '*')) or $command) {
+ $akey = untaint(md5_hex("$from:$id"));
mksymlink("$akeydir/$akey","../$from");
}
}
@@ -252,12 +252,12 @@ if ($akey and $dkey and $command eq 'COPY') {
http_die("File not found");
}
if (-e "$to/$to/$file/data") {
- http_die("File $file already exists in your outgoing spool")
- if (readlink("$to/$to/$file/id")||$to) ne
+ http_die("File $file already exists in your outgoing spool")
+ if (readlink("$to/$to/$file/id")||$to) ne
(readlink("$to/$from/$file/id")||$from);
} else {
mkdirp("$to/$to/$file");
- link "$to/$from/$file/data","$to/$to/$file/data"
+ link "$to/$from/$file/data","$to/$to/$file/data"
or http_die("cannot link to $to/$to/$file/data - $!\n");
copy("$to/$from/$file/filename","$to/$to/$file/filename");
copy("$to/$from/$file/id","$to/$to/$file/id");
@@ -302,7 +302,7 @@ if ($akey and $dkey and $command eq 'DELETE') {
""
);
&reexec;
- } else {
+ } else {
my $s = $!;
http_header('404 Not Found');
print html_header($head);
@@ -315,7 +315,7 @@ if ($akey and $dkey and $command eq 'DELETE') {
# special commands
if (($from and $id and $rid eq $id or $gkey or $skey) and $command) {
-
+
if ($command eq 'CHECKQUOTA') {
http_die("illegal command \"$command\"") if $public or $anonymous;
nvt_print('HTTP/1.1 204 OK');
@@ -390,9 +390,9 @@ if (($from and $id and $rid eq $id or $gkey or $skey) and $command) {
$filename = <$file>;
close $file;
}
- if ($filename and length $filename) {
+ if ($filename and length $filename) {
$filename = html_quote($filename);
- } else {
+ } else {
$filename = '???';
}
if (open $file,'<',"$file/comment") {
@@ -401,22 +401,22 @@ if (($from and $id and $rid eq $id or $gkey or $skey) and $command) {
}
my $rkeep = untaint(readlink "$file/keep"||$keep_default)
- int((time-mtime("$file/filename"))/$DS);
- if ($comment =~ /NOMAIL/ or
+ if ($comment =~ /NOMAIL/ or
(readlink "$to/\@NOTIFICATION"||'') =~ /^no/i) {
- printf "%8s MB [%s d] %s/%s/%s\n",
+ printf "%8s MB (%2s d) %s/%s/%s\n",
$size,
$rkeep,
$durl,
$dkey,
urlencode(basename($file));
} else {
- printf "%8s MB [%s d] %s%s %s\n",
+ printf "%8s MB (%2s d) %s%s %s\n",
$size,
$rkeep,
untaint("/fup?akey=$akey&dkey=$dkey&command=RENOTIFY"),
$filename,
$comment ? qq' "$comment"' : '',
- $file eq $nfile ?
+ $file eq $nfile ?
" → notification e-mail has been resent" :
"";
}
@@ -428,7 +428,7 @@ if (($from and $id and $rid eq $id or $gkey or $skey) and $command) {
'