local *_;
+ my $time_bar = time - 120;
my @trash;
my %possible;
# Get list of all possible files from incoming dir.
my $ent = $1; # if we get here, $RE_filename_here matched above
# $_ remains tainted, but $ent is an untainted (and safe) copy
+ # Do not consider files that have been modified in the last 2 minutes.
+ # This is an extra safety check to avoid trying to process files that
+ # are still being uploaded.
+ if (TSTAMPCHECK) {
+ if ((stat($ent))[9] >= $time_bar) {
+ ftp_syslog('debug', "DEBUG: "
+ ."$ent has been modified in the last 2 minutes, skipping")
+ if DEBUG;
+ next ENT
+ }
+ }
+
ftp_syslog('debug', "DEBUG: uploaded file to check: $ent") if DEBUG;
$possible{$ent} = 1;
}
or ftp_die("FATAL: cannot exec lsof: $!");
}
- # Do not consider files that have been modified in the last 2 minutes
- # This is an extra safety check to avoid trying to process files that are
- # still being uploaded.
- if (TSTAMPCHECK) {
- for my $ent (keys %possible) {
- my @stat = stat($ent);
- if ($stat[9] >= time - 120) {
- ftp_syslog('debug', "DEBUG: "
- ."$ent has been modified in the last 2 minutes, skipping")
- if DEBUG;
- delete ($possible{$ent});
- next;
- }
- }
- }
-
my @ret;
# For each remaining possibility, do some more checks
scan,bogus1 "scan found file: bogus1"
scan,bogus2 "scan found file: bogus2"
- scan,bogus3 "scan found file: bogus3"
+
+ recent,bogus3 "skipped recent file: bogus3"
scan,_bogus "scan found file: _bogus"
scan,+bogus "scan found file: +bogus"
!scan,x?x "ignored file: x?x"
!scan,;xax "ignored file: ;xax"
- recent,bogus3 "skipped recent file: bogus3"
-
consider,bogus1 "considered file: bogus1"
consider,bogus2 "considered file: bogus2"
}
set msglist {
start "ftp-upload start message"
nowork "ftp-upload 'nothing to do' message"
-
- scan,recent.bin "scan found main file"
- scan,recent.bin.sig "scan found signature file"
- scan,recent.bin.directive.asc "scan found directive file"
}
set testcase {
lappend msglist recent,recent.bin.directive.asc \
"skipped recent directive file"
} else {
+ lappend msglist scan,recent.bin.directive.asc \
+ "scan found directive file"
lappend msglist consider,recent.bin.directive.asc \
"considered directive file"
}
lappend testcase file-mtime "15 seconds ago"
lappend msglist recent,recent.bin "skipped recent main file"
} else {
+ lappend msglist scan,recent.bin "scan found main file"
lappend msglist consider,recent.bin "considered main file"
}
if { $recent_signature } {
lappend testcase fsig-mtime "15 seconds ago"
lappend msglist recent,recent.bin.sig "skipped recent signature file"
} else {
+ lappend msglist scan,recent.bin.sig "scan found signature file"
lappend msglist consider,recent.bin.sig "considered signature file"
}