Add advisory file locking.
commit238903ea53fe33a5d1d6f5f81d2fd00c33c1140b
authorBen Kibbey <bjk@luxsci.net>
Tue, 4 Aug 2015 02:30:06 +0000 (3 22:30 -0400)
committerBen Kibbey <bjk@luxsci.net>
Sat, 8 Aug 2015 14:11:26 +0000 (8 10:11 -0400)
tree702bd8ffee22132d7d64f1b84b7036b0cfab50eb
parent6d7f0666060ba88aadad4f3584c6450a1b0118f4
Add advisory file locking.

These advisory locks are not enforced by the kernel. This means another
non-pwmd process may do with the data file what it wants. It is mainly
for use with multiple instances of pwmd that share a common
"data_directory". The SAVE and PASSWD commands are the only commands
that do an exclusive (write) lock for their duration. The OPEN and
KEYGRIP commands keeps a shared (read-only) lock for its duration. All
other commands do a shared lock upon startup when checking the checksum
of the data file; then the lock is released.

There is the problem that these advisory locks, obtained via flock(),
aren't POSIX. Noteably, they aren't implemented on at least Solaris.
configure.ac
src/commands.c
src/common.h
src/crypto.c
src/mutex.h
src/pwmd.c
src/util-misc.c
src/util-misc.h