| Revision 3187,
712 bytes
checked in by squidly, 11 months ago
(diff) |
|
Bugfixes gestions des droits
|
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | #!/usr/bin/perl |
|---|
| 2 | |
|---|
| 3 | use strict; |
|---|
| 4 | |
|---|
| 5 | my ($name,$uid) = @ARGV; |
|---|
| 6 | |
|---|
| 7 | if (!$name || !$uid) { |
|---|
| 8 | print "Usage: mem_add <name> <uid>\n"; |
|---|
| 9 | print " Create the AlternC account <name> having uid number <uid>\n"; |
|---|
| 10 | exit(1); |
|---|
| 11 | } |
|---|
| 12 | |
|---|
| 13 | $ENV{PATH} = ""; |
|---|
| 14 | delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; |
|---|
| 15 | |
|---|
| 16 | if (!($name =~ /^([a-z0-9]+)$/)) { |
|---|
| 17 | die "Account name is incorrect."; |
|---|
| 18 | } |
|---|
| 19 | $name=$1; |
|---|
| 20 | if (!($uid =~ /^([0-9]+)$/)) { |
|---|
| 21 | die "uid is incorrect."; |
|---|
| 22 | } |
|---|
| 23 | $uid=$1; |
|---|
| 24 | |
|---|
| 25 | $< = $>; |
|---|
| 26 | $( = $); |
|---|
| 27 | |
|---|
| 28 | my $PTH="/var/alternc/html/".substr($name,0,1)."/".$name; |
|---|
| 29 | |
|---|
| 30 | my @create_paths = ($PTH); |
|---|
| 31 | |
|---|
| 32 | for my $p (@create_paths) { |
|---|
| 33 | mkdir($p); |
|---|
| 34 | chown($uid, $uid, $p); |
|---|
| 35 | system("/bin/chmod 02770 '$p'"); |
|---|
| 36 | system("/usr/lib/alternc/fixperms.sh -u '$uid' "); |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | 0; |
|---|
| 40 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.