Hello,
We are using the adduser package in our environment. We have found that
the sub get_current_uids is taking an extreme long time to return.
1) it is not limiting the select to the defined parameter.
2) it does not utilize the --system option when adding system users.
/usr/sbin/adduser --system --ingroup mysql --home /var/lib/mysql --gecos
"MySQL Server" --shell /bin/false mysql
The --system option flag is not limiting the uid list between 100 and 999,
as defined in the config file or the hard coded adduser perl file,
but instead does a select on ranges:
0,1,2,3,<through>,17786,17787,65534,65534,65566
Defined in the conf file,
/etc/adduser.conf
FIRST_SYSTEM_UID=100
LAST_SYSTEM_UID=999
hard coded adduser parameters,
/usr/sbin/adduser
$config{"first_system_gid"} = 100;
$config{"last_system_gid"} = 999;
We are currently using adduser_3.59_all.deb package. However, this sub
does not change in the newer current version adduser_3.80_all.deb. The
below is a suggested work around that we are considering in our deployments.
# ORIGINAL: adduser 3.59
# return an array containing all the UIDs
sub get_current_uids {
my(@uids, $uid);
setpwent;
push @uids, $uid while defined($uid = (getpwent)[2]);
endpwent;
@uids;
}
# SUGGESTED:
# return an array containing all the UIDs
sub get_current_uids {
my(@uids, $uid);
if ($found_sys_opt) { #found --system option
$first_system_uid = 100;
$last_system_uid = 999;
for ($uid=$first_system_uid; $uid<$last_system_uid; $uid++) {
push @uids, $uid if defined(getpwuid($uid));
}
@uids;
}
else { #otherwise, do the original routine
setpwent;
push @uids, $uid while defined($uid = (getpwent)[2]);
endpwent;
@uids;
}
}
A bug fix for this is very necessary in very large user environments, as
the return time is typically over one minute long for get_current_uids.
--Karl