245 lines
6.3 KiB
Groff
245 lines
6.3 KiB
Groff
'\" t
|
||
.\" Title: shadow
|
||
.\" Author: Julianne Frances Haugh
|
||
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
|
||
.\" Date: 03/19/2025
|
||
.\" Manual: Library Calls
|
||
.\" Source: shadow-utils 4.17.4
|
||
.\" Language: Russian
|
||
.\"
|
||
.TH "shadow" "3" "03/19/2025" "shadow\-utils 4\&.17\&.4" "Library Calls"
|
||
.\" -----------------------------------------------------------------
|
||
.\" * Define some portability stuff
|
||
.\" -----------------------------------------------------------------
|
||
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
.\" http://bugs.debian.org/507673
|
||
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
||
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
.ie \n(.g .ds Aq \(aq
|
||
.el .ds Aq '
|
||
.\" -----------------------------------------------------------------
|
||
.\" * set default formatting
|
||
.\" -----------------------------------------------------------------
|
||
.\" disable hyphenation
|
||
.nh
|
||
.\" disable justification (adjust text to left margin only)
|
||
.ad l
|
||
.\" -----------------------------------------------------------------
|
||
.\" * MAIN CONTENT STARTS HERE *
|
||
.\" -----------------------------------------------------------------
|
||
.SH "НАЗВАНИЕ"
|
||
shadow, getspnam \- процедуры для работы с файлом шифрованных паролей
|
||
.SH "СИНТАКСИС"
|
||
.PP
|
||
\fI#include <shadow\&.h>\fR
|
||
.PP
|
||
\fIstruct spwd *getspent();\fR
|
||
.PP
|
||
\fIstruct spwd *getspnam(char\fR
|
||
\fI*name\fR\fI);\fR
|
||
.PP
|
||
\fIvoid setspent();\fR
|
||
.PP
|
||
\fIvoid endspent();\fR
|
||
.PP
|
||
\fIstruct spwd *fgetspent(FILE\fR
|
||
\fI*fp\fR\fI);\fR
|
||
.PP
|
||
\fIstruct spwd *sgetspent(char\fR
|
||
\fI*cp\fR\fI);\fR
|
||
.PP
|
||
\fIint putspent(struct spwd\fR
|
||
\fI*p,\fR
|
||
\fIFILE\fR
|
||
\fI*fp\fR\fI);\fR
|
||
.PP
|
||
\fIint lckpwdf();\fR
|
||
.PP
|
||
\fIint ulckpwdf();\fR
|
||
.SH "ОПИСАНИЕ"
|
||
.PP
|
||
\fIshadow\fR
|
||
manipulates the contents of the shadow password file,
|
||
/etc/shadow\&. The structure in the
|
||
\fI#include\fR
|
||
file is:
|
||
.sp
|
||
.if n \{\
|
||
.RS 4
|
||
.\}
|
||
.nf
|
||
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 */
|
||
}
|
||
|
||
.fi
|
||
.if n \{\
|
||
.RE
|
||
.\}
|
||
.PP
|
||
Значение каждого поля:
|
||
.sp
|
||
.RS 4
|
||
.ie n \{\
|
||
\h'-04'\(bu\h'+03'\c
|
||
.\}
|
||
.el \{\
|
||
.sp -1
|
||
.IP \(bu 2.3
|
||
.\}
|
||
sp_namp \- указатель на строку с именем пользователя, завершающуюся нулевым символом
|
||
.RE
|
||
.sp
|
||
.RS 4
|
||
.ie n \{\
|
||
\h'-04'\(bu\h'+03'\c
|
||
.\}
|
||
.el \{\
|
||
.sp -1
|
||
.IP \(bu 2.3
|
||
.\}
|
||
sp_pwdp \- указатель на строку с паролем, завершающуюся нулевым символом
|
||
.RE
|
||
.sp
|
||
.RS 4
|
||
.ie n \{\
|
||
\h'-04'\(bu\h'+03'\c
|
||
.\}
|
||
.el \{\
|
||
.sp -1
|
||
.IP \(bu 2.3
|
||
.\}
|
||
sp_lstchg \- количество дней, когда был изменён пароль последний раз, начиная с 1 января 1970 года
|
||
.RE
|
||
.sp
|
||
.RS 4
|
||
.ie n \{\
|
||
\h'-04'\(bu\h'+03'\c
|
||
.\}
|
||
.el \{\
|
||
.sp -1
|
||
.IP \(bu 2.3
|
||
.\}
|
||
sp_min \- количество дней, когда можно не менять пароль
|
||
.RE
|
||
.sp
|
||
.RS 4
|
||
.ie n \{\
|
||
\h'-04'\(bu\h'+03'\c
|
||
.\}
|
||
.el \{\
|
||
.sp -1
|
||
.IP \(bu 2.3
|
||
.\}
|
||
sp_max \- количество дней, которое должно пройти, чтобы нужно было поменять пароль
|
||
.RE
|
||
.sp
|
||
.RS 4
|
||
.ie n \{\
|
||
\h'-04'\(bu\h'+03'\c
|
||
.\}
|
||
.el \{\
|
||
.sp -1
|
||
.IP \(bu 2.3
|
||
.\}
|
||
sp_warn \- количество дней, когда будет выдаваться предупреждение о скором устаревании пароля перед тем как пароль устареет
|
||
.RE
|
||
.sp
|
||
.RS 4
|
||
.ie n \{\
|
||
\h'-04'\(bu\h'+03'\c
|
||
.\}
|
||
.el \{\
|
||
.sp -1
|
||
.IP \(bu 2.3
|
||
.\}
|
||
sp_inact \- количество дней, которые должны пройти после устаревания пароля, когда начинать считать, что учётная запись неактивна и заблокирована
|
||
.RE
|
||
.sp
|
||
.RS 4
|
||
.ie n \{\
|
||
\h'-04'\(bu\h'+03'\c
|
||
.\}
|
||
.el \{\
|
||
.sp -1
|
||
.IP \(bu 2.3
|
||
.\}
|
||
sp_expire \- дней, после которых учётная запись будет заблокирована, начиная с 1 января 1970 года
|
||
.RE
|
||
.sp
|
||
.RS 4
|
||
.ie n \{\
|
||
\h'-04'\(bu\h'+03'\c
|
||
.\}
|
||
.el \{\
|
||
.sp -1
|
||
.IP \(bu 2.3
|
||
.\}
|
||
sp_flag \- зарезервировано
|
||
.RE
|
||
.SH "ОПИСАНИЕ"
|
||
.PP
|
||
\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
|
||
\fIname\fR\&.
|
||
.PP
|
||
\fIsetspent\fR
|
||
and
|
||
\fIendspent\fR
|
||
may be used to begin and end, respectively, access to the shadow password file\&.
|
||
.PP
|
||
The
|
||
\fIlckpwdf\fR
|
||
and
|
||
\fIulckpwdf\fR
|
||
routines should be used to insure exclusive access to the
|
||
/etc/shadow
|
||
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
|
||
returns \-1\&. When both locks are acquired 0 is returned\&.
|
||
.SH "ДИАГНОСТИКА"
|
||
.PP
|
||
Routines return NULL if no more entries are available or if an error occurs during processing\&. Routines which have
|
||
\fIint\fR
|
||
as the return value return 0 for success and \-1 for failure\&.
|
||
.SH "ПРЕДОСТЕРЕЖЕНИЯ"
|
||
.PP
|
||
Данные функции могут использоваться только суперпользователем, так как доступ к файлу теневых паролей ограничен\&.
|
||
.SH "ФАЙЛЫ"
|
||
.PP
|
||
/etc/shadow
|
||
.RS 4
|
||
содержит защищаемую информацию о пользователях
|
||
.RE
|
||
.SH "СМОТРИТЕ ТАКЖЕ"
|
||
.PP
|
||
\fBgetpwent\fR(3),
|
||
\fBshadow\fR(5)\&.
|