aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaouda Lo <daouda@mandriva.com>2003-06-23 14:37:15 +0000
committerDaouda Lo <daouda@mandriva.com>2003-06-23 14:37:15 +0000
commit04ace02ba1d1c16ecad2727d9c8e7c2ff5582d33 (patch)
tree25d35631204a8e569e7bdd5196dbd3842e3ff6f0
parentfeb8f9e83fd5bddb1d56c92c00428051dbe088d7 (diff)
downloaduserdrake-04ace02ba1d1c16ecad2727d9c8e7c2ff5582d33.tar
userdrake-04ace02ba1d1c16ecad2727d9c8e7c2ff5582d33.tar.gz
userdrake-04ace02ba1d1c16ecad2727d9c8e7c2ff5582d33.tar.bz2
userdrake-04ace02ba1d1c16ecad2727d9c8e7c2ff5582d33.tar.xz
userdrake-04ace02ba1d1c16ecad2727d9c8e7c2ff5582d33.zip
- Correct bug from converting NV to IV (Warly)
-rw-r--r--USER/USER.xs12
-rwxr-xr-xuserdrake222
2 files changed, 19 insertions, 15 deletions
diff --git a/USER/USER.xs b/USER/USER.xs
index 01c6be0..ceadda3 100644
--- a/USER/USER.xs
+++ b/USER/USER.xs
@@ -1327,13 +1327,13 @@ Ent_ShadowExpire(self, ssv)
XPUSHs(sv_2mortal(newSViv(atol(g_value_get_string(value)))));
}
}
- } else {
- memset(&val, 0, sizeof(val));
- g_value_init(&val, G_TYPE_LONG);
- g_value_set_long(&val, (long)SvIV( ssv ));
- lu_ent_clear(self, LU_SHADOWEXPIRE);
- lu_ent_add(self, LU_SHADOWEXPIRE, &val);
}
+ } else if (SvNOK(ssv)) {
+ memset(&val, 0, sizeof(val));
+ g_value_init(&val, G_TYPE_LONG);
+ g_value_set_long(&val, (long)SvNV( ssv ));
+ lu_ent_clear(self, LU_SHADOWEXPIRE);
+ lu_ent_add(self, LU_SHADOWEXPIRE, &val);
} else {
warn("XS_ShadowExpire: Cannot make operation on LU_SHADOWEXPIRE attribute");
}
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 {