diff options
author | Angelo Naselli <anaselli@linux.it> | 2014-08-07 13:14:39 +0200 |
---|---|---|
committer | Angelo Naselli <anaselli@linux.it> | 2014-08-07 13:14:39 +0200 |
commit | 4e770af4ee003bf6c7e81f61e627dc5cdcf2995d (patch) | |
tree | 901fd9ac60d032e5286f990057afeefd86d91073 /lib/AdminPanel/Module | |
parent | 600ef5359a962b731c00cfdebb353cdeb75ddd65 (diff) | |
download | manatools-4e770af4ee003bf6c7e81f61e627dc5cdcf2995d.tar manatools-4e770af4ee003bf6c7e81f61e627dc5cdcf2995d.tar.gz manatools-4e770af4ee003bf6c7e81f61e627dc5cdcf2995d.tar.bz2 manatools-4e770af4ee003bf6c7e81f61e627dc5cdcf2995d.tar.xz manatools-4e770af4ee003bf6c7e81f61e627dc5cdcf2995d.zip |
From userdrake
- Switch uid/gid boundary to 1000+
- Add some heuristics to ignore system users in the 500-999 range
Diffstat (limited to 'lib/AdminPanel/Module')
-rw-r--r-- | lib/AdminPanel/Module/Users.pm | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/AdminPanel/Module/Users.pm b/lib/AdminPanel/Module/Users.pm index 4f82906f..c937cd5a 100644 --- a/lib/AdminPanel/Module/Users.pm +++ b/lib/AdminPanel/Module/Users.pm @@ -139,6 +139,14 @@ has 'ctx' => ( builder => '_USERInitialize', ); +## min UID was 500 now is 1000, let's change in a single point +has 'min_UID' => ( + default => 1000, + is => 'ro', + isa => 'Int', + init_arg => undef, +); + sub _USERInitialize { my $self = shift; @@ -906,7 +914,7 @@ sub addUserDialog { $hbox = $factory->createHBox($align); my $uidManually = $factory->createCheckBox($hbox, $self->loc->N("Specify user ID manually"), 0); $factory->createHSpacing($hbox, 2.0); - my $UID = $factory->createIntField($hbox, $self->loc->N("UID"), 1, 65000, 500); + my $UID = $factory->createIntField($hbox, $self->loc->N("UID"), 1, 65000, $self->min_UID); $UID->setEnabled($uidManually->value()); $uidManually->setNotify(1); # $uidManually->setWeight($yui::YD_HORIZ, 2); @@ -988,10 +996,10 @@ sub addUserDialog { } my $uid = 0; if ($continue && $uidManually->value()) { - if (($uid = $UID->value()) < 500) { + if (($uid = $UID->value()) < $self->min_UID) { $errorString = ""; - my $uidchoice = $self->sh_gui->ask_YesOrNo({title => $self->loc->N("User Uid is < 500"), - text => $self->loc->N("Creating a user with a UID less than 500 is not recommended.\nAre you sure you want to do this?\n\n")}); + my $uidchoice = $self->sh_gui->ask_YesOrNo({title => $self->loc->N("User Uid is < %d", $self->min_UID), + text => $self->loc->N("Creating a user with a UID less than %d is not recommended.\nAre you sure you want to do this?\n\n", $self->min_UID)}); $continue = $uidchoice and $userEnt->Uid($uid); } else { $userEnt and $userEnt->Uid($uid); @@ -1206,7 +1214,7 @@ sub _refreshUsers { my $strfilt = $self->get_widget('filter')->value(); my $filterusers = $self->get_widget('filter_system')->isChecked(); - + my ($users, $group, $groupnm, $expr); defined $self->ctx and $users = $self->ctx->UsersEnumerateFull; @@ -1219,6 +1227,8 @@ sub _refreshUsers { my @UserReal; LOOP: foreach my $l (@$users) { next LOOP if $filterusers && $l->Uid($self->USER_GetValue) <= 499 || $l->Uid($self->USER_GetValue) == 65534; + next LOOP if $filterusers && $l->Uid($self->USER_GetValue) > 499 && $l->Uid($self->USER_GetValue) < $self->min_UID && + ($l->HomeDir($self->USER_GetValue) =~ /^\/($|var\/|run\/)/ || $l->LoginShell($self->USER_GetValue) =~ /(nologin|false)$/); push @UserReal, $l if $l->UserName($self->USER_GetValue) =~ /^\Q$strfilt/; } my $i; |