Re: password file locking

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

 



"Michael Ju. Tokarev" wrote:
> 
> Well, I see two common locking mechanisms:
> 
>   lckpwdf way is creating /etc/.pwd.lock file to lock
>   both passwd and shadow
> 
>   other way used in shadow-utils (if lckpwdf is not
>   available?) and pwdb is to create passwd.lck and
>   shadow.lck files

With either method you're basically saying that all files that deal with
modifying the passwd and shadow files need to agree to check for the
existance of the lock before doing anything.

Besides the fact that this approach can lead to obvious race issues, why
not use POSIX 1 advisory locks (or 'discretionary file locks' as the
fcntl man page calls them)?

They're cross-platform and placed on the file itself so no race issues
can exist as long as everybody plays ball. Since that's a requirement
for both approaches I would think that this is a far better solution.

Cooper
-- 
If you can read this you're probably not dead yet.
	- Johnny The Homicidal Maniac 7 -





[Index of Archives]     [Fedora Users]     [Kernel]     [Red Hat Install]     [Linux for the blind]     [Gimp]

  Powered by Linux