| 86 |
our $no_create_home = undef; |
our $no_create_home = undef; |
| 87 |
our $special_home = undef; |
our $special_home = undef; |
| 88 |
our $special_shell = undef; |
our $special_shell = undef; |
| 89 |
|
our $add_extra_groups = 0; |
| 90 |
|
|
| 91 |
# Global variables we need later |
# Global variables we need later |
| 92 |
my $existing_user = undef; |
my $existing_user = undef; |
| 124 |
"gid=i" => \$new_gid, |
"gid=i" => \$new_gid, |
| 125 |
"conf=s" => \$configfile, |
"conf=s" => \$configfile, |
| 126 |
"no-create-home" => \$no_create_home, |
"no-create-home" => \$no_create_home, |
| 127 |
|
"add_extra_groups" => \$add_extra_groups, |
| 128 |
"debug" => sub { $verbose = 2 } ); |
"debug" => sub { $verbose = 2 } ); |
| 129 |
|
|
| 130 |
# everyone can issue "--help" and "--version", but only root can go on |
# everyone can issue "--help" and "--version", but only root can go on |
| 535 |
} |
} |
| 536 |
} |
} |
| 537 |
|
|
| 538 |
|
if ( ( $add_extra_groups || $config{"add_extra_groups"} ) && defined($config{"extra_groups"}) ) { |
| 539 |
|
printf (gtx("Adding new user `%s' to extra groups\n"), $new_name); |
| 540 |
|
foreach my $newgrp ( split ' ', $config{"extra_groups"} ) { |
| 541 |
|
if (!defined getgrnam($newgrp)) { |
| 542 |
|
warnf (gtx("The group `%s' does not exist.\n"),$newgrp); |
| 543 |
|
next; |
| 544 |
|
} |
| 545 |
|
if (&user_is_member($new_name, $newgrp)) { |
| 546 |
|
printf gtx("The user `%s' is already a member of `%s'.\n"), |
| 547 |
|
$new_name,$newgrp if $verbose; |
| 548 |
|
next; |
| 549 |
|
|
| 550 |
|
} |
| 551 |
|
|
| 552 |
|
printf gtx("Adding user `%s' to group `%s'...\n"),$new_name,$newgrp |
| 553 |
|
if $verbose; |
| 554 |
|
&invalidate_nscd(); |
| 555 |
|
&systemcall('/usr/bin/gpasswd', '-M', |
| 556 |
|
join(',', get_group_members($newgrp), $new_name), |
| 557 |
|
$newgrp); |
| 558 |
|
&invalidate_nscd(); |
| 559 |
|
} |
| 560 |
|
} |
| 561 |
|
|
| 562 |
|
|
| 563 |
if ($config{"quotauser"}) { |
if ($config{"quotauser"}) { |
| 564 |
printf (gtx("Setting quota from `%s'.\n"),$config{quotauser}); |
printf (gtx("Setting quota from `%s'.\n"),$config{quotauser}); |
| 565 |
&systemcall('/usr/sbin/edquota', '-p', $config{quotauser}, $new_name); |
&systemcall('/usr/sbin/edquota', '-p', $config{quotauser}, $new_name); |