Handle default vs 0 better on AIX

This commit is contained in:
Jamie Cameron
2008-10-15 21:53:52 +00:00
parent b1f0532ed3
commit 5df2a340bc
4 changed files with 37 additions and 27 deletions

View File

@@ -339,8 +339,7 @@ elsif ($pft == 4 && $access{'peopt'}) {
$n eq "" ? $text{'uedit_never'} :
$text{'uedit_unknown'}));
if ($uinfo{'expire'}) {
$uinfo{'expire'} =~ /^(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/;
if ($uinfo{'expire'} =~ /^(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/) {
$emon = $1;
$eday = $2;
$ehour = $3;
@@ -355,20 +354,24 @@ elsif ($pft == 4 && $access{'peopt'}) {
}
$emon =~ s/0(\d)/$1/; # strip leading 0
print &ui_table_row(&hlink($text{'expire'}, "expire"),
&date_input($eday, $emon, $eyear, 'expire').
" ".&ui_textbox("expireh", $ehour, 3).
"/".&ui_textbox("expiremi", $emin, 3));
&ui_radio("expire_def", $uinfo{'expire'} eq '' ? 1 :
$uinfo{'expire'} eq '0' ? 2 : 0,
[ [ 1, $text{'uedit_sys'} ],
[ 2, $text{'uedit_never'} ],
[ 0, &date_input($eday, $emon, $eyear, 'expire').
" ".&ui_textbox("expireh", $ehour, 3).
"/".&ui_textbox("expiremi", $emin, 3) ] ]));
# Minimum and maximum ages in weeks
print &ui_table_row(&hlink($text{'min_weeks'}, "min_weeks"),
&ui_textbox("min", $uinfo{'min'}, 5));
&ui_opt_textbox("min", $uinfo{'min'}, 5, $text{'uedit_sys'}));
print &ui_table_row(&hlink($text{'max_weeks'}, "max_weeks"),
&ui_textbox("max", $uinfo{'max'}, 5));
&ui_opt_textbox("max", $uinfo{'max'}, 5, $text{'uedit_sys'}));
# Warning days
print &ui_table_row(&hlink($text{'warn'}, "warn"),
&ui_textbox("warn", $uinfo{'warn'}, 5));
&ui_opt_textbox("warn", $uinfo{'warn'}, 5, $text{'uedit_sys'}));
# AIX-specific flags
print &ui_table_row(&hlink($text{'flags'}, "flags"),

View File

@@ -123,6 +123,8 @@ uedit_forcechange=Force change at next login?
uedit_uid_def=Automatic
uedit_uid_calc=Calculated
uedit_disabled=Login temporarily disabled
uedit_sys=System default
uedit_never=Never
usave_err=Failed to save user
usave_eedit=You cannot edit this user
@@ -156,16 +158,16 @@ usave_emin='$1' is not a valid minimum change period
usave_emax='$1' is not a valid maximum change period
usave_ewarn='$1' is not a valid warning period
usave_einactive='$1' is not a valid inactive period
usave_eexpire=invalid expiry date
usave_echange=invalid change date
usave_eexpire=Invalid expiry date
usave_echange=Invalid change date
usave_eclass='$1' is not a valid login class
usave_emove=failed to move home directory : $1
usave_emkdir=couldn't create home directory : $1
usave_echown=couldn't chown home directory : $1
usave_echmod=couldn't chmod home directory : $1
usave_eoffice=office cannot contain a : character
usave_eworkph=work phone cannot contain a : character
usave_ehomeph=home phone cannot contain a : character
usave_emove=Failed to move home directory : $1
usave_emkdir=Couldn't create home directory : $1
usave_echown=Couldn't chown home directory : $1
usave_echmod=Couldn't chmod home directory : $1
usave_eoffice=Office cannot contain a : character
usave_eworkph=Work phone cannot contain a : character
usave_ehomeph=Home phone cannot contain a : character
usave_edigestmd5=Your system has MD5 passwords enabled, but neither the perl MD5 or Digest::MD5 module is not installed.<p>To force the use of normal encrypted passwords, adjust your <a href='$1'>module configuration</a>.<p>Or have Webmin <a href='$2'>download and install</a> the Digest::MD5 module for you.
usave_emaking=Before update command failed : $1
usave_epasswd_min=Password must be at least $1 letters long

View File

@@ -390,9 +390,19 @@ elsif ($pft == 1 || $pft == 6) {
}
elsif ($pft == 4) {
# Validate AIX-style password inputs
if ($in{'expired'} ne "" && $in{'expirem'} ne ""
&& $in{'expirey'} ne "" ) {
if ($in{'expire_def'} == 1) {
# System default expiry date
$expire = undef;
}
elsif ($in{'expire_def'} == 2) {
# Never expires
$expire = "0";
}
else {
# Add a leading zero if only 1 digit long
$in{'expirem'} =~ /^\d+$/ && $in{'expired'} =~ /^\d+$/ &&
$in{'expireh'} =~ /^\d+$/ && $in{'expiremi'} =~ /^\d+$/ &&
$in{'expirey'} =~ /^\d+$/ || &error($text{'usave_eexpire'});
$in{'expirem'} =~ s/^(\d)$/0$1/;
$in{'expired'} =~ s/^(\d)$/0$1/;
$in{'expireh'} =~ s/^(\d)$/0$1/;
@@ -406,15 +416,14 @@ elsif ($pft == 4) {
$in{'expiremi'} = "01" if $in{'expiremi'} eq "";
$expire="$in{'expirem'}$in{'expired'}$in{'expireh'}$in{'expiremi'}$in{'expirey'}";
}
else { $expire = ""; }
if ($access{'peopt'}) {
$user{'admin'} = $in{'flags'} =~ /admin/;
$user{'admchg'} = $in{'flags'} =~ /admchg/;
$user{'nocheck'} = $in{'flags'} =~ /nocheck/;
$user{'expire'} = $expire;
$user{'min'} = $in{'min'};
$user{'max'} = $in{'max'};
$user{'warn'} = $in{'warn'};
$user{'min'} = $in{'min_def'} ? undef : $in{'min'};
$user{'max'} = $in{'max_def'} ? undef : $in{'max'};
$user{'warn'} = $in{'warn_def'} ? undef : $in{'warn'};
}
else {
$user{'admin'} = $ouser{'admin'};

View File

@@ -216,19 +216,15 @@ else {
elsif (/^\s*([^=\s]+)\s*=\s*(.*)/) {
if ($1 eq 'expires') {
$lastuser->{'expire'} = $2;
$lastuser->{'expire'} =~ s/^0$//;
}
elsif ($1 eq 'minage') {
$lastuser->{'min'} = $2;
$lastuser->{'min'} =~ s/^0$//;
}
elsif ($1 eq 'maxage') {
$lastuser->{'max'} = $2;
$lastuser->{'max'} =~ s/^0$//;
}
elsif ($1 eq 'pwdwarntime') {
$lastuser->{'warn'} = $2;
$lastuser->{'warn'} =~ s/^0$//;
}
}
}