aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ManaTools/Shared/Users.pm
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2015-08-05 23:51:10 +0200
committerAngelo Naselli <anaselli@linux.it>2015-08-05 23:51:10 +0200
commit80bfa8e3765df338d351aa6710330022e9d0a18f (patch)
tree67e20c48a0a1e22ccd26f5bbf092a90047db6f9c /lib/ManaTools/Shared/Users.pm
parent729f4220ad4eef55f47d235df394fec296cde8e4 (diff)
downloadmanatools-80bfa8e3765df338d351aa6710330022e9d0a18f.tar
manatools-80bfa8e3765df338d351aa6710330022e9d0a18f.tar.gz
manatools-80bfa8e3765df338d351aa6710330022e9d0a18f.tar.bz2
manatools-80bfa8e3765df338d351aa6710330022e9d0a18f.tar.xz
manatools-80bfa8e3765df338d351aa6710330022e9d0a18f.zip
avoid crashing when getting unexpected undefined values with new libuser
Diffstat (limited to 'lib/ManaTools/Shared/Users.pm')
-rw-r--r--lib/ManaTools/Shared/Users.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ManaTools/Shared/Users.pm b/lib/ManaTools/Shared/Users.pm
index 900819e9..22a5820c 100644
--- a/lib/ManaTools/Shared/Users.pm
+++ b/lib/ManaTools/Shared/Users.pm
@@ -873,6 +873,10 @@ sub getGroupsInfo {
my @GroupReal;
LOOP: foreach my $g (@{$groups}) {
my $gid = $g->Gid($self->USER_GetValue);
+ if (!defined($gid)) {
+ print "Got an unexpected undefined group!\n";
+ next LOOP;
+ }
next LOOP if $filtergroups && $gid <= 499 || $gid == 65534;
if ($filtergroups && $gid > 499 && $gid < $self->min_GID) {
my $groupname = $g->GroupName($self->USER_GetValue);
@@ -1158,7 +1162,7 @@ sub computeLockExpire {
my ( $self, $l ) = @_;
my $ep = $l->ShadowExpire($self->USER_GetValue);
my $tm = ceil(time()/(24*60*60));
- $ep = -1 if int($tm) <= $ep;
+ $ep = -1 if !defined($ep) || int($tm) <= $ep;
my $status = $self->ctx->IsLocked($l) ? $self->loc->N("Locked") : ($ep != -1 ? $self->loc->N("Expired") : '');
return $status;
}