Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Oct 2000 15:12:30 -0700 (PDT)
From:      Doug Barton <DougB@gorean.org>
To:        Guy Helmer <ghelmer@cs.iastate.edu>
Cc:        Warner Losh <imp@village.org>, "Brandon D. Valentine" <bandix@looksharp.net>, Salvo Bartolotta <bartequi@inwind.it>, Chris Byrnes <chris@awww.jeah.net>, freebsd-questions@FreeBSD.ORG
Subject:   Re: Removing user with "-" in username 
Message-ID:  <Pine.BSF.4.21.0010241458220.90746-100000@dt051n37.san.rr.com>
In-Reply-To: <Pine.HPX.4.05.10010241428170.16988-100000@popeye.cs.iastate.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 24 Oct 2000, Guy Helmer wrote:

> On Tue, 24 Oct 2000, Warner Losh wrote:
> 
> > In message <39F5B80B.6FD8E3C7@gorean.org> Doug Barton writes:
> > : 	I sent the attached more complete fix as a response to warner's,  but
> > : never heard back (presumably due to 'con preparations). Without
> > : objection I will probably commit this to -current once my account on
> > : freefall gets setup. 
> > 
> > It looked ok to me, but I didn't have time to trace through the perl
> > code to see all the ramifications of doing this.

	*Nod* It's slightly more ambitious, if you have any specific
questions don't hesitate to ask. I spend most of my time at work with
perl, so I'm pretty confident the code is correct. 

> Is it OK to use the getpw* functions while we are modifying the passwd
> files?

	Your script actually does a pretty good job of (advisory) locking
the password files while working with them. Using getpwnam() actually has
a couple of advantages. First, it's faster, especially with really large
sites. I have some pw files with multi-thousands of users, so the time
savings is really measurable. Second, it allows for cleaner code, in the
sense that the operations of testing for the name's existence and
retrieving the data are combined. 

> I explicitly avoided using them when I originally wrote rmuser
> because the program directly manipulates the passwd files.  Otherwise,
> the changes looked OK to me.

	Thanks. :) I can't see where it would be a problem, given that
multiple instances of rmuser (and IIRC, vipw and adduser) would be
prevented from making changes while you're working. 

	At minimum, we should remove the warning from both places it
occurs. As someone else pointed out, if the users are in there already,
it's too late to check if the username is valid. 

Doug
-- 
        "The dead cannot be seduced."
		- Kai, "Lexx"

	Do YOU Yahoo!?




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0010241458220.90746-100000>