From owner-freebsd-questions Tue Oct 24 15:12:56 2000 Delivered-To: freebsd-questions@freebsd.org Received: from dt051n37.san.rr.com (dt051n37.san.rr.com [204.210.32.55]) by hub.freebsd.org (Postfix) with ESMTP id 2CAB037B479 for ; Tue, 24 Oct 2000 15:12:54 -0700 (PDT) Received: from slave (Studded@slave [10.0.0.1]) by dt051n37.san.rr.com (8.9.3/8.9.3) with ESMTP id PAA90811; Tue, 24 Oct 2000 15:12:31 -0700 (PDT) (envelope-from DougB@gorean.org) Date: Tue, 24 Oct 2000 15:12:30 -0700 (PDT) From: Doug Barton X-Sender: doug@dt051n37.san.rr.com To: Guy Helmer Cc: Warner Losh , "Brandon D. Valentine" , Salvo Bartolotta , Chris Byrnes , freebsd-questions@FreeBSD.ORG Subject: Re: Removing user with "-" in username In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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