[Adduser-devel] adduser sub get_current_uids

Joerg Hoh joerg at joerghoh.de
Tue Jan 24 22:55:58 UTC 2006


On Tue, Jan 24, 2006 at 02:28:11PM -0800, karlrink at google.com wrote:
> 
> 1) it is not limiting the select to the defined parameter.

What else would would you propose if all uids in the range of
$first_system_gid and $last_system_gid are all gone? Refusing to add?

> 2) it does not utilize the --system option when adding system users.

That's right.

> 
> # 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;
>    }
> }

I would propose that we should set $last_system_uid to  $config{$last_uid}
or something like that (in case, we run out of uids in that range between
100 and 999).

Joerg


-- 
Was denen einen ihr Watergate, ist den anderen ihr Firstgate.
- Thomas Bliessner, <slrnd1hklm.g53.nospam at melix.com.mx>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/adduser-devel/attachments/20060124/f3b0d5f5/attachment.pgp


More information about the Adduser-devel mailing list