Module config options for next uid and gid

This commit is contained in:
Jamie Cameron
2007-07-16 17:20:55 +00:00
parent a6547cc304
commit b1e3b77ff2
4 changed files with 21 additions and 3 deletions

View File

@ -67,7 +67,7 @@ else {
@shlist = ($mconfig{'default_shell'} ? ( $mconfig{'default_shell'} ) : ( ));
%shells = map { $_, 1 } split(/,/, $config{'shells'});
push(@shlist, "/bin/sh", "/bin/csh", "/bin/false") if ($shells{'fixed'});
if ($shells{'passwd'} || $in{'new'}) {
if ($shells{'passwd'} || $in{'new'} && !$config{'next_uid'}) {
# Don't do this unless we need to, as scanning all user is slow
&build_user_used(\%used, $shells{'passwd'} ? \@shlist : undef);
}
@ -115,7 +115,14 @@ else {
print "<td><b>$text{'uid'}</b></td>\n";
if ($in{'new'}) {
# Find the first free UID above the base
$newuid = &allocate_uid(\%used);
if ($config{'next_uid'}) {
$newuid = $config{'next_uid'};
$config{'next_uid'}++;
&save_module_config();
}
else {
$newuid = &allocate_uid(\%used);
}
print "<td><input name=uid size=10 value='$newuid'></td> </tr>\n";
}
else {