root/alternc/trunk/src/mail_del

Revision 1758, 472 bytes (checked in by anarcat, 2 years ago)

remove quotemeta everywhere, and make sure variables are safe before using them. Closes: #1003

  • Property svn:executable set to *
Line 
1 #!/usr/bin/perl
2
3 use strict;
4
5 my ($mailname) = @ARGV;
6
7 if (!$mailname) {
8     print "Usage: mail_del <mailname>\n";
9     print " Destroy pop account <mailname>\n";
10     exit(1);
11 }
12
13 $ENV{PATH} = "";
14 delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
15
16 if (!($mailname =~ /^([a-z0-9_\+-][a-z0-9_\+\.-]+\_[a-z0-9\.-]+)$/)) {
17     die "Email is incorrect.";
18 }
19 $mailname=$1;
20
21 $< = $>;
22 $( = $);
23
24 system("/bin/rm -rf '/var/alternc/mail/".substr($mailname,0,1)."/".$mailname."'");
25
26 0;
27
Note: See TracBrowser for help on using the browser.