From owner-freebsd-hackers Sat Nov 1 00:40:24 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id AAA08406 for hackers-outgoing; Sat, 1 Nov 1997 00:40:24 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from misery.sdf.com (misery.sdf.com [204.244.210.193]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id AAA08401 for ; Sat, 1 Nov 1997 00:40:20 -0800 (PST) (envelope-from tom@sdf.com) Received: from tom by misery.sdf.com with smtp (Exim 1.73 #1) id 0xRZ4m-00036w-00; Sat, 1 Nov 1997 00:38:36 -0800 Date: Sat, 1 Nov 1997 00:38:35 -0800 (PST) From: Tom To: hackers@freebsd.org Subject: Re: Password file builds Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk On Fri, 31 Oct 1997, Dave Chapeskie wrote: > On Fri, Oct 31, 1997 at 09:22:31AM -0800, Tom wrote: > > The biggest problem with this is, that there are no tools to fix or > > verify db files. If the /etc/pwd.db or /etc/spwd.db becomes damaged, > > you're screwed. > > So you regenerate the text version periodicly (if required) from cron > and you keep backups of the database and text versions. You do keep > backups don't you? How would the text version be regenerated? In the scheme you described there would be no test version. > > Also, there are locking issue with in place updates of db files. > > Do the pw routines in libc even do locking? I don't think so. What > > happens if someone calls getpwnam() at the while someone else is > > writing a new entry into the database? > > The man page for pwd_mkdb clearly states that it leaves locking up to > the front-ends (chpass, passwd, vipw). That locking would still be > maintained, just the text file wouldn't be updated. Nope, you missed the point. The getpw* routines in libc do not do locking, because they don't need to. But if you do inplace updates, they do. rename() is atomic, but db put() is not. > -- > Dave Chapeskie, DDM Consulting > E-Mail: dchapes@ddm.on.ca Tom