Fix automatic home dir that includes group

This commit is contained in:
Jamie Cameron
2010-07-31 02:04:49 -07:00
parent 907ce09800
commit e9f5f4e42a
2 changed files with 11 additions and 3 deletions

View File

@@ -142,10 +142,18 @@ if ($config{'given'}) {
print &ui_table_row($text{'real'},
&ui_textbox("real", $real, 40));
# Work out group name
if ($in{'new'}) {
$grp = $mconfig{'default_group'};
}
else {
$grp = &all_getgrgid($gid);
}
# Show home directory input, with an 'automatic' option
if ($mconfig{'home_base'}) {
local $hb = $in{'new'} ||
&auto_home_dir($mconfig{'home_base'}, $user) eq $home;
&auto_home_dir($mconfig{'home_base'}, $user, $grp) eq $home;
$homefield = &ui_radio("home_base", $hb ? 1 : 0,
[ [ 1, $text{'uedit_auto'} ],
[ 0, &ui_filebox("home", $hb ? "" : $home,
@@ -263,8 +271,7 @@ print &ui_table_start($text{'uedit_gmem'}, "width=100%", 4, \@tds);
# Primary group
print &ui_table_row($text{'group'},
&ui_textbox("gid", $in{'new'} ? $mconfig{'default_group'}
: ($x=&all_getgrgid($gid)) || $gid, 13).
&ui_textbox("gid", $grp || $gid, 13).
" ".&group_chooser_button("gid"), 3);
if ($config{'secmode'} != 1) {

View File

@@ -265,6 +265,7 @@ else {
$gid = &all_getgrnam($in{'gid'});
defined($gid) || &error(&text('usave_egid', $in{'gid'}));
}
$grp = &all_getgrgid($gid);
# Build useradmin-style hash of user details
local %uhash = ( 'user' => $user,