[Adduser-devel] adduser sub get_current_uids

Joerg Hoh
2006-01-24T22:56:11Z

On Tue, Jan 24, 2006 at 02:28:11PM -0800, karlrink@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@melix.com.mx>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature