aboutsummaryrefslogtreecommitdiffstats
path: root/userdrake2
diff options
context:
space:
mode:
Diffstat (limited to 'userdrake2')
-rwxr-xr-xuserdrake222
1 files changed, 13 insertions, 9 deletions
diff --git a/userdrake2 b/userdrake2
index 19cefc6..08c9687 100755
--- a/userdrake2
+++ b/userdrake2
@@ -495,7 +495,7 @@ sub Edit {
0, $us->{o}->{acheckexpire} = Gtk2::CheckButton->new(N("Enable account expiration")),
0, gtkpack__(my $h = Gtk2::HBox->new(0, 10),
0, Gtk2::Label->new(N("Account expires MM/DD/YYYY :")),
- 1, map { my $s = $_->[0]; my $t = $_->[1];
+ 0, map { my $s = $_->[0]; my $t = $_->[1];
$us->{o}->{$s} = GtkEntrySized($t),
} (['expm', 2], ['expd', 2], ['expy', 4]),
),
@@ -535,16 +535,17 @@ sub Edit {
my $expire = $userEnt->ShadowExpire($GetValue);
if ($expire && $expire != -1) {
$us->{o}->{acheckexpire}->set_active(1); $h->set_sensitive(1);
- $times = TimeOfArray($expire);
+ $times = TimeOfArray($expire, 1);
+ printf("day = %s ** Month = %s , Year = %s", $times->{dayint}, $times->{month}, $times->{year});
$us->{o}->{expd}->set_text($times->{dayint}); $us->{o}->{expm}->set_text($times->{month});
- $us->{o}->{expy}->set_text($times->{year})
+ $us->{o}->{expy}->set_text($times->{year});
}
#root account should never be locked
!$Uid and $us->{o}->{lockuser}->set_sensitive(0);
# Check if user account is locked
$ctx->IsLocked($userEnt) and $us->{o}->{lockuser}->set_active(1);
my $lastchg = $userEnt->ShadowLastChange($GetValue);
- if ($lastchg) { $times = TimeOfArray($lastchg);
+ if ($lastchg) { $times = TimeOfArray($lastchg, 0);
$dayStr->set_text($times->{daystr}); $month->set_text($times->{month}); $dayInt->set_text($times->{dayint}); $year->set_text($times->{year});
}
$min = $userEnt->ShadowMin($GetValue); $max =$userEnt->ShadowMax($GetValue); $warn = $userEnt->ShadowWarn($GetValue); $inact = $userEnt->ShadowInact($GetValue);
@@ -584,7 +585,7 @@ sub Edit {
} else { $model->append_set([ 0 => gtkcreate_pixbuf($pix[1]), 1 => $user, 2 => 0]); }
}
}
- my ($ch, $name, $uEnt, $gEnt, $ugid);
+ my ($ch, $name, $uEnt, $gEnt, $ugid, $Exp);
gtkadd($w->{window},
gtkpack_(Gtk2::VBox->new(0,5),
1, !$p ? $nbU : $nbG,
@@ -640,11 +641,13 @@ sub Edit {
$ugid = $ent->Gid($GetValue);
$userEnt->Gid($ugid);
if ($us->{o}->{acheckexpire}->get_active()) {
+ print "test";
my $yr = $us->{o}->{expy}->get_text(); my $mo = $us->{o}->{expm}->get_text();
my $dy = $us->{o}->{expd}->get_text();
$yr && $dy && $mo or RaiseError(N("Please specify Year, Month and Day \n for Account Expiration "));
- !$error and $userEnt->ShadowExpire(ConvTime($dy, $mo, $yr));
- } else { $userEnt->ShadowExpire(-1) }
+ $Exp = ConvTime($dy, $mo, $yr);
+ !$error and $userEnt->ShadowExpire($Exp);
+ } else { $userEnt->ShadowExpire(ceil(-1)) }
if ($us->{o}->{pcheckexpire}->get_active()) {
my $allowed = $us->{o}->{dbca}->get_text(); my $required = $us->{o}->{dbcr}->get_text();
my $warning = $us->{o}->{bwbc}->set_text($min); my $inactive = $us->{o}->{dbai}->get_text();
@@ -748,10 +751,11 @@ sub ConvTime {
return $days;
}
sub TimeOfArray {
- my $reltime = shift;
- my $h; my $t;
+ my ($reltime, $cm) = @_;
+ my $h; my $t; my %mth = (Jan => 1, Feb => 2, Mar => 3, Apr=> 4, May => 5, Jun => 6, Jul => 7, Aug => 8, Sep => 9, Oct => 10, Nov => 11, Dec => 12);
$t = gmtime($reltime * 24 * 60 * 60) =~ /(\S+)\s+(\S+)\s+(\d+)\s+(\S+)\s+(\d+)/;
$h->{daystr} = $1; $h->{month} = $2; $h->{dayint} = $3; $h->{year} = $5 ;
+ $cm and $h->{month} = $mth{$2};
$h
}
sub InArray {