+ elsif ($word[0] eq "cancel") {
+ if (@word != 2) {
+ msg( "mail,log", "Wrong number of arguments\n" );
+ }
+ elsif ($conf::upload_method ne "copy") {
+ msg( "mail,log", "cancel not available\n" );
+ }
+ 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) = ();
+ for ( my($adelay)=0; $adelay <= $conf::max_delayed; $adelay++ ) {
+ my($dir) = sprintf( "$conf::targetdir_delayed",$adelay );
+ if (-f "$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" );
+ }
+ }