#
# Copyright (C) 1997 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
# Copyright (C) 2001-2007 Ryan Murray <rmurray@debian.org>
+# Copyright (C) 2008 Thomas Viehmann <tv@beamnet.de>
#
# This program is free software. You can redistribute it and/or
# modify it under the terms of the GNU General Public License as
if ($word[0] eq "rm") {
foreach ( @word[1..$#word] ) {
my $origword = $_;
- if ($_ eq "--searchdirs") {
- $selecteddelayed = -2;
- }
- elsif (m,^DELAYED/([0-9]+)-day/,) {
+ if (m,^DELAYED/([0-9]+)-day/,) {
$selecteddelayed = $1;
s,^DELAYED/[0-9]+-day/,,;
}
- if (m,/,) {
+ if ($origword eq "--searchdirs") {
+ $selecteddelayed = -2;
+ }
+ elsif (m,/,) {
msg( "mail,log", "$_: filename may not contain slashes except for DELAYED/#-day/ prefixes\n" );
}
else {
msg( "mail,log", "$file: rm: $!\n" );
}
else {
+ $file =~ s,$conf::incoming/?,,;
push( @removed, $file );
}
}
elsif ($word[1] !~ m,^[a-zA-Z0-9.+_:@=%-][~a-zA-Z0-9.+_:@=%-]*\.changes$,) {
msg( "mail,log", "argument to cancel must be one .changes filename without path\n" );
}
- my (@files);
+ my (@files) = ();
for ( my($adelay)=0; $adelay <= $conf::max_delayed; $adelay++ ) {
my($dir) = sprintf( "$conf::targetdir_delayed",$adelay );
if (-f "$dir/$word[1]") {
- push (@files, "$dir/$word[1]");
- push (@files, map( "$dir/$_",get_filelist_from_known_good_changes("$dir/$word[1]")));
+ @removed = ();
+ push (@files, "$word[1]");
+ push (@files,get_filelist_from_known_good_changes("$dir/$word[1]"));
+ foreach $file ( @files ) {
+ if (!-f "$dir/$file") {
+ msg( "mail,log", "$dir/$file: no such file\n" );
+ }
+ elsif ("$dir/$file" =~ /$conf::keep_files/) {
+ msg( "mail,log", "$dir/$file is protected, cannot ".
+ "remove\n" );
+ }
+ elsif (!unlink( "$dir/$file" )) {
+ msg( "mail,log", "$dir/$file: rm: $!\n" );
+ }
+ else {
+ push( @removed, $file );
+ }
+ }
+ msg( "mail,log", "Files removed from $adelay-day: @removed\n" ) if @removed;
}
}
if (!@files) {
msg( "mail,log", "No upload found: $word[1]\n" );
}
- else {
- @removed = ();
- foreach $file ( @files ) {
- if (!-f $file) {
- msg( "mail,log", "$file: no such file\n" );
- }
- elsif ($file =~ /$conf::keep_files/) {
- msg( "mail,log", "$file is protected, cannot ".
- "remove\n" );
- }
- elsif (!unlink( $file )) {
- msg( "mail,log", "$file: rm: $!\n" );
- }
- else {
- push( @removed, $file );
- }
- }
- msg( "mail,log", "Files removed: @removed\n" ) if @removed;
- }
}
else {
msg( "mail,log", "unknown command $word[0]\n" );