2006-05-12 11:17:23 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
my ($name,$uid) = @ARGV;
|
|
|
|
|
|
|
|
if (!$name || !$uid) {
|
|
|
|
print "Usage: mem_add <name> <uid>\n";
|
|
|
|
print " Create the AlternC account <name> having uid number <uid>\n";
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
$ENV{PATH} = "";
|
|
|
|
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
|
|
|
|
|
2006-11-28 00:56:51 +00:00
|
|
|
if (!($name =~ /^([a-z0-9]+)$/)) {
|
2006-05-12 11:17:23 +00:00
|
|
|
die "Account name is incorrect.";
|
|
|
|
}
|
|
|
|
$name=$1;
|
|
|
|
if (!($uid =~ /^([0-9]+)$/)) {
|
|
|
|
die "uid is incorrect.";
|
|
|
|
}
|
|
|
|
$uid=$1;
|
|
|
|
|
|
|
|
$< = $>;
|
|
|
|
$( = $);
|
|
|
|
|
|
|
|
my $PTH="/var/alternc/html/".substr($name,0,1)."/".$name;
|
|
|
|
|
2010-03-04 15:10:05 +00:00
|
|
|
my @create_paths = ($PTH);
|
2009-01-28 20:38:11 +00:00
|
|
|
|
|
|
|
for my $p (@create_paths) {
|
|
|
|
mkdir($p);
|
2011-05-22 17:23:59 +00:00
|
|
|
chown($uid, $uid, $p);
|
2009-01-28 20:38:11 +00:00
|
|
|
system("/bin/chmod 02770 '$p'");
|
2012-06-26 08:08:49 +00:00
|
|
|
system("/usr/lib/alternc/fixperms.sh -u '$uid' ");
|
2009-01-28 20:38:11 +00:00
|
|
|
}
|
2006-05-12 11:17:23 +00:00
|
|
|
|
|
|
|
0;
|
|
|
|
|