root/alternc/tags/0.9.6/src/mail_add

Revision 1618, 0.8 kB (checked in by benjamin, 3 years ago)

ajout des perl suid scripts (desole, j'avais oublie...)

  • Property svn:executable set to *
Line 
1 #!/usr/bin/perl
2
3 use strict;
4
5 my ($mailname,$uid) = @ARGV;
6
7 if (!$mailname || !$uid) {
8     print "Usage: mail_add <mailname> <uid>\n";
9     print " Create the mail <mailname> for the alternc account having uid number <uid>\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\.-]+)$/)) {
17     die "Email is incorrect.";
18 }
19 $mailname=$1;
20 if (!($uid =~ /^([0-9]+)$/)) {
21     die "uid is incorrect.";
22 }
23 $uid=$1;
24
25 $< = $>;
26 $( = $);
27
28 my $PTH="/var/alternc/mail/".substr($mailname,0,1)."/".$mailname;
29
30 my @todo=(
31        $PTH,
32        $PTH."/Maildir",
33        $PTH."/Maildir/cur",
34        $PTH."/Maildir/new",
35        $PTH."/Maildir/tmp",
36        );
37
38 foreach(@todo) {
39     mkdir($_);
40     system("/bin/chown 33:$uid '".quotemeta($_)."'");
41 }
42
43 0;
44
Note: See TracBrowser for help on using the browser.