2007-10-07 17:17:33 +05:30
|
|
|
.\" Title: shadow
|
|
|
|
.\" Author:
|
|
|
|
.\" Generator: DocBook XSL Stylesheets v1.70.1 <http://docbook.sf.net/>
|
2007-10-07 17:17:57 +05:30
|
|
|
.\" Date: 07/30/2006
|
2007-10-07 17:17:33 +05:30
|
|
|
.\" Manual: Library Calls
|
|
|
|
.\" Source: Library Calls
|
|
|
|
.\"
|
2007-10-07 17:17:57 +05:30
|
|
|
.TH "SHADOW" "3" "07/30/2006" "Library Calls" "Library Calls"
|
2007-10-07 17:16:52 +05:30
|
|
|
.\" disable hyphenation
|
|
|
|
.nh
|
|
|
|
.\" disable justification (adjust text to left margin only)
|
|
|
|
.ad l
|
|
|
|
.SH "NAME"
|
2007-10-07 17:17:01 +05:30
|
|
|
shadow, getspnam \- encrypted password file routines
|
2007-10-07 17:16:25 +05:30
|
|
|
.SH "SYNTAX"
|
|
|
|
.PP
|
2007-10-07 17:17:33 +05:30
|
|
|
|
2007-10-07 17:16:52 +05:30
|
|
|
\fI#include <shadow.h>\fR
|
2007-10-07 17:14:44 +05:30
|
|
|
.PP
|
2007-10-07 17:17:33 +05:30
|
|
|
|
2007-10-07 17:16:52 +05:30
|
|
|
\fIstruct spwd *getspent();\fR
|
2007-10-07 17:14:44 +05:30
|
|
|
.PP
|
2007-10-07 17:17:33 +05:30
|
|
|
|
|
|
|
\fIstruct spwd *getspnam(char\fR
|
|
|
|
\fI*name\fR\fI);\fR
|
2007-10-07 17:14:44 +05:30
|
|
|
.PP
|
2007-10-07 17:17:33 +05:30
|
|
|
|
2007-10-07 17:16:52 +05:30
|
|
|
\fIvoid setspent();\fR
|
2007-10-07 17:14:44 +05:30
|
|
|
.PP
|
2007-10-07 17:17:33 +05:30
|
|
|
|
2007-10-07 17:16:52 +05:30
|
|
|
\fIvoid endspent();\fR
|
2007-10-07 17:14:44 +05:30
|
|
|
.PP
|
2007-10-07 17:17:33 +05:30
|
|
|
|
|
|
|
\fIstruct spwd *fgetspent(FILE\fR
|
|
|
|
\fI*fp\fR\fI);\fR
|
2007-10-07 17:14:44 +05:30
|
|
|
.PP
|
2007-10-07 17:17:33 +05:30
|
|
|
|
|
|
|
\fIstruct spwd *sgetspent(char\fR
|
|
|
|
\fI*cp\fR\fI);\fR
|
2007-10-07 17:14:44 +05:30
|
|
|
.PP
|
2007-10-07 17:17:33 +05:30
|
|
|
|
|
|
|
\fIint putspent(struct spwd\fR
|
|
|
|
\fI*p,\fR
|
|
|
|
\fIFILE\fR
|
|
|
|
\fI*fp\fR\fI);\fR
|
2007-10-07 17:14:44 +05:30
|
|
|
.PP
|
2007-10-07 17:17:33 +05:30
|
|
|
|
2007-10-07 17:16:52 +05:30
|
|
|
\fIint lckpwdf();\fR
|
2007-10-07 17:14:44 +05:30
|
|
|
.PP
|
2007-10-07 17:17:33 +05:30
|
|
|
|
2007-10-07 17:16:52 +05:30
|
|
|
\fIint ulckpwdf();\fR
|
2007-10-07 17:16:25 +05:30
|
|
|
.SH "DESCRIPTION"
|
|
|
|
.PP
|
2007-10-07 17:17:33 +05:30
|
|
|
|
2007-10-07 17:17:01 +05:30
|
|
|
\fIshadow\fR
|
|
|
|
manipulates the contents of the shadow password file,
|
|
|
|
\fI/etc/shadow\fR. The structure in the
|
|
|
|
\fI#include\fR
|
2007-10-07 17:16:52 +05:30
|
|
|
file is:
|
2007-10-07 17:17:01 +05:30
|
|
|
.sp
|
2007-10-07 17:17:33 +05:30
|
|
|
.RS 3n
|
2007-10-07 17:16:25 +05:30
|
|
|
.nf
|
2007-10-07 17:14:44 +05:30
|
|
|
struct spwd {
|
2007-10-07 17:16:52 +05:30
|
|
|
char *sp_namp; /* user login name */
|
|
|
|
char *sp_pwdp; /* encrypted password */
|
2007-10-07 17:16:25 +05:30
|
|
|
long int sp_lstchg; /* last password change */
|
2007-10-07 17:16:52 +05:30
|
|
|
long int sp_min; /* days until change allowed. */
|
2007-10-07 17:16:25 +05:30
|
|
|
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 */
|
2007-10-07 17:14:44 +05:30
|
|
|
}
|
2007-10-07 17:16:25 +05:30
|
|
|
|
|
|
|
.fi
|
2007-10-07 17:17:33 +05:30
|
|
|
.RE
|
2007-10-07 17:14:44 +05:30
|
|
|
.PP
|
2007-10-07 17:16:25 +05:30
|
|
|
The meanings of each field are:
|
2007-10-07 17:17:33 +05:30
|
|
|
.TP 3n
|
2007-10-07 17:16:25 +05:30
|
|
|
\(bu
|
|
|
|
sp_namp \- pointer to null\-terminated user name
|
2007-10-07 17:17:33 +05:30
|
|
|
.TP 3n
|
2007-10-07 17:16:25 +05:30
|
|
|
\(bu
|
|
|
|
sp_pwdp \- pointer to null\-terminated password
|
2007-10-07 17:17:33 +05:30
|
|
|
.TP 3n
|
2007-10-07 17:16:25 +05:30
|
|
|
\(bu
|
|
|
|
sp_lstchg \- days since Jan 1, 1970 password was last changed
|
2007-10-07 17:17:33 +05:30
|
|
|
.TP 3n
|
2007-10-07 17:16:25 +05:30
|
|
|
\(bu
|
|
|
|
sp_min \- days before which password may not be changed
|
2007-10-07 17:17:33 +05:30
|
|
|
.TP 3n
|
2007-10-07 17:16:25 +05:30
|
|
|
\(bu
|
|
|
|
sp_max \- days after which password must be changed
|
2007-10-07 17:17:33 +05:30
|
|
|
.TP 3n
|
2007-10-07 17:16:25 +05:30
|
|
|
\(bu
|
|
|
|
sp_warn \- days before password is to expire that user is warned of pending password expiration
|
2007-10-07 17:17:33 +05:30
|
|
|
.TP 3n
|
2007-10-07 17:16:25 +05:30
|
|
|
\(bu
|
|
|
|
sp_inact \- days after password expires that account is considered inactive and disabled
|
2007-10-07 17:17:33 +05:30
|
|
|
.TP 3n
|
2007-10-07 17:16:25 +05:30
|
|
|
\(bu
|
|
|
|
sp_expire \- days since Jan 1, 1970 when account will be disabled
|
2007-10-07 17:17:33 +05:30
|
|
|
.TP 3n
|
2007-10-07 17:16:25 +05:30
|
|
|
\(bu
|
|
|
|
sp_flag \- reserved for future use
|
|
|
|
.SH "DESCRIPTION"
|
|
|
|
.PP
|
2007-10-07 17:17:33 +05:30
|
|
|
|
2007-10-07 17:17:01 +05:30
|
|
|
\fIgetspent\fR,
|
|
|
|
\fIgetspname\fR,
|
|
|
|
\fIfgetspent\fR, and
|
|
|
|
\fIsgetspent\fR
|
|
|
|
each return a pointer to a
|
|
|
|
\fIstruct spwd\fR.
|
|
|
|
\fIgetspent\fR
|
|
|
|
returns the next entry from the file, and
|
|
|
|
\fIfgetspent\fR
|
|
|
|
returns the next entry from the given stream, which is assumed to be a file of the proper format.
|
|
|
|
\fIsgetspent\fR
|
|
|
|
returns a pointer to a
|
|
|
|
\fIstruct spwd\fR
|
|
|
|
using the provided string as input.
|
|
|
|
\fIgetspnam\fR
|
|
|
|
searches from the current position in the file for an entry matching
|
2007-10-07 17:16:52 +05:30
|
|
|
\fIname\fR.
|
|
|
|
.PP
|
2007-10-07 17:17:33 +05:30
|
|
|
|
2007-10-07 17:17:01 +05:30
|
|
|
\fIsetspent\fR
|
|
|
|
and
|
|
|
|
\fIendspent\fR
|
2007-10-07 17:16:52 +05:30
|
|
|
may be used to begin and end, respectively, access to the shadow password file.
|
|
|
|
.PP
|
2007-10-07 17:17:01 +05:30
|
|
|
The
|
|
|
|
\fIlckpwdf\fR
|
|
|
|
and
|
|
|
|
\fIulckpwdf\fR
|
|
|
|
routines should be used to insure exclusive access to the
|
|
|
|
\fI/etc/shadow\fR
|
|
|
|
file.
|
|
|
|
\fIlckpwdf\fR
|
|
|
|
attempts to acquire a lock using
|
|
|
|
\fIpw_lock\fR
|
|
|
|
for up to 15 seconds. It continues by attempting to acquire a second lock using
|
|
|
|
\fIspw_lock\fR
|
|
|
|
for the remainder of the initial 15 seconds. Should either attempt fail after a total of 15 seconds,
|
|
|
|
\fIlckpwdf\fR
|
2007-10-07 17:16:52 +05:30
|
|
|
returns \-1. When both locks are acquired 0 is returned.
|
2007-10-07 17:16:25 +05:30
|
|
|
.SH "DIAGNOSTICS"
|
|
|
|
.PP
|
2007-10-07 17:17:01 +05:30
|
|
|
Routines return NULL if no more entries are available or if an error occurs during processing. Routines which have
|
|
|
|
\fIint\fR
|
2007-10-07 17:16:52 +05:30
|
|
|
as the return value return 0 for success and \-1 for failure.
|
2007-10-07 17:16:25 +05:30
|
|
|
.SH "CAVEATS"
|
|
|
|
.PP
|
2007-10-07 17:16:52 +05:30
|
|
|
These routines may only be used by the super user as access to the shadow password file is restricted.
|
2007-10-07 17:16:25 +05:30
|
|
|
.SH "FILES"
|
2007-10-07 17:17:33 +05:30
|
|
|
.TP 3n
|
2007-10-07 17:16:25 +05:30
|
|
|
\fI/etc/shadow\fR
|
2007-10-07 17:17:33 +05:30
|
|
|
Secure user account information.
|
2007-10-07 17:16:25 +05:30
|
|
|
.SH "SEE ALSO"
|
|
|
|
.PP
|
2007-10-07 17:17:33 +05:30
|
|
|
|
2007-10-07 17:17:01 +05:30
|
|
|
\fBgetpwent\fR(3),
|
|
|
|
\fBshadow\fR(5).
|