Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

lckpwdf(3c) [sunos man page]

lckpwdf(3C)						   Standard C Library Functions 					       lckpwdf(3C)

NAME
lckpwdf, ulckpwdf - manipulate shadow password database lock file SYNOPSIS
#include <shadow.h> int lckpwdf(void); int ulckpwdf(void); DESCRIPTION
The lckpwdf() and ulckpwdf() functions enable 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. See passwd(4) and shadow(4). Upon completing modifications, a process should release the lock on the lock file using ulckpwdf(). This mechanism prevents simultaneous modification of the password databases. The lock file, /etc/.pwd.lock, is used to coordinate modification access to the password databases /etc/passwd and /etc/shadow. RETURN VALUES
If lckpwdf() is successful in locking the file within 15 seconds, it returns 0. If unsuccessful (for example, /etc/.pwd.lock is already locked), it returns -1. If ulckpwdf() is successful in unlocking the file /etc/.pwd.lock, it returns 0. If unsuccessful (for example, /etc/.pwd.lock is already unlocked), it returns -1. USAGE
These routines are for internal use only; compatibility is not guaranteed. FILES
/etc/passwd password database /etc/shadow shadow password database /etc/.pwd.lock lock file ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
getpwnam(3C), getspnam(3C), passwd(4), shadow(4), attributes(5) SunOS 5.10 29 Dec 1996 lckpwdf(3C)

Check Out this Related Man Page

SHADOW(3)							   Library Calls							 SHADOW(3)

NAME
shadow, getspnam - encrypted password file routines SYNTAX
#include <shadow.h> struct spwd *getspent(); struct spwd *getspnam(char *name); void setspent(); void endspent(); struct spwd *fgetspent(FILE *fp); struct spwd *sgetspent(char *cp); int putspent(struct spwd *p, FILE *fp); int lckpwdf(); int ulckpwdf(); DESCRIPTION
shadow manipulates the contents of the shadow password file, /etc/shadow. The structure in the #include file is: struct spwd { char *sp_namp; /* user login name */ char *sp_pwdp; /* encrypted password */ long int sp_lstchg; /* last password change */ long int sp_min; /* days until change allowed. */ long int sp_max; /* days before change required */ long int sp_warn; /* days warning for expiration */ long int sp_inact; /* days before account inactive */ long int sp_expire; /* date when account expires */ unsigned long int sp_flag; /* reserved for future use */ } The meanings of each field are: o sp_namp - pointer to null-terminated user name o sp_pwdp - pointer to null-terminated password o sp_lstchg - days since Jan 1, 1970 password was last changed o sp_min - days before which password may not be changed o sp_max - days after which password must be changed o sp_warn - days before password is to expire that user is warned of pending password expiration o sp_inact - days after password expires that account is considered inactive and disabled o sp_expire - days since Jan 1, 1970 when account will be disabled o sp_flag - reserved for future use DESCRIPTION
getspent, getspname, fgetspent, and sgetspent each return a pointer to a struct spwd. getspent returns the next entry from the file, and fgetspent returns the next entry from the given stream, which is assumed to be a file of the proper format. sgetspent returns a pointer to a struct spwd using the provided string as input. getspnam searches from the current position in the file for an entry matching name. setspent and endspent may be used to begin and end, respectively, access to the shadow password file. The lckpwdf and ulckpwdf routines should be used to insure exclusive access to the /etc/shadow file. lckpwdf attempts to acquire a lock using pw_lock for up to 15 seconds. It continues by attempting to acquire a second lock using spw_lock for the remainder of the initial 15 seconds. Should either attempt fail after a total of 15 seconds, lckpwdf returns -1. When both locks are acquired 0 is returned. DIAGNOSTICS
Routines return NULL if no more entries are available or if an error occurs during processing. Routines which have int as the return value return 0 for success and -1 for failure. CAVEATS
These routines may only be used by the superuser as access to the shadow password file is restricted. FILES
/etc/shadow Secure user account information. SEE ALSO
getpwent(3), shadow(5). shadow-utils 4.1.5.1 05/25/2012 SHADOW(3)
Man Page