[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: New!!!: Base-passwd 2.0



> Philippe Troin:
> > Is there a debian standard way of [ locking /etc/passwd and friends ] ?
> 
> I don't think so, at the moment. It should be doable, however. We
> have a locking policy for mailboxes. I'm sure we can have one for
> /etc/passwd.

Oops.  I should pipe up.  There is already an established locking method
for /etc/passwd and /etc/group (implemented in NIS and in passwd/group
related utilities at least in SunOS).

I used to code directory admin tools for the Northern Telecom IT group.
During my time there I confirmed that at least passwd(1), rpc.yppasswd
and vipw (which doesn't seem to be in Debian) in SunOS conformed to the
following mechanism.

If memory serves the mechanism is:
1) open(2) /etc/ptmp (with O_CREAT|O_EXCL)
        (if that fails, wait and try again)
2) read in /etc/passwd and write changed passwd file to /etc/ptmp
        (in this way /etc/passwd is maintained intact for others to use
        while you make your changes)
3) rename(2) /etc/ptmp to /etc/passwd
        (rename is a guaranteed atomic action)

The same is tru for /etc/group except that /etc/gtmp is used.

NOTE: this is strictly from memory,  I'd have to look at the source for
passwd(1), rpc.yppasswd and others to confirm this.  And unfortunately
I'm late for a meeting right now.  I'll try to look and get back to the
list this evening.

I hope this helps.

Behan

-- 
Behan Webster     mailto:behanw@verisim.com
(613) 224-7547    http://www.verisim.com/


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com


Reply to: