On Mon, Feb 09, 2004 at 09:46:10AM -0500, Bob Showalter ([EMAIL PROTECTED]) wrote:
> Kenton Brede wrote:
> > I've written the following subroutine to snag the next available UID
> > in the 700 range from /etc/passwd. I then use the return value with
> > "useradd" to add a new user.
>
> Note that
Kenton Brede wrote:
> I've written the following subroutine to snag the next available UID
> in the 700 range from /etc/passwd. I then use the return value with
> "useradd" to add a new user.
Note that this algorithm contains a race condition. Between the scan of
/etc/passwd and the call to usera
Kenton Brede wrote:
>
> On Sat, Feb 07, 2004 at 02:08:26PM -0800, John W. Krahn ([EMAIL PROTECTED]) wrote:
>
> Thanks for your response. Where do I begin asking questions about this
> one, hehe.
>
> > sub get_uid {
> > my ( $start, $end ) = @_;
> > --$start;
> > defined getpwuid $st
Kenton Brede wrote:
>
> On Sat, Feb 07, 2004 at 07:42:30PM -, Rob Dixon ([EMAIL PROTECTED]) wrote:
> >
> > sub get_uid {
> > my %list;
> > @list{map {(split /:/)[2]} } = ();
>
> map reads the UID variables from into @list.
Into %list actually. @list{} is a hash slice.
> What I d
Rob Dixon wrote:
> Kenton Brede wrote:
> > __DATA__
> > user1:x:700:101:user1:/dev/null:/bin/false
> > user2:x:706:101:user2:/dev/null:/bin/false
> > user3:x:707:101:user3:/dev/null:/bin/false
> > user4:x:708:101:user4:/dev/null:/bin/false
>
> Hi Kenton.
>
> How does this look?
>
> sub get_uid {
On Sat, Feb 07, 2004 at 02:08:26PM -0800, John W. Krahn ([EMAIL PROTECTED]) wrote:
> Kenton Brede wrote:
> >
> > I've written the following subroutine to snag the next available UID in
> > the 700 range from /etc/passwd. I then use the return value with
> > "useradd" to add a new user.
> >
> > T
On Sat, Feb 07, 2004 at 07:42:30PM -, Rob Dixon ([EMAIL PROTECTED]) wrote:
>> Kenton Brede wrote:
>>
> Hi Kenton.
Hi, thanks for the great code.
> How does this look?
Well ... complex :) Let me see if I can put this in English.
> sub get_uid {
> my %list;
> @list{map {(split /
Kenton Brede wrote:
>
> I've written the following subroutine to snag the next available UID in
> the 700 range from /etc/passwd. I then use the return value with
> "useradd" to add a new user.
>
> The subroutine works fine. If no UID 700 is found it returns 700.
> It then returns the next avai
Kenton Brede wrote:
>
> I've written the following subroutine to snag the next available UID in
> the 700 range from /etc/passwd. I then use the return value with
> "useradd" to add a new user.
>
> The subroutine works fine. If no UID 700 is found it returns 700.
> It then returns the next availa
On Sat, Feb 07, 2004 at 12:57:45PM -0600, Kenton Brede wrote:
> I've written the following subroutine to snag the next available UID in
> the 700 range from /etc/passwd. I then use the return value with
> "useradd" to add a new user.
>
> The subroutine works fine. If no UID 700 is found it retu
10 matches
Mail list logo