[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    lckpwdf(3C) manual page Table of Contents

Name

lckpwdf, ulckpwdf - manipulate shadow password database lock file

Synopsis

#include <shadow.h>

int lckpwdf(void);

int ulckpwdf(void);

MT-Level

MT-Safe

Description

lckpwdf() and ulckpwdf() are routines that are used to gain modification access to the password databases, through the lock file. A process first uses lckpwdf() to lock the lock file, thereby gaining exclusive rights to modify the /etc/passwd or /etc/shadow password database. Upon completing modifications, a process should release the lock on the lock file using ulckpwdf(). This mechanism prevents simultaneous modification of the password databases. /etc/.pwd.lock is the lock file. It is used to coordinate modification access to the password databases /etc/passwd and /etc/shadow.

lckpwdf() attempts to lock the file /etc/.pwd.lock within 15 seconds. If unsuccessful, for example, /etc/.pwd.lock is already locked, it returns -1. If successful, a return code other than -1 is returned.

ulckpwdf() attempts to unlock the file /etc/.pwd.lock. If unsuccessful, for example, /etc/.pwd.lock is already unlocked, it returns -1. If successful, it returns 0.

Return Values

lckpwdf() and ulckpwdf() return -1 on failure, and 0 otherwise.

Files

/etc/shadow
/etc/passwd
/etc/.pwd.lock

See Also

getpwnam(3C) , getspnam(3C)

Notes

These routines are for internal use only; compatibility is not guaranteed.


Table of Contents